WP Live Chat Support - Version 5.0.8

Version Description

  • 2015-10-07 - Low priority =
  • Introduced new custom WP Live Chat Support hooks:
  • wplc_hook_admin_visitor_info_display_before - Allows you to add HTML at the beginning of the vistior details DIV in the live chat window
  • wplc_hook_admin_visitor_info_display_after - Allows you to add HTML at the end of the vistior details DIV in the live chat window
  • wplc_hook_admin_javascript_chat - Allows you to add Javascript enqueues at the end of the javascript section of the live chat window
  • wplc_hook_admin_settings_main_settings_after - Allows you to add more options to the main chat settings table in the settings page, after the first main table
  • wplc_hook_admin_settings_save - Hook into the save settings head section. i.e. where we handle POST data from the live chat settings page
Download this release

Release Info

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

Code changes from version 5.0.7 to 5.0.8

css/chat-style.css CHANGED
@@ -134,7 +134,7 @@
134
 
135
  }
136
 
137
-
138
  .wplc-extension {
139
 
140
  float: left;
134
 
135
  }
136
 
137
+ .admin_visitor_advanced_info { clear:left; }
138
  .wplc-extension {
139
 
140
  float: left;
functions.php CHANGED
@@ -608,7 +608,7 @@ function wplc_change_chat_status($id,$status) {
608
  }
609
 
610
  //come back here
611
- function wplc_return_chat_messages($cid) {
612
  global $wpdb;
613
  global $wplc_tblname_msgs;
614
 
@@ -630,7 +630,7 @@ function wplc_return_chat_messages($cid) {
630
  $previous_timestamp = 0;
631
  foreach ($results as $result) {
632
  $from = $result->from;
633
- $msg = $result->msg;
634
  $timestamp = strtotime($result->timestamp);
635
 
636
  $time_diff = $timestamp - $previous_timestamp;
@@ -638,7 +638,7 @@ function wplc_return_chat_messages($cid) {
638
  // $date = new DateTime($timestamp);
639
  $timeshow = date('l, F d Y h:i A',$timestamp);
640
 
641
- if ($previous_time == $timeshow || !$show_time) { $timeshow = ""; }
642
  $previous_time = $timeshow;
643
  $previous_timestamp = $timestamp;
644
 
@@ -669,9 +669,9 @@ function wplc_return_chat_messages($cid) {
669
  }
670
 
671
  if($display_name){
672
- $msg_hist .= "<span class='$class'>$image <strong>$from</strong>: $msg</span><br /><div class='wplc-clear-float-message'></div>";
673
  } else {
674
- $msg_hist .= "<span class='chat_time'>$timeshow</span><span class='$class'>$msg</span><br /><div class='wplc-clear-float-message'></div>";
675
  }
676
 
677
  }
608
  }
609
 
610
  //come back here
611
+ function wplc_return_chat_messages($cid,$transcript = false) {
612
  global $wpdb;
613
  global $wplc_tblname_msgs;
614
 
630
  $previous_timestamp = 0;
631
  foreach ($results as $result) {
632
  $from = $result->from;
633
+ $msg = stripslashes($result->msg);
634
  $timestamp = strtotime($result->timestamp);
635
 
636
  $time_diff = $timestamp - $previous_timestamp;
638
  // $date = new DateTime($timestamp);
639
  $timeshow = date('l, F d Y h:i A',$timestamp);
640
 
641
+ if (!$transcript) { if ($previous_time == $timeshow || !$show_time) { $timeshow = ""; } }
642
  $previous_time = $timeshow;
643
  $previous_timestamp = $timestamp;
644
 
669
  }
670
 
671
  if($display_name){
672
+ $msg_hist .= "<span class='chat_time'>$timeshow</span> <span class='$class'>$image <strong>$from</strong>: $msg</span><br /><div class='wplc-clear-float-message'></div>";
673
  } else {
674
+ $msg_hist .= "<span class='chat_time'>$timeshow</span> <span class='$class'>$msg</span><br /><div class='wplc-clear-float-message'></div>";
675
  }
676
 
677
  }
includes/settings_page.php CHANGED
@@ -150,7 +150,11 @@
150
  </small>
151
  </td>
152
  </tr>
 
 
 
153
  </table>
 
154
  </div>
155
  <div id="tabs-2">
156
  <h3><?php _e("Chat Window Settings",'wplivechat')?></h3>
150
  </small>
151
  </td>
152
  </tr>
153
+
154
+
155
+
156
  </table>
157
+ <?php do_action('wplc_hook_admin_settings_main_settings_after'); ?>
158
  </div>
159
  <div id="tabs-2">
160
  <h3><?php _e("Chat Window Settings",'wplivechat')?></h3>
readme.txt CHANGED
@@ -199,6 +199,14 @@ It is highly recommended that you upgrade to WP Live Chat Support version 4.1.4
199
 
200
  == Changelog ==
201
 
 
 
 
 
 
 
 
 
202
  = 5.0.7 - 2015-10-06 - Low priority =
203
  * Added a live chat extension page
204
  * Corrected internationalization
199
 
200
  == Changelog ==
201
 
202
+ = 5.0.8 - 2015-10-07 - Low priority =
203
+ * Introduced new custom WP Live Chat Support hooks:
204
+ * wplc_hook_admin_visitor_info_display_before - Allows you to add HTML at the beginning of the vistior details DIV in the live chat window
205
+ * wplc_hook_admin_visitor_info_display_after - Allows you to add HTML at the end of the vistior details DIV in the live chat window
206
+ * wplc_hook_admin_javascript_chat - Allows you to add Javascript enqueues at the end of the javascript section of the live chat window
207
+ * wplc_hook_admin_settings_main_settings_after - Allows you to add more options to the main chat settings table in the settings page, after the first main table
208
+ * wplc_hook_admin_settings_save - Hook into the save settings head section. i.e. where we handle POST data from the live chat settings page
209
+
210
  = 5.0.7 - 2015-10-06 - Low priority =
211
  * Added a live chat extension page
212
  * Corrected internationalization
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: 5.0.7
7
  Author: WP-LiveChat
8
  Author URI: http://www.wp-livechat.com
9
  Text Domain: wplivechat
@@ -12,6 +12,14 @@
12
 
13
 
14
  /*
 
 
 
 
 
 
 
 
15
  * 5.0.7 - 2015-10-06 - Low priority
16
  * Added a live chat extension page
17
  * Corrected internationalization
@@ -269,7 +277,7 @@ global $wplc_tblname_chats;
269
  global $wplc_tblname_msgs;
270
  $wplc_tblname_chats = $wpdb->prefix . "wplc_chat_sessions";
271
  $wplc_tblname_msgs = $wpdb->prefix . "wplc_chat_msgs";
272
- $wplc_version = "5.0.7";
273
 
274
  define('WPLC_BASIC_PLUGIN_DIR', dirname(__FILE__));
275
  define('WPLC_BASIC_PLUGIN_URL', plugins_url() . "/wp-live-chat-support/");
@@ -309,6 +317,58 @@ add_action('admin_head', 'wplc_superadmin_javascript');
309
  register_activation_hook(__FILE__, 'wplc_activate');
310
 
311
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
312
  function wplc_basic_check() {
313
  // check if basic exists if pro is installed
314
  }
@@ -1135,7 +1195,10 @@ function wplc_superadmin_javascript() {
1135
  wplc_return_pro_admin_chat_javascript(sanitize_text_field($_GET['cid']));
1136
  } else {
1137
  wplc_return_admin_chat_javascript(sanitize_text_field($_GET['cid']));
 
 
1138
  }
 
1139
  }
1140
  }
1141
 
@@ -1791,6 +1854,8 @@ function wplc_admin_menu_layout_display() {
1791
  }
1792
  }
1793
 
 
 
1794
  function wplc_draw_chat_area($cid) {
1795
 
1796
  global $wpdb;
@@ -1840,6 +1905,7 @@ function wplc_draw_chat_area($cid) {
1840
 
1841
  echo"<div class='admin_chat_box'><div class='admin_chat_box_inner' id='admin_chat_box_area_" . $result->id . "'>" . wplc_return_chat_messages($cid) . "</div><div class='admin_chat_box_inner_bottom'>" . wplc_return_chat_response_box($cid) . "</div></div>";
1842
  echo "<div class='admin_visitor_info'>";
 
1843
  echo " <div style='float:left; width:100px;'><img src=\"//www.gravatar.com/avatar/" . md5($result->email) . "\" class=\"admin_chat_img\" /></div>";
1844
  echo " <div style='float:left;'>";
1845
 
@@ -1849,20 +1915,21 @@ function wplc_draw_chat_area($cid) {
1849
  echo " </div>";
1850
  echo " </div>";
1851
 
1852
- echo "<div class='admin_visitor_advanced_info'>";
1853
  echo " <strong>" . __("Site Info", "wplivechat") . "</strong>";
1854
  echo " <hr />";
1855
  echo " <span class='part1'>" . __("Chat initiated on:", "wplivechat") . "</span> <span class='part2'>" . $result->url . "</span>";
1856
- echo "</div>";
1857
 
1858
- echo "<div class='admin_visitor_advanced_info'>";
1859
  echo " <strong>" . __("Advanced Info", "wplivechat") . "</strong>";
1860
  echo " <hr />";
1861
  echo " <span class='part1'>" . __("Browser:", "wplivechat") . "</span><span class='part2'> $browser <img src='" . $wplc_basic_plugin_url . "/images/$browser_image' alt='$browser' title='$browser' /><br />";
1862
  echo " <span class='part1'>" . __("IP Address:", "wplivechat") . "</span><span class='part2'> ".$user_ip;
1863
- echo "</div>";
1864
 
1865
  echo " <div id=\"wplc_sound_update\"></div>";
 
1866
  echo "</div>";
1867
 
1868
  if ($result->status != 1) {
@@ -2030,11 +2097,7 @@ function wplc_return_admin_chat_javascript($cid) {
2030
 
2031
  jQuery(document).ready(function () {
2032
 
2033
- var wplc_image = "<?php if (isset($image)) {
2034
- echo $image;
2035
- } else {
2036
- echo "";
2037
- } ?>";
2038
  /* var wplc_ajaxurl = '<?php echo plugins_url('/ajax.php', __FILE__); ?>'; */
2039
  var wplc_ajaxurl = ajaxurl;
2040
 
@@ -2150,6 +2213,8 @@ function wplc_return_admin_chat_javascript($cid) {
2150
 
2151
 
2152
  });
 
 
2153
  </script>
2154
  <?php
2155
  }
@@ -2430,6 +2495,7 @@ function wplc_head_basic() {
2430
  update_option("WPLC_HIDE_CHAT", esc_attr($_POST['wplc_hide_chat']));
2431
  }
2432
 
 
2433
 
2434
  echo "<div class='updated'>";
2435
  _e("Your settings have been saved.", "wplivechat");
@@ -2529,7 +2595,7 @@ function wplc_extensions_menu() {
2529
 
2530
  ?>
2531
  <h2 class="nav-tab-wrapper">
2532
- <a href="admin.php?page=wplivechat-menu-extensions-page" title="<?php _e("Add-ons","wplivechat"); ?>" class="nav-tab <?php echo $normal; ?>"><?php _e("Add-ons","wplivechat"); ?></a><a href="admin.php?page=wplivechat-menu-extensions-page&type=additional" title="<?php _e("Plugins","wplivechat"); ?>" class="nav-tab <?php echo $additional; ?>"><?php _e("Plugins","wplivechat"); ?></a>
2533
  <span style='float: right; bottom:-5px; position: relative;'><img src='<?php echo plugins_url('/images/codecabin.png', __FILE__); ?>' style="height:15px;" /></span>
2534
  </h2>
2535
  <div id="tab_container">
@@ -2678,7 +2744,7 @@ function wp_button_pointers_load_scripts($hook) {
2678
 
2679
  function wplc_footer_mod( $footer_text ) {
2680
  if (isset($_GET['page']) && ($_GET['page'] == 'wplivechat-menu' || $_GET['page'] == 'wplivechat-menu-extensions-page' || $_GET['page'] == 'wplivechat-menu-settings' || $_GET['page'] == 'wplivechat-menu-offline-messages' || $_GET['page'] == 'wplivechat-menu-history')) {
2681
- $footer_text_mod = sprintf( __( 'Thank you fsor using <a href="%1$s" target="_blank">WP Live Chat Support</a>! Please <a href="%2$s" target="_blank">rate us</a> on <a href="%2$s" target="_blank">WordPress.org</a>', 'wplivechat' ),
2682
  'http://wp-livechat.com/?utm_source=plugin&utm_medium=link&utm_campaign=footer',
2683
  'https://wordpress.org/support/view/plugin-reviews/wp-live-chat-support?filter=5#postform'
2684
  );
3
  Plugin Name: WP Live Chat Support
4
  Plugin URI: http://www.wp-livechat.com
5
  Description: The easiest to use website live chat plugin. Let your visitors chat with you and increase sales conversion rates with WP Live Chat Support. No third party connection required!
6
+ Version: 5.0.8
7
  Author: WP-LiveChat
8
  Author URI: http://www.wp-livechat.com
9
  Text Domain: wplivechat
12
 
13
 
14
  /*
15
+ * 5.0.8
16
+ * Introduced new hooks:
17
+ * wplc_hook_admin_visitor_info_display_before - Allows you to add HTML at the beginning of the vistior details DIV in the live chat window
18
+ * wplc_hook_admin_visitor_info_display_after - Allows you to add HTML at the end of the vistior details DIV in the live chat window
19
+ * wplc_hook_admin_javascript_chat - Allows you to add Javascript enqueues at the end of the javascript section of the live chat window
20
+ * wplc_hook_admin_settings_main_settings_after - Allows you to add more options to the main chat settings table in the settings page, after the first main table
21
+ * wplc_hook_admin_settings_save - Hook into the save settings head section. i.e. where we handle POST data from the live chat settings page
22
+ *
23
  * 5.0.7 - 2015-10-06 - Low priority
24
  * Added a live chat extension page
25
  * Corrected internationalization
277
  global $wplc_tblname_msgs;
278
  $wplc_tblname_chats = $wpdb->prefix . "wplc_chat_sessions";
279
  $wplc_tblname_msgs = $wpdb->prefix . "wplc_chat_msgs";
280
+ $wplc_version = "5.0.8";
281
 
282
  define('WPLC_BASIC_PLUGIN_DIR', dirname(__FILE__));
283
  define('WPLC_BASIC_PLUGIN_URL', plugins_url() . "/wp-live-chat-support/");
317
  register_activation_hook(__FILE__, 'wplc_activate');
318
 
319
 
320
+ /*
321
+ * Custom Hooks
322
+ * ================
323
+ *
324
+ *
325
+ * wplc_hook_admin_visitor_info_display_before
326
+ *
327
+ * Allows your to add HTML at the beginning of the vistior details DIV in the chat window
328
+ *
329
+ * @since 5.0.8
330
+ * @param int $cid The current chat ID
331
+ * @return
332
+ *
333
+ *
334
+ * wplc_hook_admin_visitor_info_display_after
335
+ *
336
+ * Allows your to add HTML at the end of the vistior details DIV in the chat window
337
+ *
338
+ * @since 5.0.8
339
+ * @param int $cid The current chat ID
340
+ * @return
341
+ *
342
+ *
343
+ * wplc_hook_admin_javascript_chat
344
+ *
345
+ * Allows your to add Javascript enqueues at the end of the javascript section of the chat window
346
+ *
347
+ * @since 5.0.8
348
+ * @return
349
+ *
350
+ *
351
+ * wplc_hook_admin_settings_main_settings_after
352
+ *
353
+ * Allows your to add more options to the main settings table in the settings page, after the first main table
354
+ *
355
+ * @since 5.0.8
356
+ * @return
357
+ *
358
+ *
359
+ * wplc_hook_admin_settings_save
360
+ *
361
+ * Hook into the save settings head section. i.e. where we handle POST data from the settings page
362
+ *
363
+ * @since 5.0.8
364
+ * @return
365
+ *
366
+ *
367
+ *
368
+ *
369
+ */
370
+
371
+
372
  function wplc_basic_check() {
373
  // check if basic exists if pro is installed
374
  }
1195
  wplc_return_pro_admin_chat_javascript(sanitize_text_field($_GET['cid']));
1196
  } else {
1197
  wplc_return_admin_chat_javascript(sanitize_text_field($_GET['cid']));
1198
+
1199
+
1200
  }
1201
+ do_action("wplc_hook_admin_javascript_chat");
1202
  }
1203
  }
1204
 
1854
  }
1855
  }
