LiveChat – WP live chat plugin for WordPress - Version 3.5.0

Version Description

  • Plugin redesign.
  • Added new options:
    • 'Sign in with LiveChat',
    • Disable chat window on mobile devices,
    • Disable sounds in chat window,
    • Disable chat window for Guest users.
Download this release

Release Info

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

Code changes from version 3.4.2 to 3.5.0

livechat.php CHANGED
@@ -5,7 +5,7 @@ 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.4.2
9
  */
10
 
11
  if (is_admin())
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.5.0
9
  */
10
 
11
  if (is_admin())
plugin_files/LiveChat.class.php CHANGED
@@ -92,12 +92,26 @@ class LiveChat
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
  */
@@ -109,7 +123,7 @@ class LiveChat
109
  /**
110
  * Echoes given helper
111
  */
112
- public static function get_helper($class, $echo=true)
113
  {
114
  $class .= 'Helper';
115
 
@@ -128,12 +142,55 @@ class LiveChat
128
 
129
  if ($echo)
130
  {
131
- echo $c->render();
132
  return true;
133
  }
134
  else
135
  {
136
- return $c->render();
137
  }
138
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  }
92
  {
93
  if (is_null($this->login))
94
  {
95
+ $this->login = get_option('livechat_email');
96
  }
97
 
98
  return $this->login;
99
  }
100
 
101
+ /**
102
+ * Returns LiveChat settings
103
+ *
104
+ * @return int
105
+ */
106
+ public function get_settings()
107
+ {
108
+ $settings['disableSounds'] = get_option('livechat_disable_sounds');
109
+ $settings['disableMobile'] = get_option('livechat_disable_mobile');
110
+ $settings['disableGuests'] = get_option('livechat_disable_guests');
111
+
112
+ return $settings;
113
+ }
114
+
115
  /**
116
  * Injects tracking code
117
  */
123
  /**
124
  * Echoes given helper
125
  */
126
+ public static function get_helper($class, $echo=true, $params=[])
127
  {
128
  $class .= 'Helper';
129
 
142
 
143
  if ($echo)
144
  {
145
+ echo $c->render($params);
146
  return true;
147
  }
148
  else
149
  {
150
+ return $c->render($params);
151
  }
152
  }
153
+
154
+ /**
155
+ * Checks if visitor is on mobile device.
156
+ * @return boolean
157
+ */
158
+ public function check_mobile() {
159
+ $userAgent = $_SERVER['HTTP_USER_AGENT'];
160
+ $regex = '/((Chrome).*(Mobile))|((Android).*)|((iPhone|iPod).*Apple.*Mobile)|((Android).*(Mobile))/i';
161
+ return preg_match($regex, $userAgent);
162
+ }
163
+
164
+ /**
165
+ * Checks if visitor is logged in
166
+ * @return boolean
167
+ */
168
+ public function check_logged() {
169
+ if (property_exists(wp_get_current_user()->data, 'ID')) {
170
+ return true;
171
+ }
172
+ return false;
173
+ }
174
+
175
+ /**
176
+ * Get visitor's name and email
177
+ * @return array
178
+ */
179
+ public function get_user_data(){
180
+ $currentUserData = wp_get_current_user()->data;
181
+
182
+ $visitor_email = $visitor_name = '';
183
+
184
+ if (property_exists($currentUserData, 'user_email')) {
185
+ $visitor_email = $currentUserData->user_email;
186
+ }
187
+ if (property_exists($currentUserData, 'display_name')) {
188
+ $visitor_name = $currentUserData->display_name;
189
+ }
190
+
191
+ return [
192
+ 'name' => $visitor_name,
193
+ 'email' => $visitor_email
194
+ ];
195
+ }
196
  }
plugin_files/LiveChatAdmin.class.php CHANGED
@@ -24,7 +24,9 @@ final class LiveChatAdmin extends LiveChat
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
@@ -33,13 +35,13 @@ final class LiveChatAdmin extends LiveChat
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
 
@@ -97,7 +99,7 @@ final class LiveChatAdmin extends 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(
@@ -147,23 +149,46 @@ final class LiveChatAdmin extends LiveChat
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
  }
24
  {
25
  parent::__construct();
26
 
27
+ if ($_GET['page'] === 'livechat_settings')
28
+ add_action('init', array($this, 'load_scripts'));
29
+
30
  add_action('admin_menu', array($this, 'admin_menu'));
31
 
32
  // tricky error reporting
35
  add_action('init', array($this, 'error_reporting'));
36
  }
37
 
38
+ if (isset($_GET['reset']) && $_GET['reset'] == '1' && $_GET['page'] === 'livechat_settings')
39
  {
40
  $this->reset_options();
41
  }
42
+ elseif ($_SERVER['REQUEST_METHOD'] == 'POST' && strpos($_SERVER['HTTP_REFERER'], 'livechat_settings') !== false)
43
  {
44
+ echo $this->update_options($_POST);
45
  }
46
  }
47
 
99
  'administrator',
100
  'livechat',
