LiveChat – WP live chat plugin for WordPress - Version 3.2.0

Version Description

  • Compatibility with new chat window
  • Removed "click-to-chat button" configurator (no longer used)
Download this release

Release Info

Developer livechat
Plugin Icon 128x128 LiveChat – WP live chat plugin for WordPress
Version 3.2.0
Comparing to
See all releases

Code changes from version 3.1.0 to 3.2.0

livechat.php CHANGED
@@ -2,10 +2,10 @@
2
  /*
3
  Plugin Name: LiveChat
4
  Plugin URI: http://www.livechatinc.com/addons/wordpress/
5
- Description: Live chat software for live help, online sales and customer support. This plugin allows to quickly install the live chat button and tracking code on any WordPress website.
6
  Author: LiveChat
7
  Author URI: http://www.livechatinc.com
8
- Version: 3.1
9
  */
10
 
11
  if (is_admin())
2
  /*
3
  Plugin Name: LiveChat
4
  Plugin URI: http://www.livechatinc.com/addons/wordpress/
5
+ Description: Live chat software for live help, online sales and customer support. This plugin allows to quickly install LiveChat on any WordPress website.
6
  Author: LiveChat
7
  Author URI: http://www.livechatinc.com
8
+ Version: 3.2
9
  */
10
 
11
  if (is_admin())
plugin_files/LiveChat.class.php CHANGED
@@ -1,7 +1,5 @@
1
  <?php
2
 
3
- require_once('LiveChat.widget.php');
4
-
5
  class LiveChat
6
  {
7
  // singleton pattern
@@ -31,7 +29,6 @@ class LiveChat
31
  protected function __construct()
32
  {
33
  add_action ('wp_head', array($this, 'tracking_code'));
34
- add_action('widgets_init', create_function('', 'return register_widget("LiveChatWidget");'));
35
  }
36
 
37
  public static function get_instance()
@@ -60,19 +57,6 @@ class LiveChat
60
  return $this->plugin_url;
61
  }
62
 
63
- /**
64
- * Returns true if current Wordpress theme supports widgets,
65
- * false otherwise
66
- *
67
- * @return bool
68
- */
69
- public function widgets_enabled()
70
- {
71
- global $wp_registered_sidebars;
72
-
73
- return (bool)(sizeof($wp_registered_sidebars) > 0);
74
- }
75
-
76
  public function livechat_sanitize_lang ($lang)