1856
 
1857
+
1858
+
1859
  function wplc_draw_chat_area($cid) {
1860
 
1861
  global $wpdb;
1905
 
1906
  echo"<div class='admin_chat_box'><div class='admin_chat_box_inner' id='admin_chat_box_area_" . $result->id . "'>" . wplc_return_chat_messages($cid) . "</div><div class='admin_chat_box_inner_bottom'>" . wplc_return_chat_response_box($cid) . "</div></div>";
1907
  echo "<div class='admin_visitor_info'>";
1908
+ do_action("wplc_hook_admin_visitor_info_display_before",$cid);
1909
  echo " <div style='float:left; width:100px;'><img src=\"//www.gravatar.com/avatar/" . md5($result->email) . "\" class=\"admin_chat_img\" /></div>";
1910
  echo " <div style='float:left;'>";
1911
 
1915
  echo " </div>";
1916
  echo " </div>";
1917
 
1918
+ echo " <div class='admin_visitor_advanced_info'>";
1919
  echo " <strong>" . __("Site Info", "wplivechat") . "</strong>";
1920
  echo " <hr />";
1921
  echo " <span class='part1'>" . __("Chat initiated on:", "wplivechat") . "</span> <span class='part2'>" . $result->url . "</span>";
1922
+ echo " </div>";
1923
 
1924
+ echo " <div class='admin_visitor_advanced_info'>";
1925
  echo " <strong>" . __("Advanced Info", "wplivechat") . "</strong>";
1926
  echo " <hr />";
1927
  echo " <span class='part1'>" . __("Browser:", "wplivechat") . "</span><span class='part2'> $browser <img src='" . $wplc_basic_plugin_url . "/images/$browser_image' alt='$browser' title='$browser' /><br />";
1928
  echo " <span class='part1'>" . __("IP Address:", "wplivechat") . "</span><span class='part2'> ".$user_ip;
1929
+ echo " </div>";
1930
 
1931
  echo " <div id=\"wplc_sound_update\"></div>";
1932
+ do_action("wplc_hook_admin_visitor_info_display_after",$cid);
1933
  echo "</div>";
1934
 
1935
  if ($result->status != 1) {
2097
 
2098
  jQuery(document).ready(function () {
2099
 
2100
+ var wplc_image = "<?php if (isset($image)) { echo $image; } else { echo ""; } ?>";
 
 
 
 
2101
  /* var wplc_ajaxurl = '<?php echo plugins_url('/ajax.php', __FILE__); ?>'; */
2102
  var wplc_ajaxurl = ajaxurl;
2103
 
2213
 
2214
 
2215
  });
2216
+
2217
+
2218
  </script>
2219
  <?php
2220
  }
2495
  update_option("WPLC_HIDE_CHAT", esc_attr($_POST['wplc_hide_chat']));
2496
  }