101
  array($this, 'livechat_settings_page'),
102
+ $this->get_plugin_url().'images/livechat-icon.svg'
103
  );
104
 
105
  add_submenu_page(
149
  protected function reset_options()
150
  {
151
  delete_option('livechat_license_number');
152
+ delete_option('livechat_email');
153
+ delete_option('livechat_disable_sounds');
154
+ delete_option('livechat_disable_mobile');
155
+ delete_option('livechat_disable_guests');
156
  }
157
 
158
  protected function update_options($data)
159
  {
160
+ if (!isset($data['licenseEmail']) || !isset($data['licenseNumber']))
 
161
  {
162
+ if(isset($data['disableSounds']) || isset($data['disableMobile']) || isset($data['disableGuests'])) {
163
+ $disableSounds = isset( $data['disableSounds'] ) ? (int) $data['disableSounds'] : 0;
164
+ $disableMobile = isset( $data['disableMobile'] ) ? (int) $data['disableMobile'] : 0;
165
+ $disableGuests = isset( $data['disableGuests'] ) ? (int) $data['disableGuests'] : 0;
166
+
167
+ update_option( 'livechat_disable_sounds', $disableSounds );
168
+ update_option( 'livechat_disable_mobile', $disableMobile );
169
+ update_option( 'livechat_disable_guests', $disableGuests );
170
+
171
+ echo json_encode(['message' => 'success']);
172
+ die;
173
+ } else {
174
+ return false;
175
+ }
176
 
177
+ } else {
178
 
179
+ $license_number = isset( $data['licenseNumber'] ) ? (int) $data['licenseNumber'] : 0;
180
+ $email = isset( $data['licenseEmail'] ) ? (string) $data['licenseEmail'] : '';
181
 
182
+ update_option( 'livechat_license_number', $license_number );
183
+ update_option( 'livechat_email', $email );
184
+
185
+ update_option( 'livechat_disable_sounds', 0 );
186
+ update_option( 'livechat_disable_mobile', 0 );
187
+ update_option( 'livechat_disable_guests', 0 );
188
+
189
+ if ( isset( $data['changes_saved'] ) && $data['changes_saved'] == '1' ) {
190
+ $this->changes_saved = true;
191
+ }
192
  }
193
  }
194
  }
plugin_files/css/livechat.css CHANGED
@@ -1,133 +1,333 @@
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: 205px;
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
  }
1
+ a.toplevel_page_livechat div.wp-menu-image.dashicons-before img {
2
+ padding: 6px 0 0 2px !important;
3
  }
4
+
5
+ div#wordpress-livechat-container {
6
+ padding-top: 80px;
7
+ font-family: Lato, sans-serif;
8
+ font-size: 16px;
9
+ height: 100%;
10
  width: 100%;
11
+ position: absolute;
12
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
+ .updated.installed p::before {
15
+ content: '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  }
17
 
18
+ .updated.installed {
19
+ width: auto;
20
+ position: absolute;
21
+ top: 1em;
22
+ left: 25%;
23
+ transform: translateX(-55%);
24
+ z-index: 100;
25
  }
26
 
27
+ #installed-close {
28
+ display: block;
29
+ position: absolute;
30
+ right: -5px;
31
+ top: -5px;
32
+ font-size: 10px;
33
+ cursor: pointer;
34
+ background: black;
35
+ color: white;
36
+ width: 12px;
37
+ height: 12px;
38
+ line-height: 10px;
39
+ text-align: center;
40
+ border-radius: 6px;
41
+ z-index: 101;
42
  }
 
 
 
 
 
 
 
 
 
43
 