77
  {
78
  $lang = trim($lang);
1
  <?php
2
 
 
 
3
  class LiveChat
4
  {
5
  // singleton pattern
29
  protected function __construct()
30
  {
31
  add_action ('wp_head', array($this, 'tracking_code'));
 
32
  }
33
 
34
  public static function get_instance()
57
  return $this->plugin_url;
58
  }
59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  public function livechat_sanitize_lang ($lang)
61
  {
62
  $lang = trim($lang);
plugin_files/LiveChat.widget.php DELETED
@@ -1,70 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * LiveChat "click-to-chat" button widget
5
- */
6
-
7
- class LiveChatWidget extends WP_Widget
8
- {
9
- private static $my_id_base = 'livechat_widget';
10
-
11
- static public function get_id_base()
12
- {
13
- return self::$my_id_base;
14
- }
15
-
16
- function LiveChatWidget()
17
- {
18
- $this->WP_Widget('livechat_widget', 'LiveChat', array(
19
- 'classname' => 'LiveChatWidget',
20
- 'description' => 'Install "click-to-chat" button to let your visitors start a chat with you.'
21
- ), array(
22
- 'id_base' => self::$my_id_base
23
- ));
24
- }
25
-
26
- function form($instance)
27
- {
28
- if (LiveChat::get_instance()->is_installed())
29
- {
30
- echo <<<HTML
31
- <p><strong>Everything is all right!</strong></p>
32
- <p>To configure LiveChat, go to <a href="admin.php?page=livechat_settings">Settings</a>.</p>
33
- HTML;
34
- }
35
- else
36
- {
37
- echo <<<HTML
38
- <p>Your live chat button <strong>is not working yet</strong>.</p>
39
- <p>You need to <a href="admin.php?page=livechat_settings">set up your LiveChat account</a> first.</p>
40
- HTML;
41
- }
42
- }
43
-
44
- function widget($args, $instance)
45
- {
46
- // Do not try to display click-to-chat button
47
- // if LiveChat plugin is not configured properly
48
- if (LiveChat::get_instance()->is_installed() == false) return;
49
-
50
- $url = LiveChat::get_instance()->get_plugin_url();
51
-
52
- $time = time();
53
- $license = LiveChat::get_instance()->get_license_number();
54
- $lang = LiveChat::get_instance()->get_lang();
55
- $skill = LiveChat::get_instance()->get_skill();
56
-
57
- echo <<<CODE
58
- <div id="LiveChat_{$time}"><a href="http://www.livechatinc.com/?partner=lc_{$license}">live chat software</a></div>
59
-
60
- <script type="text/javascript">
61
- var __lc_buttons = __lc_buttons || [];
62
- __lc_buttons.push({
63
- elementId: 'LiveChat_{$time}',
64
- language: '{$lang}',
65
- skill: '{$skill}'
66
- });
67
- </script>
68
- CODE;
69
- }
70
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
plugin_files/LiveChatAdmin.class.php CHANGED
@@ -140,12 +140,6 @@ final class LiveChatAdmin extends LiveChat
140
  $this->get_helper('ControlPanel');
141
  }
142
 
143
- public function chat_button_page()
144
- {
145
- $this->get_helper('ChatButton');
146
- }
147
-
148
-
149
  public function changes_saved()
150
  {
151
  return $this->changes_saved;
140
  $this->get_helper('ControlPanel');
141
  }
142
 
 
 
 
 
 
 
143
  public function changes_saved()
144
  {
145
  return $this->changes_saved;
plugin_files/css/livechat.css CHANGED
@@ -58,7 +58,6 @@ hr.livechat { margin-bottom: 1em; height: 1px; border: 0; color: #999; backgroun
58
  .ajax_message.message { background-image: none; text-indent: 0px; }
59
 
60
  #control_panel { width: 99%; border: 0; }
61
- #chat_button_code { font-family: "Courier New", Courier, monospace; width: 650px; height: 200px; font-size: 85%; }
62
 
63
  #reset_settings {
64
  font-size: 85%;
@@ -135,4 +134,8 @@ p.img {
135
  /* margin-top: 1px did not work as intended under Chrome */
136
  position: relative;
137
  top: 1px;
 
 
 
 
138
  }
58
  .ajax_message.message { background-image: none; text-indent: 0px; }
59
 
60
  #control_panel { width: 99%; border: 0; }
 
61
 
62
  #reset_settings {
63
  font-size: 85%;
134
  /* margin-top: 1px did not work as intended under Chrome */
135
  position: relative;
136
  top: 1px;
137
+ }
138
+
139
+ #advanced {
140
+ margin-bottom: 0;
141
  }
plugin_files/helpers/ChatButtonHelper.class.php DELETED
@@ -1,43 +0,0 @@
1
- <?php
2
-
3
- require_once('LiveChatHelper.class.php');
4
-
5
- class ChatButtonHelper extends LiveChatHelper
6
- {
7
- public function render()
8
- {
9
- $url = LiveChat::get_instance()->get_plugin_url();
10
-
11
- $time = time();
12
- $license = LiveChat::get_instance()->get_license_number();
13
- $lang = LiveChat::get_instance()->get_lang();
14
- $skill = LiveChat::get_instance()->get_skill();
15
-
16
- $code = <<<CODE
17
- <div id="LiveChat_{$time}"><a href="http://www.livechatinc.com/?partner=lc_{$license}">live chat software</a></div>
18
-
19
- <script type="text/javascript">
20
- var __lc_buttons = __lc_buttons || [];
21
- __lc_buttons.push({
22
- elementId: 'LiveChat_{$time}',
23
- language: '{$lang}',
24
- skill: '{$skill}'
25
- });
26
- </script>
27
- CODE;
28
-
29
- return <<<HTML
30
- <p>Your theme <strong>does not</strong> support Widgets <a class="help" href="http://codex.wordpress.org/Widgetizing_Themes">(read more)</a>. Thus, you can't easily drag &amp; drop the Widget in your Wordpress admin page.</p>
31
- <hr class="livechat">
32
- <p>To install "click-to-chat" button you need to put the following code <strong>in a visible place of your website</strong>:</p>
33
- <textarea id="chat_button_code" cols="80" rows="12" readonly="readonly" onclick="this.select()">{$code}</textarea>
34
-
35
- <p><a href="#button_placement" class="toggle">What is the best place for my button?</a></p>
36
- <div id="button_placement" style="display:none">
37
- <p class="img"><img src="{$url}/images/button_placement.png" alt="" /></p>
38
- </div>
39
-
40
- <p class="back"><a href="?page=livechat_settings">&laquo; go back to Settings</a></p>
41
- HTML;
42
- }
43
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
plugin_files/helpers/ChatButtonInfoHelper.class.php DELETED
@@ -1,31 +0,0 @@
1
- <?php
2
-
3
- require_once('LiveChatHelper.class.php');
4
-
5
- class ChatButtonInfoHelper extends LiveChatHelper
6
- {
7
- public function render()
8
- {
9
- if (LiveChat::get_instance()->is_installed())
10
- {
11
- if (is_active_widget (false, false, LiveChatWidget::get_id_base()))
12
- {
13
- return '<div class="updated info installed_ok"><p>"Click-to-chat" button installed properly. <span class="help">(<a href="widgets.php">manage widgets</a>)</span></p></div>';
14
- }
15
- else
16
- {
17
- // Check if theme supports Widgets
18
- if (LiveChat::get_instance()->widgets_enabled())
19
- {
20
- return '<div class="updated info"><p>To install your "click-to-chat" button, go to <a href="widgets.php">Widgets</a> page.</p></div>';
21
- }
22
- else
23
- {
24
- return '<div class="updated info"><p>To install your "click-to-chat" button, <a href="?page=livechat_settings&amp;chat_button=1">click here</a>.</p></div>';
25
- }
26
- }
27
- }
28
-
29
- return '';
30
- }
31
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
plugin_files/helpers/SettingsHelper.class.php CHANGED
@@ -16,16 +16,9 @@ class SettingsHelper extends LiveChatHelper
16
  </div>
17
  <div class="clear"></div>
18
 
19
- <?php
20
- if (isset($_GET['chat_button']))
21
- {
22
- LiveChat::get_instance()->get_helper('ChatButton');
23
- }
24
- else
25
- {
26
- LiveChat::get_instance()->get_helper('ChangesSaved');
27
- LiveChat::get_instance()->get_helper('TrackingCodeInfo');
28
- LiveChat::get_instance()->get_helper('ChatButtonInfo');
29
  ?>
30
 
31
  <?php if (LiveChat::get_instance()->is_installed() == false) { ?>
@@ -50,15 +43,14 @@ class SettingsHelper extends LiveChatHelper
50
  <h3><?php echo _e('Download application'); ?></h3>
51
  <div class="postbox_content">
52
  <p><?php echo _e('Download LiveChat for your desktop/mobile and start chatting with your customers!'); ?></p>
53
- <p class="btn"><a href="http://www.livechatinc.com/download/" target="_blank"><?php _e('Download application'); ?></a></p>
54
  </div>
55
  </div>
56
  <?php endif; ?>
57
 
 
58
  <div class="postbox">
59
  <form method="post" action="?page=livechat_settings">
60
-
61
- <?php if (LiveChat::get_instance()->is_installed() == false) { ?>
62
  <h3>LiveChat account</h3>
63
  <div class="postbox_content">
64
  <table class="form-table">
@@ -74,11 +66,14 @@ class SettingsHelper extends LiveChatHelper
74
  <input type="hidden" name="settings_form" value="1">
75
  <input type="submit" class="button-primary" value="<?php _e('Save changes') ?>" />
76
  </p>
77
- </div>
78
  </form>
 
79
 
80
  <?php } else { ?>
81
 
 
 
82
  <h3>Advanced settings</h3>
83
  <div class="postbox_content">
84
  <table class="form-table">
@@ -97,10 +92,11 @@ class SettingsHelper extends LiveChatHelper
97
  <input type="hidden" name="settings_form" value="1">
98
  <input type="submit" class="button-primary" value="<?php _e('Save changes') ?>" />
99
  </p>
100
- </div>
101
  </form>
102
- <?php } ?>
103
  </div>
 
 
104
 
105
  <?php if (LiveChat::get_instance()->is_installed()) { ?>
106
  <p id="reset_settings">Something went wrong? <a href="?page=livechat_settings&amp;reset=1">Reset your settings</a>.</p>
@@ -158,11 +154,8 @@ class SettingsHelper extends LiveChatHelper
158
  </form>
159
  </div>
160
  </div>
161
- <?php
162
- }
163
- ?>
164
- </div>
165
- </div>
166
  <?php
167
  }
168
  }
16
  </div>
17
  <div class="clear"></div>
18
 
19
+ <?php
20
+ LiveChat::get_instance()->get_helper('ChangesSaved');
21
+ LiveChat::get_instance()->get_helper('TrackingCodeInfo');
 
 
 
 
 
 
 
22
  ?>
23
 
24
  <?php if (LiveChat::get_instance()->is_installed() == false) { ?>
43
  <h3><?php echo _e('Download application'); ?></h3>
44
  <div class="postbox_content">
45
  <p><?php echo _e('Download LiveChat for your desktop/mobile and start chatting with your customers!'); ?></p>
46
+ <p class="btn"><a href="http://www.livechatinc.com/product/" target="_blank"><?php _e('Download application'); ?></a></p>
47
  </div>
48
  </div>
49
  <?php endif; ?>
50
 
51
+ <?php if (LiveChat::get_instance()->is_installed() == false) { ?>
52
  <div class="postbox">
53
  <form method="post" action="?page=livechat_settings">
 
 
54
  <h3>LiveChat account</h3>
55
  <div class="postbox_content">
56
  <table class="form-table">
66
  <input type="hidden" name="settings_form" value="1">
67
  <input type="submit" class="button-primary" value="<?php _e('Save changes') ?>" />
68
  </p>
69
+ </div>
70
  </form>
71
+ </div>
72
 
73
  <?php } else { ?>
74
 
75
+ <div id="advanced" class="postbox" style="display:none">
76
+ <form method="post" action="?page=livechat_settings">
77
  <h3>Advanced settings</h3>
78
  <div class="postbox_content">
79
  <table class="form-table">
92
  <input type="hidden" name="settings_form" value="1">
93
  <input type="submit" class="button-primary" value="<?php _e('Save changes') ?>" />
94
  </p>
95
+ </div>
96
  </form>
 
97
  </div>
98
+ <p id="advanced-link"><a href="">Show advanced settings&hellip;</a></p>
99
+ <?php } ?>
100
 
101
  <?php if (LiveChat::get_instance()->is_installed()) { ?>
102
  <p id="reset_settings">Something went wrong? <a href="?page=livechat_settings&amp;reset=1">Reset your settings</a>.</p>
154
  </form>
155
  </div>
156
  </div>
157
+ </div>
158
+ </div>
 
 
 
159
  <?php
160
  }
161
  }
plugin_files/helpers/TrackingCodeHelper.class.php CHANGED
@@ -14,24 +14,16 @@ class TrackingCodeHelper extends LiveChatHelper
14
 
15
  return <<<HTML
16
  <script type="text/javascript">
17
- (function() {
18
- var license = '{$license_number}',
19
- params = '',
20
- lang = '{$lang}',
21
- skill = '{$skill}';
22
 
23
- __lc_load = function (p) { if (typeof __lc_loaded != 'function')
24
- if (p) { var d = document, l = d.createElement('script'), s =
25
- d.getElementsByTagName('script')[0], a = unescape('%26'),
26
- h = ('https:' == d.location.protocol ? 'https://' : 'http://'); l.type = 'text/javascript'; l.async = true;
27
- l.src = h + 'gis' + p +'.livechatinc.com/gis.cgi?serverType=control'+a+'licenseID='+license+a+'jsonp=__lc_load';
28
- if (typeof p['server'] == 'string' && typeof __lc_serv != 'string') {
29
- l.src = h + (__lc_serv = p['server']) + '/licence/'+license+'/script.cgi?lang='+lang+a+'groups='+skill;
30
- l.src += (params == '') ? '' : a+'params='+encodeURIComponent(encodeURIComponent(params)); s.parentNode.insertBefore(l, s);
31
- } else setTimeout(__lc_load, 1000); typeof __lc_serv != 'string' && s.parentNode.insertBefore(l, s);
32
- } else __lc_load(Math.ceil(Math.random()*5)); }
33
- __lc_load();
34
- })();
35
  </script>
36
  HTML;
37
  }
14
 
15
  return <<<HTML
16
  <script type="text/javascript">
17
+ var __lc = {};
18
+ __lc.license = {$license_number};
19
+ __lc.lang = '{$lang}';
20
+ __lc.skill = {$skill};
 
21
 
22
+ (function() {
23
+ var lc = document.createElement('script'); lc.type = 'text/javascript'; lc.async = true;
24
+ lc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'cdn.livechatinc.com/tracking.js';
25
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(lc, s);
26
+ })();
 
 
 
 
 
 
 
27
  </script>
28
  HTML;
29
  }
plugin_files/js/livechat.js CHANGED
@@ -12,6 +12,7 @@ var LiveChat =
12
  this.newLicenseForm();
13
  this.controlPanelIframe();
14
  this.fadeChangesSaved();
 
15
  },
16
 
17
  externalLinks: function()
@@ -253,6 +254,25 @@ var LiveChat =
253
  $cs.slideUp();
254
  }, 1000);