2497
 
2498
+ do_action("wplc_hook_admin_settings_save");
2499
 
2500
  echo "<div class='updated'>";
2501
  _e("Your settings have been saved.", "wplivechat");
2595
 
2596
  ?>
2597
  <h2 class="nav-tab-wrapper">
2598
+ <a href="admin.php?page=wplivechat-menu-extensions-page" title="<?php _e("Add-ons","wplivechat"); ?>" class="nav-tab <?php echo $normal; ?>"><?php _e("Add-ons","wplivechat"); ?></a><a href="admin.php?page=wplivechat-menu-extensions-page&type=additional" title="<?php _e("Suggested Plugins","wplivechat"); ?>" class="nav-tab <?php echo $additional; ?>"><?php _e("Suggested Plugins","wplivechat"); ?></a>
2599
  <span style='float: right; bottom:-5px; position: relative;'><img src='<?php echo plugins_url('/images/codecabin.png', __FILE__); ?>' style="height:15px;" /></span>
2600
  </h2>
2601
  <div id="tab_container">
2744
 
2745
  function wplc_footer_mod( $footer_text ) {
2746
  if (isset($_GET['page']) && ($_GET['page'] == 'wplivechat-menu' || $_GET['page'] == 'wplivechat-menu-extensions-page' || $_GET['page'] == 'wplivechat-menu-settings' || $_GET['page'] == 'wplivechat-menu-offline-messages' || $_GET['page'] == 'wplivechat-menu-history')) {
2747
+ $footer_text_mod = sprintf( __( 'Thank you for using <a href="%1$s" target="_blank">WP Live Chat Support</a>! Please <a href="%2$s" target="_blank">rate us</a> on <a href="%2$s" target="_blank">WordPress.org</a>', 'wplivechat' ),
2748
  'http://wp-livechat.com/?utm_source=plugin&utm_medium=link&utm_campaign=footer',
2749
  'https://wordpress.org/support/view/plugin-reviews/wp-live-chat-support?filter=5#postform'
2750
  );