44
+ div#wordpress-livechat-container img {
45
+ max-width: 100%;
46
+ }
47
+ div#wordpress-livechat-container div.wordpress-livechat-column-left, div#wordpress-livechat-container div.wordpress-livechat-column-right {
48
+ width: 50%;
49
+ float: left;
50
+ text-align: center;
51
+ box-sizing: border-box;
52
+ }
53
+ div#wordpress-livechat-container div.wordpress-livechat-column-right p:first-of-type {
54
+ margin-top: 65px;
55
+ }
56
+ div#wordpress-livechat-container div.wordpress-livechat-column-right p{
57
+ text-align: center;
58
+ font-size: 1em;
59
+ }
60
+ div#wordpress-livechat-container div.wordpress-livechat-column-right p img.livechat-app {
61
+ width: 100%;
62
+ }
63
+ div#wordpress-livechat-container div.wordpress-livechat-column-right p.apps-link {
64
+ margin-top: -40px;
65
+ }
66
+ div#wordpress-livechat-container .settings .login-with-livechat {
67
+ display: none;
68
+ }
69
+ div#wordpress-livechat-container a:focus{
70
+ color: inherit;
71
+ -webkit-box-shadow: none;
72
+ box-shadow: none;
73
+ }
74
+ div#wordpress-livechat-container form#licenseForm {
75
+ display: none;
76
+ }
77
+ div#wordpress-livechat-container h2 {
78
+ margin: 45px auto 20px;
79
+ font-size: 20px;
80
+ font-weight: 700;
81
+ color: #3d3d3d;
82
+ text-align: center;
83
+ line-height: 1em;
84
+ display: none;
85
+ }
86
+ div#wordpress-livechat-container .login-box-header {
87
+ position: relative;
88
+ width: 600px;
89
+ max-width: 100%;
90
+ margin: -30px auto 0;
91
+ }
92
+ div#wordpress-livechat-container .account {
93
+ margin-top: 60px;
94
+ line-height: 1.5em!important;
95
+ }
96
+ div#wordpress-livechat-container a {
97
+ color: #3d3d3d;
98
+ text-decoration: none;
99
+ outline: 0!important
100
+ }
101
+ div#wordpress-livechat-container a:hover {
102
+ color: #4d7cb3;
103
+ text-decoration: none
104
+ }
105
+ div#wordpress-livechat-container .a-important {
106
+ color: #4d7cb3;
107
+ }
108
+ .webapp {
109
+ margin-top: 3em;
110
+ }
111
+ .webapp a {
112
+ color: #5a6976 !important;
113
+ font-size: 16px;
114
+ line-height: 1.5;
115
+ font-family: "Lato", sans-serif;
116
+ font-weight: 400;
117
+ text-decoration: none;
118
+ border: 1px solid #ddd;
119
+ border-radius: 3px;
120
+ padding: 8px 24px 9px;
121
+ background: white;
122
+ cursor: pointer;
123
+ }
124
+ .webapp a:hover {
125
+ border-color: #888;
126
+ color: #5a6976 !important;
127
+ }
128
+ .disconenct {
129
+ margin-top: 4em;
130
+ font-size: .75em;
131
+ color: #999;
132
+ }
133
+ #resetAccount {
134
+ text-decoration: underline !important;
135
+ cursor: pointer;
136
+ color: inherit !important;
137
+ }
138
+ div#wordpress-livechat-container .settings {
139
+ width: 100%;
140
+ margin: 40px auto 20px auto;
141
+ }
142
+ div#wordpress-livechat-container .settings div {
143
+ margin: 5px 0;
144
+ }
145
+ div#wordpress-livechat-container .settings .title{
146
+ width: 220px;
147
+ margin: 0px 10px 10px 0px;
148
  display: inline-block;
149
+ font-size: 16px;
150
+ cursor: pointer;
151
+ text-align: left;
152
+ }
153
 
154
+ div#wordpress-livechat-container .settings .title span{
155
+ vertical-align: middle;
156
+ }
157
+ #wpfooter {
158
+ display: none;
159
+ }
160
+ div#wordpress-livechat-container .onoffswitch {
161
+ text-align: left;
162
+ position: relative;
163
+ width: 72px;
164
+ -webkit-user-select:none; -moz-user-select:none; -ms-user-select: none;
165
+ display: inline-block;
166
+ height: 26px;
167
+ vertical-align: middle;
168
+ }
169
+ div#wordpress-livechat-container .onoffswitch-checkbox {
170
+ display: none!important;
171
+ }
172
+ div#wordpress-livechat-container .onoffswitch-label {
173
+ display: block; overflow: hidden; cursor: pointer;
174
+ border: 1px solid #bbb;
175
+ -webkit-border-radius: 4px;
176
+ -moz-border-radius: 4px;
177
+ border-radius: 4px;
178
+ }
179
+ div#wordpress-livechat-container .onoffswitch-inner {
180
+ display: block; width: 200%; margin-left: -100%;
181
+ -moz-transition: margin 0.15s ease-in 0s; -webkit-transition: margin 0.15s ease-in 0s;
182
+ -o-transition: margin 0.15s ease-in 0s; transition: margin 0.15s ease-in 0s;
183
+ }
184
+ div#wordpress-livechat-container .onoffswitch-inner:before, div#wordpress-livechat-container .onoffswitch-inner:after {
185
+ display: block; float: left; width: 50%; height: 24px; padding: 0; line-height: 24px;
186
+ font-size: 14px; color: white; font-family: Trebuchet, Arial, sans-serif;
187
+ -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;
188
  -webkit-border-radius: 3px;
189
+ -moz-border-radius: 3px;
190
  border-radius: 3px;