255
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
256
  }
257
  };
258
 
12
  this.newLicenseForm();
13
  this.controlPanelIframe();
14
  this.fadeChangesSaved();
15
+ this.showAdvancedSettings();
16
  },
17
 
18
  externalLinks: function()
254
  $cs.slideUp();
255
  }, 1000);
256
  }
257
+ },
258
+
259
+ showAdvancedSettings: function()
260
+ {
261
+ $('#advanced-link a').click(function()
262
+ {
263
+ if ($('#advanced').is(':visible'))
264
+ {
265
+ $(this).html('Show advanced settings&hellip;');
266
+ $('#advanced').slideUp();
267
+ }
268
+ else
269
+ {
270
+ $(this).html('Hide advanced settings&hellip;');
271
+ $('#advanced').slideDown();
272
+ }
273
+
274
+ return false;
275
+ })
276
  }
277
  };
278
 
readme.txt CHANGED
@@ -1,7 +1,7 @@
1
  === LiveChat ===
2
  Contributors: LiveChat
3
  Tags: live support, live chat, live chat software, online support, ecommerce, increase sales, customer help, customer support, livechat, live support, customer service, plugin, chat
4
- Stable tag: 3.1.0
5
  Requires at least: 2.8
6
  Tested up to: 3.1.3
7
 
@@ -28,6 +28,10 @@ Take a tour to see why you need LiveChat on your website: http://www.livechatinc
28
 
29
  == Changelog ==
30
 
 
 
 
 
31
  = 3.1.0 =
32
  * Major update in the Tracking Code
33
 
1
  === LiveChat ===
2
  Contributors: LiveChat
3
  Tags: live support, live chat, live chat software, online support, ecommerce, increase sales, customer help, customer support, livechat, live support, customer service, plugin, chat
4
+ Stable tag: 3.2.0
5
  Requires at least: 2.8
6
  Tested up to: 3.1.3
7
 
28
 
29
  == Changelog ==
30
 
31
+ = 3.2.0 =
32
+ * Compatibility with new chat window
33
+ * Removed "click-to-chat button" configurator (no longer used)
34
+
35
  = 3.1.0 =
36
  * Major update in the Tracking Code
37