LiveChat – WP live chat plugin for WordPress - Version 3.3.8

Version Description

Download this release

Release Info

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

Code changes from version 3.3.7 to 3.3.8

trunk/livechat.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
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.3.1
9
+ */
10
+
11
+ if (is_admin())
12
+ {
13
+ require_once(dirname(__FILE__).'/plugin_files/LiveChatAdmin.class.php');
14
+ LiveChatAdmin::get_instance();
15
+ }
16
+ else
17
+ {
18
+ require_once(dirname(__FILE__).'/plugin_files/LiveChat.class.php');
19
+ LiveChat::get_instance();
20
+ }
21
+
trunk/plugin_files/LiveChat.class.php ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class LiveChat
4
+ {
5
+ // singleton pattern
6
+ protected static $instance;
7
+
8
+ /**
9
+ * Absolute path to plugin files
10
+ */
11
+ protected $plugin_url = null;
12
+
13
+ /**
14
+ * LiveChat license parameters
15
+ */
16
+ protected $login = null;
17
+ protected $license_number = null;
18
+
19
+ /**
20
+ * Remembers if LiveChat license number is set
21
+ */
22
+ protected static $license_installed = false;
23
+
24
+ /**
25
+ * Starts the plugin
26
+ */
27
+ protected function __construct()
28
+ {
29
+ add_action ('wp_head', array($this, 'tracking_code'));
30
+ }
31
+
32
+ public static function get_instance()
33
+ {
34
+ if (!isset(self::$instance))
35
+ {
36
+ $c = __CLASS__;
37
+ self::$instance = new $c;
38
+ }
39
+
40
+ return self::$instance;
41
+ }
42
+
43
+ /**
44
+ * Returns plugin files absolute path
45
+ *
46
+ * @return string
47
+ */
48
+ public function get_plugin_url()
49
+ {
50
+ if (is_null($this->plugin_url))
51
+ {
52
+ $this->plugin_url = WP_PLUGIN_URL.'/wp-live-chat-software-for-wordpress/plugin_files';
53
+ }
54
+
55
+ return $this->plugin_url;
56
+ }
57
+
58
+ /**
59
+ * Returns true if LiveChat license is set properly,
60
+ * false otherwise
61
+ *
62
+ * @return bool
63
+ */
64
+ public function is_installed()
65
+ {
66
+ return ($this->get_license_number() > 0);
67
+ }
68
+
69
+ /**
70
+ * Returns LiveChat license number
71
+ *
72
+ * @return int
73
+ */
74
+ public function get_license_number()
75
+ {
76
+ if (is_null($this->license_number))
77
+ {
78
+ $this->license_number = get_option('livechat_license_number');
79
+ }
80
+
81
+ // license_number must be >= 0
82
+ // also, this prevents from NaN values
83
+ $this->license_number = max(0, $this->license_number);
84
+
85
+ return $this->license_number;
86
+ }
87
+
88
+ /**
89
+ * Returns LiveChat login
90
+ */
91
+ public function get_login()
92
+ {
93
+ if (is_null($this->login))
94
+ {
95
+ $this->login = get_option('login');
96
+ }
97
+
98
+ return $this->login;
99
+ }
100
+
101
+ /**
102
+ * Injects tracking code
103
+ */
104
+ public function tracking_code()
105
+ {
106
+ $this->get_helper('TrackingCode');
107
+ }
108
+
109
+ /**
110
+ * Echoes given helper
111
+ */
112
+ public static function get_helper($class, $echo=true)
113
+ {
114
+ $class .= 'Helper';
115
+
116
+ if (class_exists($class) == false)
117
+ {
118
+ $path = dirname(__FILE__).'/helpers/'.$class.'.class.php';
119
+ if (file_exists($path) !== true)
120
+ {
121
+ return false;
122
+ }
123
+
124
+ require_once($path);
125
+ }
126
+
127
+ $c = new $class;
128
+
129
+ if ($echo)
130
+ {
131
+ echo $c->render();
132
+ return true;
133
+ }
134
+ else
135
+ {
136
+ return $c->render();
137
+ }
138
+ }
139
+ }
trunk/plugin_files/LiveChatAdmin.class.php ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once('LiveChat.class.php');
4
+
5
+ final class LiveChatAdmin extends LiveChat
6
+ {
7
+ /**
8
+ * Plugin's version
9
+ */
10
+ protected $plugin_version = null;
11
+
12
+ /**
13
+ * Returns true if "Advanced settings" form has just been submitted,
14
+ * false otherwise
15
+ *
16
+ * @return bool
17
+ */
18
+ protected $changes_saved = false;
19
+
20
+ /**
21
+ * Starts the plugin
22
+ */
23
+ protected function __construct()
24
+ {
25
+ parent::__construct();
26
+
27
+ add_action('init', array($this, 'load_scripts'));
28
+ add_action('admin_menu', array($this, 'admin_menu'));
29
+
30
+ // tricky error reporting
31
+ if (defined('WP_DEBUG') && WP_DEBUG == true)
32
+ {
33
+ add_action('init', array($this, 'error_reporting'));
34
+ }
35
+
36
+ if (isset($_GET['reset']) && $_GET['reset'] == '1')
37
+ {
38
+ $this->reset_options();
39
+ }
40
+ elseif ($_SERVER['REQUEST_METHOD'] == 'POST')
41
+ {
42
+ $this->update_options($_POST);
43
+ }
44
+ }
45
+
46
+ public static function get_instance()
47
+ {
48
+ if (!isset(self::$instance))
49
+ {
50
+ $c = __CLASS__;
51
+ self::$instance = new $c;
52
+ }
53
+
54
+ return self::$instance;
55
+ }
56
+
57
+ /**
58
+ * Set error reporting for debugging purposes
59
+ */
60
+ public function error_reporting()
61
+ {
62
+ error_reporting(E_ALL & ~E_USER_NOTICE);
63
+ }
64
+
65
+ /**
66
+ * Returns this plugin's version
67
+ *
68
+ * @return string
69
+ */
70
+ public function get_plugin_version()
71
+ {
72
+ if (is_null($this->plugin_version))
73
+ {
74
+ if (!function_exists('get_plugins'))
75
+ {
76
+ require_once(ABSPATH.'wp-admin/includes/plugin.php');
77
+ }
78
+
79
+ $plugin_folder = get_plugins('/'.plugin_basename(dirname(__FILE__).'/..'));
80
+ $this->plugin_version = $plugin_folder['livechat.php']['Version'];
81
+ }
82
+
83
+ return $this->plugin_version;
84
+ }
85
+
86
+ public function load_scripts()
87
+ {
88
+ wp_enqueue_script('livechat', $this->get_plugin_url().'/js/livechat.js', 'jquery', $this->get_plugin_version(), true);
89
+ wp_enqueue_style('livechat', $this->get_plugin_url().'/css/livechat.css', false, $this->get_plugin_version());
90
+ }
91
+
92
+ public function admin_menu()
93
+ {
94
+ add_menu_page(
95
+ 'LiveChat',
96
+ 'LiveChat',
97
+ 'administrator',
98
+ 'livechat',
99
+ array($this, 'livechat_settings_page'),
100
+ $this->get_plugin_url().'/images/favicon.png'
101
+ );
102
+
103
+ add_submenu_page(
104
+ 'livechat',
105
+ 'Settings',
106
+ 'Settings',
107
+ 'administrator',
108
+ 'livechat_settings',
109
+ array($this, 'livechat_settings_page')
110
+ );
111
+
112
+ // remove the submenu that is automatically added
113
+ if (function_exists('remove_submenu_page'))
114
+ {
115
+ remove_submenu_page('livechat', 'livechat');
116
+ }
117
+
118
+ // Settings link
119
+ add_filter('plugin_action_links', array($this, 'livechat_settings_link'), 10, 2);
120
+ }
121
+
122
+ /**
123
+ * Displays settings page
124
+ */
125
+ public function livechat_settings_page()
126
+ {
127
+ $this->get_helper('Settings');
128
+ }
129
+
130
+ public function changes_saved()
131
+ {
132
+ return $this->changes_saved;
133
+ }
134
+
135
+ public function livechat_settings_link($links, $file)
136
+ {
137
+ if (basename($file) !== 'livechat.php')
138
+ {
139
+ return $links;
140
+ }
141
+
142
+ $settings_link = sprintf('<a href="admin.php?page=livechat_settings">%s</a>', __('Settings'));
143
+ array_unshift ($links, $settings_link);
144
+ return $links;
145
+ }
146
+
147
+ protected function reset_options()
148
+ {
149
+ delete_option('livechat_license_number');
150
+ }
151
+
152
+ protected function update_options($data)
153
+ {
154
+ // check if we are handling LiveChat settings form
155
+ if (isset($data['settings_form']) == false && isset($data['new_license_form']) == false)
156
+ {
157
+ return false;
158
+ }
159
+
160
+ $license_number = isset($data['license_number']) ? (int)$data['license_number'] : 0;
161
+
162
+ update_option('livechat_license_number', $license_number);
163
+
164
+ if (isset($data['changes_saved']) && $data['changes_saved'] == '1')
165
+ {
166
+ $this->changes_saved = true;
167
+ }
168
+ }
169
+ }
trunk/plugin_files/css/livechat.css ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #livechat {
2
+ padding-top: 20px;
3
+ }
4
+ #lc_logo {
5
+ float: left;
6
+ width: 100%;
7
+ height: 120px;
8
+ }
9
+ #lc_logo img {
10
+ display: block;
11
+ float: left;
12
+ }
13
+ #lc_logo span {
14
+ display: block;
15
+ margin-left: 200px;
16
+
17
+ /**
18
+ * inheriting "h2" element styles
19
+ * - could not use actual <h2> element
20
+ * due to some problems with "updated" divs
21
+ */
22
+ color: #464646;
23
+ font: italic normal normal 24px Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
24
+ line-height: 80px;
25
+ text-shadow: rgba(255, 255, 255, 1) 0 1px 0;
26
+ }
27
+
28
+ .clear {
29
+ clear: both;
30
+ }
31
+
32
+ #livechat div.installed_ok { background-color: #e1fdc5; border-color: #6ac611; }
33
+ .postbox h3 { cursor: default; }
34
+ .postbox_content { padding: 0 10px; }
35
+ .postbox_content ul { margin-top: 5px; }
36
+ .postbox label { line-height: 1.5em; }
37
+ .postbox .asterisk { color: red; }
38
+ .explanation { color: #999; padding-left: 5px; }
39
+ a.help,
40
+ span.help a { color: #999; }
41
+ #wpbody-content a.help:hover,
42
+ #wpbody-content .help a:hover { color: #222; }
43
+ .installed_ok a.help,
44
+ .installed_ok .help a,
45
+ .info a.help,
46
+ .info .help a { color: #666; }
47
+ .installed_ok a.help,
48
+ .info a.help,
49
+ .installed_ok span.help,
50
+ .info span.help { font-weight: normal; color: #666; font-size: 85%; }
51
+ h3.no-radius { -moz-border-radius: 0; }
52
+ hr.livechat { margin-bottom: 1em; height: 1px; border: 0; color: #999; background: #ccc; }
53
+
54
+ .ajax_message { display: none; background: url(../images/ajax_loader.gif) no-repeat 5px 60%; font-size: 85%; padding: 0; }
55
+ .ajax_message.wait,
56
+ .ajax_message.message { display: block; }
57
+ .ajax_message.wait { text-indent: 28px; }
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%;
64
+ }
65
+ #reset_settings, #reset_settings a {
66
+ color: #999;
67
+ }
68
+
69
+
70
+ #livechat .back {
71
+ margin-top: 20px;
72
+ }
73
+
74
+ p.img {
75
+ }
76
+ p.img img {
77
+ padding: 1px;
78
+ background: white;
79
+ border: 1px solid #bbb;
80
+
81
+ -moz-border-radius: 5px;
82
+ -webkit-border-radius: 5px;
83
+ border-radius: 5px;
84
+ }
85
+
86
+ .btn a {
87
+ display: inline-block;
88
+ padding: 3px 10px;
89
+ color: white;
90
+
91
+ text-decoration: none;
92
+ font-weight: normal;
93
+ -moz-border-radius: 3px;
94
+ -webkit-border-radius: 3px;
95
+ border-radius: 3px;
96
+
97
+ text-shadow: 1px 1px 0 #06a;
98
+ border-top: 1px solid #4bf;
99
+ border-bottom: 1px solid #39f;
100
+
101
+ -moz-box-shadow: 0 1px 0 #39d, 0 -1px 0 #39d, 1px 0 0 #39d, -1px 0 0 #39d;
102
+ -webkit-box-shadow: 0 1px 0 #39d, 0 -1px 0 #39d, 1px 0 0 #39d, -1px 0 0 #39d;
103
+ box-shadow: 0 1px 0 #39d, 0 -1px 0 #39d, 1px 0 0 #39d, -1px 0 0 #39d;
104
+
105
+ background: #4ae;
106
+ background: -moz-linear-gradient(top, #4ae, #28d);
107
+ background: -webkit-gradient(linear, left top, left bottom, from(#4ae), to(#28d));
108
+
109
+ }
110
+ .btn a:hover {
111
+ text-decoration: none;
112
+ border-top-color: #5cf;
113
+ border-bottom-color: #3af;
114
+ color: white;
115
+
116
+ -moz-box-shadow: 0 1px 0 #4ae, 0 -1px 0 #4ae, 1px 0 0 #4ae, -1px 0 0 #4ae;
117
+ -webkit-box-shadow: 0 1px 0 #4ae, 0 -1px 0 #4ae, 1px 0 0 #4ae, -1px 0 0 #4ae;
118
+ box-shadow: 0 1px 0 #4ae, 0 -1px 0 #4ae, 1px 0 0 #4ae, -1px 0 0 #4ae;
119
+
120
+ background: #4bf;
121
+ background: -moz-linear-gradient(top, #4bf, #39d);
122
+ background: -webkit-gradient(linear, left top, left bottom, from(#4bf), to(#39d));
123
+ }
124
+ .btn a:active,
125
+ .btn a:focus {
126
+ /* margin-top: 1px did not work as intended under Chrome */
127
+ position: relative;
128
+ top: 1px;
129
+ }
130
+
131
+ #advanced {
132
+ margin-bottom: 0;
133
+ }
trunk/plugin_files/helpers/ChangesSavedHelper.class.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once('LiveChatHelper.class.php');
4
+
5
+ class ChangesSavedHelper extends LiveChatHelper
6
+ {
7
+ public function render()
8
+ {
9
+ if (LiveChat::get_instance()->changes_saved())
10
+ {
11
+ return '<div id="changes_saved_info" class="updated installed_ok"><p>Advanced settings saved successfully.</p></div>';
12
+ }
13
+
14
+ return '';
15
+ }
16
+ }
trunk/plugin_files/helpers/LiveChatHelper.class.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ abstract class LiveChatHelper
4
+ {
5
+ abstract public function render();
6
+ }
trunk/plugin_files/helpers/SettingsHelper.class.php ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once('LiveChatHelper.class.php');
4
+
5
+ class SettingsHelper extends LiveChatHelper
6
+ {
7
+ public function render()
8
+ {
9
+ ?>
10
+ <div id="livechat">
11
+ <div class="wrap">
12
+
13
+ <div id="lc_logo">
14
+ <img src="<?php echo LiveChat::get_instance()->get_plugin_url(); ?>/images/logo.png" />
15
+ <span>for Wordpress</span>
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) { ?>
25
+ <div class="metabox-holder">
26
+ <div class="postbox">
27
+ <h3>Do you already have a LiveChat account?</h3>
28
+ <div class="postbox_content">
29
+ <ul id="choice_account">
30
+ <li><input type="radio" name="choice_account" id="choice_account_1" checked="checked"> <label for="choice_account_1">Yes, I already have a LiveChat account</label></li>
31
+ <li><input type="radio" name="choice_account" id="choice_account_0"> <label for="choice_account_0">No, I want to create one</label></li>
32
+ </ul>
33
+ </div>
34
+ </div>
35
+ </div>
36
+ <?php } ?>
37
+
38
+ <!-- Already have an account -->
39
+ <div class="metabox-holder" id="livechat_already_have" style="display:none">
40
+
41
+ <?php if (LiveChat::get_instance()->is_installed()): ?>
42
+ <div class="postbox">
43
+ <h3><?php echo _e('Sign in to LiveChat'); ?></h3>
44
+ <div class="postbox_content">
45
+ <p><?php echo _e('Sign in to LiveChat and start chatting with your customers!'); ?></p>
46
+ <p><span class="btn"><a href="https://my.livechatinc.com/" target="_blank"><?php _e('Sign in to web application'); ?></a></span> &nbsp; or <a href="http://www.livechatinc.com/product/" target="_blank"><?php _e('download desktop app'); ?></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">
57
+ <tr>
58
+ <th scope="row"><label for="livechat_login">My LiveChat login is:</label></th>
59
+ <td><input type="text" name="login" id="livechat_login" value="<?php echo LiveChat::get_instance()->get_login(); ?>" size="40" /></td>
60
+ </tr>
61
+ </table>
62
+
63
+ <p class="ajax_message"></p>
64
+ <p class="submit">
65
+ <input type="hidden" name="license_number" value="<?php echo LiveChat::get_instance()->get_license_number(); ?>" id="license_number">
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 } ?>
74
+
75
+ <?php if (LiveChat::get_instance()->is_installed()) { ?>
76
+ <p id="reset_settings">Something went wrong? <a href="?page=livechat_settings&amp;reset=1">Reset your settings</a>.</p>
77
+ <?php } ?>
78
+ </div>
79
+
80
+ <!-- New account form -->
81
+ <div class="metabox-holder" id="livechat_new_account" style="display:none">
82
+ <div class="postbox">
83
+ <form method="post" action="?page=livechat_settings">
84
+ <h3>Create new LiveChat account</h3>
85
+ <div class="postbox_content">
86
+
87
+ <?php
88
+ $current_user = wp_get_current_user();
89
+
90
+ $fullname = $current_user->user_firstname.' '.$current_user->user_lastname;
91
+ $fullname = trim($fullname);
92
+ ?>
93
+ <table class="form-table">
94
+ <tr>
95
+ <th scope="row"><label for="name">Full name:</label></th>
96
+ <td><input type="text" name="name" id="name" maxlength="60" value="<?php echo $fullname; ?>" size="40" /></td>
97
+ </tr>
98
+ <tr>
99
+ <th scope="row"><label for="email">E-mail:</label></th>
100
+ <td><input type="text" name="email" id="email" maxlength="100" value="<?php echo $current_user->user_email; ?>" size="40" /></td>
101
+ </tr>
102
+ <tr>
103
+ <th scope="row"><label for="password">Password:</label></th>
104
+ <td><input type="password" name="password" id="password" maxlength="100" value="" size="40" /></td>
105
+ </tr>
106
+ <tr>
107
+ <th scope="row"><label for="password_retype">Retype password:</label></th>
108
+ <td><input type="password" name="password_retype" id="password_retype" maxlength="100" value="" size="40" /></td>
109
+ </tr>
110
+ </table>
111
+
112
+ <p class="ajax_message"></p>
113
+ <p class="submit">
114
+ <input type="hidden" name="website" value="<?php echo bloginfo('url'); ?>">
115
+ <input type="submit" value="Create account" id="submit" class="button-primary">
116
+ </p>
117
+ </div>
118
+ </form>
119
+
120
+ <form method="post" action="?page=livechat_settings" id="save_new_license">
121
+ <p>
122
+ <input type="hidden" name="new_license_form" value="1">
123
+ <input type="hidden" name="license_number" value="0" id="new_license_number">
124
+ </p>
125
+ </form>
126
+ </div>
127
+ </div>
128
+ </div>
129
+ </div>
130
+ <?php
131
+ }
132
+ }
trunk/plugin_files/helpers/TrackingCodeHelper.class.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once('LiveChatHelper.class.php');
4
+
5
+ class TrackingCodeHelper extends LiveChatHelper
6
+ {
7
+ public function render()
8
+ {
9
+ if (LiveChat::get_instance()->is_installed())
10
+ {
11
+ $license_number = LiveChat::get_instance()->get_license_number();
12
+
13
+ return <<<HTML
14
+ <script type="text/javascript">
15
+ var __lc = {};
16
+ __lc.license = {$license_number};
17
+
18
+ (function() {
19
+ var lc = document.createElement('script'); lc.type = 'text/javascript'; lc.async = true;
20
+ lc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'cdn.livechatinc.com/tracking.js';
21
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(lc, s);
22
+ })();
23
+ </script>
24
+ HTML;
25
+ }
26
+
27
+ return '';
28
+ }
29
+ }
trunk/plugin_files/helpers/TrackingCodeInfoHelper.class.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once('LiveChatHelper.class.php');
4
+
5
+ class TrackingCodeInfoHelper extends LiveChatHelper
6
+ {
7
+ public function render()
8
+ {
9
+ if (LiveChat::get_instance()->is_installed())
10
+ {
11
+ return '<div class="updated installed_ok"><p>LiveChat is installed properly. Woohoo!</p></div>';
12
+ }
13
+
14
+ return '';
15
+ }
16
+ }
trunk/plugin_files/images/ajax_loader.gif ADDED
Binary file
trunk/plugin_files/images/button_placement.png ADDED
Binary file
trunk/plugin_files/images/favicon.png ADDED
Binary file
trunk/plugin_files/images/logo.png ADDED
Binary file
trunk/plugin_files/images/plusminus.png ADDED
Binary file
trunk/plugin_files/js/livechat.js ADDED
@@ -0,0 +1,255 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function($)
2
+ {
3
+ var LiveChat =
4
+ {
5
+ init: function()
6
+ {
7
+ this.externalLinks();
8
+ this.resetLink();
9
+ this.toggleForms();
10
+ this.alreadyHaveAccountForm();
11
+ this.newLicenseForm();
12
+ this.controlPanelIframe();
13
+ this.fadeChangesSaved();
14
+ },
15
+
16
+ externalLinks: function()
17
+ {
18
+ $('a.help').attr('target', '_blank');
19
+ },
20
+
21
+ resetLink: function()
22
+ {
23
+ $('#reset_settings a').click(function()
24
+ {
25
+ return confirm('This will reset your LiveChat plugin settings. Continue?');
26
+ })
27
+ },
28
+
29
+ toggleForms: function()
30
+ {
31
+ var toggleForms = function()
32
+ {
33
+ // display account details page if license number is already known
34
+ if ($('#choice_account').length == 0 || $('#choice_account_1').is(':checked'))
35
+ {
36
+ $('#livechat_new_account').hide();
37
+ $('#livechat_already_have').show();
38
+ $('#livechat_login').focus();
39
+ }
40
+ else if ($('#choice_account_0').is(':checked'))
41
+ {
42
+ $('#livechat_already_have').hide();
43
+ $('#livechat_new_account').show();
44
+
45
+ if ($.trim($('#name').val()).length == 0)
46
+ {
47
+ $('#name').focus();
48
+ }
49
+ else
50
+ {
51
+ $('#password').focus();
52
+ }
53
+ }
54
+ };
55
+
56
+ toggleForms();
57
+ $('#choice_account input').click(toggleForms);
58
+ },
59
+
60
+ alreadyHaveAccountForm: function()
61
+ {
62
+ $('#livechat_already_have form').submit(function()
63
+ {
64
+ if (parseInt($('#license_number').val()) == 0)
65
+ {
66
+ var login = $.trim($('#livechat_login').val());
67
+ if (!login.length)
68
+ {
69
+ $('#livechat_login').focus();
70
+ return false;
71
+ }
72
+
73
+ $('#livechat_already_have .ajax_message').removeClass('message').addClass('wait').html('Please wait&hellip;');
74
+
75
+ $.ajax({
76
+ url: 'https://api.livechatinc.com/licence/operator/'+login+'?callback=?',
77
+ type: "GET",
78
+ dataType: 'jsonp',
79
+ cache: false,
80
+ success: function (data, status, error) {
81
+ if (data.error)
82
+ {
83
+ $('#livechat_already_have .ajax_message').removeClass('wait').addClass('message').html('Incorrect LiveChat login.');
84
+ $('#livechat_login').focus();
85
+ return false;
86
+ }
87
+ else
88
+ {
89
+ $('#license_number').val(data.number);
90
+ $('#livechat_already_have form').submit();
91
+ }
92
+ },
93
+ error: function (data, status, error) {
94
+ $('#livechat_already_have .ajax_message').removeClass('wait').addClass('message').html('Try again.');
95
+ $('#livechat_login').focus();
96
+ }
97
+ });
98
+ return false;
99
+ }
100
+ });
101
+ },
102
+
103
+ newLicenseForm: function()
104
+ {
105
+ $('#livechat_new_account form').submit(function()
106
+ {
107
+ if (parseInt($('#new_license_number').val()) > 0)
108
+ {
109
+ return true;
110
+ }
111
+
112
+ if (LiveChat.validateNewLicenseForm())
113
+ {
114
+ $('#livechat_new_account .ajax_message').removeClass('message').addClass('wait').html('Please wait&hellip;');
115
+
116
+ // Check if email address is available
117
+ $.getJSON('http://www.livechatinc.com/php/licence_info.php?email='+$('#email').val()+'&jsoncallback=?',
118
+ function(response)
119
+ {
120
+ if (response.response == 'true')
121
+ {
122
+ LiveChat.createLicense();
123
+ }
124
+ else if (response.response == 'false')
125
+ {
126
+ $('#livechat_new_account .ajax_message').removeClass('wait').addClass('message').html('This email address is already in use. Please choose another e-mail address.');
127
+ }
128
+ else
129
+ {
130
+ $('#livechat_new_account .ajax_message').removeClass('wait').addClass('message').html('Could not create account. Please try again later.');
131
+ }
132
+ });
133
+ }
134
+
135
+ return false;
136
+ });
137
+ },
138
+
139
+ createLicense: function()
140
+ {
141
+ var url;
142
+
143
+ $('#livechat_new_account .ajax_message').removeClass('message').addClass('wait').html('Creating new account&hellip;');
144
+
145
+ url = 'https://www.livechatinc.com/signup/';
146
+ url += '?name='+encodeURIComponent($('#name').val());
147
+ url += '&email='+encodeURIComponent($('#email').val());
148
+ url += '&password='+encodeURIComponent($('#password').val());
149
+ url += '&website='+encodeURIComponent($('#website').val());
150
+ url += '&timezone_gmt='+encodeURIComponent(this.calculateGMT());
151
+ url += '&action=wordpress_signup';
152
+ url += '&jsoncallback=?';
153
+
154
+ $.getJSON(url, function(data)
155
+ {
156
+ data = parseInt(data.response);
157
+ if (data == 0)
158
+ {
159
+ $('#livechat_new_account .ajax_message').html('Could not create account. Please try again later.').addClass('message').removeClass('wait');
160
+ return false;
161
+ }
162
+
163
+ // save new licence number
164
+ $('#new_license_number').val(data);
165
+ $('#save_new_license').submit();
166
+ });
167
+ },
168
+
169
+ validateNewLicenseForm: function()
170
+ {
171
+ if ($('#name').val().length < 1)
172
+ {
173
+ alert ('Please enter your name.');
174
+ $('#name').focus();
175
+ return false;
176
+ }
177
+
178
+ if (/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,6}$/i.test($('#email').val()) == false)
179
+ {
180
+ alert ('Please enter a valid email address.');
181
+ $('#email').focus();
182
+ return false;
183
+ }
184
+
185
+ if ($.trim($('#password').val()).length < 6)
186
+ {
187
+ alert('Password must be at least 6 characters long');
188
+ $('#password').focus();
189
+ return false;
190
+ }
191
+
192
+ if ($('#password').val() !== $('#password_retype').val())
193
+ {
194
+ alert('Both passwords do not match.');
195
+ $('#password').val('');
196
+ $('#password_retype').val('');
197
+ $('#password').focus();
198
+ return false;
199
+ }
200
+
201
+ return true;
202
+ },
203
+
204
+ calculateGMT: function()
205
+ {
206
+ var date, dateGMTString, date2, gmt;
207
+
208
+ date = new Date((new Date()).getFullYear(), 0, 1, 0, 0, 0, 0);
209
+ dateGMTString = date.toGMTString();
210
+ date2 = new Date(dateGMTString.substring(0, dateGMTString.lastIndexOf(" ")-1));
211
+ gmt = ((date - date2) / (1000 * 60 * 60)).toString();
212
+
213
+ return gmt;
214
+ },
215
+
216
+ controlPanelIframe: function()
217
+ {
218
+ var cp = $('#control_panel');
219
+ if (cp.length)
220
+ {
221
+ var cp_resize = function()
222
+ {
223
+ var cp_height = window.innerHeight ? window.innerHeight : $(window).height();
224
+ cp_height -= $('#wphead').height();
225
+ cp_height -= $('#updated-nag').height();
226
+ cp_height -= $('#control_panel + p').height();
227
+ cp_height -= $('#footer').height();
228
+ cp_height -= 70;
229
+
230
+ cp.attr('height', cp_height);
231
+ }
232
+ cp_resize();
233
+ $(window).resize(cp_resize);
234
+ }
235
+ },
236
+
237
+ fadeChangesSaved: function()
238
+ {
239
+ $cs = $('#changes_saved_info');
240
+
241
+ if ($cs.length)
242
+ {
243
+ setTimeout(function()
244
+ {
245
+ $cs.slideUp();
246
+ }, 1000);
247
+ }
248
+ }
249
+ };
250
+
251
+ $(document).ready(function()
252
+ {
253
+ LiveChat.init();
254
+ });
255
+ })(jQuery);
trunk/readme.txt ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === LiveChat - WP live chat software for Wordpress ===
2
+ Contributors: LiveChat
3
+ Tags: live support, live chat, live chat software, help desk, help desk software, online ticketing system, ticketing system, online support, ecommerce chat, sales, customer help, customer support, livechat, live support, customer service software, chat plugin, chat, customer service chat, live chat button, live chat plugin, live chat support, live chat tool, live chat widget, live support, live support button, live chat solution.
4
+ Stable tag: 3.3.4
5
+ Requires at least: 3.4
6
+ Tested up to: 4.8.1
7
+
8
+ Live chat and help desk software plugin for Wordpress. Add LiveChat (live chat and help desk software) to your Wordpress.
9
+
10
+ == Description ==
11
+
12
+ Looking to add a live chat plugin to your Wordpress website? LiveChat is a live chat app that enables its users to easily connect and communicate with their on-site visitors and customers. Chat operators can utilize LiveChat to instantly help customers, answer queries, and make the customer experience better. From answering support queries to onboarding new customers, LiveChat chat plugin can be used to facilitate every aspect of running a business.
13
+
14
+ LiveChat comes with a comprehensive set of features, including proactive chat invitations - so chat operators can automatically send personalized messages to appear based on specified conditions, such as the number of visited pages or time spent on the website. Other features include real time monitoring, file sharing, and advanced analytics. It has a clean design and is highly customizable, allowing to make the live chat window fit your brand.
15
+
16
+ In addition to live chat support, LiveChat also offers a built-in ticketing system to provide 24/7 customer service to customers. That being said, whenever there are no chat operators available, the chat widget is replaced by a ticket form so that customers can still contact you with their questions.
17
+
18
+ From email marketing to social, LiveChat integrates seamlessly with a range of popular third party apps and services. These include help desk software Zendesk, Freshdesk, customer relationship management apps (CRM) HubSpot, Salesforce and social media platforms Facebook or Twitter.
19
+
20
+ https://www.youtube.com/watch?v=Yf0NkRSkFRE
21
+
22
+ ——-
23
+
24
+ Product requires active LiveChat subscription after 30 days of free trial.
25
+
26
+ == Usage ==
27
+
28
+ With the LiveChat chat plugin for Wordpress, you can add live chat to every page of your website, including the checkout in no time. To answer chats, chat operators have to be logged into one of our apps - web based or desktop. There are also applications for mobile devices - iPhone, iPad and Android.
29
+
30
+ == What is LiveChat for Wordpress? ==
31
+
32
+ If you run a website, and you are serious about your business then using live chat is no brainer. Live chat plugin for Wordpress adds a live chat widget to the bottom of your website that allows visitors to chat to you in real time. Live chat software is perfect for businesses of all sizes, enabling them to close more sales and improve customer satisfaction scores.
33
+
34
+ == Requirements ==
35
+
36
+ While LiveChat plugin for Wordpress is free, you need a subscription of LiveChat to use it. For an overview of available plans and their cost navigate to [LiveChat pricing](https://www.livechatinc.com/pricing). There’s a 30-day trial to test all of the features. No credit card, no commitments.
37
+
38
+ [Sign up for our LiveChat here.](https://www.livechatinc.com/signup/?utm_source=wordpress.org&utm_medium=integration&utm_campaign=WordpressIntegration)
39
+
40
+ == Frequently Asked Questions ==
41
+
42
+ = Do you offer a free trial? =
43
+
44
+ Yes, you can test all of the features for 30 days. [Sign up for free here.](https://www.livechatinc.com/signup/?utm_source=wordpress.org&utm_medium=integration&utm_campaign=WordpressIntegration)
45
+
46
+ = Are there any limitations during the trial period? =
47
+
48
+ No, during the 30-day trial, by default, you will be able to test all of the features in the Team plan.
49
+
50
+ = Do I need to be logged in to be available for chats? =
51
+
52
+ Yes, you need to stay online to allow customers to contact you. If no one is available, your chat window will be shown as a ticket form.
53
+
54
+ = Is there a limit to the number of chats I can take? =
55
+
56
+ No, you can handle an unlimited number of live chats with any number of customers.
57
+
58
+ = Is the chat window customizable? =
59
+
60
+ Yes, each part of the chat window can be customized - company logo, chat theme and more.
61
+
62
+ = Which languages does LiveChat support? =
63
+
64
+ Short answer: LiveChat supports 43 languages. Long answer: English, Spanish, French, Chinese, Portuguese, Indonesian, Thai, Vietnamese (…).
65
+
66
+ = Which languages does LiveChat support? =
67
+
68
+ Feel free to start a chat with us – we are available 24/7/365!
69
+
70
+ == Installation ==
71
+
72
+ 1. Upload `wp-live-chat-software-for-wordpress` directory to Wordpress plugins directory (`/wp-content/plugins/`)
73
+ 2. Activate the plugin through the 'Plugins' menu in WordPress
74
+ 3. Click the 'LiveChat' menu on the left.
75
+ 4. Follow the instructions.
76
+
77
+ == Screenshots ==
78
+
79
+ 1. LiveChat Applications are available for web browser, Windows Mac and iPhone, iPad and Android devices.
80
+ 2. LiveChat is designed specifically for real-time customer service using chats and help desk tickets.
81
+ 3. Visitors list and client details display valuable information useful during chats with customers.
82
+ 4. Dashboard - a real-time glimpse of your customer service to display on a big screen.
83
+ 5. Chat window can be customized. Social media icons can be added for social engagement.
84
+ 6. LiveChat offers plenty of reports and customer service analytics.
85
+ 7. Additional information from pre-chat and post-chat surveys serves as extra knowledge about customers.
86
+ 8. Help desk software in LiveChat allows collecting tickets from chats, emails and ticket forms.
87
+
88
+
89
+ == Changelog ==
90
+
91
+ = 3.4.5 =
92
+ * Updated readme.txt file
93
+
94
+ = 3.4.4 =
95
+ * Updated readme.txt file
96
+
97
+ = 3.4.3 =
98
+ * Updated readme.txt file, checked compatibility to Wordpress 4.8.1
99
+
100
+ = 3.4.2 =
101
+ * Updated readme.txt file
102
+
103
+ = 3.4.1 =
104
+ * Updated readme.txt file, checked compatibility to Wordpress 4.8
105
+
106
+ = 3.4 =
107
+ * Updated readme.txt file, checked compatibility to Wordpress 4.7.3
108
+
109
+ = 3.3.1 =
110
+ * Updated readme.txt file
111
+
112
+ = 3.3 =
113
+ * get_currentuserinfo function deprecated in WordPress 4.5, replaced to wp_get_current_user function
114
+
115
+ = 3.2.14 =
116
+ * Updated readme.txt file, checked compatibility to Wordpress 4.4.1
117
+
118
+ = 3.2.13 =
119
+ * Removed __lc.group from tracking code, updated readme.txt file
120
+
121
+ = 3.2.12 =
122
+ * Updated readme.txt file, checked compatibility to Wordpress 4.3
123
+
124
+ = 3.2.11 =
125
+ * Moved screenshots to assets directory
126
+
127
+ = 3.2.10 =
128
+ * Updated readme.txt file, updated screenshots
129
+
130
+ = 3.2.9 =
131
+ * Updated readme.txt file, checked compatibility to Wordpress 4.2.2
132
+
133
+ = 3.2.8 =
134
+ * Plugin fully supports the newest version of Wordpress.
135
+
136
+ = 3.2.7 =
137
+ * Plugin compatible with the newest LiveChat version
138
+
139
+ = 3.2.5 =
140
+ * Updated trunk
141
+
142
+ = 3.2.4 =
143
+ * Updated url for licence number
144
+
145
+ = 3.2.3 =
146
+ * Romoved language parameter from Tracking Code
147
+
148
+ = 3.2.2 =
149
+ * Fixed CSS styles conflicts with other plugins
150
+
151
+ = 3.2.1 =
152
+ * Fixed plugin "Settings" link
153
+ * Changed message after successful installation
154
+
155
+ = 3.2.0 =
156
+ * Compatibility with new chat window
157
+ * Removed "click-to-chat button" configurator (no longer used)
158
+
159
+ = 3.1.0 =
160
+ * Major update in the Tracking Code
161
+
162
+ = 3.0.0 =
163
+ * Rewritten whole plugin code
164
+ * Fixed creating licenses
165
+ * Improved look and feel
166
+
167
+ = 2.1.8 =
168
+ * Updated desktop application download link
169
+
170
+ = 2.1.7 =
171
+ * Fixed `Skill` parameter
172
+ * Updated monitoring and chat button codes (for improved performance)
173
+ * Updated skills tutorial link
174
+
175
+ = 2.1.6 =
176
+ * Added LiveChat icon in menu bar
177
+
178
+ = 2.1.5 =
179
+ * Fixed creating new licences
180
+ * Rebranded LIVECHAT Contact Center to LiveChat
181
+ * Updated application download link
182
+ * Renamed "Groups" to "Skills"
183
+
184
+ = 2.1.4 =
185
+ * Fixed readme.txt file causing the `The plugin does not have a valid header.` problem
186
+
187
+ = 2.1.3 =
188
+ * Added timezone detection when creating new license
189
+
190
+ = 2.1.2 =
191
+ * Added "Company", "Phone" and "Website" fields in license registration form
192
+ * Fixed license registration bug
193
+ * Updated Control Panel URL
194
+
195
+ = 2.1.1 =
196
+ * Fixed monitoring and chat button code installation
197
+
198
+ = 2.1.0 =
199
+ * Added "Settings" link to plugin settings page
200
+ * Added "Download application" button
201
+ * Added Control Panel
202
+ * Added Chat button installation help for themes with no widgets support
203
+
204
+ = 2.0.0 =
205
+ * Rewritten whole plugin from scratch
206
+ * Ability to create new license from Wordpress plugin settings
207
+ * Updated monitoring code speed
208
+ * Added notification messages
209
+
210
+ = 1.0.0 =
211
+ * First plugin version