191
+ font-family: sans-serif;
192
+ font-weight: 100;
193
+ }
194
+ div#wordpress-livechat-container .onoffswitch-inner:before {
195
+ content: "ON";
196
+ text-shadow: -1px -1px 0 #58b;
197
+ padding-left: 8px;
198
+ background: #6699cc;
199
+ background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #6699cc), color-stop(1, #88bbee));
200
+ background: -ms-linear-gradient(bottom, #6699cc, #88bbee);
201
+ background: -moz-linear-gradient(center bottom, #6699cc 0%, #88bbee 100%);
202
+ background: -o-linear-gradient(#88bbee, #6699cc);
203
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#88bbee', endColorstr='#6699cc', GradientType=0);
204
+ -webkit-box-shadow: inset 0 0 5px #6699cc;
205
+ -moz-box-shadow: inset 0 0 5px #6699cc;
206
+ box-shadow: inset 0 0 5px #6699cc;
207
+ text-shadow: rgb(85, 136, 187) -1px -1px 0px;
208
+ }
209
+ div#wordpress-livechat-container .onoffswitch-inner:after {
210
+ content: "OFF";
211
+ padding-right: 5px;
212
+ background: #dddddd;
213
+ background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #dddddd), color-stop(1, #ffffff));
214
+ background: -ms-linear-gradient(bottom, #dddddd, #ffffff);
215
+ background: -moz-linear-gradient(center bottom, #dddddd 0%, #ffffff 100%);
216
+ background: -o-linear-gradient(#ffffff, #dddddd);
217
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#dddddd', GradientType=0);
218
+ -webkit-box-shadow: inset 0 0 5px #dddddd;
219
+ -moz-box-shadow: inset 0 0 5px #dddddd;
220
+ box-shadow: inset 0 0 5px #dddddd;
221
+ color: rgb(153, 153, 153);
222
+ text-align: right;
223
+ }
224
+ div#wordpress-livechat-container .onoffswitch-switch {
225
+ display: block; width: 33px; margin: 0px;
226
+ background: #cccccc;
227
+ background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #cccccc), color-stop(1, #f3f3f3));
228
+ background: -ms-linear-gradient(bottom, #cccccc, #f3f3f3);
229
+ background: -moz-linear-gradient(center bottom, #cccccc 0%, #f3f3f3 100%);
230
+ background: -o-linear-gradient(#f3f3f3, #cccccc);
231
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f3f3f3', endColorstr='#cccccc', GradientType=0);
232
+ border: 1px solid #bbb;
233
+ border-top-color: rgb(187, 187, 187);
234
+ border-top-style: solid;
235
+ border-top-width: 1px;
236
+ border-right-color: rgb(187, 187, 187);
237
+ border-right-style: solid;
238
+ border-right-width: 1px;
239
+ border-bottom-color: rgb(187, 187, 187);
240
+ border-bottom-style: solid;
241
+ border-bottom-width: 1px;
242
+ border-left-color: rgb(187, 187, 187);
243
+ border-left-style: solid;
244
+ border-left-width: 1px;
245
+ position: absolute; top: 0; bottom: 0; right: 37px;
246
+ -moz-transition: all 0.15s ease-in 0s; -webkit-transition: all 0.15s ease-in 0s;
247
+ -o-transition: all 0.15s ease-in 0s; transition: all 0.15s ease-in 0s;
248
+ -webkit-border-radius: 4px;
249
+ -moz-border-radius: 4px;
250
+ border-radius: 4px;
251
+ }
252
+ div#wordpress-livechat-container .onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {
253
+ margin-left: 0;
254
+ }
255
+ div#wordpress-livechat-container .onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
256
+ right: 0px;
257
+ }
258
 
259
+ /* Mobile */
 
 
260
 
261
+ @media screen and (max-width: 585px) {
262
+ div#wordpress-livechat-container {
263
+ padding-top: 50px;
264
+ }
265
 
266
+ div#wordpress-livechat-container div.wordpress-livechat-column-left, div#wordpress-livechat-container div.wordpress-livechat-column-right {
267
+ width: 100%;
268
+ }
269
 
270
+ .updated.installed {
271
+ top: 5em;
272
+ left: 1em;
273
+ transform: none;
274
+ }
275
+
276
+ div#wordpress-livechat-container .settings .title {
277
+ width: auto;
278
+ display: block;
279
+ text-align: center;
280
+ margin: 1em auto .5em;
281
+ }
282
  }
 
 
 
 
 
283
 
284
+ /* Sign in with LiveChat */
 
 
285
 
286
+ .login-with-livechat {
287
+ margin-top: -30px;
288
+ text-align: center;
289
  }
290
+
291
+ iframe#login-with-livechat
292
+ {
293
+ width: 205px;
294
+ height: 45px;
295
+ border: none;
296
+ }
297
+
298
+ button#logout,
299
+ #license-details
300
+ {
301
+ display: none;
302
+ }
303
+ button#logout
304
+ {
305
+ color: #5a6976;
306
+ font-size: 16px;
307
+ line-height: 1.5;
308
+ font-family: "Lato", sans-serif;
309
+ font-weight: 400;
310
+ text-decoration: none;
311
+ border: 1px solid #ddd;
312
+ border-radius: 3px;
313
+ padding: 8px 24px 9px;
314
+ background: white;
315
+ cursor: pointer;
316
+ }
317
+
318
+ button#logout:hover
319
+ {
320
+ border-color: #888;
321
+ color: #5a6976;
322
+ }
323
+
324
+ .lc-or {
325
+ text-align: center;;
326
+ font-size: 1em;
327
+ line-height: 2em;
328
+ margin-top: -.5em;
329
  }
330
 
331
+ .livechat-signup {
332
+ font-size: 1.1em;
333
  }
plugin_files/helpers/ChangesSavedHelper.class.php DELETED
@@ -1,16 +0,0 @@
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
plugin_files/helpers/SettingsHelper.class.php CHANGED
@@ -6,127 +6,115 @@ 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 style="width: 192px; height: 106px;" 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
  }
