Version Description
- Change of the widget script placement in Wordpress themes to improve the rendering performance.
- Use admin email as a default email for a Tidio account.
Download this release
Release Info
Developer | lucastidio |
Plugin | Tidio Live Chat |
Version | 3.3.2 |
Comparing to | |
See all releases |
Version 3.3.2
- classes/TidioOneApi.php +37 -0
- media/css/app-options.css +0 -0
- media/css/options.css +117 -0
- media/css/plugin-minicolors.css +259 -0
- media/img/ajax-loader.gif +0 -0
- media/img/bg.png +0 -0
- media/img/blocks-bg.png +0 -0
- media/img/brand-logo.png +0 -0
- media/img/checkmark.png +0 -0
- media/img/color-pallete.png +0 -0
- media/img/icon.png +0 -0
- media/js/options.js +160 -0
- options.php +46 -0
- readme.txt +194 -0
- tidio-elements.php +256 -0
- views/ajax-tidio-chat-redirect.php +55 -0
classes/TidioOneApi.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class TidioOneApi {
|
4 |
+
|
5 |
+
private $publicKey;
|
6 |
+
private $apiUrl = 'https://api.tidio.co/';
|
7 |
+
|
8 |
+
public function __construct($publicKey) {
|
9 |
+
$this->publicKey = $publicKey;
|
10 |
+
}
|
11 |
+
|
12 |
+
public function request($action = 'track', $data = array()) {
|
13 |
+
return $this->getContentData($this->apiUrl . $action, $data);
|
14 |
+
}
|
15 |
+
|
16 |
+
private function getContentData($url, $data = array()) {
|
17 |
+
|
18 |
+
if(!function_exists('json_encode') || !function_exists('file_get_contents')){
|
19 |
+
return false;
|
20 |
+
}
|
21 |
+
|
22 |
+
$ch = curl_init();
|
23 |
+
|
24 |
+
//
|
25 |
+
|
26 |
+
$data['projectPublicKey'] = $this->publicKey;
|
27 |
+
|
28 |
+
$url = $url . '?data=' . base64_encode(json_encode($data));
|
29 |
+
|
30 |
+
//
|
31 |
+
|
32 |
+
$response = file_get_contents($url);
|
33 |
+
|
34 |
+
return $response;
|
35 |
+
}
|
36 |
+
|
37 |
+
}
|
media/css/app-options.css
ADDED
File without changes
|
media/css/options.css
ADDED
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@import url(https://fonts.googleapis.com/css?family=Titillium+Web:400,300,200,200italic&subset=latin,latin-ext);
|
2 |
+
|
3 |
+
#after-install-text{
|
4 |
+
display: none;
|
5 |
+
}
|
6 |
+
#tidio-wrapper div, #tidio-wrapper input{
|
7 |
+
-webkit-box-sizing: border-box;
|
8 |
+
-moz-box-sizing: border-box;
|
9 |
+
box-sizing: border-box;
|
10 |
+
}
|
11 |
+
#tidio-wrapper{
|
12 |
+
background: #f1f1f1;
|
13 |
+
color:#434a54;
|
14 |
+
font-family: 'Titillium Web', sans-serif;
|
15 |
+
height:100%;
|
16 |
+
font-size:15px;
|
17 |
+
}
|
18 |
+
#tidio-chat-wp-plugin{
|
19 |
+
width: 100%;
|
20 |
+
max-width: 1206px;
|
21 |
+
height: 100%;
|
22 |
+
background: url(../img/bg.png) no-repeat 50% top;
|
23 |
+
z-index:1;
|
24 |
+
margin: 0 auto;
|
25 |
+
position: relative;
|
26 |
+
padding: 177px 190px 0px 190px;
|
27 |
+
}
|
28 |
+
#tidio-chat-wp-plugin h1{
|
29 |
+
margin: 0;
|
30 |
+
text-align: center;
|
31 |
+
font-weight: 300;
|
32 |
+
font-size:30px;
|
33 |
+
margin-top:15px;
|
34 |
+
}
|
35 |
+
#tidio-chat-wp-plugin p{
|
36 |
+
text-align: center;
|
37 |
+
margin-top: 25px;
|
38 |
+
font-weight: 300;
|
39 |
+
font-size: 15px;
|
40 |
+
}
|
41 |
+
#input-blocks{
|
42 |
+
width: 942px;
|
43 |
+
background: url(../img/blocks-bg.png) no-repeat 50% 167px;
|
44 |
+
margin: 0 -58px;
|
45 |
+
overflow: hidden;
|
46 |
+
padding-left: 100px;
|
47 |
+
}
|
48 |
+
#tidio-chat-login,
|
49 |
+
#tidio-chat-panel{
|
50 |
+
float:left;
|
51 |
+
width: 365px;
|
52 |
+
margin-top: 20px;
|
53 |
+
padding:20px;
|
54 |
+
}
|
55 |
+
#tidio-chat-login{
|
56 |
+
margin-right: 11px;
|
57 |
+
}
|
58 |
+
#tidio-chat-panel{
|
59 |
+
border: 1px solid #dadada;
|
60 |
+
border-left: 3px solid #5C9EE8;
|
61 |
+
background: #FFF;
|
62 |
+
}
|
63 |
+
#input-blocks h2,
|
64 |
+
#select-project h2
|
65 |
+
{
|
66 |
+
font-weight: 400;
|
67 |
+
margin: 0;
|
68 |
+
font-size: 16px;
|
69 |
+
border-bottom: 1px solid #dadada;
|
70 |
+
border-left: 3px solid #5C9EE8;
|
71 |
+
padding: 12px 18px;
|
72 |
+
}
|
73 |
+
#tidio-apply-account {
|
74 |
+
border: 1px solid #dadada;
|
75 |
+
padding: 20px;
|
76 |
+
margin-top: 20px;
|
77 |
+
padding-left: 61px;
|
78 |
+
line-height: 1.4;
|
79 |
+
background: url(../img/checkmark.png) no-repeat 20px 50%;
|
80 |
+
}
|
81 |
+
.form-control{
|
82 |
+
margin-top: 12px;
|
83 |
+
}
|
84 |
+
.form-control .text-input{
|
85 |
+
height: 38px;
|
86 |
+
width: 100%;
|
87 |
+
padding: 0 13px;
|
88 |
+
font-size: 14px;
|
89 |
+
max-width: 320px;
|
90 |
+
}
|
91 |
+
h2+.form-control{
|
92 |
+
margin-top:18px;
|
93 |
+
}
|
94 |
+
.tidio-button{
|
95 |
+
font-family: 'Titillium Web', sans-serif;
|
96 |
+
margin-top:20px!important;
|
97 |
+
height:40px!important;
|
98 |
+
line-height:38px!important;
|
99 |
+
text-align:center;
|
100 |
+
width:170px;
|
101 |
+
}
|
102 |
+
.button-primary.tidio-button{background:#5d9cec;}
|
103 |
+
.button-primary.tidio-button:hover{background:#4a89dc;}
|
104 |
+
|
105 |
+
/* placeholder */
|
106 |
+
::-webkit-input-placeholder { color:#aeb1b8; font-style: italic; font-weight: 200!important}
|
107 |
+
::-moz-placeholder { color:#aeb1b8; font-style: italic; font-weight: 200!important} /* firefox 19+ */
|
108 |
+
:-ms-input-placeholder { color:#aeb1b8; font-style: italic; font-weight: 200!important} /* ie */
|
109 |
+
input:-moz-placeholder { color:#aeb1b8; font-style: italic; font-weight: 200!important}
|
110 |
+
|
111 |
+
/* Project selector */
|
112 |
+
#select-project{display:none;margin:0 auto;background: url(../img/blocks-bg.png) no-repeat 50% 171px;padding:28px 244px 40px 244px;}
|
113 |
+
#select-project select{width: 100%;height: 40px!important;}
|
114 |
+
|
115 |
+
/* error */
|
116 |
+
#tidio-wrapper .error{display: none;margin-left: 60px;margin-right: 14px;}
|
117 |
+
#tidio-wrapper .error p{margin: 10px 0;}
|
media/css/plugin-minicolors.css
ADDED
@@ -0,0 +1,259 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.minicolors {
|
2 |
+
position: relative;
|
3 |
+
}
|
4 |
+
|
5 |
+
.minicolors-swatch {
|
6 |
+
position: absolute;
|
7 |
+
vertical-align: middle;
|
8 |
+
background: url('../img/color-pallete.png') -80px 0;
|
9 |
+
border: solid 1px #ccc;
|
10 |
+
cursor: text;
|
11 |
+
padding: 0;
|
12 |
+
margin: 0;
|
13 |
+
display: inline-block;
|
14 |
+
}
|
15 |
+
|
16 |
+
.minicolors-swatch-color {
|
17 |
+
position: absolute;
|
18 |
+
top: 0;
|
19 |
+
left: 0;
|
20 |
+
right: 0;
|
21 |
+
bottom: 0;
|
22 |
+
}
|
23 |
+
|
24 |
+
.minicolors input[type=hidden] + .minicolors-swatch {
|
25 |
+
width: 28px;
|
26 |
+
position: static;
|
27 |
+
cursor: pointer;
|
28 |
+
}
|
29 |
+
|
30 |
+
/* Panel */
|
31 |
+
.minicolors-panel {
|
32 |
+
position: absolute;
|
33 |
+
width: 173px;
|
34 |
+
height: 152px;
|
35 |
+
background: white;
|
36 |
+
border: solid 1px #CCC;
|
37 |
+
box-shadow: 0 0 20px rgba(0, 0, 0, .2);
|
38 |
+
z-index: 99999;
|
39 |
+
-moz-box-sizing: content-box;
|
40 |
+
-webkit-box-sizing: content-box;
|
41 |
+
box-sizing: content-box;
|
42 |
+
display: none;
|
43 |
+
}
|
44 |
+
|
45 |
+
.minicolors-panel.minicolors-visible {
|
46 |
+
display: block;
|
47 |
+
}
|
48 |
+
|
49 |
+
/* Panel positioning */
|
50 |
+
.minicolors-position-top .minicolors-panel {
|
51 |
+
top: -154px;
|
52 |
+
}
|
53 |
+
|
54 |
+
.minicolors-position-right .minicolors-panel {
|
55 |
+
right: 0;
|
56 |
+
}
|
57 |
+
|
58 |
+
.minicolors-position-bottom .minicolors-panel {
|
59 |
+
top: auto;
|
60 |
+
}
|
61 |
+
|
62 |
+
.minicolors-position-left .minicolors-panel {
|
63 |
+
left: 0;
|
64 |
+
}
|
65 |
+
|
66 |
+
.minicolors-with-opacity .minicolors-panel {
|
67 |
+
width: 194px;
|
68 |
+
}
|
69 |
+
|
70 |
+
.minicolors .minicolors-grid {
|
71 |
+
position: absolute;
|
72 |
+
top: 1px;
|
73 |
+
left: 1px;
|
74 |
+
width: 150px;
|
75 |
+
height: 150px;
|
76 |
+
background: url('../img/color-pallete.png') -120px 0;
|
77 |
+
cursor: crosshair;
|
78 |
+
}
|
79 |
+
|
80 |
+
.minicolors .minicolors-grid-inner {
|
81 |
+
position: absolute;
|
82 |
+
top: 0;
|
83 |
+
left: 0;
|
84 |
+
width: 150px;
|
85 |
+
height: 150px;
|
86 |
+
background: none;
|
87 |
+
}
|
88 |
+
|
89 |
+
.minicolors-slider-saturation .minicolors-grid {
|
90 |
+
background-position: -420px 0;
|
91 |
+
}
|
92 |
+
|
93 |
+
.minicolors-slider-saturation .minicolors-grid-inner {
|
94 |
+
background: url('../img/color-pallete.png') -270px 0;
|
95 |
+
}
|
96 |
+
|
97 |
+
.minicolors-slider-brightness .minicolors-grid {
|
98 |
+
background-position: -570px 0;
|
99 |
+
}
|
100 |
+
|
101 |
+
.minicolors-slider-brightness .minicolors-grid-inner {
|
102 |
+
background: black;
|
103 |
+
}
|
104 |
+
|
105 |
+
.minicolors-slider-wheel .minicolors-grid {
|
106 |
+
background-position: -720px 0;
|
107 |
+
}
|
108 |
+
|
109 |
+
.minicolors-slider,
|
110 |
+
.minicolors-opacity-slider {
|
111 |
+
position: absolute;
|
112 |
+
top: 1px;
|
113 |
+
left: 152px;
|
114 |
+
width: 20px;
|
115 |
+
height: 150px;
|
116 |
+
background: white url('../img/color-pallete.png') 0 0;
|
117 |
+
cursor: row-resize;
|
118 |
+
}
|
119 |
+
|
120 |
+
.minicolors-slider-saturation .minicolors-slider {
|
121 |
+
background-position: -60px 0;
|
122 |
+
}
|
123 |
+
|
124 |
+
.minicolors-slider-brightness .minicolors-slider {
|
125 |
+
background-position: -20px 0;
|
126 |
+
}
|
127 |
+
|
128 |
+
.minicolors-slider-wheel .minicolors-slider {
|
129 |
+
background-position: -20px 0;
|
130 |
+
}
|
131 |
+
|
132 |
+
.minicolors-opacity-slider {
|
133 |
+
left: 173px;
|
134 |
+
background-position: -40px 0;
|
135 |
+
display: none;
|
136 |
+
}
|
137 |
+
|
138 |
+
.minicolors-with-opacity .minicolors-opacity-slider {
|
139 |
+
display: block;
|
140 |
+
}
|
141 |
+
|
142 |
+
/* Pickers */
|
143 |
+
.minicolors-grid .minicolors-picker {
|
144 |
+
position: absolute;
|
145 |
+
top: 70px;
|
146 |
+
left: 70px;
|
147 |
+
width: 12px;
|
148 |
+
height: 12px;
|
149 |
+
border: solid 1px black;
|
150 |
+
border-radius: 10px;
|
151 |
+
margin-top: -6px;
|
152 |
+
margin-left: -6px;
|
153 |
+
background: none;
|
154 |
+
}
|
155 |
+
|
156 |
+
.minicolors-grid .minicolors-picker > div {
|
157 |
+
position: absolute;
|
158 |
+
top: 0;
|
159 |
+
left: 0;
|
160 |
+
width: 8px;
|
161 |
+
height: 8px;
|
162 |
+
border-radius: 8px;
|
163 |
+
border: solid 2px white;
|
164 |
+
-moz-box-sizing: content-box;
|
165 |
+
-webkit-box-sizing: content-box;
|
166 |
+
box-sizing: content-box;
|
167 |
+
}
|
168 |
+
|
169 |
+
.minicolors-picker {
|
170 |
+
position: absolute;
|
171 |
+
top: 0;
|
172 |
+
left: 0;
|
173 |
+
width: 18px;
|
174 |
+
height: 2px;
|
175 |
+
background: white;
|
176 |
+
border: solid 1px black;
|
177 |
+
margin-top: -2px;
|
178 |
+
-moz-box-sizing: content-box;
|
179 |
+
-webkit-box-sizing: content-box;
|
180 |
+
box-sizing: content-box;
|
181 |
+
}
|
182 |
+
|
183 |
+
/* Inline controls */
|
184 |
+
.minicolors-inline {
|
185 |
+
display: inline-block;
|
186 |
+
}
|
187 |
+
|
188 |
+
.minicolors-inline .minicolors-input {
|
189 |
+
display: none !important;
|
190 |
+
}
|
191 |
+
|
192 |
+
.minicolors-inline .minicolors-panel {
|
193 |
+
position: relative;
|
194 |
+
top: auto;
|
195 |
+
left: auto;
|
196 |
+
box-shadow: none;
|
197 |
+
z-index: auto;
|
198 |
+
display: inline-block;
|
199 |
+
}
|
200 |
+
|
201 |
+
/* Default theme */
|
202 |
+
.minicolors-theme-default .minicolors-swatch {
|
203 |
+
top: 5px;
|
204 |
+
left: 5px;
|
205 |
+
width: 18px;
|
206 |
+
height: 18px;
|
207 |
+
}
|
208 |
+
.minicolors-theme-default.minicolors-position-right .minicolors-swatch {
|
209 |
+
left: auto;
|
210 |
+
right: 5px;
|
211 |
+
}
|
212 |
+
.minicolors-theme-default.minicolors {
|
213 |
+
width: auto;
|
214 |
+
display: inline-block;
|
215 |
+
}
|
216 |
+
.minicolors-theme-default .minicolors-input {
|
217 |
+
height: 20px;
|
218 |
+
width: auto;
|
219 |
+
display: inline-block;
|
220 |
+
padding-left: 26px;
|
221 |
+
}
|
222 |
+
.minicolors-theme-default.minicolors-position-right .minicolors-input {
|
223 |
+
padding-right: 26px;
|
224 |
+
padding-left: inherit;
|
225 |
+
}
|
226 |
+
|
227 |
+
/* Bootstrap theme */
|
228 |
+
.minicolors-theme-bootstrap .minicolors-swatch {
|
229 |
+
top: 3px;
|
230 |
+
left: 3px;
|
231 |
+
width: 28px;
|
232 |
+
height: 28px;
|
233 |
+
border-radius: 3px;
|
234 |
+
}
|
235 |
+
.minicolors-theme-bootstrap .minicolors-swatch-color {
|
236 |
+
border-radius: inherit;
|
237 |
+
}
|
238 |
+
.minicolors-theme-bootstrap.minicolors-position-right .minicolors-swatch {
|
239 |
+
left: auto;
|
240 |
+
right: 3px;
|
241 |
+
}
|
242 |
+
.minicolors-theme-bootstrap .minicolors-input {
|
243 |
+
padding-left: 44px;
|
244 |
+
}
|
245 |
+
.minicolors-theme-bootstrap.minicolors-position-right .minicolors-input {
|
246 |
+
padding-right: 44px;
|
247 |
+
padding-left: 12px;
|
248 |
+
}
|
249 |
+
.minicolors-theme-bootstrap .minicolors-input.input-lg + .minicolors-swatch {
|
250 |
+
top: 4px;
|
251 |
+
left: 4px;
|
252 |
+
width: 37px;
|
253 |
+
height: 37px;
|
254 |
+
border-radius: 5px;
|
255 |
+
}
|
256 |
+
.minicolors-theme-bootstrap .minicolors-input.input-sm + .minicolors-swatch {
|
257 |
+
width: 24px;
|
258 |
+
height: 24px;
|
259 |
+
}
|
media/img/ajax-loader.gif
ADDED
Binary file
|
media/img/bg.png
ADDED
Binary file
|
media/img/blocks-bg.png
ADDED
Binary file
|
media/img/brand-logo.png
ADDED
Binary file
|
media/img/checkmark.png
ADDED
Binary file
|
media/img/color-pallete.png
ADDED
Binary file
|
media/img/icon.png
ADDED
Binary file
|
media/js/options.js
ADDED
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var TidioChatWP = {
|
2 |
+
apiUrl: 'https://api-v2.tidio.co',
|
3 |
+
chatUrl: 'https://www.tidiochat.com',
|
4 |
+
token: null,
|
5 |
+
setRedirectLink: function(url){
|
6 |
+
jQuery('a[href="admin.php?page=tidio-chat"]').attr('href', url).attr('target', '_blank');
|
7 |
+
jQuery("#open-panel-link").attr('href', url);
|
8 |
+
},
|
9 |
+
renderProjects: function (data) {
|
10 |
+
var select_project = jQuery('#select-tidio-project');
|
11 |
+
for (var i in data.value) {
|
12 |
+
var project = data.value[i];
|
13 |
+
var value = {project_id:project.id, private_key:project.private_key, public_key:project.public_key};
|
14 |
+
|
15 |
+
var option = jQuery('<option value="'+project.id+'">' + project.name + '</option>');
|
16 |
+
option.data('value', value);
|
17 |
+
select_project.append(option);
|
18 |
+
}
|
19 |
+
|
20 |
+
jQuery('#input-blocks').fadeOut('fast', function () {
|
21 |
+
jQuery('#projects-selector').append(select_project);
|
22 |
+
jQuery('#select-project').fadeIn('fast', function(){
|
23 |
+
jQuery('#tidio-login-button').prop('disabled', false).text('Log in');
|
24 |
+
});
|
25 |
+
});
|
26 |
+
},
|
27 |
+
getProjects: function (token) {
|
28 |
+
jQuery.get(TidioChatWP.apiUrl + '/project', {
|
29 |
+
api_token: token
|
30 |
+
}, function (response) {
|
31 |
+
TidioChatWP.renderProjects(response);
|
32 |
+
}, 'json');
|
33 |
+
},
|
34 |
+
showError: function (message) {
|
35 |
+
jQuery('#tidio-wrapper .error').empty().append('<p>' + message + '</p>').show();
|
36 |
+
},
|
37 |
+
hideError: function () {
|
38 |
+
jQuery('#tidio-wrapper .error').hide();
|
39 |
+
},
|
40 |
+
init: function () {
|
41 |
+
|
42 |
+
|
43 |
+
var login_button = jQuery('#tidio-login-button');
|
44 |
+
|
45 |
+
/* Login */
|
46 |
+
login_button.click(function (e) {
|
47 |
+
TidioChatWP.hideError();
|
48 |
+
var error = false;
|
49 |
+
e.preventDefault();
|
50 |
+
var email = jQuery('#tidio-login-input').val();
|
51 |
+
var password = jQuery('#tidio-password-input').val();
|
52 |
+
|
53 |
+
if (email.length == 0 || password.length == 0) {
|
54 |
+
TidioChatWP.showError('Please fill email and password fields.');
|
55 |
+
error = true;
|
56 |
+
} else if (email == '' || email.indexOf('@') == -1 || email.indexOf('.') == -1) {
|
57 |
+
TidioChatWP.showError('Email is wrong');
|
58 |
+
error = true;
|
59 |
+
}
|
60 |
+
|
61 |
+
if (error)
|
62 |
+
return false;
|
63 |
+
|
64 |
+
login_button.prop('disabled', true).text('Loading...');
|
65 |
+
|
66 |
+
jQuery.get(TidioChatWP.apiUrl + '/access/getUserToken', {
|
67 |
+
email: email,
|
68 |
+
password: password,
|
69 |
+
}, function (data) {
|
70 |
+
if (data.status == true && data.value != "ERR_DATA_INVALID") {
|
71 |
+
TidioChatWP.token = data.value;
|
72 |
+
TidioChatWP.getProjects(TidioChatWP.token);
|
73 |
+
} else {
|
74 |
+
TidioChatWP.showError('Wrong email or password');
|
75 |
+
login_button.prop('disabled', false).text('Login');
|
76 |
+
}
|
77 |
+
}, 'json');
|
78 |
+
});
|
79 |
+
|
80 |
+
/* Load project details */
|
81 |
+
jQuery('#get-tidio-project').click(function(e){
|
82 |
+
e.preventDefault();
|
83 |
+
jQuery('#get-tidio-project').prop('disabled', true).text('Loading...');
|
84 |
+
var details = jQuery('#select-tidio-project option:selected').data('value');
|
85 |
+
jQuery.extend( details,{'action': 'get_project_keys'});
|
86 |
+
jQuery.post(ajaxurl, details, function(response) {
|
87 |
+
|
88 |
+
window.open(response, '_blank');
|
89 |
+
TidioChatWP.setRedirectLink(response);
|
90 |
+
jQuery('#welcome-text').fadeOut('fast', function(){
|
91 |
+
jQuery('#after-install-text').fadeIn('fast');
|
92 |
+
});
|
93 |
+
jQuery('#select-project').fadeOut('fast');
|
94 |
+
});
|
95 |
+
|
96 |
+
});
|
97 |
+
|
98 |
+
/* No account login */
|
99 |
+
jQuery('#redirect-to-panel').click(function (e){
|
100 |
+
e.preventDefault();
|
101 |
+
jQuery('#redirect-to-panel').prop('disabled', true).text('Loading...');
|
102 |
+
var details = {'action': 'get_private_key'};
|
103 |
+
jQuery.post(ajaxurl, details, function(response) {
|
104 |
+
if(response=='error'){
|
105 |
+
// load trought ajax url
|
106 |
+
TidioChatWP.accessTroughtXHR(function(response){
|
107 |
+
window.open(response, "_blank");
|
108 |
+
TidioChatWP.setRedirectLink(response);
|
109 |
+
jQuery('#welcome-text').fadeOut('fast', function(){
|
110 |
+
jQuery('#after-install-text').fadeIn('fast');
|
111 |
+
});
|
112 |
+
jQuery('#input-blocks').fadeOut('fast');
|
113 |
+
});
|
114 |
+
return false;
|
115 |
+
}
|
116 |
+
//
|
117 |
+
window.open(response, "_blank");
|
118 |
+
TidioChatWP.setRedirectLink(response);
|
119 |
+
jQuery('#welcome-text').fadeOut('fast', function(){
|
120 |
+
jQuery('#after-install-text').fadeIn('fast');
|
121 |
+
});
|
122 |
+
jQuery('#input-blocks').fadeOut('fast');
|
123 |
+
});
|
124 |
+
});
|
125 |
+
|
126 |
+
/* Trigger on enter */
|
127 |
+
jQuery('#tidio-login-input, #tidio-password-input').bind("keydown",function(e){
|
128 |
+
if(e.keyCode == 13)
|
129 |
+
login_button.trigger('click');
|
130 |
+
});
|
131 |
+
|
132 |
+
// Open panel
|
133 |
+
|
134 |
+
// open-panel-link
|
135 |
+
},
|
136 |
+
|
137 |
+
accessTroughtXHR: function(_func){
|
138 |
+
|
139 |
+
var xhr_url = TidioChatWP.apiUrl + '/access/external/create?url=' + location.protocol + '//' + location.host + '&platform=wordpress';
|
140 |
+
jQuery.getJSON(xhr_url, {}, function(r) {
|
141 |
+
if(!r || !r.value){
|
142 |
+
alert('Error occured while creating, please try again!');
|
143 |
+
return false;
|
144 |
+
}
|
145 |
+
_func(TidioChatWP.chatUrl + '/access?privateKey=' + r.value.private_key + '&app=chat&utm_source=platform&utm_medium=wordpress');
|
146 |
+
// save this in wordpress database
|
147 |
+
jQuery.post(ajaxurl, {'action': 'tidio_chat_save_keys', 'public_key': r.value.public_key, 'private_key': r.value.private_key}, function(response) {
|
148 |
+
|
149 |
+
});
|
150 |
+
|
151 |
+
}).fail(function(){
|
152 |
+
alert('Error occured while creating, please try again!');
|
153 |
+
});
|
154 |
+
|
155 |
+
}
|
156 |
+
};
|
157 |
+
|
158 |
+
jQuery(document).ready(function () {
|
159 |
+
TidioChatWP.init();
|
160 |
+
});
|
options.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div id="tidio-wrapper">
|
2 |
+
|
3 |
+
<div id="tidio-chat-wp-plugin">
|
4 |
+
|
5 |
+
<div id="welcome-text">
|
6 |
+
<h1>Hi there! Great to see you’ve installed Tidio Chat.</h1>
|
7 |
+
<p>Select one of the options below and your integration will be complete. If you’ve already got a Tidio account, the current project will be connected to that account. However, if you don’t have an account with us (or you’d like to create a new one) - just select the option on the right.</p>
|
8 |
+
</div>
|
9 |
+
<div id="after-install-text">
|
10 |
+
<h1>Your site is already integrated with Tidio Chat</h1>
|
11 |
+
<p>All you need to do now is select the “Tidio Chat” tab on the left - that will take you to your Tidio panel. You can also open the panel by using the link below.</p>
|
12 |
+
<p><a href="#" id="open-panel-link" class="button button-primary tidio-button" target="_blank" style="margin-left: auto; margin-right: auto; display: block;">Go to Panel</a></p>
|
13 |
+
</div>
|
14 |
+
|
15 |
+
|
16 |
+
<div class="error"></div>
|
17 |
+
|
18 |
+
<div id="input-blocks">
|
19 |
+
<div id="tidio-chat-login">
|
20 |
+
<h2>Yes, I have an account with Tidio</h2>
|
21 |
+
<div class="form-control">
|
22 |
+
<input type="text" value="" id="tidio-login-input" class="text-input" placeholder="Enter your e-mail...">
|
23 |
+
</div>
|
24 |
+
<div class="form-control">
|
25 |
+
<input type="password" value="" id="tidio-password-input" class="text-input" placeholder="Type password...">
|
26 |
+
</div>
|
27 |
+
<a href="#" id="tidio-login-button" class="button tidio-button" target="_blank">Login</a>
|
28 |
+
</div>
|
29 |
+
<div id="tidio-chat-panel">
|
30 |
+
<h2>No, I do not have an account with Tidio</h2>
|
31 |
+
<div id="tidio-apply-account">
|
32 |
+
That's alright, you can start using Tidio without having the login.
|
33 |
+
</div>
|
34 |
+
<a href="#" id="redirect-to-panel" class="button button-primary tidio-button" target="_blank">Create a new account</a>
|
35 |
+
</div>
|
36 |
+
</div>
|
37 |
+
|
38 |
+
<div id="select-project">
|
39 |
+
<h2>Select project:</h2>
|
40 |
+
<div class="form-control">
|
41 |
+
<select name="select-tidio-project" id="select-tidio-project"></select>
|
42 |
+
</div>
|
43 |
+
<a href="#" id="get-tidio-project" style="margin-left:auto;margin-right:auto;display:block;" class="button button-primary tidio-button" target="_blank">Select</a>
|
44 |
+
</div>
|
45 |
+
</div>
|
46 |
+
</div>
|
readme.txt
ADDED
@@ -0,0 +1,194 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Tidio Live Chat ===
|
2 |
+
Contributors: tytus-tytus, lucastidio
|
3 |
+
Tags: free live chat, plugin, facebook, admin, live chat, chat, livechat, post, tidio, widget, post, posts, twitter, zendesk, mailchimp
|
4 |
+
Requires at least: 3.0
|
5 |
+
Tested up to: 4.9
|
6 |
+
Stable tag: trunk
|
7 |
+
License: GPLv2
|
8 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
+
|
10 |
+
Meet Tidio Live Chat - a free live chat for your website. No login or registration required - It integrates with your website in less than 20 seconds
|
11 |
+
|
12 |
+
== Description ==
|
13 |
+
|
14 |
+
Tidio Live Chat is a live chat service which allows you to easily communicate with your customers. It is designed specifically for the WordPress community. Once you install the plugin, you will be ready to take full advantage of the benefits our service provides; no registration required.
|
15 |
+
|
16 |
+
= Features =
|
17 |
+
* Extremely easy installation - once you install the plugin, you’re ready to go
|
18 |
+
* Keep track of who visits your website
|
19 |
+
* Contact any customer that is currently visiting your site
|
20 |
+
* Adjust the colour scheme to your needs
|
21 |
+
* Use a dedicated app for mobile and desktop devices (iOS, Android, Windows, OS X, Chrome)
|
22 |
+
* The integrated widget supports 183 languages
|
23 |
+
* Available in 2 outstanding designs
|
24 |
+
* Offline messages form for your visitors to send you an email, when you are not online
|
25 |
+
* Contact your visitors via email when they leave the chat
|
26 |
+
* Integration with Zendesk, GetResponse, SalesForce, MailChimp, and many more…
|
27 |
+
|
28 |
+
= How does it work? =
|
29 |
+
Right after you install, open the “Tidio Chat” tab and you’re ready to go! Once you access the Tidio dashboard, you can reply to any incoming chats and manage your settings. Chat box will be visible on your website so your visitors will be able to contact you in real time.
|
30 |
+
|
31 |
+
[youtube https://www.youtube.com/watch?v=lL84qzWi4zQ]
|
32 |
+
|
33 |
+
[youtube https://www.youtube.com/watch?v=GYAIWqrWZQQ]
|
34 |
+
|
35 |
+
= Supported languages =
|
36 |
+
* English
|
37 |
+
* Spanish
|
38 |
+
* Portuguese
|
39 |
+
* Arabic
|
40 |
+
* Chinese
|
41 |
+
* Danish
|
42 |
+
* Dutch
|
43 |
+
* French
|
44 |
+
* German
|
45 |
+
* Hebrew
|
46 |
+
* Hindi
|
47 |
+
* Italian
|
48 |
+
* Japanese
|
49 |
+
* Korean
|
50 |
+
* Persian
|
51 |
+
* Polish
|
52 |
+
* Romanian
|
53 |
+
* Russian
|
54 |
+
* Swedish
|
55 |
+
|
56 |
+
If you're lacking support of your language, please contact us on contact[at]tidio.net or visit our website www.tidiochat.com
|
57 |
+
|
58 |
+
Please note that Tidio Chat is free. After activating the plugin, your 7 day trial period will begin. When the trial period is finished, you can downgrade your account to Free or continue to use the PRO account. [More information here](http://www.tidiochat.com/en/pricing "Live Chat Pricing").
|
59 |
+
|
60 |
+
== Installation ==
|
61 |
+
1. Go to WordPress Control Panel
|
62 |
+
1. Click "Plugins", then "Add New"
|
63 |
+
1. Type in "Tidio Live Chat" and click "Search Plugins"
|
64 |
+
1. Download and install the Plugin
|
65 |
+
1. Click the "Activate Plugin" link
|
66 |
+
1. Move to the "Live Chat" section in the menu
|
67 |
+
1. Done! Now you can start talk with your users
|
68 |
+
|
69 |
+
== Frequently Asked Questions ==
|
70 |
+
|
71 |
+
= Do I need to sign up in order to use the Chat? =
|
72 |
+
No, to use the chat you just need to install the plugin and it’s done! No registration or login required.
|
73 |
+
|
74 |
+
= Can I add an infinite number of agents? =
|
75 |
+
Yes , there is no limit to the number of agents you can add.
|
76 |
+
|
77 |
+
= Is it possible to translate every single element of Tidio Chat? =
|
78 |
+
Yes, all elements of Tidio Chat are translatable in your control panel.
|
79 |
+
|
80 |
+
= Can I change the colour of the chat’s widget? =
|
81 |
+
Yes, you can change the chat’s appearance according to your needs.
|
82 |
+
|
83 |
+
= Do I need to know any programming language to install Tidio Chat? =
|
84 |
+
No, just click the Download option and start using chat’s simple interface right away.
|
85 |
+
|
86 |
+
= Can I manage TidioChat for two sites, from one control panel? =
|
87 |
+
You can switch between projects easily or open another project in incognito/private mode.
|
88 |
+
|
89 |
+
= If I’ll have multiple agents, is there a way to have a separate avatar for every single agent? =
|
90 |
+
Yes, you can have a separate avatar for each of your agents.
|
91 |
+
|
92 |
+
= Can I see history of past conversations? =
|
93 |
+
Yes, in the history menu, on the left side of your chat panel.
|
94 |
+
|
95 |
+
= Is there an option to set “respond automatically”? =
|
96 |
+
You are able to create automated messages which start a conversation with your customers.
|
97 |
+
|
98 |
+
= Is there an application for iOS or Android? =
|
99 |
+
Yes, you can download our mobile app from App Store (http://goo.gl/mqth2P) or Google Play (http://goo.gl/ayibFD)
|
100 |
+
|
101 |
+
= Can I install TidioChat on my plain html site? =
|
102 |
+
Yes you can
|
103 |
+
|
104 |
+
= Is it possible to initiate a conversation before the visitor does? =
|
105 |
+
Yes, you can do it with the automatic messages feature or simply choose a client from the visitors list and engage a conversation.
|
106 |
+
|
107 |
+
= Can I move the Tidio Chat widget? =
|
108 |
+
There are currently 2 positions for the chat, the bottom left and the bottom right hand corner.
|
109 |
+
|
110 |
+
= Can I hide chat’s widget? =
|
111 |
+
Yes, simply go to your chat panel and switch the “Display” option to off.
|
112 |
+
|
113 |
+
== Screenshots ==
|
114 |
+
1. Live Chat - instantly reply to people who visit your website
|
115 |
+
2. Intuitive Chat Panel - manage and monitor all conversations and visitors in one place
|
116 |
+
3. Automations - set up automated messages triggered by predefined actions
|
117 |
+
4. Dedicated app for mobile and desktop devices (iOS, Android, Chrome, Windows, OS X)
|
118 |
+
|
119 |
+
== Changelog ==
|
120 |
+
|
121 |
+
= 3.3.2 =
|
122 |
+
* Change of the widget script placement in Wordpress themes to improve the rendering performance.
|
123 |
+
* Use admin email as a default email for a Tidio account.
|
124 |
+
|
125 |
+
= 3.3.1 =
|
126 |
+
* Refreshed texts within the plugin to be more intuitive.
|
127 |
+
|
128 |
+
= 3.3.0 =
|
129 |
+
* New button added to reset the account data.
|
130 |
+
* Account data is not automatically removed while deactivating or uninstalling plugin.
|
131 |
+
|
132 |
+
= 3.2.0 =
|
133 |
+
* Remove old files, move to https api requests.
|
134 |
+
|
135 |
+
= 3.1.1 =
|
136 |
+
* Add single version number across plugin.
|
137 |
+
|
138 |
+
= 3.1.0 =
|
139 |
+
* Cleanup with changes after last modifications.
|
140 |
+
|
141 |
+
= 3.0.1 =
|
142 |
+
* (added) curl support
|
143 |
+
|
144 |
+
= 3.0 =
|
145 |
+
* (added) new design
|
146 |
+
* (added) integration with tidio chat account
|
147 |
+
|
148 |
+
= 2.1.2 =
|
149 |
+
* (added) compatibility with other tidio plugins
|
150 |
+
|
151 |
+
= 2.1 =
|
152 |
+
* (added) compatibility with tidio one api
|
153 |
+
|
154 |
+
= 2.0.5 =
|
155 |
+
* (added) compatibility with tidio one
|
156 |
+
|
157 |
+
= 2.0.2 =
|
158 |
+
* (added) support to sites with disabled allow_url_fopen flag
|
159 |
+
|
160 |
+
= 2.0.1 =
|
161 |
+
* (added) new icon
|
162 |
+
|
163 |
+
= 2.0 =
|
164 |
+
* Compatibility with tidiochat.com
|
165 |
+
|
166 |
+
= 1.3.2 =
|
167 |
+
* Added compatibility with other Tidio plugins
|
168 |
+
|
169 |
+
= 1.3.1 =
|
170 |
+
* (fixed) error with location files using __DIR__
|
171 |
+
|
172 |
+
= 1.3 =
|
173 |
+
* (added) translate mode
|
174 |
+
* (added) feedback form
|
175 |
+
* (fixed) auth problem
|
176 |
+
|
177 |
+
= 1.2.1 =
|
178 |
+
* (fixed) curl followlocation error
|
179 |
+
|
180 |
+
= 1.2 =
|
181 |
+
* (added) appearance editor
|
182 |
+
* (added) compatibility with wordpress 3.9
|
183 |
+
* (fixed) compatibility with others tidio plugins
|
184 |
+
|
185 |
+
= 1.1 =
|
186 |
+
* (added) chat settings
|
187 |
+
|
188 |
+
= 1.0 =
|
189 |
+
* Initial release.
|
190 |
+
|
191 |
+
|
192 |
+
== Upgrade Notice ==
|
193 |
+
= 1.0 =
|
194 |
+
* Initial release.
|
tidio-elements.php
ADDED
@@ -0,0 +1,256 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Plugin Name: Tidio Chat
|
5 |
+
* Plugin URI: http://www.tidiochat.com
|
6 |
+
* Description: Tidio Live Chat - Live chat for your website. No logging in, no signing up - integrates with your website in less than 20 seconds.
|
7 |
+
* Version: 3.3.0
|
8 |
+
* Author: Tidio Ltd.
|
9 |
+
* Author URI: http://www.tidiochat.com
|
10 |
+
* License: GPL2
|
11 |
+
*/
|
12 |
+
define('TIDIOCHAT_VERSION', '3.3.2');
|
13 |
+
|
14 |
+
class TidioLiveChat {
|
15 |
+
|
16 |
+
private $scriptUrl = '//code.tidio.co/';
|
17 |
+
private static $apiUrl = 'https://api-v2.tidio.co';
|
18 |
+
private static $chatUrl = 'https://www.tidiochat.com';
|
19 |
+
|
20 |
+
public function __construct() {
|
21 |
+
|
22 |
+
if (!empty($_GET['tidio_chat_version'])) {
|
23 |
+
echo TIDIOCHAT_VERSION;
|
24 |
+
exit;
|
25 |
+
}
|
26 |
+
|
27 |
+
/* Before add link to menu - check is user trying to unninstal */
|
28 |
+
if (is_admin() && !empty($_GET['tidio_one_clear_cache'])) {
|
29 |
+
delete_option('tidio-one-public-key');
|
30 |
+
delete_option('tidio-one-private-key');
|
31 |
+
}
|
32 |
+
|
33 |
+
add_action('admin_menu', array($this, 'addAdminMenuLink'));
|
34 |
+
|
35 |
+
if(get_option('tidio-one-public-key')){
|
36 |
+
add_action('admin_footer', array($this, 'adminJS'));
|
37 |
+
}
|
38 |
+
|
39 |
+
if (!is_admin()) {
|
40 |
+
add_action('wp_enqueue_scripts', array($this, 'enqueueScripts'));
|
41 |
+
}else{
|
42 |
+
add_action('admin_enqueue_scripts', array($this, 'enqueueAdminScripts'));
|
43 |
+
}
|
44 |
+
|
45 |
+
add_action('wp_ajax_tidio_chat_save_keys', array($this, 'ajaxTidioChatSaveKeys'));
|
46 |
+
|
47 |
+
/* Ajax functions to set up existing tidio account */
|
48 |
+
add_action('wp_ajax_get_project_keys', array($this, 'ajaxGetProjectKeys'));
|
49 |
+
add_action('wp_ajax_get_private_key', array($this, 'ajaxGetPrivateKey'));
|
50 |
+
|
51 |
+
add_filter('plugin_action_links', array($this, 'pluginActionLinks'), 10, 2);
|
52 |
+
add_action('admin_post_tidio-chat-reset', array($this, 'uninstall'));
|
53 |
+
}
|
54 |
+
|
55 |
+
public function pluginActionLinks($links, $file) {
|
56 |
+
if (strpos($file, 'tidio-elements.php') !== false && get_option('tidio-one-private-key')) {
|
57 |
+
$links[] = '<a href="'.admin_url('admin-post.php').'?action=tidio-chat-reset">'.esc_html__( 'Clear Account Data' , 'tidio-live-chat').'</a>';
|
58 |
+
}
|
59 |
+
|
60 |
+
return $links;
|
61 |
+
}
|
62 |
+
|
63 |
+
public function ajaxGetProjectKeys(){
|
64 |
+
update_option('tidio-one-public-key', $_POST['public_key']);
|
65 |
+
update_option('tidio-one-private-key', $_POST['private_key']);
|
66 |
+
echo self::getRedirectUrl($_POST['private_key']);
|
67 |
+
exit();
|
68 |
+
}
|
69 |
+
|
70 |
+
// Ajax - Create an new project
|
71 |
+
|
72 |
+
public function ajaxTidioChatSaveKeys() {
|
73 |
+
|
74 |
+
if (!is_admin()) {
|
75 |
+
exit;
|
76 |
+
}
|
77 |
+
|
78 |
+
if (empty($_POST['private_key']) || empty($_POST['public_key'])) {
|
79 |
+
exit;
|
80 |
+
}
|
81 |
+
|
82 |
+
update_option('tidio-one-public-key', $_POST['public_key']);
|
83 |
+
update_option('tidio-one-private-key', $_POST['private_key']);
|
84 |
+
|
85 |
+
echo '1';
|
86 |
+
exit;
|
87 |
+
}
|
88 |
+
|
89 |
+
// Front End Scripts
|
90 |
+
public function enqueueScripts() {
|
91 |
+
wp_enqueue_script('tidio-chat', $this->scriptUrl . self::getPublicKey() . '.js', array(), TIDIOCHAT_VERSION, true);
|
92 |
+
}
|
93 |
+
|
94 |
+
// Admin scripts and style enquee
|
95 |
+
public function enqueueAdminScripts(){
|
96 |
+
wp_enqueue_script('tidio-chat-admin', plugins_url('media/js/options.js', __FILE__), array(), TIDIOCHAT_VERSION, true);
|
97 |
+
wp_enqueue_style('tidio-chat-admin-style', plugins_url('media/css/options.css', __FILE__), array(), TIDIOCHAT_VERSION);
|
98 |
+
}
|
99 |
+
|
100 |
+
// Admin JavaScript
|
101 |
+
public function adminJS() {
|
102 |
+
$privateKey = self::getPrivateKey();
|
103 |
+
$redirectUrl = '';
|
104 |
+
|
105 |
+
if ($privateKey && $privateKey != 'false') {
|
106 |
+
$redirectUrl = self::getRedirectUrl($privateKey);
|
107 |
+
} else {
|
108 |
+
$redirectUrl = admin_url('admin-ajax.php?action=tidio_chat_redirect');
|
109 |
+
}
|
110 |
+
|
111 |
+
echo "<script>jQuery('a[href=\"admin.php?page=tidio-chat\"]').attr('href', '" . $redirectUrl . "').attr('target', '_blank') </script>";
|
112 |
+
}
|
113 |
+
|
114 |
+
// Menu Pages
|
115 |
+
|
116 |
+
public function addAdminMenuLink() {
|
117 |
+
$optionPage = add_menu_page(
|
118 |
+
'Tidio Chat', 'Tidio Chat', 'manage_options', 'tidio-chat', array($this, 'addAdminPage'), content_url() . '/plugins/tidio-live-chat/media/img/icon.png'
|
119 |
+
);
|
120 |
+
}
|
121 |
+
|
122 |
+
public function addAdminPage() {
|
123 |
+
// Set class property
|
124 |
+
$dir = plugin_dir_path(__FILE__);
|
125 |
+
include $dir . 'options.php';
|
126 |
+
}
|
127 |
+
|
128 |
+
// Uninstall
|
129 |
+
|
130 |
+
public function uninstall() {
|
131 |
+
delete_option('tidio-one-public-key');
|
132 |
+
delete_option('tidio-one-private-key');
|
133 |
+
wp_redirect( admin_url('plugins.php') );
|
134 |
+
die();
|
135 |
+
}
|
136 |
+
|
137 |
+
// Get Private Key
|
138 |
+
|
139 |
+
public static function getPrivateKey() {
|
140 |
+
self::syncPrivateKey();
|
141 |
+
|
142 |
+
$privateKey = get_option('tidio-one-private-key');
|
143 |
+
|
144 |
+
if ($privateKey) {
|
145 |
+
return $privateKey;
|
146 |
+
}
|
147 |
+
|
148 |
+
try {
|
149 |
+
$data = self::getContent(self::getAccessUrl());
|
150 |
+
} catch(Exception $e){
|
151 |
+
$data = null;
|
152 |
+
}
|
153 |
+
//
|
154 |
+
if (!$data) {
|
155 |
+
update_option('tidio-one-private-key', 'false');
|
156 |
+
return false;
|
157 |
+
}
|
158 |
+
|
159 |
+
@$data = json_decode($data, true);
|
160 |
+
if (!$data || !$data['status']) {
|
161 |
+
update_option('tidio-one-private-key', 'false');
|
162 |
+
return false;
|
163 |
+
}
|
164 |
+
|
165 |
+
update_option('tidio-one-private-key', $data['value']['private_key']);
|
166 |
+
update_option('tidio-one-public-key', $data['value']['public_key']);
|
167 |
+
|
168 |
+
return $data['value']['private_key'];
|
169 |
+
}
|
170 |
+
|
171 |
+
public static function getContent($url){
|
172 |
+
|
173 |
+
if(function_exists('curl_version')){ // load trought curl
|
174 |
+
$ch = curl_init();
|
175 |
+
|
176 |
+
curl_setopt($ch, CURLOPT_HEADER, 0);
|
177 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
178 |
+
curl_setopt($ch, CURLOPT_URL, $url);
|
179 |
+
|
180 |
+
$data = curl_exec($ch);
|
181 |
+
curl_close($ch);
|
182 |
+
|
183 |
+
return $data;
|
184 |
+
} else { // load trought file get contents
|
185 |
+
return file_get_contents($url);
|
186 |
+
}
|
187 |
+
|
188 |
+
}
|
189 |
+
|
190 |
+
// Sync private key with old version
|
191 |
+
|
192 |
+
public static function syncPrivateKey() {
|
193 |
+
if (get_option('tidio-one-public-key')) {
|
194 |
+
return false;
|
195 |
+
}
|
196 |
+
|
197 |
+
$publicKey = get_option('tidio-chat-external-public-key');
|
198 |
+
$privateKey = get_option('tidio-chat-external-private-key');
|
199 |
+
|
200 |
+
if (!$publicKey || !$privateKey) {
|
201 |
+
return false;
|
202 |
+
}
|
203 |
+
|
204 |
+
// sync old variables with new one
|
205 |
+
|
206 |
+
update_option('tidio-one-public-key', $publicKey);
|
207 |
+
update_option('tidio-one-private-key', $privateKey);
|
208 |
+
|
209 |
+
return true;
|
210 |
+
}
|
211 |
+
|
212 |
+
// Get Access Url
|
213 |
+
|
214 |
+
public static function getAccessUrl() {
|
215 |
+
return self::$apiUrl . '/access/external/create?url=' . urlencode(site_url()) . '&platform=wordpress&email=' . urlencode(get_option('admin_email')) . '&_ip=' . $_SERVER['REMOTE_ADDR'];
|
216 |
+
}
|
217 |
+
|
218 |
+
public static function getRedirectUrl($privateKey) {
|
219 |
+
return self::$chatUrl . '/access?' . http_build_query(
|
220 |
+
array(
|
221 |
+
'privateKey' => $privateKey,
|
222 |
+
'utm_source' => 'platform',
|
223 |
+
'utm_medium' => 'wordpress',
|
224 |
+
'tour_default_email' => get_option('admin_email'),
|
225 |
+
)
|
226 |
+
);
|
227 |
+
}
|
228 |
+
|
229 |
+
public static function ajaxGetPrivateKey(){
|
230 |
+
$privateKey = self::getPrivateKey();
|
231 |
+
if(!$privateKey || $privateKey=='false'){
|
232 |
+
echo 'error';
|
233 |
+
exit();
|
234 |
+
}
|
235 |
+
echo self::getRedirectUrl($privateKey);
|
236 |
+
exit();
|
237 |
+
}
|
238 |
+
|
239 |
+
// Get Public Key
|
240 |
+
|
241 |
+
public static function getPublicKey() {
|
242 |
+
$publicKey = get_option('tidio-one-public-key');
|
243 |
+
|
244 |
+
if ($publicKey) {
|
245 |
+
return $publicKey;
|
246 |
+
}
|
247 |
+
|
248 |
+
self::getPrivateKey();
|
249 |
+
|
250 |
+
return get_option('tidio-one-public-key');
|
251 |
+
}
|
252 |
+
|
253 |
+
}
|
254 |
+
|
255 |
+
$tidioLiveChat = new TidioLiveChat();
|
256 |
+
|
views/ajax-tidio-chat-redirect.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!doctype html>
|
2 |
+
<html>
|
3 |
+
<head>
|
4 |
+
<meta charset="utf-8">
|
5 |
+
<title>Redirect to Tidio Chat...</title>
|
6 |
+
</head>
|
7 |
+
|
8 |
+
<body>
|
9 |
+
|
10 |
+
<script>
|
11 |
+
|
12 |
+
var path = {
|
13 |
+
admin_url: '<?php echo admin_url() ?>'
|
14 |
+
};
|
15 |
+
|
16 |
+
</script>
|
17 |
+
|
18 |
+
<?php /* ACCESS REDIRECT */ ?>
|
19 |
+
|
20 |
+
<?php if($view['mode']=='redirect'){ ?>
|
21 |
+
|
22 |
+
<script> location.href = '<?php echo $view['redirect_url'] ?>'; </script>
|
23 |
+
|
24 |
+
<?php } ?>
|
25 |
+
|
26 |
+
<?php /* ACCESS REQUEST */ ?>
|
27 |
+
|
28 |
+
<?php if($view['mode']=='access_request'){ ?>
|
29 |
+
|
30 |
+
<img src="<?php echo admin_url() ?>../wp-content/plugins/tidio-live-chat/media/img/ajax-loader.gif" />
|
31 |
+
|
32 |
+
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
|
33 |
+
<script>
|
34 |
+
|
35 |
+
$.getJSON('<?php echo $view['access_url'] ?>&remote=1', function(data){
|
36 |
+
|
37 |
+
if(!data || !data['status']){
|
38 |
+
alert('Error occurred, please refresh page and try again!');
|
39 |
+
return false;
|
40 |
+
}
|
41 |
+
|
42 |
+
data = data['value'];
|
43 |
+
|
44 |
+
location.href = path.admin_url + 'admin-ajax.php?action=tidio_chat_redirect&access_status=success&private_key=' + data.private_key + '&public_key=' + data.public_key;
|
45 |
+
|
46 |
+
});
|
47 |
+
|
48 |
+
</script>
|
49 |
+
|
50 |
+
<?php } ?>
|
51 |
+
|
52 |
+
|
53 |
+
|
54 |
+
</body>
|
55 |
+
</html>
|