6
  {
7
  public function render()
8
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
+ $license_email = LiveChat::get_instance()->get_login();
11
+ $settings = LiveChat::get_instance()->get_settings();
 
 
 
 
 
 
 
12
 
13
+ $notification = '';
 
 
 
 
 
 
 
 
 
 
14
 
15
+ if ($_GET['actionType'] === 'install') {
16
+ $notification = '<div class="updated installed">
17
+ <p>
18
+ LiveChat is now installed on your website!
19
+ </p>
20
+ <span id="installed-close">x</span>
21
+ </div>';
22
+ }
 
23
 
24
+ echo $notification;
25
+ ?>
26
+ <div id="wordpress-livechat-container">
27
+ <?php if (LiveChat::get_instance()->is_installed() == false) { ?>
28
+ <div class="wordpress-livechat-column-left">
29
+ <div class="login-box-header">
30
+ <img src="<?php echo plugins_url('wp-live-chat-software-for-wordpress').'/plugin_files/images/livechat-wordpress@2x.png'; ?>" alt="LiveChat + Wordpress" class="logo">
31
+ </div>
32
+ <div id="useExistingAccount">
33
+ <p class="login-with-livechat"><br>
34
+ <iframe id="login-with-livechat" src="https://addons.livechatinc.com/sign-in-with-livechat" > </iframe>
35
+ </p>
36
+ <p class="lc-or">or<br>
37
+ <a href="https://my.livechatinc.com/signup?a=wordpress&utm_source=wordpress.org&utm_medium=integration&utm_campaign=wordpress_plugin" target="_blank" class="livechat-signup a-important">
38
+ create an account
39
+ </a>
40
+ </p>
41
+ <form id="licenseForm" action="?page=livechat_settings&actionType=install" method="post">actionType=install
42
+ <input type="hidden" name="licenseEmail" id="licenseEmail">
43
+ <input type="hidden" name="licenseNumber" id="licenseNumber">
44
+ </form>
45
+ </div>
46
+ </div>
47
+ <div class="wordpress-livechat-column-right">
48
+ <p><img src="<?php echo plugins_url('wp-live-chat-software-for-wordpress').'/plugin_files/images/livechat-app.png'; ?>" alt="LiveChat apps" class="livechat-app"></p>
49
+ <p class="apps-link">Check out our apps for <a href="https://www.livechatinc.com/applications/?utm_source=wordpress.org&utm_medium=integration&utm_campaign=wordpress_plugin" target="_blank" class="a-important">desktop or mobile!</a></p>
50
+ </div>
51
+ <?php } ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
+ <?php if (LiveChat::get_instance()->is_installed()): ?>
54
+ <div class="wordpress-livechat-column-left">
55
+ <div class="account">
56
+ Currently you are using your<br>
57
+ <strong><?php echo $license_email ?></strong><br>
58
+ LiveChat account.
59
+ </div>
60
+ <p class="webapp">
61
+ <a href="https://my.livechatinc.com/?utm_source=wordpress.org&utm_medium=integration&utm_campaign=wordpress_plugin" target="_blank">
62
+ Open web application
63
+ </a>
64
+ </p>
65
+ <div class="settings">
66
+ <p class="login-with-livechat"><br>
67
+ <iframe id="login-with-livechat" src="https://addons.livechatinc.com/sign-in-with-livechat" > </iframe>
68
+ </p>
69
+ <div>
70
+ <div class="title">
71
+ <span>Hide chat on mobile</span>
72
+ </div>
73
+ <div class="onoffswitch">
74
+ <input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="disableMobile" <?php echo ($settings['disableMobile']) ? 'checked': '' ?>>
75
+ <label class="onoffswitch-label" for="disableMobile">
76
+ <span class="onoffswitch-inner"></span>
77
+ <span class="onoffswitch-switch"></span>
78
+ </label>
79
+ </div>
80
+ </div>
81
+ <div>
82
+ <div class="title">
83
+ <span>Disable chat window sounds</span>
84
+ </div>
85
+ <div class="onoffswitch">
86
+ <input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="disableSounds" <?php echo ($settings['disableSounds']) ? 'checked': '' ?>>
87
+ <label class="onoffswitch-label" for="disableSounds">
88
+ <span class="onoffswitch-inner"></span>
89
+ <span class="onoffswitch-switch"></span>
90
+ </label>
91
+ </div>
92
+ </div>
93
+ <div>
94
+ <div class="title">
95
+ <span>Hide chat for Guest visitors</span>
96
+ </div>
97
+ <div class="onoffswitch">
98
+ <input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="disableGuests" <?php echo ($settings['disableGuests']) ? 'checked': '' ?>>
99
+ <label class="onoffswitch-label" for="disableGuests">
100
+ <span class="onoffswitch-inner"></span>
101
+ <span class="onoffswitch-switch"></span>
102
+ </label>
103
+ </div>
104
+ </div>
105
+ </div>
106
+ <p class="disconenct">
107
+ Something went wrong? <a id="resetAccount" href="?page=livechat_settings&reset=1" style="display: inline-block">
108
+ Disconect your account.
109
+ </a>
110
+ </p>
111
+ </div>
112
+ <div class="wordpress-livechat-column-right">
113
+ <p><img src="<?php echo plugins_url('wp-live-chat-software-for-wordpress').'/plugin_files/images/livechat-app.png'; ?>" alt="LiveChat apps" class="livechat-app"></p>
114
+ <p class="apps-link">Check out our apps for <a href="https://www.livechatinc.com/applications/?utm_source=wordpress.org&utm_medium=integration&utm_campaign=wordpress_plugin" target="_blank" class="a-important">desktop or mobile!</a></p>
115
+ </div>
116
+ <?php endif; ?>
117
+ </div>
118
  <?php
119
  }
120
  }
plugin_files/helpers/TrackingCodeHelper.class.php CHANGED
@@ -6,24 +6,58 @@ 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
  }
6
  {
7
  public function render()
8
  {
9
+ $tracking = '';
10
+
11
  if (LiveChat::get_instance()->is_installed())
12
  {
13
  $license_number = LiveChat::get_instance()->get_license_number();
14
+ $settings = LiveChat::get_instance()->get_settings();
15
+ $check_mobile = LiveChat::get_instance()->check_mobile();
16
+ $check_logged = LiveChat::get_instance()->check_logged();
17
+ $visitor = LiveChat::get_instance()->get_user_data();
18
 
19
+ if (!$settings['disableMobile'] || ($settings['disableMobile'] && !$check_mobile)) {
20
+ if (!$settings['disableGuests'] || ($settings['disableGuests'] && $check_logged)) {
21
+ $tracking = <<<TRACKING_CODE_START
22
  <script type="text/javascript">
23
+ window.__lc = window.__lc || {};
24
+ window.__lc.license = {$license_number};
25
+
26
+ TRACKING_CODE_START;
27
+
28
+ $tracking .= <<<VISITOR_DATA
29
+ window.__lc.visitor = {
30
+ name: '{$visitor['name']}',
31
+ email: '{$visitor['email']}'
32
+ };
33
+
34
+ VISITOR_DATA;
35
+
36
+ $tracking .= <<<TRACKING_CODE_LOAD
37
+ (function() {
38
+ var lc = document.createElement('script'); lc.type = 'text/javascript'; lc.async = true;
39
+ lc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'cdn.livechatinc.com/tracking.js';
40
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(lc, s);
41
+ })();
42
+
43
+ TRACKING_CODE_LOAD;
44
+ if ($settings['disableSounds']) {
45
+ $tracking .= <<<DISABLE_SOUNDS
46
+
47
+ var LC_API = LC_API || {};
48
+
49
+ LC_API.on_after_load = function () {
50
+ LC_API.disable_sounds();
51
+ }
52
+
53
+ DISABLE_SOUNDS;
54
+ }
55
+
56
+ $tracking .= '</script>';
57
+ }
58
+ }
59
  }
60
 
61
+ return $tracking;
62
  }
63
  }
plugin_files/helpers/TrackingCodeInfoHelper.class.php DELETED
@@ -1,16 +0,0 @@
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
plugin_files/images/button_placement.png DELETED
Binary file
plugin_files/images/favicon.png DELETED
Binary file
plugin_files/images/livechat-app.png ADDED
Binary file
plugin_files/images/livechat-icon.svg ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 22.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="0 0 32 32" style="enable-background:new 0 0 32 32;" xml:space="preserve" width="22" height="22">
5
+ <style type="text/css">
6
+ .st0{fill:#313131;}
7
+ .st1{fill:#FFFFFF;}
8
+ .st2{fill:#D86C37;}
9
+ </style>
10
+ <g>
11
+ <path class="st0" d="M11,0C7.9,0,6.3,0,4.6,0.5C2.7,1.2,1.2,2.7,0.6,4.6C0.2,5.8,0,7,0,8.7l0,12.1c0,3.2,0,4.8,0.6,6.5
12
+ c0.7,1.9,2.2,3.4,4.1,4.1c1.1,0.3,2.1,0.5,3.5,0.5H24c1.4,0,2.4-0.2,3.5-0.5c1.9-0.7,3.4-2.2,4.1-4.1c0.3-1.1,0.5-2.1,0.5-3.5V8.1
13
+ c0-1.4-0.2-2.4-0.5-3.4c-0.7-1.9-2.2-3.4-4.1-4.1C25.7,0,24.1,0,20.9,0"/>
14
+ <path class="st1" d="M24.2,3.3c2.5,0,4.5,2,4.5,4.5v16.5c0,2.5-2,4.5-4.5,4.5h-7.5l-7.2,2.7c-0.2,0.1-0.4,0-0.5-0.2
15
+ c0-0.1,0-0.1,0-0.2l0-2.3H7.8c-2.5,0-4.5-2-4.5-4.5l0,0V7.8c0-2.5,2-4.5,4.5-4.5C7.8,3.3,24.2,3.3,24.2,3.3z"/>
16
+ <path class="st0" d="M14.5,23.9c0-0.2,0.1-0.5,0.1-0.7c0-0.4,0-0.9,0-1.3c0-0.2,0-0.5-0.1-0.7H9.1V8.4C8.6,8.3,8.1,8.2,7.5,8.2
17
+ c-0.5,0-1,0-1.5,0.1v15.6H14.5z"/>
18
+ <path class="st2" d="M15.5,19.4c0.3,1,0.8,1.8,1.4,2.5c0.6,0.7,1.4,1.3,2.3,1.7c0.9,0.4,2,0.6,3.2,0.6c0.6,0,1.3,0,1.9-0.1
19
+ c0.6-0.1,1.3-0.3,2-0.5c-0.1-0.4-0.1-0.9-0.3-1.3c-0.1-0.4-0.3-0.8-0.5-1.2c-0.4,0.2-0.9,0.3-1.4,0.4c-0.5,0.1-0.9,0.1-1.4,0.1
20
+ c-3,0-4.5-1.8-4.5-5.3c0-1.8,0.4-3.1,1.1-4c0.7-0.9,1.8-1.4,3.2-1.4c0.5,0,1,0,1.4,0.1c0.4,0.1,0.8,0.2,1.4,0.4
21
+ c0.2-0.4,0.3-0.8,0.5-1.2c0.1-0.4,0.2-0.8,0.3-1.3c-0.6-0.3-1.2-0.4-1.9-0.5c-0.6-0.1-1.3-0.1-1.9-0.1c-1.2,0-2.2,0.2-3.1,0.6
22
+ c-0.9,0.4-1.7,1-2.3,1.7c-0.6,0.7-1.1,1.6-1.4,2.6C15.1,14,15,15,15,16.2C15,17.4,15.1,18.4,15.5,19.4z"/>
23
+ </g>
24
+ </svg>
plugin_files/images/livechat-wordpress@2x.png ADDED
Binary file
plugin_files/images/logo.png DELETED
Binary file
plugin_files/images/plusminus.png DELETED
Binary file
plugin_files/js/livechat.js CHANGED
@@ -4,19 +4,52 @@ 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
  {
@@ -26,226 +59,47 @@ var LiveChat =
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()
4
  {
5
  init: function()
6
  {
7
+ this.signInWithLiveChat();
8
  this.resetLink();
9
+ this.hideInstalledNotification();
10
+ this.settingsForm();
 
 
 
11
  },
12
 
13
+ bindEvent: function(element, eventName, eventHandler) {
14
+ if (element.addEventListener){
15
+ element.addEventListener(eventName, eventHandler, false);
16
+ } else if (element.attachEvent) {
17
+ element.attachEvent('on' + eventName, eventHandler);
18
+ }
19
+ },
20
+
21
+ signInWithLiveChat: function () {
22
+ var logoutButton = document.getElementById('resetAccount'),
23
+ iframeEl = document.getElementById('login-with-livechat');
24
+
25
+ LiveChat.bindEvent(window, 'message', function (e) {
26
+ if(e.data.startsWith('{')) {
27
+ var lcDetails = JSON.parse(e.data);
28
+ switch (lcDetails.type) {
29
+ case 'logged-in':
30
+ var licenseForm = $('div#wordpress-livechat-container div#useExistingAccount form#licenseForm');
31
+ licenseForm.find('input#licenseEmail').val(lcDetails.email);
32
+ licenseForm.find('input#licenseNumber').val(lcDetails.license);
33
+ licenseForm.submit();
34
+ break;
35
+ case 'signed-out':
36
+ $('#login-with-livechat').css('display', 'block');
37
+ $('#logout').css('display', 'none');
38
+ break;
39
+ }
40
+ }
41
+ });
42
+
43
+ if(logoutButton) {
44
+ LiveChat.bindEvent(logoutButton, 'click', function (e) {
45
+ sendMessage('logout');
46
+ });
47
+ }
48
+
49
+ var sendMessage = function(msg) {
50
+ iframeEl.contentWindow.postMessage(msg, '*');
51
+ };
52
+ },
53
 
54
  resetLink: function()
55
  {
59
  })
60
  },
61
 
62
+ hideInstalledNotification: function () {
63
+ var notificationElement = $('.updated.installed');
64
+ $('#installed-close').click(function () {
65
+ notificationElement.slideUp();
66
+ });
67
+ setTimeout(function () {
68
+ notificationElement.slideUp();
69
+ }, 3000);
70
+ },
71
+
72
+ setSettings: function(settings) {
73
+ $.ajax({
74
+ url: '?page=livechat_settings',
75
+ type: "POST",
76
+ data: settings,
77
+ dataType: 'json',
78
+ cache: false,
79
+ async: false,
80
+ error: function () {
81
+ alert('Something went wrong. Please try again or contact our support team.');
82
+ }
83
+ });
84
+ },
85
+ settingsForm: function() {
86
+ $('.settings .title').click(function() {
87
+ $(this).next('.onoffswitch').children('label').click();
88
+ });
89
+ $('.onoffswitch-checkbox').change(function() {
90
+ var settings = {};
91
+ $('.onoffswitch-checkbox').each(function(){
92
+ var paramName = $(this).attr('id');
93
+ if ($(this).is(':checked')) {
94
+ settings[paramName] = 1;
95
+ } else {
96
+ settings[paramName]= 0;
97
+ }
98
+ });
99
+
100
+ LiveChat.setSettings(settings);
101
+ });
102
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  };
104
 
105
  $(document).ready(function()
readme.txt CHANGED
@@ -1,9 +1,11 @@
1
  === LiveChat - WP live chat plugin for WordPress ===
2
  Contributors: LiveChat
3
  Tags: chat plugin, live chat, live chat plugin, wordpress live chat, wordpress chat, wordpress live chat plugin, wordpress chat plugin, live chat software, live support, help desk, help desk software, online ticketing system, ticketing system, online support, ecommerce chat, chat online, chat software, sales, customer help, customer support, livechat, customer service software, chat, customer service chat, live chat button, live chat support, live chat tool, live chat widget, live support button, live chat solution, online live chat, online chat, wp chat, wp live chat, livechat inc, livechatinc, live chat inc, wp livechat support, smartsupp, smart supp, tidio, jivochat, formilla, tawk, tawkto, tawk.to, facebook, facebook messenger, messenger, facebook live chat, facebook chat, crisp, pure chat, purechat, zendesk, zendesk chat, liveagent, olark, happyfox, reve chat, chatra, provide support, comm100, kayako, zoho, zoho salesiq, userlike, userengage, drift, livehelpnow, live help now, intercom, freshdesk, zendesk, clickdesk, liveperson, live person, bold360, websitealive, website alive, velaro, hubspot, salesforce, zapier, zopim, mailchimp, analytics, google analytics, im chat, slack, casengo, tagove, wisechat, wise chat, mylivechat, my live chat, livezilla, chatrify
4
- Stable tag: 3.4.2
5
- Requires at least: 3.4
6
- Tested up to: 4.9
 
 
7
 
8
  Live chat and help desk software plugin for WordPress. Add LiveChat (live chat and help desk software) to your WordPress.
9
 
@@ -266,6 +268,14 @@ For more detailed instructions, go to the [live chat plugin page](https://www.li
266
 
267
  == Changelog ==
268
 
 
 
 
 
 
 
 
 
269
  = 3.4.2 =
270
  * Fixed get_plugin_url function, updated logo - added HiRes retina image
271
 
1
  === LiveChat - WP live chat plugin for WordPress ===
2
  Contributors: LiveChat
3
  Tags: chat plugin, live chat, live chat plugin, wordpress live chat, wordpress chat, wordpress live chat plugin, wordpress chat plugin, live chat software, live support, help desk, help desk software, online ticketing system, ticketing system, online support, ecommerce chat, chat online, chat software, sales, customer help, customer support, livechat, customer service software, chat, customer service chat, live chat button, live chat support, live chat tool, live chat widget, live support button, live chat solution, online live chat, online chat, wp chat, wp live chat, livechat inc, livechatinc, live chat inc, wp livechat support, smartsupp, smart supp, tidio, jivochat, formilla, tawk, tawkto, tawk.to, facebook, facebook messenger, messenger, facebook live chat, facebook chat, crisp, pure chat, purechat, zendesk, zendesk chat, liveagent, olark, happyfox, reve chat, chatra, provide support, comm100, kayako, zoho, zoho salesiq, userlike, userengage, drift, livehelpnow, live help now, intercom, freshdesk, zendesk, clickdesk, liveperson, live person, bold360, websitealive, website alive, velaro, hubspot, salesforce, zapier, zopim, mailchimp, analytics, google analytics, im chat, slack, casengo, tagove, wisechat, wise chat, mylivechat, my live chat, livezilla, chatrify
4
+ Stable tag: 3.5.0
5
+ Requires PHP: 5.6
6
+ Tested up to: 4.9.5
7
+ License: GPLv2 or later
8
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
  Live chat and help desk software plugin for WordPress. Add LiveChat (live chat and help desk software) to your WordPress.
11
 
268
 
269
  == Changelog ==
270
 
271
+ = 3.5.0 =
272
+ * Plugin redesign.
273
+ * Added new options:
274
+ * 'Sign in with LiveChat',
275
+ * Disable chat window on mobile devices,
276
+ * Disable sounds in chat window,
277
+ * Disable chat window for Guest users.
278
+
279
  = 3.4.2 =
280
  * Fixed get_plugin_url function, updated logo - added HiRes retina image
281