Version Description
2019-02-05 - Low priority =
Fixed access to new dashboard for non admin agents
Fixed documentation suggestions not working (Pro)
Download this release
Release Info
Developer | WP-LiveChat |
Plugin | WP Live Chat Support |
Version | 8.0.23 |
Comparing to | |
See all releases |
Code changes from version 8.0.22 to 8.0.23
- css/admin_styles.css +449 -449
- includes/dashboard_page.php +93 -93
- js/wplc_dashboard.js +90 -90
- modules/gdpr.php +764 -764
- modules/node_server.php +1233 -1233
- readme.txt +12 -3
- wp-live-chat-support.php +6484 -6470
css/admin_styles.css
CHANGED
@@ -1,449 +1,449 @@
|
|
1 |
-
|
2 |
-
/**
|
3 |
-
* Settings
|
4 |
-
*/
|
5 |
-
|
6 |
-
#wplc_settings .tooltip {
|
7 |
-
background-color: #333;
|
8 |
-
color: #eee;
|
9 |
-
padding: 15px;
|
10 |
-
border-radius: 15px;
|
11 |
-
opacity: 0.8;
|
12 |
-
}
|
13 |
-
|
14 |
-
#wplc_settings .form-table td {
|
15 |
-
font-size: 13px !important;
|
16 |
-
line-height: 1.5em !important;
|
17 |
-
}
|
18 |
-
|
19 |
-
|
20 |
-
.wplc-extension-label-box {
|
21 |
-
display:block;
|
22 |
-
overflow:auto;
|
23 |
-
clear:both;
|
24 |
-
}
|
25 |
-
.wplc-extension-label {
|
26 |
-
display:block;
|
27 |
-
float:left;
|
28 |
-
padding:5px;
|
29 |
-
margin-right:5px;
|
30 |
-
font-size:0.8em;
|
31 |
-
background-color:#bbb;
|
32 |
-
color:#FFF;
|
33 |
-
webkit-border-radius: 5px;
|
34 |
-
-moz-border-radius: 5px;
|
35 |
-
border-radius: 5px;
|
36 |
-
}
|
37 |
-
|
38 |
-
|
39 |
-
#wplc_tabs {
|
40 |
-
box-shadow: 0 0 40px 1px rgba(0,0,0,.07);
|
41 |
-
-webkit-box-shadow: 0 0 40px 1px rgba(0,0,0,.07);
|
42 |
-
-moz-box-shadow: 0 0 40px 1px rgba(0,0,0,.07);
|
43 |
-
-o-box-shadow: 0 0 40px 1px rgba(0,0,0,.07);
|
44 |
-
}
|
45 |
-
|
46 |
-
|
47 |
-
.wplc-extension {
|
48 |
-
|
49 |
-
float: left;
|
50 |
-
margin: 0 1% 1% 0;
|
51 |
-
background: #fff;
|
52 |
-
border: 1px solid #ccc;
|
53 |
-
width: 320px;
|
54 |
-
padding: 14px;
|
55 |
-
height: 370px;
|
56 |
-
position: relative;
|
57 |
-
|
58 |
-
}
|
59 |
-
.wplc-extension h3 {
|
60 |
-
margin: 0 0 8px;
|
61 |
-
font-size: 13px;
|
62 |
-
|
63 |
-
}
|
64 |
-
|
65 |
-
.wplc-extension .button-secondary {
|
66 |
-
position: absolute;
|
67 |
-
bottom: 14px;
|
68 |
-
left: 14px;
|
69 |
-
}
|
70 |
-
.wplc-plugin {
|
71 |
-
height: 250px;
|
72 |
-
}
|
73 |
-
|
74 |
-
|
75 |
-
.wplc_header_vh {
|
76 |
-
font: bold 14px/26px Arial;
|
77 |
-
padding: 0 0 0 0px;
|
78 |
-
color: #C2BBBE;
|
79 |
-
display: block;
|
80 |
-
text-transform: uppercase;
|
81 |
-
display:block;
|
82 |
-
}
|
83 |
-
.wplc_headerspan_v { min-width:120px; width:20%; display:block; }
|
84 |
-
.wplc_headerspan_nr { min-width:60px; width:10%; display:block; }
|
85 |
-
.wplc_headerspan_dev { min-width:60px; width:10%; display:block; }
|
86 |
-
.wplc_headerspan_d { min-width:200px; width:30%; display:block; }
|
87 |
-
.wplc_headerspan_d a { font-style: italic; }
|
88 |
-
.wplc_headerspan_t { min-width:60px; width:9%; display:block; }
|
89 |
-
.wplc_headerspan_s { min-width:80px; width:12%; display:block; }
|
90 |
-
.wplc_headerspan_a { min-width:100px; width:15%; display:block; }
|
91 |
-
.wplc_chat_ul_header {
|
92 |
-
clear: both;
|
93 |
-
overflow:auto;
|
94 |
-
display:block;
|
95 |
-
padding:10px;
|
96 |
-
}
|
97 |
-
|
98 |
-
|
99 |
-
.relevant_extension p {
|
100 |
-
margin-top:2px;
|
101 |
-
}
|
102 |
-
.relevant_extension h3 {
|
103 |
-
margin-bottom:2px;
|
104 |
-
}
|
105 |
-
.relevant_extension {
|
106 |
-
width: 49% !important;
|
107 |
-
height: 125px !important;
|
108 |
-
opacity:0.5;
|
109 |
-
}
|
110 |
-
.relevant_extension:hover {
|
111 |
-
opacity:1.0;
|
112 |
-
}
|
113 |
-
|
114 |
-
|
115 |
-
.relevant_extension .button-secondary {
|
116 |
-
right:10px !important;
|
117 |
-
left: initial !important;
|
118 |
-
|
119 |
-
}
|
120 |
-
|
121 |
-
|
122 |
-
.relevant_extension img {
|
123 |
-
margin-right:10px;
|
124 |
-
}
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
@media (min-width:320px) {
|
129 |
-
/* smartphones, portrait iPhone, portrait 480x320 phones (Android) */
|
130 |
-
.relevant_extension {
|
131 |
-
width: 85% !important;
|
132 |
-
height: 145px !important;
|
133 |
-
opacity:0.5;
|
134 |
-
}
|
135 |
-
.relevant_extension img {
|
136 |
-
width:105px;
|
137 |
-
}
|
138 |
-
.wplc-extension .wp-post-image {
|
139 |
-
height: auto;
|
140 |
-
}
|
141 |
-
}
|
142 |
-
@media (min-width:480px) {
|
143 |
-
/* smartphones, Android phones, landscape iPhone */
|
144 |
-
.relevant_extension {
|
145 |
-
width: 94% !important;
|
146 |
-
height: 125px !important;
|
147 |
-
opacity:0.5;
|
148 |
-
}
|
149 |
-
.relevant_extension img {
|
150 |
-
width:105px;
|
151 |
-
}
|
152 |
-
.wplc-extension .wp-post-image {
|
153 |
-
height: auto;
|
154 |
-
}
|
155 |
-
}
|
156 |
-
@media (min-width:600px) {
|
157 |
-
/* portrait tablets, portrait iPad, e-readers (Nook/Kindle), landscape 800x480 phones (Android) */
|
158 |
-
.relevant_extension {
|
159 |
-
width: 94% !important;
|
160 |
-
height: 125px !important;
|
161 |
-
opacity:0.5;
|
162 |
-
}
|
163 |
-
.relevant_extension img {
|
164 |
-
width:105px;
|
165 |
-
}
|
166 |
-
.wplc-extension .wp-post-image {
|
167 |
-
height: auto;
|
168 |
-
}
|
169 |
-
}
|
170 |
-
@media (min-width:801px) {
|
171 |
-
/* tablet, landscape iPad, lo-res laptops ands desktops */
|
172 |
-
.relevant_extension {
|
173 |
-
width: 43% !important;
|
174 |
-
height: 145px !important;
|
175 |
-
opacity:0.5;
|
176 |
-
}
|
177 |
-
.relevant_extension img {
|
178 |
-
width:95px;
|
179 |
-
}
|
180 |
-
.wplc-extension .wp-post-image {
|
181 |
-
height: auto;
|
182 |
-
}
|
183 |
-
}
|
184 |
-
@media (min-width:1025px) {
|
185 |
-
/* big landscape tablets, laptops, and desktops */
|
186 |
-
.relevant_extension {
|
187 |
-
width: 44% !important;
|
188 |
-
height: 125px !important;
|
189 |
-
opacity:0.5;
|
190 |
-
}
|
191 |
-
.relevant_extension img {
|
192 |
-
width:125px;
|
193 |
-
}
|
194 |
-
.wplc-extension .wp-post-image {
|
195 |
-
height: auto;
|
196 |
-
}
|
197 |
-
}
|
198 |
-
@media (min-width:1281px) {
|
199 |
-
/* hi-res laptops and desktops */
|
200 |
-
.relevant_extension {
|
201 |
-
width: 32% !important;
|
202 |
-
height: 125px !important;
|
203 |
-
opacity:0.5;
|
204 |
-
}
|
205 |
-
.relevant_extension img {
|
206 |
-
width:110px;
|
207 |
-
}
|
208 |
-
.wplc-extension .wp-post-image {
|
209 |
-
height: auto;
|
210 |
-
}
|
211 |
-
}
|
212 |
-
|
213 |
-
|
214 |
-
.wplc-palette-selection {
|
215 |
-
border: 1px solid #CCC;
|
216 |
-
border-radius: 5px;
|
217 |
-
padding: 5px;
|
218 |
-
margin: 5px;
|
219 |
-
height:100%;
|
220 |
-
|
221 |
-
}
|
222 |
-
|
223 |
-
.wplc_palette_single {
|
224 |
-
margin: 5px;
|
225 |
-
margin-top: 15px;
|
226 |
-
width: 162px;
|
227 |
-
height: 122px;
|
228 |
-
text-align: center;
|
229 |
-
display: inline-block;
|
230 |
-
vertical-align: top;
|
231 |
-
cursor: pointer;
|
232 |
-
|
233 |
-
}
|
234 |
-
.wplc-palette-top { display:block; width:100%; height:25%; }
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
#wplc_tabs .ui-tabs-anchor {
|
239 |
-
width: 100%;
|
240 |
-
}
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
/* Gutenberg styles */
|
245 |
-
#tabs-gutenberg input[type='button'] {
|
246 |
-
cursor: pointer;
|
247 |
-
}
|
248 |
-
|
249 |
-
#wplc_custom_js_editor, #wplc_custom_css_editor, #wplc_custom_html_editor {
|
250 |
-
width: 560px;
|
251 |
-
height: 285px;
|
252 |
-
margin: 10px 0 10px 0;
|
253 |
-
}
|
254 |
-
|
255 |
-
#wplc_gutenberg_icon {
|
256 |
-
cursor: pointer;
|
257 |
-
}
|
258 |
-
|
259 |
-
.wplc_code {
|
260 |
-
cursor: pointer;
|
261 |
-
transition: all .2s ease-in-out;
|
262 |
-
border-radius: 3px;
|
263 |
-
color: #696969;
|
264 |
-
}
|
265 |
-
|
266 |
-
.wplc_code:hover {
|
267 |
-
background: #d7d7d7;
|
268 |
-
}
|
269 |
-
|
270 |
-
.wplc_code:focus, .wplc_code:active {
|
271 |
-
background: #018add;
|
272 |
-
color: #fff;
|
273 |
-
}
|
274 |
-
|
275 |
-
|
276 |
-
.wplc_agent_container ul {
|
277 |
-
display:block;
|
278 |
-
overflow:auto;
|
279 |
-
}
|
280 |
-
.wplc_agent_container li{
|
281 |
-
display: block;
|
282 |
-
float: left;
|
283 |
-
text-align: center;
|
284 |
-
border: 1px solid #CCC;
|
285 |
-
width:150px;
|
286 |
-
height:310px;
|
287 |
-
padding: 10px;
|
288 |
-
border-radius: 5px;
|
289 |
-
margin: 10px;
|
290 |
-
box-shadow: 2px 2px 2px #CCC;
|
291 |
-
overflow: auto;
|
292 |
-
|
293 |
-
}
|
294 |
-
.wplc_agent_container img{
|
295 |
-
border-radius: 100px;
|
296 |
-
}
|
297 |
-
.wplc_agent_container h3 {
|
298 |
-
font: bold 12px/16px Arial;
|
299 |
-
padding: 0 0 0 0px;
|
300 |
-
color: #C2BBBE;
|
301 |
-
display: block;
|
302 |
-
height:40px;
|
303 |
-
text-transform: uppercase;
|
304 |
-
}
|
305 |
-
.wplc_agent_container small { word-wrap: break-word; display:block; height:50px; }
|
306 |
-
.wplc_agent_container select { width: 120px; }
|
307 |
-
|
308 |
-
.initiate_upsell {
|
309 |
-
position: absolute;
|
310 |
-
bottom: 0;
|
311 |
-
padding: 10px;
|
312 |
-
border-top: 1px solid #ccc;
|
313 |
-
width: 100%;
|
314 |
-
background-color: #fff;
|
315 |
-
}
|
316 |
-
|
317 |
-
/* Dashboard Page Styles */
|
318 |
-
#wplc_dashboard_container {
|
319 |
-
box-sizing: border-box;
|
320 |
-
}
|
321 |
-
.wplc_panel_col {
|
322 |
-
display: inline-block !important;
|
323 |
-
box-sizing: border-box;
|
324 |
-
vertical-align: top;
|
325 |
-
padding: 15px;
|
326 |
-
margin: 0 !important;
|
327 |
-
}
|
328 |
-
|
329 |
-
.wplc_col_12 {
|
330 |
-
width: 100%;
|
331 |
-
}
|
332 |
-
|
333 |
-
.wplc_col_6 {
|
334 |
-
width: 50%;
|
335 |
-
}
|
336 |
-
|
337 |
-
.wplc_col_4 {
|
338 |
-
width: 32%;
|
339 |
-
}
|
340 |
-
|
341 |
-
.wplc_dashboard_row {
|
342 |
-
white-space: nowrap;
|
343 |
-
|
344 |
-
}
|
345 |
-
.wplc-center {
|
346 |
-
text-align: center;
|
347 |
-
}
|
348 |
-
span.smaller {
|
349 |
-
font-size: 0.7em;
|
350 |
-
}
|
351 |
-
span.wplc-stat {
|
352 |
-
font-size: 4em;
|
353 |
-
}
|
354 |
-
|
355 |
-
.wplc_material_panel {
|
356 |
-
background: #fff;
|
357 |
-
box-sizing: border-box;
|
358 |
-
padding: 10px;
|
359 |
-
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.00), 0 1px 15px rgba(0, 0, 0, 0.04);
|
360 |
-
border-radius: 2px;
|
361 |
-
overflow: auto;
|
362 |
-
max-width: 100%;
|
363 |
-
width: 100%;
|
364 |
-
white-space: normal;
|
365 |
-
}
|
366 |
-
|
367 |
-
.wplc_panel_title {
|
368 |
-
margin-top: 0;
|
369 |
-
}
|
370 |
-
|
371 |
-
.wplc_panel_row {
|
372 |
-
display: block !important;
|
373 |
-
width: 100% !important;
|
374 |
-
}
|
375 |
-
|
376 |
-
.wplc_panel_row iframe {
|
377 |
-
display: block !important;
|
378 |
-
}
|
379 |
-
|
380 |
-
.wplc_post,
|
381 |
-
.wplc_post_excerpt{
|
382 |
-
width: 100%;
|
383 |
-
max-width: 100%;
|
384 |
-
}
|
385 |
-
.wplc_post_readmore a,
|
386 |
-
.wplc_readmore{
|
387 |
-
color: orange !important;
|
388 |
-
text-decoration: none;
|
389 |
-
}
|
390 |
-
|
391 |
-
.wplc_post_readmore a:hover,
|
392 |
-
.wplc_readmore:hover {
|
393 |
-
text-decoration: underline;
|
394 |
-
}
|
395 |
-
|
396 |
-
.wplc_readmore {
|
397 |
-
padding: 10px;
|
398 |
-
padding-top: 0;
|
399 |
-
display: block;
|
400 |
-
}
|
401 |
-
|
402 |
-
.wplc_post {
|
403 |
-
border-bottom: 1px solid #eee;
|
404 |
-
padding: 10px 0;
|
405 |
-
box-sizing: border-box;
|
406 |
-
}
|
407 |
-
|
408 |
-
|
409 |
-
.wplc_post:last-of-type {
|
410 |
-
border: none !important;
|
411 |
-
}
|
412 |
-
|
413 |
-
.wplc_post_title {
|
414 |
-
font-weight: 800;
|
415 |
-
color: #656565;
|
416 |
-
font-size: 14px;
|
417 |
-
}
|
418 |
-
|
419 |
-
.wplc_panel_row {
|
420 |
-
padding: 10px;
|
421 |
-
box-sizing: border-box;
|
422 |
-
}
|
423 |
-
|
424 |
-
.wplc_panel_inner_title {
|
425 |
-
font-weight: 800;
|
426 |
-
font-size: 15px;
|
427 |
-
margin-bottom: 10px;
|
428 |
-
display: block;
|
429 |
-
}
|
430 |
-
.wplc_incident {
|
431 |
-
border-bottom: 1px solid #eee;
|
432 |
-
padding: 10px 0;
|
433 |
-
}
|
434 |
-
|
435 |
-
.wplc_incident_info {
|
436 |
-
margin-top: 10px !important;
|
437 |
-
}
|
438 |
-
|
439 |
-
|
440 |
-
.wplc_incident_value,
|
441 |
-
.wplc_module_value{
|
442 |
-
|
443 |
-
text-transform: capitalize;
|
444 |
-
}
|
445 |
-
|
446 |
-
#wplc_dashboard_page_title {
|
447 |
-
padding: 15px;
|
448 |
-
padding-bottom: 0;
|
449 |
-
}
|
1 |
+
|
2 |
+
/**
|
3 |
+
* Settings
|
4 |
+
*/
|
5 |
+
|
6 |
+
#wplc_settings .tooltip {
|
7 |
+
background-color: #333;
|
8 |
+
color: #eee;
|
9 |
+
padding: 15px;
|
10 |
+
border-radius: 15px;
|
11 |
+
opacity: 0.8;
|
12 |
+
}
|
13 |
+
|
14 |
+
#wplc_settings .form-table td {
|
15 |
+
font-size: 13px !important;
|
16 |
+
line-height: 1.5em !important;
|
17 |
+
}
|
18 |
+
|
19 |
+
|
20 |
+
.wplc-extension-label-box {
|
21 |
+
display:block;
|
22 |
+
overflow:auto;
|
23 |
+
clear:both;
|
24 |
+
}
|
25 |
+
.wplc-extension-label {
|
26 |
+
display:block;
|
27 |
+
float:left;
|
28 |
+
padding:5px;
|
29 |
+
margin-right:5px;
|
30 |
+
font-size:0.8em;
|
31 |
+
background-color:#bbb;
|
32 |
+
color:#FFF;
|
33 |
+
webkit-border-radius: 5px;
|
34 |
+
-moz-border-radius: 5px;
|
35 |
+
border-radius: 5px;
|
36 |
+
}
|
37 |
+
|
38 |
+
|
39 |
+
#wplc_tabs {
|
40 |
+
box-shadow: 0 0 40px 1px rgba(0,0,0,.07);
|
41 |
+
-webkit-box-shadow: 0 0 40px 1px rgba(0,0,0,.07);
|
42 |
+
-moz-box-shadow: 0 0 40px 1px rgba(0,0,0,.07);
|
43 |
+
-o-box-shadow: 0 0 40px 1px rgba(0,0,0,.07);
|
44 |
+
}
|
45 |
+
|
46 |
+
|
47 |
+
.wplc-extension {
|
48 |
+
|
49 |
+
float: left;
|
50 |
+
margin: 0 1% 1% 0;
|
51 |
+
background: #fff;
|
52 |
+
border: 1px solid #ccc;
|
53 |
+
width: 320px;
|
54 |
+
padding: 14px;
|
55 |
+
height: 370px;
|
56 |
+
position: relative;
|
57 |
+
|
58 |
+
}
|
59 |
+
.wplc-extension h3 {
|
60 |
+
margin: 0 0 8px;
|
61 |
+
font-size: 13px;
|
62 |
+
|
63 |
+
}
|
64 |
+
|
65 |
+
.wplc-extension .button-secondary {
|
66 |
+
position: absolute;
|
67 |
+
bottom: 14px;
|
68 |
+
left: 14px;
|
69 |
+
}
|
70 |
+
.wplc-plugin {
|
71 |
+
height: 250px;
|
72 |
+
}
|
73 |
+
|
74 |
+
|
75 |
+
.wplc_header_vh {
|
76 |
+
font: bold 14px/26px Arial;
|
77 |
+
padding: 0 0 0 0px;
|
78 |
+
color: #C2BBBE;
|
79 |
+
display: block;
|
80 |
+
text-transform: uppercase;
|
81 |
+
display:block;
|
82 |
+
}
|
83 |
+
.wplc_headerspan_v { min-width:120px; width:20%; display:block; }
|
84 |
+
.wplc_headerspan_nr { min-width:60px; width:10%; display:block; }
|
85 |
+
.wplc_headerspan_dev { min-width:60px; width:10%; display:block; }
|
86 |
+
.wplc_headerspan_d { min-width:200px; width:30%; display:block; }
|
87 |
+
.wplc_headerspan_d a { font-style: italic; }
|
88 |
+
.wplc_headerspan_t { min-width:60px; width:9%; display:block; }
|
89 |
+
.wplc_headerspan_s { min-width:80px; width:12%; display:block; }
|
90 |
+
.wplc_headerspan_a { min-width:100px; width:15%; display:block; }
|
91 |
+
.wplc_chat_ul_header {
|
92 |
+
clear: both;
|
93 |
+
overflow:auto;
|
94 |
+
display:block;
|
95 |
+
padding:10px;
|
96 |
+
}
|
97 |
+
|
98 |
+
|
99 |
+
.relevant_extension p {
|
100 |
+
margin-top:2px;
|
101 |
+
}
|
102 |
+
.relevant_extension h3 {
|
103 |
+
margin-bottom:2px;
|
104 |
+
}
|
105 |
+
.relevant_extension {
|
106 |
+
width: 49% !important;
|
107 |
+
height: 125px !important;
|
108 |
+
opacity:0.5;
|
109 |
+
}
|
110 |
+
.relevant_extension:hover {
|
111 |
+
opacity:1.0;
|
112 |
+
}
|
113 |
+
|
114 |
+
|
115 |
+
.relevant_extension .button-secondary {
|
116 |
+
right:10px !important;
|
117 |
+
left: initial !important;
|
118 |
+
|
119 |
+
}
|
120 |
+
|
121 |
+
|
122 |
+
.relevant_extension img {
|
123 |
+
margin-right:10px;
|
124 |
+
}
|
125 |
+
|
126 |
+
|
127 |
+
|
128 |
+
@media (min-width:320px) {
|
129 |
+
/* smartphones, portrait iPhone, portrait 480x320 phones (Android) */
|
130 |
+
.relevant_extension {
|
131 |
+
width: 85% !important;
|
132 |
+
height: 145px !important;
|
133 |
+
opacity:0.5;
|
134 |
+
}
|
135 |
+
.relevant_extension img {
|
136 |
+
width:105px;
|
137 |
+
}
|
138 |
+
.wplc-extension .wp-post-image {
|
139 |
+
height: auto;
|
140 |
+
}
|
141 |
+
}
|
142 |
+
@media (min-width:480px) {
|
143 |
+
/* smartphones, Android phones, landscape iPhone */
|
144 |
+
.relevant_extension {
|
145 |
+
width: 94% !important;
|
146 |
+
height: 125px !important;
|
147 |
+
opacity:0.5;
|
148 |
+
}
|
149 |
+
.relevant_extension img {
|
150 |
+
width:105px;
|
151 |
+
}
|
152 |
+
.wplc-extension .wp-post-image {
|
153 |
+
height: auto;
|
154 |
+
}
|
155 |
+
}
|
156 |
+
@media (min-width:600px) {
|
157 |
+
/* portrait tablets, portrait iPad, e-readers (Nook/Kindle), landscape 800x480 phones (Android) */
|
158 |
+
.relevant_extension {
|
159 |
+
width: 94% !important;
|
160 |
+
height: 125px !important;
|
161 |
+
opacity:0.5;
|
162 |
+
}
|
163 |
+
.relevant_extension img {
|
164 |
+
width:105px;
|
165 |
+
}
|
166 |
+
.wplc-extension .wp-post-image {
|
167 |
+
height: auto;
|
168 |
+
}
|
169 |
+
}
|
170 |
+
@media (min-width:801px) {
|
171 |
+
/* tablet, landscape iPad, lo-res laptops ands desktops */
|
172 |
+
.relevant_extension {
|
173 |
+
width: 43% !important;
|
174 |
+
height: 145px !important;
|
175 |
+
opacity:0.5;
|
176 |
+
}
|
177 |
+
.relevant_extension img {
|
178 |
+
width:95px;
|
179 |
+
}
|
180 |
+
.wplc-extension .wp-post-image {
|
181 |
+
height: auto;
|
182 |
+
}
|
183 |
+
}
|
184 |
+
@media (min-width:1025px) {
|
185 |
+
/* big landscape tablets, laptops, and desktops */
|
186 |
+
.relevant_extension {
|
187 |
+
width: 44% !important;
|
188 |
+
height: 125px !important;
|
189 |
+
opacity:0.5;
|
190 |
+
}
|
191 |
+
.relevant_extension img {
|
192 |
+
width:125px;
|
193 |
+
}
|
194 |
+
.wplc-extension .wp-post-image {
|
195 |
+
height: auto;
|
196 |
+
}
|
197 |
+
}
|
198 |
+
@media (min-width:1281px) {
|
199 |
+
/* hi-res laptops and desktops */
|
200 |
+
.relevant_extension {
|
201 |
+
width: 32% !important;
|
202 |
+
height: 125px !important;
|
203 |
+
opacity:0.5;
|
204 |
+
}
|
205 |
+
.relevant_extension img {
|
206 |
+
width:110px;
|
207 |
+
}
|
208 |
+
.wplc-extension .wp-post-image {
|
209 |
+
height: auto;
|
210 |
+
}
|
211 |
+
}
|
212 |
+
|
213 |
+
|
214 |
+
.wplc-palette-selection {
|
215 |
+
border: 1px solid #CCC;
|
216 |
+
border-radius: 5px;
|
217 |
+
padding: 5px;
|
218 |
+
margin: 5px;
|
219 |
+
height:100%;
|
220 |
+
|
221 |
+
}
|
222 |
+
|
223 |
+
.wplc_palette_single {
|
224 |
+
margin: 5px;
|
225 |
+
margin-top: 15px;
|
226 |
+
width: 162px;
|
227 |
+
height: 122px;
|
228 |
+
text-align: center;
|
229 |
+
display: inline-block;
|
230 |
+
vertical-align: top;
|
231 |
+
cursor: pointer;
|
232 |
+
|
233 |
+
}
|
234 |
+
.wplc-palette-top { display:block; width:100%; height:25%; }
|
235 |
+
|
236 |
+
|
237 |
+
|
238 |
+
#wplc_tabs .ui-tabs-anchor {
|
239 |
+
width: 100%;
|
240 |
+
}
|
241 |
+
|
242 |
+
|
243 |
+
|
244 |
+
/* Gutenberg styles */
|
245 |
+
#tabs-gutenberg input[type='button'] {
|
246 |
+
cursor: pointer;
|
247 |
+
}
|
248 |
+
|
249 |
+
#wplc_custom_js_editor, #wplc_custom_css_editor, #wplc_custom_html_editor {
|
250 |
+
width: 560px;
|
251 |
+
height: 285px;
|
252 |
+
margin: 10px 0 10px 0;
|
253 |
+
}
|
254 |
+
|
255 |
+
#wplc_gutenberg_icon {
|
256 |
+
cursor: pointer;
|
257 |
+
}
|
258 |
+
|
259 |
+
.wplc_code {
|
260 |
+
cursor: pointer;
|
261 |
+
transition: all .2s ease-in-out;
|
262 |
+
border-radius: 3px;
|
263 |
+
color: #696969;
|
264 |
+
}
|
265 |
+
|
266 |
+
.wplc_code:hover {
|
267 |
+
background: #d7d7d7;
|
268 |
+
}
|
269 |
+
|
270 |
+
.wplc_code:focus, .wplc_code:active {
|
271 |
+
background: #018add;
|
272 |
+
color: #fff;
|
273 |
+
}
|
274 |
+
|
275 |
+
|
276 |
+
.wplc_agent_container ul {
|
277 |
+
display:block;
|
278 |
+
overflow:auto;
|
279 |
+
}
|
280 |
+
.wplc_agent_container li{
|
281 |
+
display: block;
|
282 |
+
float: left;
|
283 |
+
text-align: center;
|
284 |
+
border: 1px solid #CCC;
|
285 |
+
width:150px;
|
286 |
+
height:310px;
|
287 |
+
padding: 10px;
|
288 |
+
border-radius: 5px;
|
289 |
+
margin: 10px;
|
290 |
+
box-shadow: 2px 2px 2px #CCC;
|
291 |
+
overflow: auto;
|
292 |
+
|
293 |
+
}
|
294 |
+
.wplc_agent_container img{
|
295 |
+
border-radius: 100px;
|
296 |
+
}
|
297 |
+
.wplc_agent_container h3 {
|
298 |
+
font: bold 12px/16px Arial;
|
299 |
+
padding: 0 0 0 0px;
|
300 |
+
color: #C2BBBE;
|
301 |
+
display: block;
|
302 |
+
height:40px;
|
303 |
+
text-transform: uppercase;
|
304 |
+
}
|
305 |
+
.wplc_agent_container small { word-wrap: break-word; display:block; height:50px; }
|
306 |
+
.wplc_agent_container select { width: 120px; }
|
307 |
+
|
308 |
+
.initiate_upsell {
|
309 |
+
position: absolute;
|
310 |
+
bottom: 0;
|
311 |
+
padding: 10px;
|
312 |
+
border-top: 1px solid #ccc;
|
313 |
+
width: 100%;
|
314 |
+
background-color: #fff;
|
315 |
+
}
|
316 |
+
|
317 |
+
/* Dashboard Page Styles */
|
318 |
+
#wplc_dashboard_container {
|
319 |
+
box-sizing: border-box;
|
320 |
+
}
|
321 |
+
.wplc_panel_col {
|
322 |
+
display: inline-block !important;
|
323 |
+
box-sizing: border-box;
|
324 |
+
vertical-align: top;
|
325 |
+
padding: 15px;
|
326 |
+
margin: 0 !important;
|
327 |
+
}
|
328 |
+
|
329 |
+
.wplc_col_12 {
|
330 |
+
width: 100%;
|
331 |
+
}
|
332 |
+
|
333 |
+
.wplc_col_6 {
|
334 |
+
width: 50%;
|
335 |
+
}
|
336 |
+
|
337 |
+
.wplc_col_4 {
|
338 |
+
width: 32%;
|
339 |
+
}
|
340 |
+
|
341 |
+
.wplc_dashboard_row {
|
342 |
+
white-space: nowrap;
|
343 |
+
|
344 |
+
}
|
345 |
+
.wplc-center {
|
346 |
+
text-align: center;
|
347 |
+
}
|
348 |
+
span.smaller {
|
349 |
+
font-size: 0.7em;
|
350 |
+
}
|
351 |
+
span.wplc-stat {
|
352 |
+
font-size: 4em;
|
353 |
+
}
|
354 |
+
|
355 |
+
.wplc_material_panel {
|
356 |
+
background: #fff;
|
357 |
+
box-sizing: border-box;
|
358 |
+
padding: 10px;
|
359 |
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.00), 0 1px 15px rgba(0, 0, 0, 0.04);
|
360 |
+
border-radius: 2px;
|
361 |
+
overflow: auto;
|
362 |
+
max-width: 100%;
|
363 |
+
width: 100%;
|
364 |
+
white-space: normal;
|
365 |
+
}
|
366 |
+
|
367 |
+
.wplc_panel_title {
|
368 |
+
margin-top: 0;
|
369 |
+
}
|
370 |
+
|
371 |
+
.wplc_panel_row {
|
372 |
+
display: block !important;
|
373 |
+
width: 100% !important;
|
374 |
+
}
|
375 |
+
|
376 |
+
.wplc_panel_row iframe {
|
377 |
+
display: block !important;
|
378 |
+
}
|
379 |
+
|
380 |
+
.wplc_post,
|
381 |
+
.wplc_post_excerpt{
|
382 |
+
width: 100%;
|
383 |
+
max-width: 100%;
|
384 |
+
}
|
385 |
+
.wplc_post_readmore a,
|
386 |
+
.wplc_readmore{
|
387 |
+
color: orange !important;
|
388 |
+
text-decoration: none;
|
389 |
+
}
|
390 |
+
|
391 |
+
.wplc_post_readmore a:hover,
|
392 |
+
.wplc_readmore:hover {
|
393 |
+
text-decoration: underline;
|
394 |
+
}
|
395 |
+
|
396 |
+
.wplc_readmore {
|
397 |
+
padding: 10px;
|
398 |
+
padding-top: 0;
|
399 |
+
display: block;
|
400 |
+
}
|
401 |
+
|
402 |
+
.wplc_post {
|
403 |
+
border-bottom: 1px solid #eee;
|
404 |
+
padding: 10px 0;
|
405 |
+
box-sizing: border-box;
|
406 |
+
}
|
407 |
+
|
408 |
+
|
409 |
+
.wplc_post:last-of-type {
|
410 |
+
border: none !important;
|
411 |
+
}
|
412 |
+
|
413 |
+
.wplc_post_title {
|
414 |
+
font-weight: 800;
|
415 |
+
color: #656565;
|
416 |
+
font-size: 14px;
|
417 |
+
}
|
418 |
+
|
419 |
+
.wplc_panel_row {
|
420 |
+
padding: 10px;
|
421 |
+
box-sizing: border-box;
|
422 |
+
}
|
423 |
+
|
424 |
+
.wplc_panel_inner_title {
|
425 |
+
font-weight: 800;
|
426 |
+
font-size: 15px;
|
427 |
+
margin-bottom: 10px;
|
428 |
+
display: block;
|
429 |
+
}
|
430 |
+
.wplc_incident {
|
431 |
+
border-bottom: 1px solid #eee;
|
432 |
+
padding: 10px 0;
|
433 |
+
}
|
434 |
+
|
435 |
+
.wplc_incident_info {
|
436 |
+
margin-top: 10px !important;
|
437 |
+
}
|
438 |
+
|
439 |
+
|
440 |
+
.wplc_incident_value,
|
441 |
+
.wplc_module_value{
|
442 |
+
|
443 |
+
text-transform: capitalize;
|
444 |
+
}
|
445 |
+
|
446 |
+
#wplc_dashboard_page_title {
|
447 |
+
padding: 15px;
|
448 |
+
padding-bottom: 0;
|
449 |
+
}
|
includes/dashboard_page.php
CHANGED
@@ -1,94 +1,94 @@
|
|
1 |
-
<script>
|
2 |
-
var nifty_api_key = '<?php echo get_option("wplc_node_server_secret_token"); ?>';
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
</script>
|
7 |
-
|
8 |
-
<?php
|
9 |
-
$user = wp_get_current_user();
|
10 |
-
|
11 |
-
global $wpdb;
|
12 |
-
global $wplc_tblname_chats;
|
13 |
-
$sql = "SELECT COUNT(id) as total_chats FROM `$wplc_tblname_chats` WHERE `agent_id` <> 0";
|
14 |
-
$results = $wpdb->get_row( $sql );
|
15 |
-
if ($results) {
|
16 |
-
$total_count = $results->total_chats;
|
17 |
-
} else {
|
18 |
-
$total_count = 0;
|
19 |
-
}
|
20 |
-
?>
|
21 |
-
|
22 |
-
<div class="wrap wplc_wrap">
|
23 |
-
<h2 id="wplc_dashboard_page_title"><?php _e( 'WP Live Chat Support Dashboard', 'wplivechat' ) ?></h2>
|
24 |
-
<div class="wplc_dashboard_container">
|
25 |
-
|
26 |
-
|
27 |
-
<div class="wplc_dashboard_row">
|
28 |
-
<div class="wplc_panel_col wplc_col_6">
|
29 |
-
<div class="wplc_panel">
|
30 |
-
<h3 class="wplc_panel_title"><?php printf( __( 'Welcome, %s', 'wplivechat' ), $user->display_name ); ?></h3>
|
31 |
-
</div>
|
32 |
-
</div>
|
33 |
-
<div class="wplc_panel_col wplc_col_6">
|
34 |
-
<div class="wplc_panel pull-right">
|
35 |
-
<em style='dispaly:block; float:left; margin-top:0px; margin-right:5px;'>A product of </em><a href='https://bleeper.io/?utm_source=wplc&utm_medium=link&utm_campaign=dash' target='_BLANK' title='Bleeper.io' border='0'><img src='https://bleeper.io/assets/images/bleeper-logo.png' alt='Bleeper - A Customer Communication Tool for Startups and Founders' title='Bleeper - A Customer Communication Tool for Startups and Founders' border='0' style='height:20px;'/></a>
|
36 |
-
</div>
|
37 |
-
</div>
|
38 |
-
</div>
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
<div class="wplc_dashboard_row">
|
43 |
-
<div class="wplc_panel_col wplc_col_12">
|
44 |
-
<div class="wplc_panel">
|
45 |
-
<div class="wplc_material_panel">
|
46 |
-
|
47 |
-
|
48 |
-
<div class="wplc_panel_col wplc_col_4 wplc-center">
|
49 |
-
<h4><?php _e("Actions","wplivechat"); ?></h4>
|
50 |
-
<p><a href='admin.php?page=wplivechat-menu&subaction=override' class='button-primary'><?php echo __("Chat with Visitors","wplivechat"); ?></a></p>
|
51 |
-
<p><a href='admin.php?page=wplivechat-menu-settings' class='button-secondary'><?php echo __("Settings","wplivechat"); ?></a></p>
|
52 |
-
</div>
|
53 |
-
|
54 |
-
<div class="wplc_panel_col wplc_col_4 wplc-center">
|
55 |
-
<h4><?php _e("Active Visitors","wplivechat"); ?><br /> </h4>
|
56 |
-
<span class='wplc-stat' id='totalVisitors'>...</span>
|
57 |
-
<p><a href='admin.php?page=wplivechat-menu&subaction=override' class='button-secondary'><?php echo __("Chat now","wplivechat"); ?></a></p>
|
58 |
-
</div>
|
59 |
-
|
60 |
-
<div class="wplc_panel_col wplc_col_4 wplc-center">
|
61 |
-
<h4><?php _e("Conversations","wplivechat"); ?><br /><span class='smaller'><?php _e("Last 90 days","wplivechat"); ?></span></h4>
|
62 |
-
<span class='wplc-stat'><?php echo $total_count; ?></span>
|
63 |
-
</div>
|
64 |
-
|
65 |
-
|
66 |
-
</div>
|
67 |
-
</div>
|
68 |
-
</div>
|
69 |
-
</div>
|
70 |
-
|
71 |
-
<script type="text/javascript">
|
72 |
-
function resizeIframe(iframe) {
|
73 |
-
setTimeout(function() {
|
74 |
-
iframe.height = iframe.contentWindow.document.body.scrollHeight + "px";
|
75 |
-
},3000);
|
76 |
-
|
77 |
-
}
|
78 |
-
</script>
|
79 |
-
|
80 |
-
<div class="wplc_dashboard_row">
|
81 |
-
<div class="wplc_panel_col wplc_col_12">
|
82 |
-
<div class="wplc_panel">
|
83 |
-
|
84 |
-
|
85 |
-
<div class="resp-container">
|
86 |
-
<iframe onload="resizeIframe(this)" id="idIframe" class="resp-iframe" width="100%" height="1300" src="https://bleeper.io/app/external-dashboard/"></iframe>
|
87 |
-
</div>
|
88 |
-
|
89 |
-
</div>
|
90 |
-
</div>
|
91 |
-
</div>
|
92 |
-
|
93 |
-
</div>
|
94 |
</div>
|
1 |
+
<script>
|
2 |
+
var nifty_api_key = '<?php echo get_option("wplc_node_server_secret_token"); ?>';
|
3 |
+
|
4 |
+
|
5 |
+
|
6 |
+
</script>
|
7 |
+
|
8 |
+
<?php
|
9 |
+
$user = wp_get_current_user();
|
10 |
+
|
11 |
+
global $wpdb;
|
12 |
+
global $wplc_tblname_chats;
|
13 |
+
$sql = "SELECT COUNT(id) as total_chats FROM `$wplc_tblname_chats` WHERE `agent_id` <> 0";
|
14 |
+
$results = $wpdb->get_row( $sql );
|
15 |
+
if ($results) {
|
16 |
+
$total_count = $results->total_chats;
|
17 |
+
} else {
|
18 |
+
$total_count = 0;
|
19 |
+
}
|
20 |
+
?>
|
21 |
+
|
22 |
+
<div class="wrap wplc_wrap">
|
23 |
+
<h2 id="wplc_dashboard_page_title"><?php _e( 'WP Live Chat Support Dashboard', 'wplivechat' ) ?></h2>
|
24 |
+
<div class="wplc_dashboard_container">
|
25 |
+
|
26 |
+
|
27 |
+
<div class="wplc_dashboard_row">
|
28 |
+
<div class="wplc_panel_col wplc_col_6">
|
29 |
+
<div class="wplc_panel">
|
30 |
+
<h3 class="wplc_panel_title"><?php printf( __( 'Welcome, %s', 'wplivechat' ), $user->display_name ); ?></h3>
|
31 |
+
</div>
|
32 |
+
</div>
|
33 |
+
<div class="wplc_panel_col wplc_col_6">
|
34 |
+
<div class="wplc_panel pull-right">
|
35 |
+
<em style='dispaly:block; float:left; margin-top:0px; margin-right:5px;'>A product of </em><a href='https://bleeper.io/?utm_source=wplc&utm_medium=link&utm_campaign=dash' target='_BLANK' title='Bleeper.io' border='0'><img src='https://bleeper.io/assets/images/bleeper-logo.png' alt='Bleeper - A Customer Communication Tool for Startups and Founders' title='Bleeper - A Customer Communication Tool for Startups and Founders' border='0' style='height:20px;'/></a>
|
36 |
+
</div>
|
37 |
+
</div>
|
38 |
+
</div>
|
39 |
+
|
40 |
+
|
41 |
+
|
42 |
+
<div class="wplc_dashboard_row">
|
43 |
+
<div class="wplc_panel_col wplc_col_12">
|
44 |
+
<div class="wplc_panel">
|
45 |
+
<div class="wplc_material_panel">
|
46 |
+
|
47 |
+
|
48 |
+
<div class="wplc_panel_col wplc_col_4 wplc-center">
|
49 |
+
<h4><?php _e("Actions","wplivechat"); ?></h4>
|
50 |
+
<p><a href='admin.php?page=wplivechat-menu&subaction=override' class='button-primary'><?php echo __("Chat with Visitors","wplivechat"); ?></a></p>
|
51 |
+
<p><a href='admin.php?page=wplivechat-menu-settings' class='button-secondary'><?php echo __("Settings","wplivechat"); ?></a></p>
|
52 |
+
</div>
|
53 |
+
|
54 |
+
<div class="wplc_panel_col wplc_col_4 wplc-center">
|
55 |
+
<h4><?php _e("Active Visitors","wplivechat"); ?><br /> </h4>
|
56 |
+
<span class='wplc-stat' id='totalVisitors'>...</span>
|
57 |
+
<p><a href='admin.php?page=wplivechat-menu&subaction=override' class='button-secondary'><?php echo __("Chat now","wplivechat"); ?></a></p>
|
58 |
+
</div>
|
59 |
+
|
60 |
+
<div class="wplc_panel_col wplc_col_4 wplc-center">
|
61 |
+
<h4><?php _e("Conversations","wplivechat"); ?><br /><span class='smaller'><?php _e("Last 90 days","wplivechat"); ?></span></h4>
|
62 |
+
<span class='wplc-stat'><?php echo $total_count; ?></span>
|
63 |
+
</div>
|
64 |
+
|
65 |
+
|
66 |
+
</div>
|
67 |
+
</div>
|
68 |
+
</div>
|
69 |
+
</div>
|
70 |
+
|
71 |
+
<script type="text/javascript">
|
72 |
+
function resizeIframe(iframe) {
|
73 |
+
setTimeout(function() {
|
74 |
+
iframe.height = iframe.contentWindow.document.body.scrollHeight + "px";
|
75 |
+
},3000);
|
76 |
+
|
77 |
+
}
|
78 |
+
</script>
|
79 |
+
|
80 |
+
<div class="wplc_dashboard_row">
|
81 |
+
<div class="wplc_panel_col wplc_col_12">
|
82 |
+
<div class="wplc_panel">
|
83 |
+
|
84 |
+
|
85 |
+
<div class="resp-container">
|
86 |
+
<iframe onload="resizeIframe(this)" id="idIframe" class="resp-iframe" width="100%" height="1300" src="https://bleeper.io/app/external-dashboard/"></iframe>
|
87 |
+
</div>
|
88 |
+
|
89 |
+
</div>
|
90 |
+
</div>
|
91 |
+
</div>
|
92 |
+
|
93 |
+
</div>
|
94 |
</div>
|
js/wplc_dashboard.js
CHANGED
@@ -1,91 +1,91 @@
|
|
1 |
-
var wplcApiUrls = {
|
2 |
-
blogFeedUrl: 'https://bleeper.io/blog/wp-json/wp/v2/posts',
|
3 |
-
statusPageComponentsURL: 'https://bleeper.statuspage.io/api/v2/components.json',
|
4 |
-
statusPageIncidentsURL: 'https://bleeper.statuspage.io/api/v2/incidents.json',
|
5 |
-
visitorURL: 'https://bleeper-eu-1.eu-4.evennode.com/api/v1/total-visitors-online?api_key='+nifty_api_key
|
6 |
-
}
|
7 |
-
|
8 |
-
function getTotalVisitors() {
|
9 |
-
jQuery.getJSON( wplcApiUrls.visitorURL, function( data ) {
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
jQuery('#totalVisitors').html( data );
|
14 |
-
});
|
15 |
-
|
16 |
-
}
|
17 |
-
|
18 |
-
function getBlogPosts() {
|
19 |
-
jQuery.getJSON( wplcApiUrls.blogFeedUrl, function( data ) {
|
20 |
-
|
21 |
-
const limit = 5;
|
22 |
-
let output = '';
|
23 |
-
|
24 |
-
for (let i in data){
|
25 |
-
if(i >= limit){
|
26 |
-
continue;
|
27 |
-
}
|
28 |
-
|
29 |
-
const post = data[i];
|
30 |
-
const html = `<div class='wplc_post'>
|
31 |
-
<div class='wplc_post_title'>${post.title.rendered}</div>
|
32 |
-
<p class='wplc_post_excerpt'>${post.excerpt.rendered}</p>
|
33 |
-
<div class='wplc_post_readmore'>
|
34 |
-
<a href='${post.link}' target='_BLANK' title='${post.title.rendered}'>Read More</a>
|
35 |
-
</div>
|
36 |
-
</div>`;
|
37 |
-
output += html;
|
38 |
-
}
|
39 |
-
|
40 |
-
jQuery('#wplc_blog_posts').html( output );
|
41 |
-
|
42 |
-
});
|
43 |
-
}
|
44 |
-
|
45 |
-
function getStatusComponents() {
|
46 |
-
jQuery.getJSON( wplcApiUrls.statusPageComponentsURL, function( data ) {
|
47 |
-
|
48 |
-
let output = '';
|
49 |
-
|
50 |
-
if(typeof data.components !== 'undefined'){
|
51 |
-
for(let i in data.components){
|
52 |
-
const component = data.components[i];
|
53 |
-
const html = `<div class='wplc_module'>${component.name}: <strong class='wplc_module_value'>${component.status}</strong></div>`;
|
54 |
-
output += html;
|
55 |
-
}
|
56 |
-
}
|
57 |
-
|
58 |
-
jQuery('#wplc_status_modules').html( output );
|
59 |
-
});
|
60 |
-
}
|
61 |
-
|
62 |
-
|
63 |
-
function getStatusIncidents() {
|
64 |
-
jQuery.getJSON( wplcApiUrls.statusPageIncidentsURL, function( data ) {
|
65 |
-
|
66 |
-
let output = '';
|
67 |
-
|
68 |
-
if(typeof data.incidents !== 'undefined'){
|
69 |
-
for(let i in data.incidents){
|
70 |
-
const incident = data.incidents[i];
|
71 |
-
|
72 |
-
const months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
73 |
-
const date = new Date(incident.created_at);
|
74 |
-
|
75 |
-
const last_report = typeof incident.incident_updates !== 'undefined' && typeof incident.incident_updates[0] !== 'undefined' && incident.incident_updates[0].body !== 'undefined' ? incident.incident_updates[0].body : incident.name;
|
76 |
-
|
77 |
-
const html = `<div class='wplc_incident'>${date.getDate()} ${months[date.getMonth()]} ${date.getFullYear()}: <strong class='wplc_incident_value'>${incident.status}</strong><div class='wplc_incident_info'>${last_report}</div></div>`;
|
78 |
-
output += html;
|
79 |
-
}
|
80 |
-
}
|
81 |
-
|
82 |
-
jQuery('#wplc_status_incidents').html( output );
|
83 |
-
});
|
84 |
-
}
|
85 |
-
|
86 |
-
jQuery(document).ready(function($){
|
87 |
-
getBlogPosts();
|
88 |
-
getStatusComponents();
|
89 |
-
getStatusIncidents();
|
90 |
-
getTotalVisitors();
|
91 |
});
|
1 |
+
var wplcApiUrls = {
|
2 |
+
blogFeedUrl: 'https://bleeper.io/blog/wp-json/wp/v2/posts',
|
3 |
+
statusPageComponentsURL: 'https://bleeper.statuspage.io/api/v2/components.json',
|
4 |
+
statusPageIncidentsURL: 'https://bleeper.statuspage.io/api/v2/incidents.json',
|
5 |
+
visitorURL: 'https://bleeper-eu-1.eu-4.evennode.com/api/v1/total-visitors-online?api_key='+nifty_api_key
|
6 |
+
}
|
7 |
+
|
8 |
+
function getTotalVisitors() {
|
9 |
+
jQuery.getJSON( wplcApiUrls.visitorURL, function( data ) {
|
10 |
+
|
11 |
+
|
12 |
+
|
13 |
+
jQuery('#totalVisitors').html( data );
|
14 |
+
});
|
15 |
+
|
16 |
+
}
|
17 |
+
|
18 |
+
function getBlogPosts() {
|
19 |
+
jQuery.getJSON( wplcApiUrls.blogFeedUrl, function( data ) {
|
20 |
+
|
21 |
+
const limit = 5;
|
22 |
+
let output = '';
|
23 |
+
|
24 |
+
for (let i in data){
|
25 |
+
if(i >= limit){
|
26 |
+
continue;
|
27 |
+
}
|
28 |
+
|
29 |
+
const post = data[i];
|
30 |
+
const html = `<div class='wplc_post'>
|
31 |
+
<div class='wplc_post_title'>${post.title.rendered}</div>
|
32 |
+
<p class='wplc_post_excerpt'>${post.excerpt.rendered}</p>
|
33 |
+
<div class='wplc_post_readmore'>
|
34 |
+
<a href='${post.link}' target='_BLANK' title='${post.title.rendered}'>Read More</a>
|
35 |
+
</div>
|
36 |
+
</div>`;
|
37 |
+
output += html;
|
38 |
+
}
|
39 |
+
|
40 |
+
jQuery('#wplc_blog_posts').html( output );
|
41 |
+
|
42 |
+
});
|
43 |
+
}
|
44 |
+
|
45 |
+
function getStatusComponents() {
|
46 |
+
jQuery.getJSON( wplcApiUrls.statusPageComponentsURL, function( data ) {
|
47 |
+
|
48 |
+
let output = '';
|
49 |
+
|
50 |
+
if(typeof data.components !== 'undefined'){
|
51 |
+
for(let i in data.components){
|
52 |
+
const component = data.components[i];
|
53 |
+
const html = `<div class='wplc_module'>${component.name}: <strong class='wplc_module_value'>${component.status}</strong></div>`;
|
54 |
+
output += html;
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
jQuery('#wplc_status_modules').html( output );
|
59 |
+
});
|
60 |
+
}
|
61 |
+
|
62 |
+
|
63 |
+
function getStatusIncidents() {
|
64 |
+
jQuery.getJSON( wplcApiUrls.statusPageIncidentsURL, function( data ) {
|
65 |
+
|
66 |
+
let output = '';
|
67 |
+
|
68 |
+
if(typeof data.incidents !== 'undefined'){
|
69 |
+
for(let i in data.incidents){
|
70 |
+
const incident = data.incidents[i];
|
71 |
+
|
72 |
+
const months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
73 |
+
const date = new Date(incident.created_at);
|
74 |
+
|
75 |
+
const last_report = typeof incident.incident_updates !== 'undefined' && typeof incident.incident_updates[0] !== 'undefined' && incident.incident_updates[0].body !== 'undefined' ? incident.incident_updates[0].body : incident.name;
|
76 |
+
|
77 |
+
const html = `<div class='wplc_incident'>${date.getDate()} ${months[date.getMonth()]} ${date.getFullYear()}: <strong class='wplc_incident_value'>${incident.status}</strong><div class='wplc_incident_info'>${last_report}</div></div>`;
|
78 |
+
output += html;
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
jQuery('#wplc_status_incidents').html( output );
|
83 |
+
});
|
84 |
+
}
|
85 |
+
|
86 |
+
jQuery(document).ready(function($){
|
87 |
+
getBlogPosts();
|
88 |
+
getStatusComponents();
|
89 |
+
getStatusIncidents();
|
90 |
+
getTotalVisitors();
|
91 |
});
|
modules/gdpr.php
CHANGED
@@ -1,765 +1,765 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* GDPR Compliance Module
|
5 |
-
*/
|
6 |
-
|
7 |
-
add_filter("wplc_activate_default_settings_array", "wplc_gdpr_set_default_settings", 10, 1);
|
8 |
-
/*
|
9 |
-
* Sets the default GDPR options
|
10 |
-
*/
|
11 |
-
function wplc_gdpr_set_default_settings($wplc_default_settings_array){
|
12 |
-
//Disabled by default on new installations
|
13 |
-
/*if(is_array($wplc_default_settings_array)){
|
14 |
-
if(!isset($wplc_default_settings_array['wplc_gdpr_enabled'])){
|
15 |
-
//Is not set already
|
16 |
-
//$wplc_default_settings_array['wplc_gdpr_enabled'] = 0;
|
17 |
-
}
|
18 |
-
}*/
|
19 |
-
return $wplc_default_settings_array;
|
20 |
-
}
|
21 |
-
|
22 |
-
add_action("wplc_hook_privacy_options_content", "wplc_gdpr_settings_content", 10, 1);
|
23 |
-
/**
|
24 |
-
* Adds the GDPR sepcific settings to the Privacy tab
|
25 |
-
*/
|
26 |
-
function wplc_gdpr_settings_content($wplc_settings = false){
|
27 |
-
if($wplc_settings === false){ $wplc_settings = get_option("WPLC_SETTINGS"); }
|
28 |
-
|
29 |
-
?>
|
30 |
-
<table class="wp-list-table wplc_list_table widefat fixed striped pages">
|
31 |
-
<tbody>
|
32 |
-
<tr>
|
33 |
-
<td width="250" valign="top">
|
34 |
-
<label for="wplc_gdpr_enabled"><?php _e("Enbled GDPR Compliance", "wplivechat"); ?> <i class="fa fa-question-circle wplc_light_grey wplc_settings_tooltip" title="<?php _e('Disabling will disable all GDPR related options, this is not advised.', 'wplivechat'); ?>"></i></label>
|
35 |
-
</td>
|
36 |
-
<td>
|
37 |
-
<input type="checkbox" name="wplc_gdpr_enabled" value="1" <?php echo(isset($wplc_settings['wplc_gdpr_enabled']) && $wplc_settings['wplc_gdpr_enabled'] == '1' ? 'checked' : ''); ?> >
|
38 |
-
<a href="https://www.eugdpr.org/" target="_blank"><?php _e("Importance of GDPR Compliance", "wplivechat"); ?></a>
|
39 |
-
</td>
|
40 |
-
</tr>
|
41 |
-
|
42 |
-
<tr>
|
43 |
-
<td width="250" valign="top">
|
44 |
-
<label for="wplc_gdpr_notice_company"><?php _e("Company Name", "wplivechat"); ?></label>
|
45 |
-
</td>
|
46 |
-
<td>
|
47 |
-
<input type="text" name="wplc_gdpr_notice_company" value="<?php echo(isset($wplc_settings['wplc_gdpr_notice_company']) ? $wplc_settings['wplc_gdpr_notice_company'] : get_bloginfo('name')); ?>" >
|
48 |
-
</td>
|
49 |
-
</tr>
|
50 |
-
|
51 |
-
<tr>
|
52 |
-
<td width="250" valign="top">
|
53 |
-
<label for="wplc_gdpr_notice_retention_purpose"><?php _e("Retention Purpose", "wplivechat"); ?></label>
|
54 |
-
</td>
|
55 |
-
<td>
|
56 |
-
<input type="text" name="wplc_gdpr_notice_retention_purpose" value="<?php echo(isset($wplc_settings['wplc_gdpr_notice_retention_purpose']) ? $wplc_settings['wplc_gdpr_notice_retention_purpose'] : __('Chat/Support', 'wplivechat')); ?>" >
|
57 |
-
</td>
|
58 |
-
</tr>
|
59 |
-
|
60 |
-
<tr>
|
61 |
-
<td width="250" valign="top">
|
62 |
-
<label for="wplc_gdpr_notice_retention_period"><?php _e("Retention Period", "wplivechat"); ?></label>
|
63 |
-
</td>
|
64 |
-
<td>
|
65 |
-
<input type="number" name="wplc_gdpr_notice_retention_period" value="<?php echo(isset($wplc_settings['wplc_gdpr_notice_retention_period']) ? intval($wplc_settings['wplc_gdpr_notice_retention_period']) < 1 ? 1 : intval($wplc_settings['wplc_gdpr_notice_retention_period']) : 30); ?>" > <?php _e('days', 'wplivechat'); ?>
|
66 |
-
</td>
|
67 |
-
</tr>
|
68 |
-
|
69 |
-
<tr>
|
70 |
-
<td width="250" valign="top">
|
71 |
-
<label><?php _e("Next Check", "wplivechat"); ?>
|
72 |
-
<i class="fa fa-question-circle wplc_light_grey wplc_settings_tooltip" title="<?php _e('When the next cron will run to check for data which is older than our retention period.', 'wplivechat'); ?>"></i>
|
73 |
-
</label>
|
74 |
-
</td>
|
75 |
-
<td>
|
76 |
-
<span>
|
77 |
-
<?php
|
78 |
-
echo date('d-m-Y H:i:s', wp_next_scheduled('wplc_gdpr_cron_hook'));
|
79 |
-
?>
|
80 |
-
</span>
|
81 |
-
</td>
|
82 |
-
</tr>
|
83 |
-
|
84 |
-
<tr>
|
85 |
-
<td width="250" valign="top">
|
86 |
-
<label><?php _e("GDPR Notice", "wplivechat"); ?>
|
87 |
-
<i class="fa fa-question-circle wplc_light_grey wplc_settings_tooltip" title="<?php _e('Users will be asked to accept the notice shown here, in the form of a check box.', 'wplivechat'); ?>"></i>
|
88 |
-
</label>
|
89 |
-
</td>
|
90 |
-
<td>
|
91 |
-
<span>
|
92 |
-
<?php
|
93 |
-
echo wplc_gdpr_generate_retention_agreement_notice($wplc_settings);
|
94 |
-
echo "<br><br>";
|
95 |
-
echo apply_filters('wplc_gdpr_create_opt_in_checkbox_filter', "");
|
96 |
-
?>
|
97 |
-
</span>
|
98 |
-
</td>
|
99 |
-
</tr>
|
100 |
-
|
101 |
-
|
102 |
-
</tbody>
|
103 |
-
</table>
|
104 |
-
<?php
|
105 |
-
}
|
106 |
-
|
107 |
-
add_filter("wplc_settings_save_filter_hook", "wplc_gdpr_settings_save_hooked", 10, 1);
|
108 |
-
/**
|
109 |
-
* Save the settings for GDPR
|
110 |
-
*/
|
111 |
-
function wplc_gdpr_settings_save_hooked($wplc_data){
|
112 |
-
|
113 |
-
if (isset($_POST['wplc_gdpr_enabled'])) {
|
114 |
-
$wplc_data['wplc_gdpr_enabled'] = esc_attr($_POST['wplc_gdpr_enabled']);
|
115 |
-
do_action('wplc_gdpr_reg_cron_hook');
|
116 |
-
|
117 |
-
update_option('WPLC_GDPR_DISABLED_WARNING_DISMISSED', 'false');
|
118 |
-
} else {
|
119 |
-
do_action('wplc_gdpr_de_reg_cron_hook');
|
120 |
-
}
|
121 |
-
|
122 |
-
if (isset($_POST['wplc_gdpr_notice_company'])) { $wplc_data['wplc_gdpr_notice_company'] = esc_attr($_POST['wplc_gdpr_notice_company']); }
|
123 |
-
if (isset($_POST['wplc_gdpr_notice_retention_purpose'])) { $wplc_data['wplc_gdpr_notice_retention_purpose'] = esc_attr($_POST['wplc_gdpr_notice_retention_purpose']); }
|
124 |
-
if (isset($_POST['wplc_gdpr_notice_retention_period'])) { $wplc_data['wplc_gdpr_notice_retention_period'] = esc_attr($_POST['wplc_gdpr_notice_retention_period']); }
|
125 |
-
|
126 |
-
return $wplc_data;
|
127 |
-
}
|
128 |
-
|
129 |
-
|
130 |
-
add_action("wplc_hook_menu", "wplc_gdpr_add_menu");
|
131 |
-
/**
|
132 |
-
* Adds a menu specifically dedicated to GDPR
|
133 |
-
*/
|
134 |
-
function wplc_gdpr_add_menu(){
|
135 |
-
$wplc_settings = get_option("WPLC_SETTINGS");
|
136 |
-
|
137 |
-
if(isset($wplc_settings['wplc_gdpr_enabled']) && $wplc_settings['wplc_gdpr_enabled'] == '1'){
|
138 |
-
add_submenu_page('wplivechat-menu', __('GDPR', 'wplivechat'), __('GDPR', 'wplivechat'), 'manage_options', 'wplivechat-menu-gdpr-page', 'wplc_gdpr_page_layout');
|
139 |
-
}
|
140 |
-
}
|
141 |
-
|
142 |
-
/**
|
143 |
-
* Handles the layout for the GDPR page
|
144 |
-
*/
|
145 |
-
function wplc_gdpr_page_layout(){
|
146 |
-
?>
|
147 |
-
<h2><?php _e('WP Live Chat Support - GDPR', 'wplivechat'); ?></h2>
|
148 |
-
|
149 |
-
<small><em><?php _e("Search is performed on chat sessions, messages, and offline messages. Data will also be deleted automatically per your retention policy.", "wplivechat"); ?></em></small>
|
150 |
-
<?php do_action('wplc_gdpr_page_before_table_hook'); ?>
|
151 |
-
<table class="wp-list-table wplc_list_table widefat fixed striped pages">
|
152 |
-
<thead>
|
153 |
-
<tr>
|
154 |
-
<th></th>
|
155 |
-
<th>
|
156 |
-
</th>
|
157 |
-
<th>
|
158 |
-
<form method="GET" action="">
|
159 |
-
<input type="hidden" name="page" value='wplivechat-menu-gdpr-page'>
|
160 |
-
<input name='term' type="text" value='<?php echo(isset($_GET['term']) ? htmlspecialchars($_GET['term']) : ''); ?>' placeholder="<?php _e('Name, Email, Message', 'wplivechat'); ?>" style='height:30px; width: 70%'>
|
161 |
-
|
162 |
-
<?php do_action('wplc_gdpr_page_search_form_before_submit_hook'); ?>
|
163 |
-
|
164 |
-
<input type='submit' class='button' value="<?php _e("Search", "wplivechat"); ?>" >
|
165 |
-
</form>
|
166 |
-
</th>
|
167 |
-
</tr>
|
168 |
-
</thead>
|
169 |
-
<tbody>
|
170 |
-
<?php
|
171 |
-
if(isset($_GET['term'])){
|
172 |
-
$results = wplc_gdpr_return_chat_session_search_results(htmlspecialchars($_GET['term']));
|
173 |
-
|
174 |
-
foreach ($results as $heading => $sub_results) {
|
175 |
-
$original_heading = $heading;
|
176 |
-
$heading = ucwords(str_replace("_", " ", $heading));
|
177 |
-
$heading = str_replace("%%TABLE%%", $heading, __('Search Results in %%TABLE%%', 'wplivechat'));
|
178 |
-
?>
|
179 |
-
<tr>
|
180 |
-
<td><strong><?php echo $heading; ?></strong></td>
|
181 |
-
<td></td>
|
182 |
-
<td style="text-align: right"><em><?php echo count($sub_results); ?></em></td>
|
183 |
-
</tr>
|
184 |
-
<?php
|
185 |
-
|
186 |
-
/**Setup Defaults*/
|
187 |
-
$cid_identidier = 'id';
|
188 |
-
$action_action_filter = 'chat_session';
|
189 |
-
$show_fields = array('name', 'email');
|
190 |
-
switch ($original_heading) {
|
191 |
-
case 'chat_messages':
|
192 |
-
$cid_identidier = 'chat_sess_id';
|
193 |
-
$show_fields = array('msg');
|
194 |
-
break;
|
195 |
-
case 'offline_messages':
|
196 |
-
$action_action_filter = 'offline_message';
|
197 |
-
$show_fields = array('name', 'email', 'message');
|
198 |
-
break;
|
199 |
-
}
|
200 |
-
|
201 |
-
$action_action_filter = htmlspecialchars($action_action_filter);
|
202 |
-
|
203 |
-
foreach ($sub_results as $key => $value) {
|
204 |
-
$cid = isset($value[$cid_identidier]) ? $value[$cid_identidier] : 'false';
|
205 |
-
$delete_button_text = str_replace("%%CID%%", $cid, __("Delete Chat (%%CID%%)", "wplivechat"));
|
206 |
-
$download_button_text = str_replace("%%CID%%", $cid, __("Download Chat (%%CID%%)", "wplivechat"));
|
207 |
-
|
208 |
-
?>
|
209 |
-
<tr>
|
210 |
-
<td><?php echo(__('Chat ID', 'wplivechat') . ": " . $cid ); ?></td>
|
211 |
-
<td>
|
212 |
-
<?php
|
213 |
-
foreach ($value as $subkey => $sub_val) {
|
214 |
-
if(in_array($subkey, $show_fields)){
|
215 |
-
echo( sanitize_text_field($subkey) . ": " . str_replace("%%BREAK%%", "<br>", sanitize_text_field($sub_val) ) . "<br>");
|
216 |
-
}
|
217 |
-
}
|
218 |
-
?>
|
219 |
-
</td>
|
220 |
-
<td>
|
221 |
-
<a class='button' href='?page=wplivechat-menu-gdpr-page&term=<?php echo(htmlspecialchars($_GET["term"])); ?>&action=delete&filter=<?php echo $action_action_filter; ?>&id=<?php echo htmlspecialchars($cid); ?>'><?php echo $delete_button_text; ?></a>
|
222 |
-
<a class='button button-primary' href='?page=wplivechat-menu-gdpr-page&term=<?php echo(htmlspecialchars($_GET["term"])); ?>&action=download&filter=<?php echo $action_action_filter; ?>&id=<?php echo htmlspecialchars($cid); ?>'><?php echo $download_button_text; ?></a>
|
223 |
-
</td>
|
224 |
-
</tr>
|
225 |
-
<?php
|
226 |
-
}
|
227 |
-
}
|
228 |
-
} else {
|
229 |
-
?>
|
230 |
-
<tr>
|
231 |
-
<td><strong><?php _e('Please perform a search using the input field above', 'wplivechat'); ?></strong></td>
|
232 |
-
<td></td>
|
233 |
-
<td></td>
|
234 |
-
</tr>
|
235 |
-
<?php
|
236 |
-
}
|
237 |
-
?>
|
238 |
-
</tbody>
|
239 |
-
</table>
|
240 |
-
|
241 |
-
<?php do_action('wplc_gdpr_page_after_table_hook'); ?>
|
242 |
-
|
243 |
-
<?php
|
244 |
-
}
|
245 |
-
|
246 |
-
add_action('admin_init', 'wplc_gdpr_admin_init', 1);
|
247 |
-
/**
|
248 |
-
* Runs on admin init, if we are on the GDPR page, we run the check action hook
|
249 |
-
* This will allow us to alter the header if needed for JSON files
|
250 |
-
*/
|
251 |
-
function wplc_gdpr_admin_init(){
|
252 |
-
wplc_gdpr_check_for_cron();
|
253 |
-
|
254 |
-
if(isset($_GET['page']) && $_GET['page'] === 'wplivechat-menu-gdpr-page'){
|
255 |
-
do_action('wplc_gdpr_page_process_actions_hook');
|
256 |
-
}
|
257 |
-
}
|
258 |
-
|
259 |
-
|
260 |
-
add_action('wplc_gdpr_page_process_actions_hook', 'wplc_gdpr_page_process_actions');
|
261 |
-
/**
|
262 |
-
* Handles the magic processing of the GDPR page
|
263 |
-
*/
|
264 |
-
function wplc_gdpr_page_process_actions(){
|
265 |
-
if(isset($_GET['action']) && isset($_GET['filter']) && isset($_GET['id'])){
|
266 |
-
$action = sanitize_text_field($_GET['action']);
|
267 |
-
$filter = sanitize_text_field($_GET['filter']);
|
268 |
-
$id = sanitize_text_field($_GET['id']);
|
269 |
-
|
270 |
-
if($action === 'delete'){
|
271 |
-
wplc_gdpr_delete_chat($filter, $id);
|
272 |
-
} else if($action === 'download'){
|
273 |
-
wplc_gdpr_download_chat($filter, $id);
|
274 |
-
}
|
275 |
-
}
|
276 |
-
}
|
277 |
-
|
278 |
-
/**
|
279 |
-
* Delete a chat
|
280 |
-
*/
|
281 |
-
function wplc_gdpr_delete_chat($filter_type, $cid, $output = true){
|
282 |
-
global $wpdb, $wplc_tblname_offline_msgs, $wplc_tblname_chats, $wplc_tblname_msgs;
|
283 |
-
if($filter_type === 'chat_session'){
|
284 |
-
$wpdb->delete($wplc_tblname_chats, array('id' => $cid));
|
285 |
-
$wpdb->delete($wplc_tblname_msgs, array('chat_sess_id' => $cid));
|
286 |
-
} else if ($filter_type === 'offline_message'){
|
287 |
-
$wpdb->delete($wplc_tblname_offline_msgs, array('id' => $cid));
|
288 |
-
}
|
289 |
-
|
290 |
-
do_action('wplc_gdpr_delete_chat_extend_hook', $filter_type, $cid);
|
291 |
-
|
292 |
-
if($output){
|
293 |
-
$output = "<div class='update-nag' style='margin-top: 0px;margin-bottom: 5px;'>";
|
294 |
-
$output .= "<strong>" . __("Data Deleted", "wplivechat") . "(" . $cid . ")" . "</strong><br>";
|
295 |
-
$output .= "</div>";
|
296 |
-
echo $output;
|
297 |
-
}
|
298 |
-
}
|
299 |
-
|
300 |
-
/**
|
301 |
-
* Download a chat
|
302 |
-
*/
|
303 |
-
function wplc_gdpr_download_chat($filter_type, $cid){
|
304 |
-
global $wpdb, $wplc_tblname_offline_msgs, $wplc_tblname_chats, $wplc_tblname_msgs;
|
305 |
-
if($filter_type === 'chat_session'){
|
306 |
-
$result_chat_session = $wpdb->get_results("SELECT * FROM $wplc_tblname_chats WHERE `id` = '$cid' LIMIT 1", ARRAY_A);
|
307 |
-
$result_chat_messages = $wpdb->get_results("SELECT * FROM $wplc_tblname_msgs WHERE `chat_sess_id` = '$cid'", ARRAY_A);
|
308 |
-
|
309 |
-
if(count($result_chat_session) > 0){
|
310 |
-
$chat_session = $result_chat_session[0];
|
311 |
-
|
312 |
-
$chat_session['messages'] = array();
|
313 |
-
foreach ($result_chat_messages as $key => $value) {
|
314 |
-
$chat_session['messages'][] = $value;
|
315 |
-
}
|
316 |
-
|
317 |
-
$chat_session = apply_filters('wplc_gdpr_download_chat_extender_hook', $chat_session, $cid);
|
318 |
-
|
319 |
-
//var_dump(json_encode($chat_session));
|
320 |
-
|
321 |
-
header('Content-disposition: attachment; filename=chat_export_' . $cid . '.json');
|
322 |
-
header('Content-type: application/json');
|
323 |
-
echo json_encode($chat_session);
|
324 |
-
die(); //Let's stop any further data capture please and thank you
|
325 |
-
}
|
326 |
-
} else if ($filter_type === 'offline_message'){
|
327 |
-
|
328 |
-
}
|
329 |
-
}
|
330 |
-
|
331 |
-
/**
|
332 |
-
* Searches the db for all relevant chat sessions based on the search term
|
333 |
-
*/
|
334 |
-
function wplc_gdpr_return_chat_session_search_results($term){
|
335 |
-
global $wpdb, $wplc_tblname_offline_msgs, $wplc_tblname_chats, $wplc_tblname_msgs;
|
336 |
-
|
337 |
-
$term = sanitize_text_field($term);
|
338 |
-
|
339 |
-
$results_chats = $wpdb->get_results("SELECT * FROM $wplc_tblname_chats WHERE `name` LIKE '%$term%' OR `email` LIKE '%$term%'", ARRAY_A);
|
340 |
-
$results_message = $wpdb->get_results("SELECT * FROM $wplc_tblname_msgs WHERE `msg` LIKE '%$term%'", ARRAY_A);
|
341 |
-
$results_offline = $wpdb->get_results("SELECT * FROM $wplc_tblname_offline_msgs WHERE `name` LIKE '%$term%' OR `email` LIKE '%$term%' OR `message` LIKE '%$term%'", ARRAY_A);
|
342 |
-
|
343 |
-
$formatted_messages = array();
|
344 |
-
foreach ($results_message as $key => $value) {
|
345 |
-
$cid = isset($value['chat_sess_id']) ? $value['chat_sess_id'] : false;
|
346 |
-
if($cid !== false){
|
347 |
-
$msg = maybe_unserialize($value['msg']);
|
348 |
-
$msg = is_array($msg) ? $msg['m'] : $msg;
|
349 |
-
if(!isset($formatted_messages[$cid])){
|
350 |
-
$formatted_messages[$cid]['chat_sess_id'] = $cid;
|
351 |
-
$formatted_messages[$cid]['msg'] = $msg . "%%BREAK%%";
|
352 |
-
} else {
|
353 |
-
$formatted_messages[$cid]['msg'] .= $msg . "%%BREAK%%";
|
354 |
-
}
|
355 |
-
}
|
356 |
-
}
|
357 |
-
|
358 |
-
$return_results = array(
|
359 |
-
'chat_sessions' => $results_chats,
|
360 |
-
'chat_messages' => $formatted_messages,
|
361 |
-
'offline_messages' => $results_offline
|
362 |
-
);
|
363 |
-
|
364 |
-
return $return_results;
|
365 |
-
|
366 |
-
}
|
367 |
-
|
368 |
-
/**
|
369 |
-
* Generates a localized retention notice message
|
370 |
-
*/
|
371 |
-
function wplc_gdpr_generate_retention_agreement_notice($wplc_settings = false){
|
372 |
-
if($wplc_settings === false){ $wplc_settings = get_option("WPLC_SETTINGS"); }
|
373 |
-
|
374 |
-
$localized_notice = __("I agree for my personal data to be processed and for the use of cookies in order to engage in a chat processed by %%COMPANY%%, for the purpose of %%PURPOSE%%, for the time of %%PERIOD%% day(s) as per the GDPR.", "wplivechat");
|
375 |
-
$company_replacement = isset($wplc_settings['wplc_gdpr_notice_company']) ? $wplc_settings['wplc_gdpr_notice_company'] : get_bloginfo('name');
|
376 |
-
$purpose_replacement = isset($wplc_settings['wplc_gdpr_notice_retention_purpose']) ? $wplc_settings['wplc_gdpr_notice_retention_purpose'] : __('Chat/Support', 'wplivechat');
|
377 |
-
$period_replacement = isset($wplc_settings['wplc_gdpr_notice_retention_period']) ? intval($wplc_settings['wplc_gdpr_notice_retention_period']) : 30;
|
378 |
-
|
379 |
-
if($period_replacement < 1){ $period_replacement = 1; }
|
380 |
-
|
381 |
-
$localized_notice = str_replace("%%COMPANY%%", $company_replacement, $localized_notice);
|
382 |
-
$localized_notice = str_replace("%%PURPOSE%%", $purpose_replacement, $localized_notice);
|
383 |
-
$localized_notice = str_replace("%%PERIOD%%", $period_replacement, $localized_notice);
|
384 |
-
|
385 |
-
$localized_notice = apply_filters('wplc_gdpr_retention_agreement_notice_filter', $localized_notice);
|
386 |
-
|
387 |
-
return $localized_notice;
|
388 |
-
}
|
389 |
-
|
390 |
-
add_filter('wplc_gdpr_create_opt_in_checkbox_filter', 'wplc_gdpr_add_wplc_privacy_notice', 10, 1);
|
391 |
-
/**
|
392 |
-
* WPLC Compliance notice and link to policy
|
393 |
-
*/
|
394 |
-
function wplc_gdpr_add_wplc_privacy_notice($content){
|
395 |
-
$link = '<a href="https://wp-livechat.com/privacy-policy/" target="_blank">' . __('Privacy Policy', 'wplivechat') . '</a>';
|
396 |
-
$localized_content = __('We use WP Live Chat Support as our live chat platform. By clicking below to submit this form, you acknowledge that the information you provide now and during the chat will be transferred to WP Live Chat Support for processing in accordance with their %%POLICY_LINK%%.', 'wplivechat');
|
397 |
-
|
398 |
-
$localized_content = str_replace("%%POLICY_LINK%%", $link, $localized_content);
|
399 |
-
$html = "<div class='wplc_gdpr_privacy_notice'>$localized_content</div>";
|
400 |
-
|
401 |
-
return $content . $html;
|
402 |
-
}
|
403 |
-
|
404 |
-
add_action("wplc_before_history_table_hook", "wplc_gdpr_retention_cron_notice");
|
405 |
-
add_action("wplc_hook_chat_missed", "wplc_gdpr_retention_cron_notice");
|
406 |
-
add_action("wplc_hook_offline_messages_display", "wplc_gdpr_retention_cron_notice", 1);
|
407 |
-
/**
|
408 |
-
* Shows a notice which notifies the admin that all messages older than the retention period will be removed
|
409 |
-
*/
|
410 |
-
function wplc_gdpr_retention_cron_notice(){
|
411 |
-
$wplc_settings = get_option("WPLC_SETTINGS");
|
412 |
-
|
413 |
-
if(isset($wplc_settings['wplc_gdpr_enabled']) && $wplc_settings['wplc_gdpr_enabled'] == '1'){
|
414 |
-
$period_replacement = isset($wplc_settings['wplc_gdpr_notice_retention_period']) ? intval($wplc_settings['wplc_gdpr_notice_retention_period']) : 30;
|
415 |
-
|
416 |
-
if($period_replacement < 1){ $period_replacement = 1; }
|
417 |
-
|
418 |
-
$retention_period_message = __("Please note as per the GDPR settings you have selected, all chat data will be retained for %%PERIOD%% day(s).", "wplivechat");
|
419 |
-
$retention_period_message = str_replace("%%PERIOD%%", $period_replacement, $retention_period_message);
|
420 |
-
|
421 |
-
$retention_period_message_alt = __("After this period of time, all chat data older than %%PERIOD%% day(s), will be permanently removed from your server. ", "wplivechat");
|
422 |
-
$retention_period_message_alt = str_replace("%%PERIOD%%", $period_replacement, $retention_period_message_alt);
|
423 |
-
|
424 |
-
$output = "<div class='update-nag' style='margin-top: 0px;margin-bottom: 5px;'>";
|
425 |
-
$output .= "<strong>" . __("GDPR - Data Retention", "wplivechat") . "</strong><br>";
|
426 |
-
$output .= "<p>" . $retention_period_message . "</p>";
|
427 |
-
$output .= "<p>" . $retention_period_message_alt . "</p>";
|
428 |
-
|
429 |
-
$output .= apply_filters('wplc_gdpr_retention_cron_notice_extender_hook', "");
|
430 |
-
|
431 |
-
$output .= "<a class='button' href='?page=wplivechat-menu-settings#tabs-privacy' >" . __("Privacy Settings", "wplivechat") . "</a>";
|
432 |
-
$output .= "</div>";
|
433 |
-
echo $output;
|
434 |
-
|
435 |
-
}
|
436 |
-
}
|
437 |
-
|
438 |
-
add_filter('cron_schedules','wplc_gdpr_custom_cron_schedules', 10, 1);
|
439 |
-
/**
|
440 |
-
* Setup a cron schedule
|
441 |
-
*/
|
442 |
-
function wplc_gdpr_custom_cron_schedules($schedules){
|
443 |
-
if(!isset($schedules["wplc_6_hour"])){
|
444 |
-
$schedules["wplc_6_hour"] = array(
|
445 |
-
'interval' => 6*60*60,
|
446 |
-
'display' => __('Once every 6 hours'));
|
447 |
-
}
|
448 |
-
|
449 |
-
return $schedules;
|
450 |
-
}
|
451 |
-
|
452 |
-
/**
|
453 |
-
* Checks if cron is still registered
|
454 |
-
*/
|
455 |
-
function wplc_gdpr_check_for_cron(){
|
456 |
-
$cron_jobs = get_option( 'cron' );
|
457 |
-
$cron_found = false;
|
458 |
-
foreach ($cron_jobs as $cron_key => $cron_data) {
|
459 |
-
if(is_array($cron_data)){
|
460 |
-
foreach ($cron_data as $cron_inner_key => $cron_inner_data) {
|
461 |
-
if($cron_inner_key === "wplc_gdpr_cron_hook"){
|
462 |
-
$cron_found = true;
|
463 |
-
}
|
464 |
-
}
|
465 |
-
}
|
466 |
-
}
|
467 |
-
|
468 |
-
if(!$cron_found){
|
469 |
-
do_action('wplc_gdpr_reg_cron_hook'); //The cron was unregistered at some point. Lets fix that
|
470 |
-
}
|
471 |
-
}
|
472 |
-
|
473 |
-
add_action('wplc_gdpr_reg_cron_hook', 'wplc_gdpr_register_cron');
|
474 |
-
/**
|
475 |
-
* Cron Register
|
476 |
-
*/
|
477 |
-
function wplc_gdpr_register_cron(){
|
478 |
-
$wplc_settings = get_option('WPLC_SETTINGS');
|
479 |
-
if(isset($wplc_settings['wplc_gdpr_enabled']) && $wplc_settings['wplc_gdpr_enabled'] == '1'){
|
480 |
-
wp_schedule_event( time(), 'wplc_6_hour', 'wplc_gdpr_cron_hook' );
|
481 |
-
}
|
482 |
-
|
483 |
-
}
|
484 |
-
|
485 |
-
add_action('wplc_gdpr_de_reg_cron_hook', 'wplc_gdpr_de_register_cron');
|
486 |
-
/**
|
487 |
-
* Cron De-Register
|
488 |
-
*/
|
489 |
-
function wplc_gdpr_de_register_cron(){
|
490 |
-
wp_clear_scheduled_hook('wplc_gdpr_cron_hook');
|
491 |
-
}
|
492 |
-
|
493 |
-
|
494 |
-
add_action('wplc_gdpr_cron_hook', 'wplc_gdpr_cron_delete_chats');
|
495 |
-
/**
|
496 |
-
* GDPR Cron for deleting chats that are old school
|
497 |
-
*/
|
498 |
-
function wplc_gdpr_cron_delete_chats(){
|
499 |
-
global $wpdb, $wplc_tblname_chats, $wplc_tblname_msgs, $wplc_tblname_offline_msgs;
|
500 |
-
$wplc_settings = get_option("WPLC_SETTINGS");
|
501 |
-
if(isset($wplc_settings['wplc_gdpr_enabled']) && $wplc_settings['wplc_gdpr_enabled'] == '1'){
|
502 |
-
$period_replacement = isset($wplc_settings['wplc_gdpr_notice_retention_period']) ? intval($wplc_settings['wplc_gdpr_notice_retention_period']) : 30;
|
503 |
-
|
504 |
-
if($period_replacement < 1){ $period_replacement = 1; }
|
505 |
-
|
506 |
-
$days_ago = date('Y-m-d', strtotime('-' . $period_replacement . ' days', time()));
|
507 |
-
|
508 |
-
$results_chats = $wpdb->get_results("DELETE FROM $wplc_tblname_chats WHERE `timestamp` < '$days_ago'", ARRAY_A);
|
509 |
-
$results_messages = $wpdb->get_results("DELETE FROM $wplc_tblname_msgs WHERE `timestamp` < '$days_ago'", ARRAY_A);
|
510 |
-
$results_offline = $wpdb->get_results("DELETE FROM $wplc_tblname_offline_msgs WHERE `timestamp` < '$days_ago'", ARRAY_A);
|
511 |
-
|
512 |
-
do_action('wplc_cron_delete_chats_extender', $days_ago);
|
513 |
-
}
|
514 |
-
}
|
515 |
-
|
516 |
-
add_filter('wplc_filter_live_chat_box_html_start_chat_button', 'wplc_gdpr_create_opt_in_checkbox_in_chatbox', 10, 2);
|
517 |
-
add_filter('wplc_filter_live_chat_box_html_send_offline_message_button', 'wplc_gdpr_create_opt_in_checkbox_in_chatbox', 10, 2);
|
518 |
-
/**
|
519 |
-
* Checkbox opt in please
|
520 |
-
*/
|
521 |
-
function wplc_gdpr_create_opt_in_checkbox_in_chatbox($filter_content, $wplc_cid = false){
|
522 |
-
$wplc_settings = get_option("WPLC_SETTINGS");
|
523 |
-
if(isset($wplc_settings['wplc_gdpr_enabled']) && $wplc_settings['wplc_gdpr_enabled'] == '1'){
|
524 |
-
$checkbox = "<input type='checkbox' id='wplc_chat_gdpr_opt_in'> <label for='wplc_chat_gdpr_opt_in'>" . wplc_gdpr_generate_retention_agreement_notice($wplc_settings) . "</label>";
|
525 |
-
|
526 |
-
$checkbox = apply_filters('wplc_gdpr_create_opt_in_checkbox_filter', $checkbox);
|
527 |
-
|
528 |
-
$filter_content = $checkbox . $filter_content;
|
529 |
-
|
530 |
-
}
|
531 |
-
|
532 |
-
return $filter_content;
|
533 |
-
}
|
534 |
-
|
535 |
-
add_filter('wplc_start_button_custom_attributes_filter', 'wplc_gdpr_chat_box_opt_in_custom_attributes', 10, 2);
|
536 |
-
add_filter('wplc_offline_message_button_custom_attributes_filter', 'wplc_gdpr_chat_box_opt_in_custom_attributes', 10, 2);
|
537 |
-
add_filter('wplc_end_button_custom_attributes_filter', 'wplc_gdpr_chat_box_opt_in_custom_attributes', 10, 2);
|
538 |
-
/**
|
539 |
-
* Adds custom attributes to the start chat, and offline messages buttons to prevent click without opt in
|
540 |
-
*/
|
541 |
-
function wplc_gdpr_chat_box_opt_in_custom_attributes($content, $wplc_settings = false){
|
542 |
-
if($wplc_settings === false){ $wplc_settings = get_option("WPLC_SETTINGS"); }
|
543 |
-
|
544 |
-
if(isset($wplc_settings['wplc_gdpr_enabled']) && $wplc_settings['wplc_gdpr_enabled'] == '1'){
|
545 |
-
$content .= " data-wplc-gdpr-enabled='true' ";
|
546 |
-
}
|
547 |
-
|
548 |
-
return $content;
|
549 |
-
}
|
550 |
-
|
551 |
-
add_filter("wplc_filter_inner_live_chat_box_4th_layer", "wplc_gdpr_end_chat_action_prompt", 10, 2);
|
552 |
-
/**
|
553 |
-
* Creates the GDPR end chat notice/prompt
|
554 |
-
*/
|
555 |
-
function wplc_gdpr_end_chat_action_prompt($content, $wplc_settings = false){
|
556 |
-
if($wplc_settings === false){ $wplc_settings = get_option("WPLC_SETTINGS"); }
|
557 |
-
|
558 |
-
$notice_html = "";
|
559 |
-
if(isset($wplc_settings['wplc_gdpr_enabled']) && $wplc_settings['wplc_gdpr_enabled'] == '1'){
|
560 |
-
$remove_data_button = "<button id='wplc_gdpr_remove_data_button' class='wplc-color-bg-1 wplc-color-2' data-wplc-rest-nonce='" . wp_create_nonce('wp_rest'). "' data-wplc-rest-url='" . wplc_gdpr_get_rest_url() ."'>" . __("Delete Chat Data", "wplivechat") . "</button>";
|
561 |
-
$download_data_button = "<button id='wplc_gdpr_download_data_button' class='wplc-color-bg-1 wplc-color-2' data-wplc-init-nonce='" . wp_create_nonce( 'wplc-init-nonce-' . date('Y-m-d') ). "'>" . __("Download Chat Data", "wplivechat") . "</button>";
|
562 |
-
|
563 |
-
$notice_html = "<div class='wplc_in_chat_notice' id='wplc_gdpr_end_chat_notice_container' style='display:none;'>";
|
564 |
-
$notice_html .= "<div class='wplc_in_chat_notice_heading'>" . __("Chat Ended", "wplivechat") . "</div>";
|
565 |
-
$notice_html .= "<div class='wplc_in_chat_notice_content'>" . $download_data_button . " " . $remove_data_button . "</div>";
|
566 |
-
$notice_html .= "</div>";
|
567 |
-
}
|
568 |
-
|
569 |
-
return $notice_html . $content;
|
570 |
-
|
571 |
-
}
|
572 |
-
|
573 |
-
add_action('init', 'wplc_gdpr_front_end_download_chat');
|
574 |
-
/**
|
575 |
-
* Runs a special function on init on the front end of the site. This allows us to write out a json file as long as certain spec is met
|
576 |
-
*/
|
577 |
-
function wplc_gdpr_front_end_download_chat(){
|
578 |
-
if(isset($_GET['wplc_action']) && isset($_GET['wplc_init_nonce']) && isset($_GET['wplc_cid'])){
|
579 |
-
if($_GET['wplc_action'] === 'wplc_gdpr_download_chat_json'){
|
580 |
-
if(wp_verify_nonce( htmlspecialchars($_GET['wplc_init_nonce']), 'wplc-init-nonce-' . date('Y-m-d'))){
|
581 |
-
$chat_id = sanitize_text_field($_GET['wplc_cid']);
|
582 |
-
if( ! filter_var($chat_id, FILTER_VALIDATE_INT) ) {
|
583 |
-
/* We need to identify if this CID is a node CID, and if so, return the WP CID */
|
584 |
-
$chat_id = wplc_return_chat_id_by_rel($chat_id);
|
585 |
-
}
|
586 |
-
wplc_gdpr_download_chat('chat_session', $chat_id);
|
587 |
-
}
|
588 |
-
}
|
589 |
-
}
|
590 |
-
}
|
591 |
-
|
592 |
-
/**
|
593 |
-
* A simle wrapper for getting the rest URL
|
594 |
-
*/
|
595 |
-
function wplc_gdpr_get_rest_url(){
|
596 |
-
if(function_exists('get_rest_url')){
|
597 |
-
return get_rest_url() . "wp_live_chat_support/v1/gdpr";
|
598 |
-
} else {
|
599 |
-
return get_site_url() . "/wp-json/wp_live_chat_support/v1/gdpr";
|
600 |
-
}
|
601 |
-
}
|
602 |
-
|
603 |
-
add_action('wplc_api_route_hook', 'wplc_gdpr_rest_end_points');
|
604 |
-
/**
|
605 |
-
* Adds a special rest end point for processing deleting of chats
|
606 |
-
*/
|
607 |
-
function wplc_gdpr_rest_end_points(){
|
608 |
-
register_rest_route('wp_live_chat_support/v1/gdpr','/delete_chat', array(
|
609 |
-
'methods' => 'GET, POST',
|
610 |
-
'callback' => 'wplc_gdpr_rest_delete_chat',
|
611 |
-
'permission_callback' => 'wplc_gdpr_rest_api_nonce_verify'
|
612 |
-
));
|
613 |
-
}
|
614 |
-
|
615 |
-
/**
|
616 |
-
* GDPR Rest permission checks
|
617 |
-
*/
|
618 |
-
function wplc_gdpr_rest_api_nonce_verify(){
|
619 |
-
// $wplc_rest_access_allowed = wp_verify_nonce( $_REQUEST['wplc_rest_nonce'], 'wplc-gdpr-rest-nonce-' . date('Y-m-d'));
|
620 |
-
|
621 |
-
$wplc_rest_access_allowed = check_ajax_referer('wp_rest', '_nonce' , false);
|
622 |
-
// $wplc_rest_access_allowed = wp_verify_nonce($_REQUEST['wplc_rest_nonce'], 'wplc-gdpr-rest-nonce-' . date('Y-m-d'));
|
623 |
-
|
624 |
-
return $wplc_rest_access_allowed;
|
625 |
-
}
|
626 |
-
|
627 |
-
/**
|
628 |
-
* Handles the deleting of chats via the rest api
|
629 |
-
*/
|
630 |
-
function wplc_gdpr_rest_delete_chat(WP_REST_Request $request ){
|
631 |
-
$return_array = array();
|
632 |
-
if(isset($request)){
|
633 |
-
if(isset($request['wplc_cid'])){
|
634 |
-
$chat_id = sanitize_text_field($request['wplc_cid']);
|
635 |
-
if( ! filter_var($chat_id, FILTER_VALIDATE_INT) ) {
|
636 |
-
/* We need to identify if this CID is a node CID, and if so, return the WP CID */
|
637 |
-
$chat_id = wplc_return_chat_id_by_rel($chat_id);
|
638 |
-
|
639 |
-
}
|
640 |
-
|
641 |
-
wplc_gdpr_delete_chat('chat_session', $chat_id, false);
|
642 |
-
|
643 |
-
$return_array['response'] = __('Complete', 'wplivechat');
|
644 |
-
$return_array['cid'] = $chat_id;
|
645 |
-
}
|
646 |
-
}
|
647 |
-
|
648 |
-
return $return_array;
|
649 |
-
|
650 |
-
}
|
651 |
-
|
652 |
-
add_action('admin_notices', 'wplc_gdpr_disabled_warning');
|
653 |
-
/**
|
654 |
-
* Notice of doom
|
655 |
-
*/
|
656 |
-
function wplc_gdpr_disabled_warning(){
|
657 |
-
|
658 |
-
if(isset($_GET['wplc_gdpr_dismiss_notice'])){
|
659 |
-
update_option('WPLC_GDPR_DISABLED_WARNING_DISMISSED', 'true');
|
660 |
-
}
|
661 |
-
|
662 |
-
if(isset($_GET['page'])){
|
663 |
-
if($_GET['page'] === 'wplivechat-menu-settings'){
|
664 |
-
$wplc_settings = get_option("WPLC_SETTINGS");
|
665 |
-
if(!isset($wplc_settings['wplc_gdpr_enabled']) || $wplc_settings['wplc_gdpr_enabled'] != '1'){
|
666 |
-
$gdpr_disabled_warning_dismissed = get_option('WPLC_GDPR_DISABLED_WARNING_DISMISSED', false);
|
667 |
-
if($gdpr_disabled_warning_dismissed === false || $gdpr_disabled_warning_dismissed === 'false'){
|
668 |
-
$implication_warning = __('GDPR compliance has been disabled, read more about the implications of this here', 'wplivechat');
|
669 |
-
$privacy_warning = __('Additionally please take a look at WP Live Chat Support', 'wplivechat');
|
670 |
-
$final_warning = __('It is highly recommended that you enable GDPR compliance to ensure your user data is regulated.', 'wplivechat');
|
671 |
-
|
672 |
-
$output = "<div class='update-nag' style='margin-bottom: 5px; border-color:#DD0000'>";
|
673 |
-
$output .= "<strong>" . __("Warning - GDPR Compliance Disabled - Action Required", "wplivechat") . "</strong><br>";
|
674 |
-
$output .= "<p>" . $implication_warning . ": <a href='https://www.eugdpr.org/' target='_blank'>" . __('EU GDPR', 'wplivechat') . "</a></p>";
|
675 |
-
$output .= "<p>" . $privacy_warning . " <a href='https://wp-livechat.com/privacy-policy/' target='_blank'>" . __('Privacy Policy', 'wplivechat') . "</a></p>";
|
676 |
-
$output .= "<p>" . $final_warning . "</p>";
|
677 |
-
$output .= "<a class='button' href='?page=wplivechat-menu-settings#tabs-privacy' >" . __("Privacy Settings", "wplivechat") . "</a> ";
|
678 |
-
$output .= "<a class='button' href='?page=" . htmlspecialchars($_GET['page']) ."&wplc_gdpr_dismiss_notice=true' style='color: #fff;background-color: #bb0000;border-color: #c70000;'>" . __("Dismiss & Accept Responsibility", "wplivechat") . "</a>";
|
679 |
-
$output .= "</div>";
|
680 |
-
echo $output;
|
681 |
-
}
|
682 |
-
}
|
683 |
-
}
|
684 |
-
}
|
685 |
-
}
|
686 |
-
|
687 |
-
|
688 |
-
add_filter( 'admin_footer_text', 'wplc_gdpr_footer_mod', 99, 1);
|
689 |
-
/**
|
690 |
-
* Adds the data privacy notices
|
691 |
-
*/
|
692 |
-
function wplc_gdpr_footer_mod( $footer_text ) {
|
693 |
-
if(isset($_GET['page'])){
|
694 |
-
if(strpos($_GET['page'], 'wplivechat') !== FALSE){
|
695 |
-
$footer_text_addition = __( 'Please refer to our %%PRIVACY_LINK%% for information on Data Processing', 'wplivechat' );
|
696 |
-
$footer_text_addition = str_replace("%%PRIVACY_LINK%%", "<a href='' target='_blank'>" . __(
|
697 |
-
"Privacy Policy", "wplivechat") . "</a>", $footer_text_addition);
|
698 |
-
|
699 |
-
return str_replace( '</span>', '', $footer_text ) . ' | ' . $footer_text_addition . '</span>';
|
700 |
-
}
|
701 |
-
}
|
702 |
-
|
703 |
-
return $footer_text;
|
704 |
-
|
705 |
-
}
|
706 |
-
|
707 |
-
add_filter( 'wplc_node_server_us_options_enabled', 'wplc_gdpr_allow_us_servers_check',10 ,2);
|
708 |
-
/**
|
709 |
-
* Checks if GDPR option is enabled so we can force users into the EU
|
710 |
-
*/
|
711 |
-
function wplc_gdpr_allow_us_servers_check($is_allowed, $wplc_settings = false){
|
712 |
-
if($wplc_settings === false){ $wplc_settings = get_option("WPLC_SETTINGS"); }
|
713 |
-
|
714 |
-
if(isset($wplc_settings['wplc_gdpr_enabled']) && $wplc_settings['wplc_gdpr_enabled'] == '1'){
|
715 |
-
return false;
|
716 |
-
}
|
717 |
-
|
718 |
-
return $is_allowed;
|
719 |
-
}
|
720 |
-
|
721 |
-
|
722 |
-
add_filter( 'wplc_node_server_default_selection_override', 'wplc_gdpr_node_server_eu_default_override',10,2);
|
723 |
-
/**
|
724 |
-
* Checks if GDPR option is enabled so we can force users into the EU
|
725 |
-
*/
|
726 |
-
function wplc_gdpr_node_server_eu_default_override($selected, $wplc_settings = false){
|
727 |
-
if($wplc_settings === false){ $wplc_settings = get_option("WPLC_SETTINGS"); }
|
728 |
-
if(isset($wplc_settings['wplc_gdpr_enabled']) && $wplc_settings['wplc_gdpr_enabled'] == '1'){
|
729 |
-
if($selected === 'auto' || $selected === 'us1' || $selected === 'us2'){
|
730 |
-
//This is not allowed in the GDPR
|
731 |
-
$selected = 'eu1';
|
732 |
-
}
|
733 |
-
}
|
734 |
-
|
735 |
-
return $selected;
|
736 |
-
}
|
737 |
-
|
738 |
-
|
739 |
-
add_action('wplc_node_server_selection_notices', 'wplc_gdpr_node_server_override_notice',10,1);
|
740 |
-
/**
|
741 |
-
* Will add a very simple server override if GDPR is enabled
|
742 |
-
*/
|
743 |
-
function wplc_gdpr_node_server_override_notice($wplc_settings = false){
|
744 |
-
if($wplc_settings === false){ $wplc_settings = get_option("WPLC_SETTINGS"); }
|
745 |
-
if(isset($wplc_settings['wplc_gdpr_enabled']) && $wplc_settings['wplc_gdpr_enabled'] == '1'){
|
746 |
-
echo "<small><strong><em>" . __("GDPR Compliance Enabled - Server Selection Limited to EU", "wplivechat") . "</em></strong></small>";
|
747 |
-
}
|
748 |
-
}
|
749 |
-
|
750 |
-
add_filter('wplc_update_settings_between_versions_hook', 'wplc_gdpr_update_settings_between_versions',10,1);
|
751 |
-
/**
|
752 |
-
* This will handle the auto update magic. Although we have a default in place this is far superior as it is a hard data set
|
753 |
-
*/
|
754 |
-
function wplc_gdpr_update_settings_between_versions($wplc_settings){
|
755 |
-
if(is_array($wplc_settings)){
|
756 |
-
$gdpr_enabled_atleast_once_before = get_option('WPLC_GDPR_ENABLED_AT_LEAST_ONCE', false);
|
757 |
-
if($gdpr_enabled_atleast_once_before === false){
|
758 |
-
//Only fire if this user has never had GDPR enabled before
|
759 |
-
update_option('WPLC_GDPR_ENABLED_AT_LEAST_ONCE', 'true');
|
760 |
-
$wplc_settings['wplc_gdpr_enabled'] = '0';
|
761 |
-
}
|
762 |
-
}
|
763 |
-
|
764 |
-
return $wplc_settings;
|
765 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* GDPR Compliance Module
|
5 |
+
*/
|
6 |
+
|
7 |
+
add_filter("wplc_activate_default_settings_array", "wplc_gdpr_set_default_settings", 10, 1);
|
8 |
+
/*
|
9 |
+
* Sets the default GDPR options
|
10 |
+
*/
|
11 |
+
function wplc_gdpr_set_default_settings($wplc_default_settings_array){
|
12 |
+
//Disabled by default on new installations
|
13 |
+
/*if(is_array($wplc_default_settings_array)){
|
14 |
+
if(!isset($wplc_default_settings_array['wplc_gdpr_enabled'])){
|
15 |
+
//Is not set already
|
16 |
+
//$wplc_default_settings_array['wplc_gdpr_enabled'] = 0;
|
17 |
+
}
|
18 |
+
}*/
|
19 |
+
return $wplc_default_settings_array;
|
20 |
+
}
|
21 |
+
|
22 |
+
add_action("wplc_hook_privacy_options_content", "wplc_gdpr_settings_content", 10, 1);
|
23 |
+
/**
|
24 |
+
* Adds the GDPR sepcific settings to the Privacy tab
|
25 |
+
*/
|
26 |
+
function wplc_gdpr_settings_content($wplc_settings = false){
|
27 |
+
if($wplc_settings === false){ $wplc_settings = get_option("WPLC_SETTINGS"); }
|
28 |
+
|
29 |
+
?>
|
30 |
+
<table class="wp-list-table wplc_list_table widefat fixed striped pages">
|
31 |
+
<tbody>
|
32 |
+
<tr>
|
33 |
+
<td width="250" valign="top">
|
34 |
+
<label for="wplc_gdpr_enabled"><?php _e("Enbled GDPR Compliance", "wplivechat"); ?> <i class="fa fa-question-circle wplc_light_grey wplc_settings_tooltip" title="<?php _e('Disabling will disable all GDPR related options, this is not advised.', 'wplivechat'); ?>"></i></label>
|
35 |
+
</td>
|
36 |
+
<td>
|
37 |
+
<input type="checkbox" name="wplc_gdpr_enabled" value="1" <?php echo(isset($wplc_settings['wplc_gdpr_enabled']) && $wplc_settings['wplc_gdpr_enabled'] == '1' ? 'checked' : ''); ?> >
|
38 |
+
<a href="https://www.eugdpr.org/" target="_blank"><?php _e("Importance of GDPR Compliance", "wplivechat"); ?></a>
|
39 |
+
</td>
|
40 |
+
</tr>
|
41 |
+
|
42 |
+
<tr>
|
43 |
+
<td width="250" valign="top">
|
44 |
+
<label for="wplc_gdpr_notice_company"><?php _e("Company Name", "wplivechat"); ?></label>
|
45 |
+
</td>
|
46 |
+
<td>
|
47 |
+
<input type="text" name="wplc_gdpr_notice_company" value="<?php echo(isset($wplc_settings['wplc_gdpr_notice_company']) ? $wplc_settings['wplc_gdpr_notice_company'] : get_bloginfo('name')); ?>" >
|
48 |
+
</td>
|
49 |
+
</tr>
|
50 |
+
|
51 |
+
<tr>
|
52 |
+
<td width="250" valign="top">
|
53 |
+
<label for="wplc_gdpr_notice_retention_purpose"><?php _e("Retention Purpose", "wplivechat"); ?></label>
|
54 |
+
</td>
|
55 |
+
<td>
|
56 |
+
<input type="text" name="wplc_gdpr_notice_retention_purpose" value="<?php echo(isset($wplc_settings['wplc_gdpr_notice_retention_purpose']) ? $wplc_settings['wplc_gdpr_notice_retention_purpose'] : __('Chat/Support', 'wplivechat')); ?>" >
|
57 |
+
</td>
|
58 |
+
</tr>
|
59 |
+
|
60 |
+
<tr>
|
61 |
+
<td width="250" valign="top">
|
62 |
+
<label for="wplc_gdpr_notice_retention_period"><?php _e("Retention Period", "wplivechat"); ?></label>
|
63 |
+
</td>
|
64 |
+
<td>
|
65 |
+
<input type="number" name="wplc_gdpr_notice_retention_period" value="<?php echo(isset($wplc_settings['wplc_gdpr_notice_retention_period']) ? intval($wplc_settings['wplc_gdpr_notice_retention_period']) < 1 ? 1 : intval($wplc_settings['wplc_gdpr_notice_retention_period']) : 30); ?>" > <?php _e('days', 'wplivechat'); ?>
|
66 |
+
</td>
|
67 |
+
</tr>
|
68 |
+
|
69 |
+
<tr>
|
70 |
+
<td width="250" valign="top">
|
71 |
+
<label><?php _e("Next Check", "wplivechat"); ?>
|
72 |
+
<i class="fa fa-question-circle wplc_light_grey wplc_settings_tooltip" title="<?php _e('When the next cron will run to check for data which is older than our retention period.', 'wplivechat'); ?>"></i>
|
73 |
+
</label>
|
74 |
+
</td>
|
75 |
+
<td>
|
76 |
+
<span>
|
77 |
+
<?php
|
78 |
+
echo date('d-m-Y H:i:s', wp_next_scheduled('wplc_gdpr_cron_hook'));
|
79 |
+
?>
|
80 |
+
</span>
|
81 |
+
</td>
|
82 |
+
</tr>
|
83 |
+
|
84 |
+
<tr>
|
85 |
+
<td width="250" valign="top">
|
86 |
+
<label><?php _e("GDPR Notice", "wplivechat"); ?>
|
87 |
+
<i class="fa fa-question-circle wplc_light_grey wplc_settings_tooltip" title="<?php _e('Users will be asked to accept the notice shown here, in the form of a check box.', 'wplivechat'); ?>"></i>
|
88 |
+
</label>
|
89 |
+
</td>
|
90 |
+
<td>
|
91 |
+
<span>
|
92 |
+
<?php
|
93 |
+
echo wplc_gdpr_generate_retention_agreement_notice($wplc_settings);
|
94 |
+
echo "<br><br>";
|
95 |
+
echo apply_filters('wplc_gdpr_create_opt_in_checkbox_filter', "");
|
96 |
+
?>
|
97 |
+
</span>
|
98 |
+
</td>
|
99 |
+
</tr>
|
100 |
+
|
101 |
+
|
102 |
+
</tbody>
|
103 |
+
</table>
|
104 |
+
<?php
|
105 |
+
}
|
106 |
+
|
107 |
+
add_filter("wplc_settings_save_filter_hook", "wplc_gdpr_settings_save_hooked", 10, 1);
|
108 |
+
/**
|
109 |
+
* Save the settings for GDPR
|
110 |
+
*/
|
111 |
+
function wplc_gdpr_settings_save_hooked($wplc_data){
|
112 |
+
|
113 |
+
if (isset($_POST['wplc_gdpr_enabled'])) {
|
114 |
+
$wplc_data['wplc_gdpr_enabled'] = esc_attr($_POST['wplc_gdpr_enabled']);
|
115 |
+
do_action('wplc_gdpr_reg_cron_hook');
|
116 |
+
|
117 |
+
update_option('WPLC_GDPR_DISABLED_WARNING_DISMISSED', 'false');
|
118 |
+
} else {
|
119 |
+
do_action('wplc_gdpr_de_reg_cron_hook');
|
120 |
+
}
|
121 |
+
|
122 |
+
if (isset($_POST['wplc_gdpr_notice_company'])) { $wplc_data['wplc_gdpr_notice_company'] = esc_attr($_POST['wplc_gdpr_notice_company']); }
|
123 |
+
if (isset($_POST['wplc_gdpr_notice_retention_purpose'])) { $wplc_data['wplc_gdpr_notice_retention_purpose'] = esc_attr($_POST['wplc_gdpr_notice_retention_purpose']); }
|
124 |
+
if (isset($_POST['wplc_gdpr_notice_retention_period'])) { $wplc_data['wplc_gdpr_notice_retention_period'] = esc_attr($_POST['wplc_gdpr_notice_retention_period']); }
|
125 |
+
|
126 |
+
return $wplc_data;
|
127 |
+
}
|
128 |
+
|
129 |
+
|
130 |
+
add_action("wplc_hook_menu", "wplc_gdpr_add_menu");
|
131 |
+
/**
|
132 |
+
* Adds a menu specifically dedicated to GDPR
|
133 |
+
*/
|
134 |
+
function wplc_gdpr_add_menu(){
|
135 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
136 |
+
|
137 |
+
if(isset($wplc_settings['wplc_gdpr_enabled']) && $wplc_settings['wplc_gdpr_enabled'] == '1'){
|
138 |
+
add_submenu_page('wplivechat-menu', __('GDPR', 'wplivechat'), __('GDPR', 'wplivechat'), 'manage_options', 'wplivechat-menu-gdpr-page', 'wplc_gdpr_page_layout');
|
139 |
+
}
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Handles the layout for the GDPR page
|
144 |
+
*/
|
145 |
+
function wplc_gdpr_page_layout(){
|
146 |
+
?>
|
147 |
+
<h2><?php _e('WP Live Chat Support - GDPR', 'wplivechat'); ?></h2>
|
148 |
+
|
149 |
+
<small><em><?php _e("Search is performed on chat sessions, messages, and offline messages. Data will also be deleted automatically per your retention policy.", "wplivechat"); ?></em></small>
|
150 |
+
<?php do_action('wplc_gdpr_page_before_table_hook'); ?>
|
151 |
+
<table class="wp-list-table wplc_list_table widefat fixed striped pages">
|
152 |
+
<thead>
|
153 |
+
<tr>
|
154 |
+
<th></th>
|
155 |
+
<th>
|
156 |
+
</th>
|
157 |
+
<th>
|
158 |
+
<form method="GET" action="">
|
159 |
+
<input type="hidden" name="page" value='wplivechat-menu-gdpr-page'>
|
160 |
+
<input name='term' type="text" value='<?php echo(isset($_GET['term']) ? htmlspecialchars($_GET['term']) : ''); ?>' placeholder="<?php _e('Name, Email, Message', 'wplivechat'); ?>" style='height:30px; width: 70%'>
|
161 |
+
|
162 |
+
<?php do_action('wplc_gdpr_page_search_form_before_submit_hook'); ?>
|
163 |
+
|
164 |
+
<input type='submit' class='button' value="<?php _e("Search", "wplivechat"); ?>" >
|
165 |
+
</form>
|
166 |
+
</th>
|
167 |
+
</tr>
|
168 |
+
</thead>
|
169 |
+
<tbody>
|
170 |
+
<?php
|
171 |
+
if(isset($_GET['term'])){
|
172 |
+
$results = wplc_gdpr_return_chat_session_search_results(htmlspecialchars($_GET['term']));
|
173 |
+
|
174 |
+
foreach ($results as $heading => $sub_results) {
|
175 |
+
$original_heading = $heading;
|
176 |
+
$heading = ucwords(str_replace("_", " ", $heading));
|
177 |
+
$heading = str_replace("%%TABLE%%", $heading, __('Search Results in %%TABLE%%', 'wplivechat'));
|
178 |
+
?>
|
179 |
+
<tr>
|
180 |
+
<td><strong><?php echo $heading; ?></strong></td>
|
181 |
+
<td></td>
|
182 |
+
<td style="text-align: right"><em><?php echo count($sub_results); ?></em></td>
|
183 |
+
</tr>
|
184 |
+
<?php
|
185 |
+
|
186 |
+
/**Setup Defaults*/
|
187 |
+
$cid_identidier = 'id';
|
188 |
+
$action_action_filter = 'chat_session';
|
189 |
+
$show_fields = array('name', 'email');
|
190 |
+
switch ($original_heading) {
|
191 |
+
case 'chat_messages':
|
192 |
+
$cid_identidier = 'chat_sess_id';
|
193 |
+
$show_fields = array('msg');
|
194 |
+
break;
|
195 |
+
case 'offline_messages':
|
196 |
+
$action_action_filter = 'offline_message';
|
197 |
+
$show_fields = array('name', 'email', 'message');
|
198 |
+
break;
|
199 |
+
}
|
200 |
+
|
201 |
+
$action_action_filter = htmlspecialchars($action_action_filter);
|
202 |
+
|
203 |
+
foreach ($sub_results as $key => $value) {
|
204 |
+
$cid = isset($value[$cid_identidier]) ? $value[$cid_identidier] : 'false';
|
205 |
+
$delete_button_text = str_replace("%%CID%%", $cid, __("Delete Chat (%%CID%%)", "wplivechat"));
|
206 |
+
$download_button_text = str_replace("%%CID%%", $cid, __("Download Chat (%%CID%%)", "wplivechat"));
|
207 |
+
|
208 |
+
?>
|
209 |
+
<tr>
|
210 |
+
<td><?php echo(__('Chat ID', 'wplivechat') . ": " . $cid ); ?></td>
|
211 |
+
<td>
|
212 |
+
<?php
|
213 |
+
foreach ($value as $subkey => $sub_val) {
|
214 |
+
if(in_array($subkey, $show_fields)){
|
215 |
+
echo( sanitize_text_field($subkey) . ": " . str_replace("%%BREAK%%", "<br>", sanitize_text_field($sub_val) ) . "<br>");
|
216 |
+
}
|
217 |
+
}
|
218 |
+
?>
|
219 |
+
</td>
|
220 |
+
<td>
|
221 |
+
<a class='button' href='?page=wplivechat-menu-gdpr-page&term=<?php echo(htmlspecialchars($_GET["term"])); ?>&action=delete&filter=<?php echo $action_action_filter; ?>&id=<?php echo htmlspecialchars($cid); ?>'><?php echo $delete_button_text; ?></a>
|
222 |
+
<a class='button button-primary' href='?page=wplivechat-menu-gdpr-page&term=<?php echo(htmlspecialchars($_GET["term"])); ?>&action=download&filter=<?php echo $action_action_filter; ?>&id=<?php echo htmlspecialchars($cid); ?>'><?php echo $download_button_text; ?></a>
|
223 |
+
</td>
|
224 |
+
</tr>
|
225 |
+
<?php
|
226 |
+
}
|
227 |
+
}
|
228 |
+
} else {
|
229 |
+
?>
|
230 |
+
<tr>
|
231 |
+
<td><strong><?php _e('Please perform a search using the input field above', 'wplivechat'); ?></strong></td>
|
232 |
+
<td></td>
|
233 |
+
<td></td>
|
234 |
+
</tr>
|
235 |
+
<?php
|
236 |
+
}
|
237 |
+
?>
|
238 |
+
</tbody>
|
239 |
+
</table>
|
240 |
+
|
241 |
+
<?php do_action('wplc_gdpr_page_after_table_hook'); ?>
|
242 |
+
|
243 |
+
<?php
|
244 |
+
}
|
245 |
+
|
246 |
+
add_action('admin_init', 'wplc_gdpr_admin_init', 1);
|
247 |
+
/**
|
248 |
+
* Runs on admin init, if we are on the GDPR page, we run the check action hook
|
249 |
+
* This will allow us to alter the header if needed for JSON files
|
250 |
+
*/
|
251 |
+
function wplc_gdpr_admin_init(){
|
252 |
+
wplc_gdpr_check_for_cron();
|
253 |
+
|
254 |
+
if(isset($_GET['page']) && $_GET['page'] === 'wplivechat-menu-gdpr-page'){
|
255 |
+
do_action('wplc_gdpr_page_process_actions_hook');
|
256 |
+
}
|
257 |
+
}
|
258 |
+
|
259 |
+
|
260 |
+
add_action('wplc_gdpr_page_process_actions_hook', 'wplc_gdpr_page_process_actions');
|
261 |
+
/**
|
262 |
+
* Handles the magic processing of the GDPR page
|
263 |
+
*/
|
264 |
+
function wplc_gdpr_page_process_actions(){
|
265 |
+
if(isset($_GET['action']) && isset($_GET['filter']) && isset($_GET['id'])){
|
266 |
+
$action = sanitize_text_field($_GET['action']);
|
267 |
+
$filter = sanitize_text_field($_GET['filter']);
|
268 |
+
$id = sanitize_text_field($_GET['id']);
|
269 |
+
|
270 |
+
if($action === 'delete'){
|
271 |
+
wplc_gdpr_delete_chat($filter, $id);
|
272 |
+
} else if($action === 'download'){
|
273 |
+
wplc_gdpr_download_chat($filter, $id);
|
274 |
+
}
|
275 |
+
}
|
276 |
+
}
|
277 |
+
|
278 |
+
/**
|
279 |
+
* Delete a chat
|
280 |
+
*/
|
281 |
+
function wplc_gdpr_delete_chat($filter_type, $cid, $output = true){
|
282 |
+
global $wpdb, $wplc_tblname_offline_msgs, $wplc_tblname_chats, $wplc_tblname_msgs;
|
283 |
+
if($filter_type === 'chat_session'){
|
284 |
+
$wpdb->delete($wplc_tblname_chats, array('id' => $cid));
|
285 |
+
$wpdb->delete($wplc_tblname_msgs, array('chat_sess_id' => $cid));
|
286 |
+
} else if ($filter_type === 'offline_message'){
|
287 |
+
$wpdb->delete($wplc_tblname_offline_msgs, array('id' => $cid));
|
288 |
+
}
|
289 |
+
|
290 |
+
do_action('wplc_gdpr_delete_chat_extend_hook', $filter_type, $cid);
|
291 |
+
|
292 |
+
if($output){
|
293 |
+
$output = "<div class='update-nag' style='margin-top: 0px;margin-bottom: 5px;'>";
|
294 |
+
$output .= "<strong>" . __("Data Deleted", "wplivechat") . "(" . $cid . ")" . "</strong><br>";
|
295 |
+
$output .= "</div>";
|
296 |
+
echo $output;
|
297 |
+
}
|
298 |
+
}
|
299 |
+
|
300 |
+
/**
|
301 |
+
* Download a chat
|
302 |
+
*/
|
303 |
+
function wplc_gdpr_download_chat($filter_type, $cid){
|
304 |
+
global $wpdb, $wplc_tblname_offline_msgs, $wplc_tblname_chats, $wplc_tblname_msgs;
|
305 |
+
if($filter_type === 'chat_session'){
|
306 |
+
$result_chat_session = $wpdb->get_results("SELECT * FROM $wplc_tblname_chats WHERE `id` = '$cid' LIMIT 1", ARRAY_A);
|
307 |
+
$result_chat_messages = $wpdb->get_results("SELECT * FROM $wplc_tblname_msgs WHERE `chat_sess_id` = '$cid'", ARRAY_A);
|
308 |
+
|
309 |
+
if(count($result_chat_session) > 0){
|
310 |
+
$chat_session = $result_chat_session[0];
|
311 |
+
|
312 |
+
$chat_session['messages'] = array();
|
313 |
+
foreach ($result_chat_messages as $key => $value) {
|
314 |
+
$chat_session['messages'][] = $value;
|
315 |
+
}
|
316 |
+
|
317 |
+
$chat_session = apply_filters('wplc_gdpr_download_chat_extender_hook', $chat_session, $cid);
|
318 |
+
|
319 |
+
//var_dump(json_encode($chat_session));
|
320 |
+
|
321 |
+
header('Content-disposition: attachment; filename=chat_export_' . $cid . '.json');
|
322 |
+
header('Content-type: application/json');
|
323 |
+
echo json_encode($chat_session);
|
324 |
+
die(); //Let's stop any further data capture please and thank you
|
325 |
+
}
|
326 |
+
} else if ($filter_type === 'offline_message'){
|
327 |
+
|
328 |
+
}
|
329 |
+
}
|
330 |
+
|
331 |
+
/**
|
332 |
+
* Searches the db for all relevant chat sessions based on the search term
|
333 |
+
*/
|
334 |
+
function wplc_gdpr_return_chat_session_search_results($term){
|
335 |
+
global $wpdb, $wplc_tblname_offline_msgs, $wplc_tblname_chats, $wplc_tblname_msgs;
|
336 |
+
|
337 |
+
$term = sanitize_text_field($term);
|
338 |
+
|
339 |
+
$results_chats = $wpdb->get_results("SELECT * FROM $wplc_tblname_chats WHERE `name` LIKE '%$term%' OR `email` LIKE '%$term%'", ARRAY_A);
|
340 |
+
$results_message = $wpdb->get_results("SELECT * FROM $wplc_tblname_msgs WHERE `msg` LIKE '%$term%'", ARRAY_A);
|
341 |
+
$results_offline = $wpdb->get_results("SELECT * FROM $wplc_tblname_offline_msgs WHERE `name` LIKE '%$term%' OR `email` LIKE '%$term%' OR `message` LIKE '%$term%'", ARRAY_A);
|
342 |
+
|
343 |
+
$formatted_messages = array();
|
344 |
+
foreach ($results_message as $key => $value) {
|
345 |
+
$cid = isset($value['chat_sess_id']) ? $value['chat_sess_id'] : false;
|
346 |
+
if($cid !== false){
|
347 |
+
$msg = maybe_unserialize($value['msg']);
|
348 |
+
$msg = is_array($msg) ? $msg['m'] : $msg;
|
349 |
+
if(!isset($formatted_messages[$cid])){
|
350 |
+
$formatted_messages[$cid]['chat_sess_id'] = $cid;
|
351 |
+
$formatted_messages[$cid]['msg'] = $msg . "%%BREAK%%";
|
352 |
+
} else {
|
353 |
+
$formatted_messages[$cid]['msg'] .= $msg . "%%BREAK%%";
|
354 |
+
}
|
355 |
+
}
|
356 |
+
}
|
357 |
+
|
358 |
+
$return_results = array(
|
359 |
+
'chat_sessions' => $results_chats,
|
360 |
+
'chat_messages' => $formatted_messages,
|
361 |
+
'offline_messages' => $results_offline
|
362 |
+
);
|
363 |
+
|
364 |
+
return $return_results;
|
365 |
+
|
366 |
+
}
|
367 |
+
|
368 |
+
/**
|
369 |
+
* Generates a localized retention notice message
|
370 |
+
*/
|
371 |
+
function wplc_gdpr_generate_retention_agreement_notice($wplc_settings = false){
|
372 |
+
if($wplc_settings === false){ $wplc_settings = get_option("WPLC_SETTINGS"); }
|
373 |
+
|
374 |
+
$localized_notice = __("I agree for my personal data to be processed and for the use of cookies in order to engage in a chat processed by %%COMPANY%%, for the purpose of %%PURPOSE%%, for the time of %%PERIOD%% day(s) as per the GDPR.", "wplivechat");
|
375 |
+
$company_replacement = isset($wplc_settings['wplc_gdpr_notice_company']) ? $wplc_settings['wplc_gdpr_notice_company'] : get_bloginfo('name');
|
376 |
+
$purpose_replacement = isset($wplc_settings['wplc_gdpr_notice_retention_purpose']) ? $wplc_settings['wplc_gdpr_notice_retention_purpose'] : __('Chat/Support', 'wplivechat');
|
377 |
+
$period_replacement = isset($wplc_settings['wplc_gdpr_notice_retention_period']) ? intval($wplc_settings['wplc_gdpr_notice_retention_period']) : 30;
|
378 |
+
|
379 |
+
if($period_replacement < 1){ $period_replacement = 1; }
|
380 |
+
|
381 |
+
$localized_notice = str_replace("%%COMPANY%%", $company_replacement, $localized_notice);
|
382 |
+
$localized_notice = str_replace("%%PURPOSE%%", $purpose_replacement, $localized_notice);
|
383 |
+
$localized_notice = str_replace("%%PERIOD%%", $period_replacement, $localized_notice);
|
384 |
+
|
385 |
+
$localized_notice = apply_filters('wplc_gdpr_retention_agreement_notice_filter', $localized_notice);
|
386 |
+
|
387 |
+
return $localized_notice;
|
388 |
+
}
|
389 |
+
|
390 |
+
add_filter('wplc_gdpr_create_opt_in_checkbox_filter', 'wplc_gdpr_add_wplc_privacy_notice', 10, 1);
|
391 |
+
/**
|
392 |
+
* WPLC Compliance notice and link to policy
|
393 |
+
*/
|
394 |
+
function wplc_gdpr_add_wplc_privacy_notice($content){
|
395 |
+
$link = '<a href="https://wp-livechat.com/privacy-policy/" target="_blank">' . __('Privacy Policy', 'wplivechat') . '</a>';
|
396 |
+
$localized_content = __('We use WP Live Chat Support as our live chat platform. By clicking below to submit this form, you acknowledge that the information you provide now and during the chat will be transferred to WP Live Chat Support for processing in accordance with their %%POLICY_LINK%%.', 'wplivechat');
|
397 |
+
|
398 |
+
$localized_content = str_replace("%%POLICY_LINK%%", $link, $localized_content);
|
399 |
+
$html = "<div class='wplc_gdpr_privacy_notice'>$localized_content</div>";
|
400 |
+
|
401 |
+
return $content . $html;
|
402 |
+
}
|
403 |
+
|
404 |
+
add_action("wplc_before_history_table_hook", "wplc_gdpr_retention_cron_notice");
|
405 |
+
add_action("wplc_hook_chat_missed", "wplc_gdpr_retention_cron_notice");
|
406 |
+
add_action("wplc_hook_offline_messages_display", "wplc_gdpr_retention_cron_notice", 1);
|
407 |
+
/**
|
408 |
+
* Shows a notice which notifies the admin that all messages older than the retention period will be removed
|
409 |
+
*/
|
410 |
+
function wplc_gdpr_retention_cron_notice(){
|
411 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
412 |
+
|
413 |
+
if(isset($wplc_settings['wplc_gdpr_enabled']) && $wplc_settings['wplc_gdpr_enabled'] == '1'){
|
414 |
+
$period_replacement = isset($wplc_settings['wplc_gdpr_notice_retention_period']) ? intval($wplc_settings['wplc_gdpr_notice_retention_period']) : 30;
|
415 |
+
|
416 |
+
if($period_replacement < 1){ $period_replacement = 1; }
|
417 |
+
|
418 |
+
$retention_period_message = __("Please note as per the GDPR settings you have selected, all chat data will be retained for %%PERIOD%% day(s).", "wplivechat");
|
419 |
+
$retention_period_message = str_replace("%%PERIOD%%", $period_replacement, $retention_period_message);
|
420 |
+
|
421 |
+
$retention_period_message_alt = __("After this period of time, all chat data older than %%PERIOD%% day(s), will be permanently removed from your server. ", "wplivechat");
|
422 |
+
$retention_period_message_alt = str_replace("%%PERIOD%%", $period_replacement, $retention_period_message_alt);
|
423 |
+
|
424 |
+
$output = "<div class='update-nag' style='margin-top: 0px;margin-bottom: 5px;'>";
|
425 |
+
$output .= "<strong>" . __("GDPR - Data Retention", "wplivechat") . "</strong><br>";
|
426 |
+
$output .= "<p>" . $retention_period_message . "</p>";
|
427 |
+
$output .= "<p>" . $retention_period_message_alt . "</p>";
|
428 |
+
|
429 |
+
$output .= apply_filters('wplc_gdpr_retention_cron_notice_extender_hook', "");
|
430 |
+
|
431 |
+
$output .= "<a class='button' href='?page=wplivechat-menu-settings#tabs-privacy' >" . __("Privacy Settings", "wplivechat") . "</a>";
|
432 |
+
$output .= "</div>";
|
433 |
+
echo $output;
|
434 |
+
|
435 |
+
}
|
436 |
+
}
|
437 |
+
|
438 |
+
add_filter('cron_schedules','wplc_gdpr_custom_cron_schedules', 10, 1);
|
439 |
+
/**
|
440 |
+
* Setup a cron schedule
|
441 |
+
*/
|
442 |
+
function wplc_gdpr_custom_cron_schedules($schedules){
|
443 |
+
if(!isset($schedules["wplc_6_hour"])){
|
444 |
+
$schedules["wplc_6_hour"] = array(
|
445 |
+
'interval' => 6*60*60,
|
446 |
+
'display' => __('Once every 6 hours'));
|
447 |
+
}
|
448 |
+
|
449 |
+
return $schedules;
|
450 |
+
}
|
451 |
+
|
452 |
+
/**
|
453 |
+
* Checks if cron is still registered
|
454 |
+
*/
|
455 |
+
function wplc_gdpr_check_for_cron(){
|
456 |
+
$cron_jobs = get_option( 'cron' );
|
457 |
+
$cron_found = false;
|
458 |
+
foreach ($cron_jobs as $cron_key => $cron_data) {
|
459 |
+
if(is_array($cron_data)){
|
460 |
+
foreach ($cron_data as $cron_inner_key => $cron_inner_data) {
|
461 |
+
if($cron_inner_key === "wplc_gdpr_cron_hook"){
|
462 |
+
$cron_found = true;
|
463 |
+
}
|
464 |
+
}
|
465 |
+
}
|
466 |
+
}
|
467 |
+
|
468 |
+
if(!$cron_found){
|
469 |
+
do_action('wplc_gdpr_reg_cron_hook'); //The cron was unregistered at some point. Lets fix that
|
470 |
+
}
|
471 |
+
}
|
472 |
+
|
473 |
+
add_action('wplc_gdpr_reg_cron_hook', 'wplc_gdpr_register_cron');
|
474 |
+
/**
|
475 |
+
* Cron Register
|
476 |
+
*/
|
477 |
+
function wplc_gdpr_register_cron(){
|
478 |
+
$wplc_settings = get_option('WPLC_SETTINGS');
|
479 |
+
if(isset($wplc_settings['wplc_gdpr_enabled']) && $wplc_settings['wplc_gdpr_enabled'] == '1'){
|
480 |
+
wp_schedule_event( time(), 'wplc_6_hour', 'wplc_gdpr_cron_hook' );
|
481 |
+
}
|
482 |
+
|
483 |
+
}
|
484 |
+
|
485 |
+
add_action('wplc_gdpr_de_reg_cron_hook', 'wplc_gdpr_de_register_cron');
|
486 |
+
/**
|
487 |
+
* Cron De-Register
|
488 |
+
*/
|
489 |
+
function wplc_gdpr_de_register_cron(){
|
490 |
+
wp_clear_scheduled_hook('wplc_gdpr_cron_hook');
|
491 |
+
}
|
492 |
+
|
493 |
+
|
494 |
+
add_action('wplc_gdpr_cron_hook', 'wplc_gdpr_cron_delete_chats');
|
495 |
+
/**
|
496 |
+
* GDPR Cron for deleting chats that are old school
|
497 |
+
*/
|
498 |
+
function wplc_gdpr_cron_delete_chats(){
|
499 |
+
global $wpdb, $wplc_tblname_chats, $wplc_tblname_msgs, $wplc_tblname_offline_msgs;
|
500 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
501 |
+
if(isset($wplc_settings['wplc_gdpr_enabled']) && $wplc_settings['wplc_gdpr_enabled'] == '1'){
|
502 |
+
$period_replacement = isset($wplc_settings['wplc_gdpr_notice_retention_period']) ? intval($wplc_settings['wplc_gdpr_notice_retention_period']) : 30;
|
503 |
+
|
504 |
+
if($period_replacement < 1){ $period_replacement = 1; }
|
505 |
+
|
506 |
+
$days_ago = date('Y-m-d', strtotime('-' . $period_replacement . ' days', time()));
|
507 |
+
|
508 |
+
$results_chats = $wpdb->get_results("DELETE FROM $wplc_tblname_chats WHERE `timestamp` < '$days_ago'", ARRAY_A);
|
509 |
+
$results_messages = $wpdb->get_results("DELETE FROM $wplc_tblname_msgs WHERE `timestamp` < '$days_ago'", ARRAY_A);
|
510 |
+
$results_offline = $wpdb->get_results("DELETE FROM $wplc_tblname_offline_msgs WHERE `timestamp` < '$days_ago'", ARRAY_A);
|
511 |
+
|
512 |
+
do_action('wplc_cron_delete_chats_extender', $days_ago);
|
513 |
+
}
|
514 |
+
}
|
515 |
+
|
516 |
+
add_filter('wplc_filter_live_chat_box_html_start_chat_button', 'wplc_gdpr_create_opt_in_checkbox_in_chatbox', 10, 2);
|
517 |
+
add_filter('wplc_filter_live_chat_box_html_send_offline_message_button', 'wplc_gdpr_create_opt_in_checkbox_in_chatbox', 10, 2);
|
518 |
+
/**
|
519 |
+
* Checkbox opt in please
|
520 |
+
*/
|
521 |
+
function wplc_gdpr_create_opt_in_checkbox_in_chatbox($filter_content, $wplc_cid = false){
|
522 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
523 |
+
if(isset($wplc_settings['wplc_gdpr_enabled']) && $wplc_settings['wplc_gdpr_enabled'] == '1'){
|
524 |
+
$checkbox = "<input type='checkbox' id='wplc_chat_gdpr_opt_in'> <label for='wplc_chat_gdpr_opt_in'>" . wplc_gdpr_generate_retention_agreement_notice($wplc_settings) . "</label>";
|
525 |
+
|
526 |
+
$checkbox = apply_filters('wplc_gdpr_create_opt_in_checkbox_filter', $checkbox);
|
527 |
+
|
528 |
+
$filter_content = $checkbox . $filter_content;
|
529 |
+
|
530 |
+
}
|
531 |
+
|
532 |
+
return $filter_content;
|
533 |
+
}
|
534 |
+
|
535 |
+
add_filter('wplc_start_button_custom_attributes_filter', 'wplc_gdpr_chat_box_opt_in_custom_attributes', 10, 2);
|
536 |
+
add_filter('wplc_offline_message_button_custom_attributes_filter', 'wplc_gdpr_chat_box_opt_in_custom_attributes', 10, 2);
|
537 |
+
add_filter('wplc_end_button_custom_attributes_filter', 'wplc_gdpr_chat_box_opt_in_custom_attributes', 10, 2);
|
538 |
+
/**
|
539 |
+
* Adds custom attributes to the start chat, and offline messages buttons to prevent click without opt in
|
540 |
+
*/
|
541 |
+
function wplc_gdpr_chat_box_opt_in_custom_attributes($content, $wplc_settings = false){
|
542 |
+
if($wplc_settings === false){ $wplc_settings = get_option("WPLC_SETTINGS"); }
|
543 |
+
|
544 |
+
if(isset($wplc_settings['wplc_gdpr_enabled']) && $wplc_settings['wplc_gdpr_enabled'] == '1'){
|
545 |
+
$content .= " data-wplc-gdpr-enabled='true' ";
|
546 |
+
}
|
547 |
+
|
548 |
+
return $content;
|
549 |
+
}
|
550 |
+
|
551 |
+
add_filter("wplc_filter_inner_live_chat_box_4th_layer", "wplc_gdpr_end_chat_action_prompt", 10, 2);
|
552 |
+
/**
|
553 |
+
* Creates the GDPR end chat notice/prompt
|
554 |
+
*/
|
555 |
+
function wplc_gdpr_end_chat_action_prompt($content, $wplc_settings = false){
|
556 |
+
if($wplc_settings === false){ $wplc_settings = get_option("WPLC_SETTINGS"); }
|
557 |
+
|
558 |
+
$notice_html = "";
|
559 |
+
if(isset($wplc_settings['wplc_gdpr_enabled']) && $wplc_settings['wplc_gdpr_enabled'] == '1'){
|
560 |
+
$remove_data_button = "<button id='wplc_gdpr_remove_data_button' class='wplc-color-bg-1 wplc-color-2' data-wplc-rest-nonce='" . wp_create_nonce('wp_rest'). "' data-wplc-rest-url='" . wplc_gdpr_get_rest_url() ."'>" . __("Delete Chat Data", "wplivechat") . "</button>";
|
561 |
+
$download_data_button = "<button id='wplc_gdpr_download_data_button' class='wplc-color-bg-1 wplc-color-2' data-wplc-init-nonce='" . wp_create_nonce( 'wplc-init-nonce-' . date('Y-m-d') ). "'>" . __("Download Chat Data", "wplivechat") . "</button>";
|
562 |
+
|
563 |
+
$notice_html = "<div class='wplc_in_chat_notice' id='wplc_gdpr_end_chat_notice_container' style='display:none;'>";
|
564 |
+
$notice_html .= "<div class='wplc_in_chat_notice_heading'>" . __("Chat Ended", "wplivechat") . "</div>";
|
565 |
+
$notice_html .= "<div class='wplc_in_chat_notice_content'>" . $download_data_button . " " . $remove_data_button . "</div>";
|
566 |
+
$notice_html .= "</div>";
|
567 |
+
}
|
568 |
+
|
569 |
+
return $notice_html . $content;
|
570 |
+
|
571 |
+
}
|
572 |
+
|
573 |
+
add_action('init', 'wplc_gdpr_front_end_download_chat');
|
574 |
+
/**
|
575 |
+
* Runs a special function on init on the front end of the site. This allows us to write out a json file as long as certain spec is met
|
576 |
+
*/
|
577 |
+
function wplc_gdpr_front_end_download_chat(){
|
578 |
+
if(isset($_GET['wplc_action']) && isset($_GET['wplc_init_nonce']) && isset($_GET['wplc_cid'])){
|
579 |
+
if($_GET['wplc_action'] === 'wplc_gdpr_download_chat_json'){
|
580 |
+
if(wp_verify_nonce( htmlspecialchars($_GET['wplc_init_nonce']), 'wplc-init-nonce-' . date('Y-m-d'))){
|
581 |
+
$chat_id = sanitize_text_field($_GET['wplc_cid']);
|
582 |
+
if( ! filter_var($chat_id, FILTER_VALIDATE_INT) ) {
|
583 |
+
/* We need to identify if this CID is a node CID, and if so, return the WP CID */
|
584 |
+
$chat_id = wplc_return_chat_id_by_rel($chat_id);
|
585 |
+
}
|
586 |
+
wplc_gdpr_download_chat('chat_session', $chat_id);
|
587 |
+
}
|
588 |
+
}
|
589 |
+
}
|
590 |
+
}
|
591 |
+
|
592 |
+
/**
|
593 |
+
* A simle wrapper for getting the rest URL
|
594 |
+
*/
|
595 |
+
function wplc_gdpr_get_rest_url(){
|
596 |
+
if(function_exists('get_rest_url')){
|
597 |
+
return get_rest_url() . "wp_live_chat_support/v1/gdpr";
|
598 |
+
} else {
|
599 |
+
return get_site_url() . "/wp-json/wp_live_chat_support/v1/gdpr";
|
600 |
+
}
|
601 |
+
}
|
602 |
+
|
603 |
+
add_action('wplc_api_route_hook', 'wplc_gdpr_rest_end_points');
|
604 |
+
/**
|
605 |
+
* Adds a special rest end point for processing deleting of chats
|
606 |
+
*/
|
607 |
+
function wplc_gdpr_rest_end_points(){
|
608 |
+
register_rest_route('wp_live_chat_support/v1/gdpr','/delete_chat', array(
|
609 |
+
'methods' => 'GET, POST',
|
610 |
+
'callback' => 'wplc_gdpr_rest_delete_chat',
|
611 |
+
'permission_callback' => 'wplc_gdpr_rest_api_nonce_verify'
|
612 |
+
));
|
613 |
+
}
|
614 |
+
|
615 |
+
/**
|
616 |
+
* GDPR Rest permission checks
|
617 |
+
*/
|
618 |
+
function wplc_gdpr_rest_api_nonce_verify(){
|
619 |
+
// $wplc_rest_access_allowed = wp_verify_nonce( $_REQUEST['wplc_rest_nonce'], 'wplc-gdpr-rest-nonce-' . date('Y-m-d'));
|
620 |
+
|
621 |
+
$wplc_rest_access_allowed = check_ajax_referer('wp_rest', '_nonce' , false);
|
622 |
+
// $wplc_rest_access_allowed = wp_verify_nonce($_REQUEST['wplc_rest_nonce'], 'wplc-gdpr-rest-nonce-' . date('Y-m-d'));
|
623 |
+
|
624 |
+
return $wplc_rest_access_allowed;
|
625 |
+
}
|
626 |
+
|
627 |
+
/**
|
628 |
+
* Handles the deleting of chats via the rest api
|
629 |
+
*/
|
630 |
+
function wplc_gdpr_rest_delete_chat(WP_REST_Request $request ){
|
631 |
+
$return_array = array();
|
632 |
+
if(isset($request)){
|
633 |
+
if(isset($request['wplc_cid'])){
|
634 |
+
$chat_id = sanitize_text_field($request['wplc_cid']);
|
635 |
+
if( ! filter_var($chat_id, FILTER_VALIDATE_INT) ) {
|
636 |
+
/* We need to identify if this CID is a node CID, and if so, return the WP CID */
|
637 |
+
$chat_id = wplc_return_chat_id_by_rel($chat_id);
|
638 |
+
|
639 |
+
}
|
640 |
+
|
641 |
+
wplc_gdpr_delete_chat('chat_session', $chat_id, false);
|
642 |
+
|
643 |
+
$return_array['response'] = __('Complete', 'wplivechat');
|
644 |
+
$return_array['cid'] = $chat_id;
|
645 |
+
}
|
646 |
+
}
|
647 |
+
|
648 |
+
return $return_array;
|
649 |
+
|
650 |
+
}
|
651 |
+
|
652 |
+
add_action('admin_notices', 'wplc_gdpr_disabled_warning');
|
653 |
+
/**
|
654 |
+
* Notice of doom
|
655 |
+
*/
|
656 |
+
function wplc_gdpr_disabled_warning(){
|
657 |
+
|
658 |
+
if(isset($_GET['wplc_gdpr_dismiss_notice'])){
|
659 |
+
update_option('WPLC_GDPR_DISABLED_WARNING_DISMISSED', 'true');
|
660 |
+
}
|
661 |
+
|
662 |
+
if(isset($_GET['page'])){
|
663 |
+
if($_GET['page'] === 'wplivechat-menu-settings'){
|
664 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
665 |
+
if(!isset($wplc_settings['wplc_gdpr_enabled']) || $wplc_settings['wplc_gdpr_enabled'] != '1'){
|
666 |
+
$gdpr_disabled_warning_dismissed = get_option('WPLC_GDPR_DISABLED_WARNING_DISMISSED', false);
|
667 |
+
if($gdpr_disabled_warning_dismissed === false || $gdpr_disabled_warning_dismissed === 'false'){
|
668 |
+
$implication_warning = __('GDPR compliance has been disabled, read more about the implications of this here', 'wplivechat');
|
669 |
+
$privacy_warning = __('Additionally please take a look at WP Live Chat Support', 'wplivechat');
|
670 |
+
$final_warning = __('It is highly recommended that you enable GDPR compliance to ensure your user data is regulated.', 'wplivechat');
|
671 |
+
|
672 |
+
$output = "<div class='update-nag' style='margin-bottom: 5px; border-color:#DD0000'>";
|
673 |
+
$output .= "<strong>" . __("Warning - GDPR Compliance Disabled - Action Required", "wplivechat") . "</strong><br>";
|
674 |
+
$output .= "<p>" . $implication_warning . ": <a href='https://www.eugdpr.org/' target='_blank'>" . __('EU GDPR', 'wplivechat') . "</a></p>";
|
675 |
+
$output .= "<p>" . $privacy_warning . " <a href='https://wp-livechat.com/privacy-policy/' target='_blank'>" . __('Privacy Policy', 'wplivechat') . "</a></p>";
|
676 |
+
$output .= "<p>" . $final_warning . "</p>";
|
677 |
+
$output .= "<a class='button' href='?page=wplivechat-menu-settings#tabs-privacy' >" . __("Privacy Settings", "wplivechat") . "</a> ";
|
678 |
+
$output .= "<a class='button' href='?page=" . htmlspecialchars($_GET['page']) ."&wplc_gdpr_dismiss_notice=true' style='color: #fff;background-color: #bb0000;border-color: #c70000;'>" . __("Dismiss & Accept Responsibility", "wplivechat") . "</a>";
|
679 |
+
$output .= "</div>";
|
680 |
+
echo $output;
|
681 |
+
}
|
682 |
+
}
|
683 |
+
}
|
684 |
+
}
|
685 |
+
}
|
686 |
+
|
687 |
+
|
688 |
+
add_filter( 'admin_footer_text', 'wplc_gdpr_footer_mod', 99, 1);
|
689 |
+
/**
|
690 |
+
* Adds the data privacy notices
|
691 |
+
*/
|
692 |
+
function wplc_gdpr_footer_mod( $footer_text ) {
|
693 |
+
if(isset($_GET['page'])){
|
694 |
+
if(strpos($_GET['page'], 'wplivechat') !== FALSE){
|
695 |
+
$footer_text_addition = __( 'Please refer to our %%PRIVACY_LINK%% for information on Data Processing', 'wplivechat' );
|
696 |
+
$footer_text_addition = str_replace("%%PRIVACY_LINK%%", "<a href='' target='_blank'>" . __(
|
697 |
+
"Privacy Policy", "wplivechat") . "</a>", $footer_text_addition);
|
698 |
+
|
699 |
+
return str_replace( '</span>', '', $footer_text ) . ' | ' . $footer_text_addition . '</span>';
|
700 |
+
}
|
701 |
+
}
|
702 |
+
|
703 |
+
return $footer_text;
|
704 |
+
|
705 |
+
}
|
706 |
+
|
707 |
+
add_filter( 'wplc_node_server_us_options_enabled', 'wplc_gdpr_allow_us_servers_check',10 ,2);
|
708 |
+
/**
|
709 |
+
* Checks if GDPR option is enabled so we can force users into the EU
|
710 |
+
*/
|
711 |
+
function wplc_gdpr_allow_us_servers_check($is_allowed, $wplc_settings = false){
|
712 |
+
if($wplc_settings === false){ $wplc_settings = get_option("WPLC_SETTINGS"); }
|
713 |
+
|
714 |
+
if(isset($wplc_settings['wplc_gdpr_enabled']) && $wplc_settings['wplc_gdpr_enabled'] == '1'){
|
715 |
+
return false;
|
716 |
+
}
|
717 |
+
|
718 |
+
return $is_allowed;
|
719 |
+
}
|
720 |
+
|
721 |
+
|
722 |
+
add_filter( 'wplc_node_server_default_selection_override', 'wplc_gdpr_node_server_eu_default_override',10,2);
|
723 |
+
/**
|
724 |
+
* Checks if GDPR option is enabled so we can force users into the EU
|
725 |
+
*/
|
726 |
+
function wplc_gdpr_node_server_eu_default_override($selected, $wplc_settings = false){
|
727 |
+
if($wplc_settings === false){ $wplc_settings = get_option("WPLC_SETTINGS"); }
|
728 |
+
if(isset($wplc_settings['wplc_gdpr_enabled']) && $wplc_settings['wplc_gdpr_enabled'] == '1'){
|
729 |
+
if($selected === 'auto' || $selected === 'us1' || $selected === 'us2'){
|
730 |
+
//This is not allowed in the GDPR
|
731 |
+
$selected = 'eu1';
|
732 |
+
}
|
733 |
+
}
|
734 |
+
|
735 |
+
return $selected;
|
736 |
+
}
|
737 |
+
|
738 |
+
|
739 |
+
add_action('wplc_node_server_selection_notices', 'wplc_gdpr_node_server_override_notice',10,1);
|
740 |
+
/**
|
741 |
+
* Will add a very simple server override if GDPR is enabled
|
742 |
+
*/
|
743 |
+
function wplc_gdpr_node_server_override_notice($wplc_settings = false){
|
744 |
+
if($wplc_settings === false){ $wplc_settings = get_option("WPLC_SETTINGS"); }
|
745 |
+
if(isset($wplc_settings['wplc_gdpr_enabled']) && $wplc_settings['wplc_gdpr_enabled'] == '1'){
|
746 |
+
echo "<small><strong><em>" . __("GDPR Compliance Enabled - Server Selection Limited to EU", "wplivechat") . "</em></strong></small>";
|
747 |
+
}
|
748 |
+
}
|
749 |
+
|
750 |
+
add_filter('wplc_update_settings_between_versions_hook', 'wplc_gdpr_update_settings_between_versions',10,1);
|
751 |
+
/**
|
752 |
+
* This will handle the auto update magic. Although we have a default in place this is far superior as it is a hard data set
|
753 |
+
*/
|
754 |
+
function wplc_gdpr_update_settings_between_versions($wplc_settings){
|
755 |
+
if(is_array($wplc_settings)){
|
756 |
+
$gdpr_enabled_atleast_once_before = get_option('WPLC_GDPR_ENABLED_AT_LEAST_ONCE', false);
|
757 |
+
if($gdpr_enabled_atleast_once_before === false){
|
758 |
+
//Only fire if this user has never had GDPR enabled before
|
759 |
+
update_option('WPLC_GDPR_ENABLED_AT_LEAST_ONCE', 'true');
|
760 |
+
$wplc_settings['wplc_gdpr_enabled'] = '0';
|
761 |
+
}
|
762 |
+
}
|
763 |
+
|
764 |
+
return $wplc_settings;
|
765 |
}
|
modules/node_server.php
CHANGED
@@ -1,1234 +1,1234 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* Node Code -> Insert pun here
|
4 |
-
*/
|
5 |
-
|
6 |
-
define("BLEEPER_API_URL", "https://bleeper.io/app/api/v1/");
|
7 |
-
define("BLEEPER_REMOTE_DASH_ROUTE", "remote_dashboard.php");
|
8 |
-
|
9 |
-
define("BLEEPER_NODE_SERVER_URL", "https://bleeper.us-3.evennode.com");
|
10 |
-
|
11 |
-
//define("BLEEPER_NODE_SERVER_URL", "http://localhost:3000");
|
12 |
-
define("BLEEPER_NODE_END_POINTS_ROUTE", "api/v1/");
|
13 |
-
define("BLEEPER_NODE_END_POINT_TOKEN", "zf6fe1399sdfgsdfg02ad09ab6a8cb7345s");
|
14 |
-
|
15 |
-
|
16 |
-
add_action("wplc_activate_hook", "wplc_node_server_token_check", 10);
|
17 |
-
add_action("wplc_update_hook", "wplc_node_server_token_check", 10);
|
18 |
-
/**
|
19 |
-
* Checks if a secret key has been created.
|
20 |
-
* If not create one for use in the API
|
21 |
-
*
|
22 |
-
* @return void
|
23 |
-
*/
|
24 |
-
function wplc_node_server_token_check(){
|
25 |
-
if (!get_option("wplc_node_server_secret_token")) {
|
26 |
-
$user_token = wplc_node_server_token_create();
|
27 |
-
add_option("wplc_node_server_secret_token", $user_token);
|
28 |
-
}
|
29 |
-
}
|
30 |
-
|
31 |
-
add_action("wplc_admin_remote_dashboard_below", "wplc_admin_remote_dashboard_thank_you_footer");
|
32 |
-
/*
|
33 |
-
* Adds a simple thank you message to the footer of the dashboard
|
34 |
-
*/
|
35 |
-
function wplc_admin_remote_dashboard_thank_you_footer(){
|
36 |
-
echo "<p id='wplc_footer_message' style='display:none;'>";
|
37 |
-
echo __("Thank you for using WP Live Chat Support - Need assistance? Please get in touch here: ", "wplivechat");
|
38 |
-
echo "<a href='https://wp-livechat.com/contact-us/' rel='nofollow' target='_blank'>" . __("Contact us", "wplivechat") . "</a><span class='bleeper_stats'></span><span class='bleeper_instance'></span>";
|
39 |
-
echo "</p>";
|
40 |
-
}
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Generates a new Secret Token
|
44 |
-
*
|
45 |
-
* @return string
|
46 |
-
*/
|
47 |
-
function wplc_node_server_token_create(){
|
48 |
-
$the_code = rand(0, 1000) . rand(0, 1000) . rand(0, 1000) . rand(0, 1000) . rand(0, 1000);
|
49 |
-
$the_time = time();
|
50 |
-
$token = md5($the_code . $the_time);
|
51 |
-
return $token;
|
52 |
-
}
|
53 |
-
|
54 |
-
/**
|
55 |
-
* Re-Generates the token
|
56 |
-
* @return void
|
57 |
-
*/
|
58 |
-
function wplc_node_server_token_regenerate(){
|
59 |
-
$wplc_node_token_new = wplc_node_server_token_create();
|
60 |
-
update_option("wplc_node_server_secret_token", $wplc_node_token_new);
|
61 |
-
}
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Post to the NODE server -
|
65 |
-
*
|
66 |
-
* @param string $route Route you would like to use for the node server
|
67 |
-
* @param string $form_data data to send
|
68 |
-
* @return string (or false on fail)
|
69 |
-
*/
|
70 |
-
function wplc_node_server_post($route, $form_data){
|
71 |
-
$url = BLEEPER_NODE_SERVER_URL . BLEEPER_NODE_END_POINTS_ROUTE . $route;
|
72 |
-
|
73 |
-
$wplc_end_point_override = get_option("wplc_end_point_override");
|
74 |
-
if($wplc_end_point_override !== false && $wplc_end_point_override !== ""){
|
75 |
-
$url = $wplc_end_point_override . BLEEPER_NODE_END_POINTS_ROUTE . $route; //Use the override URL
|
76 |
-
}
|
77 |
-
|
78 |
-
|
79 |
-
if(!isset($form_data['token'])){
|
80 |
-
$form_data['token'] = BLEEPER_NODE_END_POINT_TOKEN; //Add the security token
|
81 |
-
}
|
82 |
-
|
83 |
-
if(!isset($form_data['api_key'])){
|
84 |
-
$wplc_node_token = get_option("wplc_node_server_secret_token");
|
85 |
-
if(!$wplc_node_token){
|
86 |
-
if(function_exists("wplc_node_server_token_regenerate")){
|
87 |
-
wplc_node_server_token_regenerate();
|
88 |
-
$wplc_node_token = get_option("wplc_node_server_secret_token");
|
89 |
-
}
|
90 |
-
}
|
91 |
-
|
92 |
-
$form_data['api_key'] = $wplc_node_token; //Add the security token
|
93 |
-
}
|
94 |
-
|
95 |
-
if(!isset($form_data['origin_url'])){
|
96 |
-
$ajax_url = admin_url('admin-ajax.php');
|
97 |
-
$origin_url = str_replace("/wp-admin/admin-ajax.php", "", $ajax_url);
|
98 |
-
$form_data['origin_url'] = $origin_url; //Add the security token
|
99 |
-
}
|
100 |
-
|
101 |
-
$context = @stream_context_create($options);
|
102 |
-
$result = @file_get_contents($url . "?" . http_build_query($form_data), false, $context);
|
103 |
-
|
104 |
-
if ($result === FALSE) {
|
105 |
-
return false;
|
106 |
-
} else {
|
107 |
-
return $result;
|
108 |
-
}
|
109 |
-
}
|
110 |
-
|
111 |
-
add_action("wplc_hook_chat_notification","wplc_filter_notification_hook_node",20,3);
|
112 |
-
/**
|
113 |
-
* Send a system notification to the node server
|
114 |
-
*
|
115 |
-
* @return void
|
116 |
-
*/
|
117 |
-
function wplc_filter_notification_hook_node($type,$cid,$data){
|
118 |
-
$wplc_settings = get_option("WPLC_SETTINGS");
|
119 |
-
if(isset($wplc_settings['wplc_use_node_server']) && intval($wplc_settings['wplc_use_node_server']) == 1) {
|
120 |
-
|
121 |
-
if(filter_var($cid, FILTER_VALIDATE_INT) ) {
|
122 |
-
//Let's reverse the CID back to it's rel counterpart
|
123 |
-
$cid = wplc_return_chat_rel_by_id($cid);
|
124 |
-
}
|
125 |
-
|
126 |
-
$msg = false;
|
127 |
-
switch($type){
|
128 |
-
case "doc_suggestion":
|
129 |
-
$msg = $data['formatted_msg'];
|
130 |
-
break;
|
131 |
-
default:
|
132 |
-
break;
|
133 |
-
}
|
134 |
-
|
135 |
-
if(isset($cid)){
|
136 |
-
if($msg !== false){
|
137 |
-
$form_data = array(
|
138 |
-
'chat_id' => $cid,
|
139 |
-
'notification_text' => $msg,
|
140 |
-
);
|
141 |
-
|
142 |
-
$user_request = wplc_node_server_post("user_chat_notification", $form_data);
|
143 |
-
|
144 |
-
if($user_request === false){
|
145 |
-
//Something is wrong
|
146 |
-
} else {
|
147 |
-
|
148 |
-
}
|
149 |
-
}
|
150 |
-
}
|
151 |
-
}
|
152 |
-
|
153 |
-
return;
|
154 |
-
}
|
155 |
-
|
156 |
-
add_action("wplc_api_route_hook", "wplc_api_node_routes");
|
157 |
-
/**
|
158 |
-
* Add a REST API routes for the node server
|
159 |
-
*
|
160 |
-
* @return void
|
161 |
-
*/
|
162 |
-
function wplc_api_node_routes(){
|
163 |
-
register_rest_route('wp_live_chat_support/v1','/async_storage', array(
|
164 |
-
'methods' => 'POST',
|
165 |
-
'callback' => 'wplc_node_async_storage_rest'
|
166 |
-
));
|
167 |
-
}
|
168 |
-
|
169 |
-
/**
|
170 |
-
* Handles Async storage REST -> Params are processed within the request
|
171 |
-
* Required POST variables:
|
172 |
-
* - Chat ID
|
173 |
-
* - Security Key
|
174 |
-
* - Message (JSON encoded array)
|
175 |
-
* - Action
|
176 |
-
*
|
177 |
-
* @param WP_REST_Request $request Request Data
|
178 |
-
* @return void
|
179 |
-
*/
|
180 |
-
function wplc_node_async_storage_rest(WP_REST_Request $request){
|
181 |
-
$return_array = array();
|
182 |
-
$return_array['request_status'] = false; //Default to be returned if something goes wrong
|
183 |
-
if(isset($request)){
|
184 |
-
if(isset($request['security'])){
|
185 |
-
$stored_token = get_option("wplc_node_server_secret_token");
|
186 |
-
$check = $_POST['server_token'] == $stored_token ? true : false;
|
187 |
-
if ($check) {
|
188 |
-
if(isset($request['chat_id'])){
|
189 |
-
if(isset($request['messages'])){
|
190 |
-
if(isset($request['relay_action'])){
|
191 |
-
$chat_id = sanitize_text_field($request['chat_id']);
|
192 |
-
$message_data = json_decode($request['messages']);
|
193 |
-
$chat_session = wplc_return_chat_session_variable($chat_id);
|
194 |
-
$action = $request['relay_action'];
|
195 |
-
if($message_data !== NULL){
|
196 |
-
if($action == "wplc_user_send_msg"){
|
197 |
-
foreach ($message_data as $message) {
|
198 |
-
$message = sanitize_text_field($message);
|
199 |
-
wplc_record_chat_msg("1", $chat_id, $message);
|
200 |
-
|
201 |
-
//wplc_update_user_on_page($chat_id, "3", $chat_session); //Keep timestamp active
|
202 |
-
wplc_update_active_timestamp($chat_id);
|
203 |
-
}
|
204 |
-
|
205 |
-
$return_array['request_status'] = true;
|
206 |
-
$return_array['request_information'] = __("Success", "wplivechat");
|
207 |
-
} else if ($action == "wplc_admin_send_msg"){
|
208 |
-
foreach ($message_data as $message) {
|
209 |
-
$message = sanitize_text_field($message);
|
210 |
-
wplc_record_chat_msg("2", $chat_id, $message, true);
|
211 |
-
|
212 |
-
//wplc_update_user_on_page($chat_id, "3", $chat_session); //Keep timestamp active
|
213 |
-
wplc_update_active_timestamp($chat_id);
|
214 |
-
}
|
215 |
-
|
216 |
-
$return_array['request_status'] = true;
|
217 |
-
$return_array['request_information'] = __("Success", "wplivechat");
|
218 |
-
}
|
219 |
-
} else {
|
220 |
-
$return_array['request_information'] = __("Message data is corrupt", "wplivechat");
|
221 |
-
}
|
222 |
-
} else {
|
223 |
-
$return_array['request_information'] = __("Action not set", "wplivechat");
|
224 |
-
}
|
225 |
-
} else {
|
226 |
-
$return_array['request_information'] = __("Message data array not set", "wplivechat");
|
227 |
-
}
|
228 |
-
} else {
|
229 |
-
$return_array['request_information'] = __("Chat ID is not set", "wplivechat");
|
230 |
-
}
|
231 |
-
}
|
232 |
-
} else {
|
233 |
-
$return_array['request_information'] = __("No security nonce found", "wplivechat");
|
234 |
-
}
|
235 |
-
}
|
236 |
-
|
237 |
-
return $return_array;
|
238 |
-
|
239 |
-
}
|
240 |
-
|
241 |
-
add_action("wp_ajax_wplc_node_async_storage_ajax", "wplc_node_async_storage_ajax");
|
242 |
-
add_action("wp_ajax_nopriv_wplc_node_async_storage_ajax", "wplc_node_async_storage_ajax");
|
243 |
-
/**
|
244 |
-
* Handles Async storage AJAX (Fallback for if REST is not present) -> Params are processed within the request
|
245 |
-
* Required POST variables:
|
246 |
-
* - Chat ID
|
247 |
-
* - Security Key
|
248 |
-
* - Message (JSON encoded array)
|
249 |
-
* - Action
|
250 |
-
*
|
251 |
-
* @return void
|
252 |
-
*/
|
253 |
-
function wplc_node_async_storage_ajax(){
|
254 |
-
$return_array = array();
|
255 |
-
$return_array['request_status'] = false; //Default to be returned if something goes wrong
|
256 |
-
if(isset($_POST)){
|
257 |
-
if(isset($_POST['server_token'])){
|
258 |
-
$stored_token = get_option("wplc_node_server_secret_token");
|
259 |
-
$check = $_POST['server_token'] == $stored_token ? true : false;
|
260 |
-
if ($check) {
|
261 |
-
if(isset($_POST['chat_id'])){
|
262 |
-
if(isset($_POST['messages'])){
|
263 |
-
if(isset($_POST['relay_action'])){
|
264 |
-
$chat_id = sanitize_text_field($_POST['chat_id']);
|
265 |
-
$message_data = json_decode($_POST['messages']);
|
266 |
-
$chat_session = wplc_return_chat_session_variable($chat_id);
|
267 |
-
$action = $_POST['relay_action'];
|
268 |
-
if($message_data !== NULL){
|
269 |
-
if($action == "wplc_user_send_msg"){
|
270 |
-
foreach ($message_data as $message) {
|
271 |
-
$message = sanitize_text_field($message);
|
272 |
-
wplc_record_chat_msg("1", $chat_id, $message);
|
273 |
-
//wplc_update_user_on_page($chat_id, "3", $chat_session); //Keep timestamp active
|
274 |
-
wplc_update_active_timestamp($chat_id);
|
275 |
-
|
276 |
-
}
|
277 |
-
|
278 |
-
$return_array['request_status'] = true;
|
279 |
-
$return_array['request_information'] = __("Success", "wplivechat");
|
280 |
-
} else if ($action == "wplc_admin_send_msg"){
|
281 |
-
foreach ($message_data as $message) {
|
282 |
-
$message = sanitize_text_field($message);
|
283 |
-
wplc_record_chat_msg("2", $chat_id, $message);
|
284 |
-
//wplc_update_user_on_page($chat_id, "3", $chat_session); //Keep timestamp active
|
285 |
-
wplc_update_active_timestamp($chat_id);
|
286 |
-
}
|
287 |
-
|
288 |
-
$return_array['request_status'] = true;
|
289 |
-
$return_array['request_information'] = __("Success", "wplivechat");
|
290 |
-
}
|
291 |
-
} else {
|
292 |
-
$return_array['request_information'] = __("Message data is corrupt", "wplivechat");
|
293 |
-
}
|
294 |
-
} else {
|
295 |
-
$return_array['request_information'] = __("Action not set", "wplivechat");
|
296 |
-
}
|
297 |
-
} else {
|
298 |
-
$return_array['request_information'] = __("Message data array not set", "wplivechat");
|
299 |
-
}
|
300 |
-
} else {
|
301 |
-
$return_array['request_information'] = __("Chat ID is not set", "wplivechat");
|
302 |
-
}
|
303 |
-
}
|
304 |
-
} else {
|
305 |
-
$return_array['request_information'] = __("No security nonce found", "wplivechat");
|
306 |
-
}
|
307 |
-
}
|
308 |
-
|
309 |
-
return $return_array;
|
310 |
-
|
311 |
-
}
|
312 |
-
|
313 |
-
/**
|
314 |
-
* Loads remote dashboard
|
315 |
-
*
|
316 |
-
* @return void
|
317 |
-
*/
|
318 |
-
function wplc_admin_dashboard_layout_node( $location = 'dashboard' ){
|
319 |
-
if ( $location === 'dashboard') {
|
320 |
-
|
321 |
-
if( ! get_user_meta( get_current_user_id(), 'wplc_ma_agent', true ) ){
|
322 |
-
echo "<div class='error below-h1'>";
|
323 |
-
echo "<h2>".__("Error", "wplivechat")."</h2>";
|
324 |
-
echo "<p>".__("Only chat agents can access this page.", "wplivechat")."</p>";
|
325 |
-
echo "</div>";
|
326 |
-
return;
|
327 |
-
}
|
328 |
-
|
329 |
-
do_action("wplc_admin_remote_dashboard_above");
|
330 |
-
|
331 |
-
echo "<div id='bleeper_content_wrapper'></div>";
|
332 |
-
|
333 |
-
if ( ! isset( $_GET['action'] ) || 'history' !== $_GET['action'] ) {
|
334 |
-
|
335 |
-
echo "<div class='wplc_remote_dash_below_contianer'>";
|
336 |
-
do_action("wplc_admin_remote_dashboard_below");
|
337 |
-
echo "</div>";
|
338 |
-
|
339 |
-
}
|
340 |
-
} else {
|
341 |
-
do_action("wplc_admin_remote_dashboard_above");
|
342 |
-
|
343 |
-
echo "<div id='bleeper_content_wrapper'></div>";
|
344 |
-
|
345 |
-
if ( ! empty( $_GET['page'] ) && 'wplivechat-menu' === $_GET['page'] ) { // This div is also hidden by js under the same conditions
|
346 |
-
|
347 |
-
echo "<div class='wplc_remote_dash_below_contianer'>";
|
348 |
-
do_action("wplc_admin_remote_dashboard_below");
|
349 |
-
echo "</div>";
|
350 |
-
|
351 |
-
}
|
352 |
-
}
|
353 |
-
}
|
354 |
-
|
355 |
-
add_action("wplc_admin_remote_dashboard_below", "wplc_admin_remote_dashboard_below_delegate");
|
356 |
-
/*
|
357 |
-
* Delegates the below dashboard hooks
|
358 |
-
*/
|
359 |
-
function wplc_admin_remote_dashboard_below_delegate(){
|
360 |
-
do_action("wplc_hook_chat_dashboard_bottom");
|
361 |
-
}
|
362 |
-
|
363 |
-
add_action("wplc_hook_chat_dashboard_bottom","wplc_hook_control_dashboard_bottom_loading_logo",1);
|
364 |
-
/**
|
365 |
-
* Decides whether or not to show the available extensions for this area.
|
366 |
-
* @return void
|
367 |
-
* @since 6.0.00
|
368 |
-
* @author Nick Duncan <nick@codecabin.co.za>
|
369 |
-
*/
|
370 |
-
function wplc_hook_control_dashboard_bottom_loading_logo() {
|
371 |
-
$wplc_settings = get_option("WPLC_SETTINGS");
|
372 |
-
if(isset($wplc_settings['wplc_use_node_server']) && $wplc_settings['wplc_use_node_server'] == 1){
|
373 |
-
echo "<div id='wplc_footer_loading_icon'><img src='https://bleeper.io/app/assets/images/wplc_loading.png' width='50' /><br />Connecting...</div>";
|
374 |
-
}
|
375 |
-
}
|
376 |
-
|
377 |
-
add_action('admin_enqueue_scripts', 'wplc_enqueue_dashboard_popup_scripts');
|
378 |
-
/**
|
379 |
-
* Enqueues the scripts for the admin dashboard popup icon and chat box
|
380 |
-
* @return void
|
381 |
-
*/
|
382 |
-
function wplc_enqueue_dashboard_popup_scripts() {
|
383 |
-
global $wplc_version;
|
384 |
-
wp_enqueue_script('jquery-ui-draggable');
|
385 |
-
wp_enqueue_script('wplc-admin-popup', plugins_url('../js/wplc_admin_popup.js', __FILE__ ), array('jquery-ui-draggable'), $wplc_version);
|
386 |
-
|
387 |
-
wp_button_pointers_load_scripts('toplevel_page_wplivechat-menu');
|
388 |
-
}
|
389 |
-
|
390 |
-
add_action( "admin_footer", "wplc_dashboard_display_decide" );
|
391 |
-
/**
|
392 |
-
* Decide whether or not to display the dashboard layout on an admin page
|
393 |
-
* @return void
|
394 |
-
*/
|
395 |
-
function wplc_dashboard_display_decide() {
|
396 |
-
$wplc_settings = get_option("WPLC_SETTINGS");
|
397 |
-
if ( isset( $wplc_settings['wplc_use_node_server'] ) && $wplc_settings['wplc_use_node_server'] == 1 ) {
|
398 |
-
//Node in use, load remote dashboard
|
399 |
-
if ( isset( $_GET['page'] ) && $_GET['page'] === 'wplivechat-menu') {
|
400 |
-
// we control this in the wplc_admin_menu_layout function
|
401 |
-
//wplc_admin_dashboard_layout_node('dashboard');
|
402 |
-
} else {
|
403 |
-
if (function_exists("wplc_pro_version_control")) {
|
404 |
-
global $wplc_pro_version;
|
405 |
-
$wplc_ver = str_replace('.', '', $wplc_pro_version);
|
406 |
-
$checker = intval($wplc_ver);
|
407 |
-
if (function_exists("wplc_pro_version_control") && $checker < 8000) {
|
408 |
-
/* ONLY SHOW THE POPOUT DASHBOARD IF THEY ARE USING PRO 8.0.00 and above */
|
409 |
-
return;
|
410 |
-
}
|
411 |
-
}
|
412 |
-
|
413 |
-
|
414 |
-
/**
|
415 |
-
* Check to see if we have enabled "Enable chat dashboard and notifications on all admin pages"
|
416 |
-
*/
|
417 |
-
|
418 |
-
if ( isset( $wplc_settings['wplc_enable_all_admin_pages'] ) && $wplc_settings['wplc_enable_all_admin_pages'] === '1' ) {
|
419 |
-
|
420 |
-
|
421 |
-
wplc_admin_dashboard_layout_node('other');
|
422 |
-
|
423 |
-
echo '<div class="floating-right-toolbar">';
|
424 |
-
echo '<label for="user_list_bleeper_control" style="margin-bottom: 0; display:none;"></label>';
|
425 |
-
|
426 |
-
echo '<i id="toolbar-item-open-bleeper" class="fa fa-fw" style="background:url(\''.plugins_url('../images/48px.png', __FILE__).'\') no-repeat; background-size: cover;"></i>';
|
427 |
-
echo '</div>';
|
428 |
-
}
|
429 |
-
|
430 |
-
}
|
431 |
-
}
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
}
|
436 |
-
|
437 |
-
|
438 |
-
/**
|
439 |
-
* Loads remote dashboard scripts and styles
|
440 |
-
*
|
441 |
-
* @return void
|
442 |
-
*/
|
443 |
-
function wplc_admin_remote_dashboard_scripts($wplc_settings){
|
444 |
-
global $wplc_version;
|
445 |
-
$wplc_current_user = get_current_user_id();
|
446 |
-
if( get_user_meta( $wplc_current_user, 'wplc_ma_agent', true )) {
|
447 |
-
|
448 |
-
$user_info = get_userdata(intval($wplc_current_user));
|
449 |
-
|
450 |
-
$user_array = get_users(array(
|
451 |
-
'meta_key' => 'wplc_ma_agent',
|
452 |
-
));
|
453 |
-
|
454 |
-
$a_array = array();
|
455 |
-
if ($user_array) {
|
456 |
-
foreach ($user_array as $user) {
|
457 |
-
$current_user_name = apply_filters("wplc_agent_display_name_filter", $user->display_name);
|
458 |
-
$a_array[$user->ID] = array();
|
459 |
-
$a_array[$user->ID]['name'] = $user->display_name;
|
460 |
-
$a_array[$user->ID]['display_name'] = $user->display_name;
|
461 |
-
$a_array[$user->ID]['md5'] = md5( $user->user_email );
|
462 |
-
$a_array[$user->ID]['email'] = md5( $user->user_email );
|
463 |
-
}
|
464 |
-
}
|
465 |
-
|
466 |
-
|
467 |
-
if( isset($wplc_settings['wplc_show_name']) && $wplc_settings['wplc_show_name'] == '1' ){ $wplc_show_name = true; } else { $wplc_show_name = false; }
|
468 |
-
if( isset($wplc_settings['wplc_show_avatar']) && $wplc_settings['wplc_show_avatar'] ){ $wplc_show_avatar = true; } else { $wplc_show_avatar = false; }
|
469 |
-
if( isset($wplc_settings['wplc_show_date']) && $wplc_settings['wplc_show_date'] == '1' ){ $wplc_show_date = true; } else { $wplc_show_date = false; }
|
470 |
-
if( isset($wplc_settings['wplc_show_time']) && $wplc_settings['wplc_show_time'] == '1' ){ $wplc_show_time = true; } else { $wplc_show_time = false; }
|
471 |
-
|
472 |
-
$wplc_chat_detail = array( 'name' => $wplc_show_name, 'avatar' => $wplc_show_avatar, 'date' => $wplc_show_date, 'time' => $wplc_show_time );
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
$wplc_end_point_override = get_option("wplc_end_point_override");
|
478 |
-
if($wplc_end_point_override !== false && $wplc_end_point_override !== ""){
|
479 |
-
$bleeper_url = $wplc_end_point_override; //Use the override URL
|
480 |
-
} else {
|
481 |
-
$bleeper_url = BLEEPER_NODE_SERVER_URL;
|
482 |
-
}
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
wp_register_script('wplc-admin-js-sockets', "https://bleeper.io/app/assets/js/vendor/socket.io/socket.io.slim.js", false, $wplc_version, false);
|
488 |
-
//wp_register_script('wplc-admin-js-sockets', trailingslashit( $bleeper_url ) . "socket.io/socket.io.js", false, $wplc_version, false);
|
489 |
-
//wp_register_script('wplc-admin-js-sockets', "http://localhost:3000/socket.io/socket.io.js", false, $wplc_version, false);
|
490 |
-
wp_enqueue_script('wplc-admin-js-sockets');
|
491 |
-
|
492 |
-
wp_register_script('wplc-admin-js-bootstrap', "https://bleeper.io/app/assets/js/bootstrap.js", array("wplc-admin-js-sockets"), $wplc_version, false);
|
493 |
-
wp_enqueue_script('wplc-admin-js-bootstrap');
|
494 |
-
|
495 |
-
// NB: This causes Failed to initVars ReferenceError: wplc_show_date is not defined when uncommented and enabled
|
496 |
-
if(empty($wplc_settings['wplc_disable_emojis']))
|
497 |
-
{
|
498 |
-
wp_register_script('wplc-admin-js-emoji', "https://bleeper.io/app/assets/wdt-emoji/emoji.min.js", array("wplc-admin-js-sockets"), $wplc_version, false);
|
499 |
-
wp_enqueue_script('wplc-admin-js-emoji');
|
500 |
-
|
501 |
-
wp_register_script('wplc-admin-js-emoji-bundle', "https://bleeper.io/app/assets/wdt-emoji/wdt-emoji-bundle.min.js", array("wplc-admin-js-emoji"), $wplc_version, false);
|
502 |
-
wp_enqueue_script('wplc-admin-js-emoji-bundle');
|
503 |
-
}
|
504 |
-
|
505 |
-
wp_register_script('md5', plugins_url( '../js/md5.js', __FILE__ ), array("wplc-admin-js-sockets"), false, false);
|
506 |
-
wp_enqueue_script('md5');
|
507 |
-
|
508 |
-
$dependencies = array();
|
509 |
-
if(empty($wplc_settings['wplc_disable_emojis']))
|
510 |
-
$dependencies[] = "wplc-admin-js-emoji-bundle";
|
511 |
-
wp_register_script('wplc-admin-js-agent', "https://bleeper.io/app/assets/js/bleeper-agent-dev.js", $dependencies, $wplc_version, false);
|
512 |
-
|
513 |
-
wp_localize_script('wplc-admin-js-agent', 'bleeper_remote_enabled', "true");
|
514 |
-
|
515 |
-
if (isset($wplc_settings['wplc_enable_msg_sound'])) {
|
516 |
-
|
517 |
-
if (intval($wplc_settings['wplc_enable_msg_sound']) == 1) {
|
518 |
-
wp_localize_script('wplc-admin-js-agent', "bleeper_ping_sound_notification_enabled", "true");
|
519 |
-
} else {
|
520 |
-
wp_localize_script('wplc-admin-js-agent', "bleeper_ping_sound_notification_enabled", "false");
|
521 |
-
}
|
522 |
-
|
523 |
-
}
|
524 |
-
|
525 |
-
wp_register_script('my-wplc-admin-chatbox-ui-events', plugins_url('../js/wplc_u_admin_chatbox_ui_events.js', __FILE__), array('jquery'), $wplc_version, true);
|
526 |
-
wp_enqueue_script('my-wplc-admin-chatbox-ui-events');
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
$wplc_et_ajax_nonce = wp_create_nonce( "wplc_et_nonce" );
|
531 |
-
wp_register_script( 'wplc_transcript_admin', plugins_url( '../js/wplc_transcript.js', __FILE__ ), null, '', true );
|
532 |
-
$wplc_transcript_localizations = array(
|
533 |
-
'ajax_nonce' => $wplc_et_ajax_nonce,
|
534 |
-
'string_loading' => __( "Sending transcript...", "wplivechat" ),
|
535 |
-
'string_title' => __( "Sending Transcript", "wplivechat" ),
|
536 |
-
'string_close' => __( "Close", "wplivechat" ),
|
537 |
-
'string_chat_emailed' => __( "The chat transcript has been emailed.", "wplivechat" ),
|
538 |
-
'string_error1' => sprintf( __( "There was a problem emailing the chat. Please <a target='_BLANK' href='%s'>contact support</a>.", "wplivechat" ), "http://wp-livechat.com/contact-us/?utm_source=plugin&utm_medium=link&utm_campaign=error_emailing_chat" )
|
539 |
-
);
|
540 |
-
wp_localize_script( 'wplc_transcript_admin', 'wplc_transcript_nonce', $wplc_transcript_localizations );
|
541 |
-
wp_enqueue_script( 'wplc_transcript_admin' );
|
542 |
-
|
543 |
-
$wplc_node_token = get_option("wplc_node_server_secret_token");
|
544 |
-
if(!$wplc_node_token){
|
545 |
-
if(function_exists("wplc_node_server_token_regenerate")){
|
546 |
-
wplc_node_server_token_regenerate();
|
547 |
-
$wplc_node_token = get_option("wplc_node_server_secret_token");
|
548 |
-
}
|
549 |
-
}
|
550 |
-
|
551 |
-
$form_data = array("node_token" => $wplc_node_token, "action" => "wordpress");
|
552 |
-
$form_data = apply_filters("wplc_admin_dashboard_layout_node_request_variable_filter", $form_data); //Filter for pro to add a few request variables to the mix for additional structure
|
553 |
-
|
554 |
-
/*$options = array(
|
555 |
-
'http' => array(
|
556 |
-
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
|
557 |
-
'method' => 'POST',
|
558 |
-
'content' => http_build_query($form_data)
|
559 |
-
)
|
560 |
-
);
|
561 |
-
$context = @stream_context_create($options);
|
562 |
-
$result = @file_get_contents(BLEEPER_API_URL . BLEEPER_REMOTE_DASH_ROUTE, false, $context);*/
|
563 |
-
|
564 |
-
wp_localize_script('wplc-admin-js-agent', 'bleeper_remote_form_data_array', $form_data);
|
565 |
-
wp_localize_script('wplc-admin-js-agent', 'bleeper_remote_form_api_url', BLEEPER_API_URL);
|
566 |
-
wp_localize_script('wplc-admin-js-agent', 'bleeper_remote_form_route', BLEEPER_REMOTE_DASH_ROUTE);
|
567 |
-
|
568 |
-
|
569 |
-
if ( isset( $_GET['page'] ) && $_GET['page'] === 'wplivechat-menu' ) {
|
570 |
-
wp_localize_script('wplc-admin-js-agent', 'bleeper_in_dashboard', '1');
|
571 |
-
} else {
|
572 |
-
wp_localize_script('wplc-admin-js-agent', 'bleeper_in_dashboard', '0');
|
573 |
-
}
|
574 |
-
|
575 |
-
$inline_error_message = "<div class='error below-h1' style='display:none;' id='bleeper_inline_connection_error'>
|
576 |
-
<p>" . __("Connection Error", "wplivechat") . "<br /></p>
|
577 |
-
<p>" . __("We are having some trouble contacting the server. Please try again later.", "wplivechat") . "</p>
|
578 |
-
</div>";
|
579 |
-
wp_localize_script('wplc-admin-js-agent', 'bleeper_remote_form_error', $inline_error_message);
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
if (isset($wplc_settings['wplc_enable_visitor_sound']) && intval($wplc_settings['wplc_enable_visitor_sound']) == 1) {
|
586 |
-
wp_localize_script('wplc-admin-js-agent', 'bleeper_enable_visitor_sound', '1');
|
587 |
-
} else {
|
588 |
-
wp_localize_script('wplc-admin-js-agent', 'bleeper_enable_visitor_sound', '0');
|
589 |
-
}
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
$agent_display_name = $user_info->display_name;
|
595 |
-
|
596 |
-
wp_localize_script('wplc-admin-js-agent', 'agent_id', "" . $wplc_current_user);
|
597 |
-
wp_localize_script('wplc-admin-js-agent', 'bleeper_agent_name', apply_filters("wplc_agent_display_name_filter", $agent_display_name) );
|
598 |
-
wp_localize_script('wplc-admin-js-agent', 'nifty_api_key', get_option("wplc_node_server_secret_token"));
|
599 |
-
|
600 |
-
//For node verification
|
601 |
-
if(function_exists("wplc_pro_activate")){
|
602 |
-
wp_localize_script('wplc-admin-js-agent', 'bleeper_pro_auth', get_option('wp-live-chat-support-pro_key', "false"));
|
603 |
-
} else {
|
604 |
-
wp_localize_script('wplc-admin-js-agent', 'bleeper_pro_auth', 'false');
|
605 |
-
}
|
606 |
-
wp_localize_script('wplc-admin-js-agent', 'bleeper_agent_verification_end_point', rest_url('wp_live_chat_support/v1/validate_agent'));
|
607 |
-
wp_localize_script('wplc-admin-js-agent', 'bleeper_disable_mongo', "true");
|
608 |
-
wp_localize_script('wplc-admin-js-agent', 'bleeper_disable_add_message', "true");
|
609 |
-
wp_localize_script('wplc-admin-js-agent', 'wplc_nonce', wp_create_nonce("wplc"));
|
610 |
-
wp_localize_script('wplc-admin-js-agent', 'wplc_cid', "null");
|
611 |
-
wp_localize_script('wplc-admin-js-agent', 'wplc_chat_name', "null");
|
612 |
-
//wp_localize_script('wplc-admin-js-agent', 'wplc_chat_email', "null"); //TODO: Parse the email
|
613 |
-
|
614 |
-
wp_localize_script( 'wplc-admin-js-agent', 'wplc_show_chat_detail', $wplc_chat_detail );
|
615 |
-
|
616 |
-
wp_localize_script('wplc-admin-js-agent', 'wplc_agent_data', $a_array);
|
617 |
-
wp_localize_script('wplc-admin-js-agent', 'all_agents', $a_array);
|
618 |
-
|
619 |
-
wp_localize_script('wplc-admin-js-agent', 'wplc_url', plugins_url( '', dirname( __FILE__ ) ) );
|
620 |
-
|
621 |
-
if( isset($wplc_settings['wplc_settings_enabled']) && intval($wplc_settings["wplc_settings_enabled"]) == 2) {
|
622 |
-
|
623 |
-
$wplc_disabled_html = __("Chat is disabled in settings area, re-enable", "wplivechat");
|
624 |
-
$wplc_disabled_html .= " <a href='?page=wplivechat-menu-settings'>" . __("here", "wplivechat") . "</a>";
|
625 |
-
|
626 |
-
wp_localize_script('wplc-admin-js-agent', 'wplc_disabled', 'true');
|
627 |
-
wp_localize_script('wplc-admin-js-agent', 'wplc_disabled_html', $wplc_disabled_html);
|
628 |
-
}
|
629 |
-
|
630 |
-
|
631 |
-
//Added rest nonces
|
632 |
-
if(class_exists("WP_REST_Request")) {
|
633 |
-
wp_localize_script('wplc-admin-js-agent', 'wplc_restapi_enabled', '1');
|
634 |
-
wp_localize_script('wplc-admin-js-agent', 'wplc_restapi_token', get_option('wplc_api_secret_token'));
|
635 |
-
wp_localize_script('wplc-admin-js-agent', 'wplc_restapi_endpoint', rest_url('wp_live_chat_support/v1'));
|
636 |
-
wp_localize_script('wplc-admin-js-agent', 'bleeper_override_upload_url', rest_url('wp_live_chat_support/v1/remote_upload'));
|
637 |
-
wp_localize_script('wplc-admin-js-agent', 'wplc_restapi_nonce', wp_create_nonce( 'wp_rest' ));
|
638 |
-
|
639 |
-
} else {
|
640 |
-
wp_localize_script('wplc-admin-js-agent', 'wplc_restapi_enabled', '0');
|
641 |
-
wp_localize_script('wplc-admin-js-agent', 'wplc_restapi_nonce', "false");
|
642 |
-
}
|
643 |
-
|
644 |
-
$agent_tagline = apply_filters( "wplc_filter_simple_agent_data_agent_tagline", '', get_current_user_id() );
|
645 |
-
$agent_bio = apply_filters( "wplc_filter_simple_agent_data_agent_bio", '', '', get_current_user_id() );
|
646 |
-
$social_links = apply_filters( "wplc_filter_simple_agent_data_social_links", '', get_current_user_id() );
|
647 |
-
$head_data = array(
|
648 |
-
'tagline' => $agent_tagline,
|
649 |
-
'bio' => $agent_bio,
|
650 |
-
'social' => $social_links
|
651 |
-
);
|
652 |
-
wp_localize_script( 'wplc-admin-js-agent', 'wplc_head_data', $head_data );
|
653 |
-
wp_localize_script( 'wplc-admin-js-agent', 'wplc_user_chat_notification_prefix', __("User received notification:", "wplivechat") );
|
654 |
-
|
655 |
-
wp_localize_script( 'wplc-admin-js-agent', 'bleeper_valid_direct_to_page_array', wplc_node_pages_posts_array() );
|
656 |
-
|
657 |
-
if( isset($wplc_settings['wplc_new_chat_ringer_count']) && $wplc_settings['wplc_new_chat_ringer_count'] !== "") {
|
658 |
-
$wplc_ringer_count = intval($wplc_settings['wplc_new_chat_ringer_count']);
|
659 |
-
wp_localize_script( 'wplc-admin-js-agent', 'bleeper_ringer_count', "" . $wplc_ringer_count );
|
660 |
-
}
|
661 |
-
|
662 |
-
|
663 |
-
$wplc_server_location = get_option( "wplc_server_location" );
|
664 |
-
$wplc_server_location = apply_filters('wplc_node_server_default_selection_override', $wplc_server_location, $wplc_settings);
|
665 |
-
|
666 |
-
if( $wplc_server_location !== false && $wplc_server_location !== "" && $wplc_server_location !== "auto" ){
|
667 |
-
if ( $wplc_server_location === "us1") { $wplc_server_location = "0"; }
|
668 |
-
else if ( $wplc_server_location === "us2") { $wplc_server_location = "3"; }
|
669 |
-
else if ( $wplc_server_location === "eu1") { $wplc_server_location = "1"; }
|
670 |
-
else if ( $wplc_server_location === "eu2") { $wplc_server_location = "2"; }
|
671 |
-
else { $wplc_server_location = "0"; }
|
672 |
-
wp_localize_script( 'wplc-admin-js-agent', 'bleeper_server_location', $wplc_server_location );
|
673 |
-
}
|
674 |
-
|
675 |
-
/* use the end point override as the final decision for identifying the actual end point override variable */
|
676 |
-
$wplc_end_point_override = get_option("wplc_end_point_override");
|
677 |
-
if($wplc_end_point_override !== false && $wplc_end_point_override !== ""){
|
678 |
-
wp_localize_script( 'wplc-admin-js-agent', 'bleeper_end_point_override', $wplc_end_point_override );
|
679 |
-
}
|
680 |
-
|
681 |
-
wp_localize_script( 'wplc-admin-js-agent', 'bleeper_new_chat_notification_title', __('New chat received', 'wplivechat') );
|
682 |
-
wp_localize_script( 'wplc-admin-js-agent', 'bleeper_new_chat_notification_text', __("A new chat has been received. Please go the 'Live Chat' page to accept the chat", "wplivechat") );
|
683 |
-
|
684 |
-
$wplc_notification_icon = plugin_dir_url(dirname(__FILE__)) . 'images/wplc_notification_icon.png';
|
685 |
-
wp_localize_script( 'wplc-admin-js-agent', 'bleeper_new_chat_notification_icon', $wplc_notification_icon );
|
686 |
-
|
687 |
-
do_action("wplc_admin_remoter_dashboard_scripts_localizer"); //For pro localization of agents list, and departments
|
688 |
-
|
689 |
-
wp_enqueue_script('wplc-admin-js-agent');
|
690 |
-
|
691 |
-
wp_register_script('wplc-admin-chat-server', plugins_url( '../js/wplc_server.js', __FILE__ ), array("wplc-admin-js-agent", "wplc-admin-js-sockets"), $wplc_version, false); //Added this for async storage calls
|
692 |
-
wp_enqueue_script('wplc-admin-chat-server');
|
693 |
-
|
694 |
-
wp_localize_script( 'wplc-admin-chat-server', 'wplc_datetime_format', array(
|
695 |
-
'date_format' => get_option( 'date_format' ),
|
696 |
-
'time_format' => get_option( 'time_format' ),
|
697 |
-
) );
|
698 |
-
|
699 |
-
wp_register_script('wplc-admin-chat-events', plugins_url( '../js/wplc_u_admin_events.js', __FILE__ ), array("wplc-admin-js-agent", "wplc-admin-js-sockets", "wplc-admin-chat-server"), $wplc_version, false); //Added this for async storage calls
|
700 |
-
wp_enqueue_script('wplc-admin-chat-events');
|
701 |
-
|
702 |
-
if (isset($wplc_settings['wplc_show_date']) && $wplc_settings["wplc_show_date"] == '1') {
|
703 |
-
wp_localize_script('wplc-admin-chat-server', 'wplc_show_date', 'true');
|
704 |
-
} else {
|
705 |
-
wp_localize_script('wplc-admin-chat-server', 'wplc_show_date', 'false');
|
706 |
-
}
|
707 |
-
|
708 |
-
if (isset($wplc_settings['wplc_show_time']) && $wplc_settings["wplc_show_time"] == '1') {
|
709 |
-
wp_localize_script('wplc-admin-chat-server', 'wplc_show_time', 'true');
|
710 |
-
} else {
|
711 |
-
wp_localize_script('wplc-admin-chat-server', 'wplc_show_time', 'false');
|
712 |
-
}
|
713 |
-
|
714 |
-
if (isset($wplc_settings['wplc_show_name']) && $wplc_settings["wplc_show_name"] == '1') {
|
715 |
-
wp_localize_script('wplc-admin-chat-server', 'wplc_show_name', 'true');
|
716 |
-
} else {
|
717 |
-
wp_localize_script('wplc-admin-chat-server', 'wplc_show_name', 'false');
|
718 |
-
}
|
719 |
-
|
720 |
-
if (isset($wplc_settings['wplc_show_avatar']) && $wplc_settings["wplc_show_avatar"] == '1') {
|
721 |
-
wp_localize_script('wplc-admin-chat-server', 'wplc_show_avatar', 'true');
|
722 |
-
} else {
|
723 |
-
wp_localize_script('wplc-admin-chat-server', 'wplc_show_avatar', 'false');
|
724 |
-
}
|
725 |
-
}
|
726 |
-
}
|
727 |
-
|
728 |
-
add_action("wplc_admin_remoter_dashboard_scripts_localizer", "wplc_admin_remote_dashboard_localize_upselling_tips");
|
729 |
-
/*
|
730 |
-
* Localizes an array of upselling tips
|
731 |
-
*/
|
732 |
-
function wplc_admin_remote_dashboard_localize_upselling_tips(){
|
733 |
-
$tips_header = __("Did you know?", "wplivechat");
|
734 |
-
|
735 |
-
$tips_array = array(
|
736 |
-
"0" => "<p><a href='http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=unlimited_agents_tip' title='".__("Add unlimited agents", "wplivechat")."' target=\"_BLANK\">".__("Add unlimited agents", "wplivechat")."</a> ".__(" with the Pro add-on of WP Live Chat Support","wplivechat")." "."<a href='http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=unlimited_agents_tip2' target='_BLANK'>".__("(once off payment).","wplivechat")."</a></p>",
|
737 |
-
"1" => "<p>".__("With the Pro add-on of WP Live Chat Support, you can", "wplivechat")." <a href='http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=initiate_tip' title='".__("see who's online and initiate chats", "wplivechat")."' target=\"_BLANK\">".__("initiate chats", "wplivechat")."</a> ".__("with your online visitors with the click of a button.", "wplivechat")." <br /><br /><a href='http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=initiate_tip2' title='".__("Buy the Pro add-on now (once off payment).", "wplivechat")."' target=\"_BLANK\"><strong>".__("Buy the Pro add-on now (once off payment).", "wplivechat")."</strong></a></p>",
|
738 |
-
"2" => "<p><a href='http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=transfer_tip' title='".__("Transfer Chats", "wplivechat")."' target=\"_BLANK\">".__("Transfer Chats", "wplivechat")."</a> ".__(" with the Pro add-on of WP Live Chat Support","wplivechat")." "."<a href='http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=transfer_tip2' target='_BLANK'>".__("(once off payment).","wplivechat")."</a></p>"
|
739 |
-
);
|
740 |
-
|
741 |
-
$tips_array = apply_filters("wplc_admin_remote_dashboard_localize_tips_array", $tips_array);
|
742 |
-
|
743 |
-
wp_localize_script( 'wplc-admin-js-agent', 'agent_to_agent_chat_upsell', sprintf(__('Chat to other agents with the <a href="%s" target="_BLANK">Pro version</a>.' ,'wplivechat'),'https://wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=a2achat'));
|
744 |
-
|
745 |
-
$initiate_upsell = "<i class='fa fa-horn'></i> ".__("With the Pro add-on of WP Live Chat Support, you can", "wplivechat");
|
746 |
-
$initiate_upsell .= ' <a href="https://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=initiate1" title="'.__("see who's online and initiate chats", "wplivechat").'" target=\"_BLANK\">';
|
747 |
-
$initiate_upsell .= __("initiate chats", "wplivechat");
|
748 |
-
$initiate_upsell .= '</a> '.__("with your online visitors with the click of a button.", "wplivechat");
|
749 |
-
$initiate_upsell .= ' <a href="https://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=initiate2" title="'.__("Buy the Pro add-on now.", "wplivechat").'" target=\"_BLANK\">';
|
750 |
-
$initiate_upsell .= '<strong>'.__("Buy the Pro add-on now.", "wplivechat").'</strong></a>';
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
wp_localize_script( 'wplc-admin-js-agent', 'initiate_chat_upsell', $initiate_upsell);
|
755 |
-
|
756 |
-
|
757 |
-
wp_localize_script( 'wplc-admin-js-agent', 'wplc_event_upsell', sprintf( __( 'Get detailed visitor events with the <a target="_BLANK" href="%s">Pro version</a>.', 'wplivechat'), 'https://wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=pro_events' ) );
|
758 |
-
|
759 |
-
wp_localize_script( 'wplc-admin-js-agent', 'wplc_tip_header', $tips_header );
|
760 |
-
wp_localize_script( 'wplc-admin-js-agent', 'wplc_tip_array', $tips_array );
|
761 |
-
|
762 |
-
if (!function_exists("wplc_pro_activate")) {
|
763 |
-
/* identify if the user wants to display the agent to agent chat upsell */
|
764 |
-
$wplc_current_user = get_current_user_id();
|
765 |
-
$check = get_user_meta( $wplc_current_user, "wplc_a2a_upsell" );
|
766 |
-
if ($check) {
|
767 |
-
wp_localize_script( 'wplc-admin-js-agent', 'wplc_upsell_a2a', '1' );
|
768 |
-
}
|
769 |
-
|
770 |
-
}
|
771 |
-
|
772 |
-
|
773 |
-
}
|
774 |
-
|
775 |
-
/**
|
776 |
-
* Loads remote dashboard styles
|
777 |
-
*
|
778 |
-
* @return void
|
779 |
-
*/
|
780 |
-
function wplc_admin_remote_dashboard_styles(){
|
781 |
-
global $wplc_version;
|
782 |
-
|
783 |
-
$wplc_settings = get_option("WPLC_SETTINGS");
|
784 |
-
|
785 |
-
wp_register_style( 'wplc-admin-style', "https://bleeper.io/app/assets/css/chat_dashboard/admin_style.css", false, $wplc_version );
|
786 |
-
wp_enqueue_style( 'wplc-admin-style' );
|
787 |
-
|
788 |
-
if (!isset($wplc_settings['wplc_show_avatar']) || (isset($wplc_settings['wplc_show_avatar']) && intval($wplc_settings['wplc_show_avatar']) == 0) ) {
|
789 |
-
wp_add_inline_style( 'wplc-admin-style', ".wplc-user-message, .wplc-admin-message { padding-left: 0 !important; }" );
|
790 |
-
|
791 |
-
/*
|
792 |
-
if(!isset($wplc_settings['wplc_show_name']) || (isset($wplc_settings['wplc_show_name']) && intval($wplc_settings['wplc_show_name']) == 0) ){
|
793 |
-
//User is hiding both name and grav - add more inline styles
|
794 |
-
|
795 |
-
$current_agent_info = wp_get_current_user();
|
796 |
-
$current_agent_initial = "A"; //Default
|
797 |
-
|
798 |
-
if(isset($current_agent_info->display_name)){
|
799 |
-
$current_agent_initial = substr($current_agent_info->display_name, 0, 1);
|
800 |
-
}
|
801 |
-
|
802 |
-
|
803 |
-
$inline_identity_css =
|
804 |
-
"
|
805 |
-
.wplc-admin-message .messageBody::before {
|
806 |
-
display:inline-block; width: 15px; height: 15px; background:#333; content:'" . $current_agent_initial . "'; color:#fff; margin-right:10px; position:relative; top:px; text-align:center; font-size: 10px; border-radius:3px;
|
807 |
-
}
|
808 |
-
|
809 |
-
.wplc-user-message .messageBody::before {
|
810 |
-
display:inline-block; width: 15px; height: 15px; background:#2b97d2; content:'U'; color:#fff; margin-right:10px; position:relative; top:px; text-align:center; font-size: 10px; border-radius:3px;
|
811 |
-
}
|
812 |
-
";
|
813 |
-
|
814 |
-
wp_add_inline_style( 'wplc-admin-style', $inline_identity_css );
|
815 |
-
}*/
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
} else if( !isset($wplc_settings['wplc_show_name']) || (isset($wplc_settings['wplc_show_name']) && intval($wplc_settings['wplc_show_name']) == 0) ){
|
820 |
-
//User has enabled the gravatar, but has chosen to hide the user name.
|
821 |
-
//This causes some issues with admin display so let's just add some different styling to get around this
|
822 |
-
$inline_identity_css =
|
823 |
-
"
|
824 |
-
.wplc-admin-message-avatar, .wplc-user-message-avatar {
|
825 |
-
max-width:28px !important;
|
826 |
-
max-height:28px !important;
|
827 |
-
}
|
828 |
-
|
829 |
-
.wplc-admin-message, .wplc-user-message{
|
830 |
-
padding-left:25px !important;
|
831 |
-
}
|
832 |
-
|
833 |
-
.wplc-admin-message::before, .wplc-user-message::before {
|
834 |
-
content: ' ';
|
835 |
-
width: 7px;
|
836 |
-
height: 7px;
|
837 |
-
background:#343434;
|
838 |
-
position: absolute;
|
839 |
-
left: 12px;
|
840 |
-
border-radius: 2px;
|
841 |
-
z-index: 1;
|
842 |
-
}
|
843 |
-
|
844 |
-
.wplc-user-message::before {
|
845 |
-
background:#2b97d2;
|
846 |
-
}
|
847 |
-
";
|
848 |
-
|
849 |
-
wp_add_inline_style( 'wplc-admin-style', $inline_identity_css );
|
850 |
-
}
|
851 |
-
|
852 |
-
wp_register_style( 'wplc-admin-style-bootstrap', "https://bleeper.io/app/assets/css/bootstrap.css", false, $wplc_version );
|
853 |
-
wp_enqueue_style( 'wplc-admin-style-bootstrap' );
|
854 |
-
|
855 |
-
if(empty($wplc_settings['wplc_disable_emojis']))
|
856 |
-
{
|
857 |
-
wp_register_style( 'wplc-admin-style-emoji', "https://bleeper.io/app/assets/wdt-emoji/wdt-emoji-bundle.css", false, $wplc_version );
|
858 |
-
wp_enqueue_style( 'wplc-admin-style-emoji' );
|
859 |
-
}
|
860 |
-
|
861 |
-
do_action("wplc_admin_remote_dashboard_styles_hook");
|
862 |
-
}
|
863 |
-
|
864 |
-
add_action("wplc_admin_remote_dashboard_above", "wplc_limited_error_output");
|
865 |
-
/*
|
866 |
-
* Outputs an error for limitations due to API key
|
867 |
-
*/
|
868 |
-
function wplc_limited_error_output(){
|
869 |
-
if(function_exists("wplc_pro_activate")){
|
870 |
-
echo "<p id='wplc_limited_container' class='update-nag' style='display:none;'>";
|
871 |
-
echo "<strong>" . __("Dear Pro User,", "wplivechat") . "</strong><br>";
|
872 |
-
echo __("Your API Key could not be validated, some functionality may be limited", "wplivechat");
|
873 |
-
echo "</p>";
|
874 |
-
}
|
875 |
-
|
876 |
-
echo "<p id='wplc_agent_invalid_container' class='update-nag' style='display:none;'>";
|
877 |
-
echo __("You are not a verified agent, chat dashboard has been disabled", "wplivechat");
|
878 |
-
echo "</p>";
|
879 |
-
}
|
880 |
-
|
881 |
-
/*
|
882 |
-
* Add action for notice checks
|
883 |
-
*/
|
884 |
-
if ( ! function_exists( "wplc_active_chat_box_notices" ) ) {
|
885 |
-
if(isset($_GET['page']) && $_GET['page'] === "wplivechat-menu"){
|
886 |
-
add_action( "wplc_admin_remote_dashboard_above", "wplc_active_chat_box_notices" );
|
887 |
-
}
|
888 |
-
}
|
889 |
-
|
890 |
-
add_action("wplc_admin_general_node_compat_check", "wplc_node_compat_version_check");
|
891 |
-
add_action("wplc_admin_remote_dashboard_above", "wplc_node_compat_version_check", 1);
|
892 |
-
/*
|
893 |
-
* Checks if current Pro is compatible with node basic, if not, show notice, and localize scripts needed for conflict free execution
|
894 |
-
*/
|
895 |
-
function wplc_node_compat_version_check(){
|
896 |
-
global $wplc_pro_version;
|
897 |
-
$wplc_ver = str_replace('.', '', $wplc_pro_version);
|
898 |
-
$checker = intval($wplc_ver);
|
899 |
-
if (function_exists("wplc_pro_version_control") && $checker < 8000) {
|
900 |
-
$wpc_ma_js_strings = array(
|
901 |
-
'remove_agent' => __('Remove', 'wplivechat'),
|
902 |
-
'nonce' => wp_create_nonce("wplc"),
|
903 |
-
'user_id' => get_current_user_id(),
|
904 |
-
'typing_string' => __('Typing...', 'wplivechat')
|
905 |
-
|
906 |
-
);
|
907 |
-
wp_localize_script('wplc-admin-js-agent', 'wplc_admin_strings', $wpc_ma_js_strings);
|
908 |
-
|
909 |
-
if(isset($_GET['page']) && $_GET['page'] === "wplivechat-menu"){
|
910 |
-
wp_register_script('wplc-admin-force-offline-js', plugins_url('../js/wplc_node_offline_mode_controller.js', __FILE__), array('jquery'), '', true);
|
911 |
-
wp_enqueue_script('wplc-admin-force-offline-js');
|
912 |
-
}
|
913 |
-
|
914 |
-
$is_dashboard = (isset($_GET['page']) && $_GET['page'] === "wplivechat-menu") ? true : false;
|
915 |
-
?>
|
916 |
-
<div class="<?php echo ($is_dashboard ? "" : "update-nag"); ?>" id="wplc_offline_mode_prompt_container" style='margin-top:5px;margin-bottom:5px;<?php echo ($is_dashboard ? "display:none; " : ""); ?>'>
|
917 |
-
<div style="display: inline-block; width: 80px; position: absolute; padding-top: 1em;">
|
918 |
-
<img src="https://bleeper.io/app/assets/images/wplc_loading.png" />
|
919 |
-
</div>
|
920 |
-
<div style="display: inline-block; margin-left: 80px;">
|
921 |
-
<p style="display: none;"><strong id="wplc_offline_mode_prompt"><?php _e("WP Live Chat Support - Offline Mode", "wplivechat") ?></strong></p>
|
922 |
-
<?php echo wplc_node_compat_pro_update_nag_content(); ?>
|
923 |
-
</div>
|
924 |
-
</div>
|
925 |
-
<?php
|
926 |
-
}
|
927 |
-
}
|
928 |
-
|
929 |
-
/*
|
930 |
-
* Checks if the users Pro API key is expired - this will only be called if pro is active and is less than V8
|
931 |
-
* true -> Show link to my account page
|
932 |
-
* false -> Show link to update page
|
933 |
-
*/
|
934 |
-
function wplc_node_compat_pro_update_nag_content(){
|
935 |
-
$html_out = "<p id='wplc_offline_mode_reason'>";
|
936 |
-
|
937 |
-
$is_pro_valid = wplc_node_compat_pro_api_key_is_valid_post();
|
938 |
-
|
939 |
-
if($is_pro_valid){
|
940 |
-
$html_out .= sprintf(__("Chat is now in offline mode, please <a href='%s' target='_BLANK'>upgrade to Version 8</a> (or above) of the WP Live Chat Support Pro Add-on to ensure all functionality works as expected.", "wplivechat"), "update-core.php");
|
941 |
-
} else {
|
942 |
-
$html_out .= sprintf(__("Chat is now in offline mode, please renew your API key by visiting the <a href='%s' target='_BLANK'>My Account</a> area, and receive updates.", "wplivechat"), "https://wp-livechat.com/my-account");
|
943 |
-
}
|
944 |
-
|
945 |
-
$html_out .= "</p>";
|
946 |
-
|
947 |
-
$html_out .= "<p>";
|
948 |
-
$html_out .= __("Alternatively, please disable the node server option in the Live Chat settings area (Live Chat -> Settings -> Advanced Features)", "wplivechat");
|
949 |
-
$html_out .= "</p>";
|
950 |
-
|
951 |
-
if($is_pro_valid){
|
952 |
-
$html_out .= "<a href='update-core.php' class='button button-primary' target='_BLANK'>" . __("Upgrade", "wplivechat") . "</a>";
|
953 |
-
} else {
|
954 |
-
$html_out .= "<a href='update-core.php' class='button button-primary' target='_BLANK'>" . __("Renew License", "wplivechat") . "</a>";
|
955 |
-
}
|
956 |
-
|
957 |
-
if(!isset($_GET['page']) || $_GET['page'] !== "wplivechat-menu-settings"){
|
958 |
-
$html_out .= " <a href='?page=wplivechat-menu-settings#tabs-beta' class='button' target='_BLANK'>" . __("Settings", "wplivechat") . "</a>";
|
959 |
-
}
|
960 |
-
|
961 |
-
$html_out .= " <a href='?page=wplivechat-menu&action=welcome' class='button' target='_BLANK'>" . __("Whats new in Version 8", "wplivechat") . "</a>";
|
962 |
-
|
963 |
-
return $html_out;
|
964 |
-
|
965 |
-
}
|
966 |
-
|
967 |
-
/*
|
968 |
-
* Checks if the Pro API key is valid or not
|
969 |
-
* Returns true or false
|
970 |
-
*/
|
971 |
-
function wplc_node_compat_pro_api_key_is_valid_post(){
|
972 |
-
$wplc_pro_validation_url = "http://ccplugins.co/api-control/";
|
973 |
-
$wplc_pro_option_key = "wp-live-chat-support-pro_key";
|
974 |
-
$wplc_pro_slug = "wp-live-chat-support-pro";
|
975 |
-
$is_valid = false; //By default it is false
|
976 |
-
if (get_option($wplc_pro_option_key)) {
|
977 |
-
$args = array(
|
978 |
-
'slug' => $wplc_pro_slug,
|
979 |
-
);
|
980 |
-
$data_array = array(
|
981 |
-
'method' => 'POST',
|
982 |
-
'body' => array(
|
983 |
-
'action' => 'api_validation',
|
984 |
-
'd' => get_option('siteurl'),
|
985 |
-
'request' => serialize($args),
|
986 |
-
'api_key' => get_option($wplc_pro_option_key)
|
987 |
-
));
|
988 |
-
$response = wp_remote_post($wplc_pro_validation_url, $data_array);
|
989 |
-
if (is_array($response)) {
|
990 |
-
if ( $response['response']['code'] == "200" ) {
|
991 |
-
$data = $response['body'];
|
992 |
-
$data = unserialize($data);
|
993 |
-
|
994 |
-
if(isset($data['status']) && $data['status'] === "OK"){
|
995 |
-
$is_valid = true;
|
996 |
-
}
|
997 |
-
}
|
998 |
-
}
|
999 |
-
|
1000 |
-
}
|
1001 |
-
|
1002 |
-
return $is_valid;
|
1003 |
-
}
|
1004 |
-
|
1005 |
-
add_filter("wplc_loggedin_filter","wplc_node_compat_version_disable_chat",99,1);
|
1006 |
-
/*
|
1007 |
-
* Checks if user is using out-date pro with node server, if so, disable chat on front end
|
1008 |
-
*/
|
1009 |
-
function wplc_node_compat_version_disable_chat($logged_in) {
|
1010 |
-
global $wplc_pro_version;
|
1011 |
-
$wplc_settings = get_option("WPLC_SETTINGS");
|
1012 |
-
if(isset($wplc_settings['wplc_use_node_server']) && $wplc_settings['wplc_use_node_server'] == 1){
|
1013 |
-
$wplc_ver = str_replace('.', '', $wplc_pro_version);
|
1014 |
-
$checker = intval($wplc_ver);
|
1015 |
-
if (function_exists("wplc_pro_version_control") && $checker < 8000) {
|
1016 |
-
return false; //Force chat offline
|
1017 |
-
}
|
1018 |
-
}
|
1019 |
-
return $logged_in;
|
1020 |
-
}
|
1021 |
-
|
1022 |
-
add_action("admin_notices", "wplc_node_v8_plus_notice_dismissable");
|
1023 |
-
/*
|
1024 |
-
* Displays an admin notice (which can be dismissed), to notify any V8+ users of the node option (if not already checked)
|
1025 |
-
*/
|
1026 |
-
function wplc_node_v8_plus_notice_dismissable(){
|
1027 |
-
if(isset($_GET['page']) && strpos($_GET['page'], 'wplivechat') !== FALSE){
|
1028 |
-
if(isset($_GET['wplc_dismiss_notice_v8']) && $_GET['wplc_dismiss_notice_v8'] === "true"){
|
1029 |
-
update_option("wplc_node_v8_plus_notice_dismissed", 'true');
|
1030 |
-
}
|
1031 |
-
|
1032 |
-
$wplc_settings = get_option("WPLC_SETTINGS");
|
1033 |
-
if(isset($wplc_settings['wplc_use_node_server']) && $wplc_settings['wplc_use_node_server'] == 1){
|
1034 |
-
//Do Nothing
|
1035 |
-
} else {
|
1036 |
-
//User is not on node, let's check if they have seen this notice before, if not, let's show a notice
|
1037 |
-
$wplc_has_notice_been_dismissed = get_option("wplc_node_v8_plus_notice_dismissed", false);
|
1038 |
-
if($wplc_has_notice_been_dismissed === false){
|
1039 |
-
//Has not been dismissed
|
1040 |
-
$output = "<div class='notice notice-warning' style='border-color: #0180bc;'>";
|
1041 |
-
$output .= "<p><strong>" . __( 'Welcome to V8 of WP Live Chat Support', 'wplivechat' ) . "</strong></p>";
|
1042 |
-
$output .= "<p>" . __('Did you know, this version features high speed message delivery, agent to agent chat, and a single window layout?', 'wplivechat') . "</p>";
|
1043 |
-
$output .= "<p>" . __('To activate this functionality please navigate to Live Chat -> Settings -> Advanced Features -> And enable our Chat Server option.', 'wplivechat') . "</p>";
|
1044 |
-
|
1045 |
-
$output .= "<p>";
|
1046 |
-
$output .= "<a href='?page=wplivechat-menu-settings#tabs-beta' class='button button-primary'>" . __("Show me!", "wplivechat") . "</a> ";
|
1047 |
-
$output .= "<a href='?page=".$_GET['page']."&wplc_dismiss_notice_v8=true' id='wplc_v8_dismiss_node_notice' class='button'>" . __("Don't Show This Again", "wplivechat") . "</a>";
|
1048 |
-
$output .= "</p>";
|
1049 |
-
|
1050 |
-
$output .= "</div>";
|
1051 |
-
|
1052 |
-
echo $output;
|
1053 |
-
}
|
1054 |
-
}
|
1055 |
-
}
|
1056 |
-
}
|
1057 |
-
|
1058 |
-
add_filter("wplc_activate_default_settings_array", "wplc_node_set_default_settings", 10, 1);
|
1059 |
-
/*
|
1060 |
-
* Adds default node setting to the default settings array
|
1061 |
-
*/
|
1062 |
-
function wplc_node_set_default_settings($wplc_default_settings_array){
|
1063 |
-
if(is_array($wplc_default_settings_array)){
|
1064 |
-
if(!isset($wplc_default_settings_array['wplc_use_node_server'])){
|
1065 |
-
//Is not set already
|
1066 |
-
$wplc_default_settings_array['wplc_use_node_server'] = 1;
|
1067 |
-
}
|
1068 |
-
}
|
1069 |
-
return $wplc_default_settings_array;
|
1070 |
-
}
|
1071 |
-
|
1072 |
-
add_filter( 'rest_url', 'wplc_node_rest_url_ssl_fix');
|
1073 |
-
/**
|
1074 |
-
* Changes the REST URL to include the SSL version if we are using SSL
|
1075 |
-
* See https://core.trac.wordpress.org/ticket/36451
|
1076 |
-
*/
|
1077 |
-
function wplc_node_rest_url_ssl_fix($url){
|
1078 |
-
if (is_ssl()){
|
1079 |
-
$url = set_url_scheme( $url, 'https' );
|
1080 |
-
return $url;
|
1081 |
-
}
|
1082 |
-
return $url;
|
1083 |
-
}
|
1084 |
-
|
1085 |
-
/**
|
1086 |
-
* Returns an array of pages/posts available on the site
|
1087 |
-
*/
|
1088 |
-
function wplc_node_pages_posts_array(){
|
1089 |
-
$r = array(
|
1090 |
-
'depth' => 0,
|
1091 |
-
'child_of' => 0,
|
1092 |
-
'echo' => false,
|
1093 |
-
'id' => '',
|
1094 |
-
'class' => '',
|
1095 |
-
'show_option_none' => '',
|
1096 |
-
'show_option_no_change' => '',
|
1097 |
-
'option_none_value' => '',
|
1098 |
-
'value_field' => 'ID',
|
1099 |
-
);
|
1100 |
-
|
1101 |
-
$pages = get_pages($r);
|
1102 |
-
$posts = get_posts(array('posts_per_page' => -1));
|
1103 |
-
|
1104 |
-
$posts_pages = array_merge($pages,$posts);
|
1105 |
-
|
1106 |
-
$return_array = array();
|
1107 |
-
|
1108 |
-
foreach ($posts_pages as $key => $value) {
|
1109 |
-
$post_page_id = $value->ID;
|
1110 |
-
$post_page_title = $value->post_title;
|
1111 |
-
|
1112 |
-
$return_array[get_permalink($post_page_id)] = $post_page_title;
|
1113 |
-
}
|
1114 |
-
|
1115 |
-
return $return_array;
|
1116 |
-
}
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
add_action("init","wplc_node_cloud_server_integration_hook_handler");
|
1121 |
-
/**
|
1122 |
-
* V8 Cloud Action & Filter Handlers
|
1123 |
-
*/
|
1124 |
-
function wplc_node_cloud_server_integration_hook_handler() {
|
1125 |
-
$wplc_settings = get_option("WPLC_SETTINGS");
|
1126 |
-
if(isset($wplc_settings['wplc_use_node_server']) && $wplc_settings['wplc_use_node_server'] == 1){
|
1127 |
-
if(function_exists("wplc_cloud_load_updates")){
|
1128 |
-
remove_action("init","wplc_cloud_load_updates");
|
1129 |
-
remove_action("wplc_hook_chat_dashboard_above","wplc_cloud_1_hook_chat_dashboard_above");
|
1130 |
-
remove_action("wplc_hook_admin_chatbox_javascript","wplc_cloud_hook_control_push_js_to_admin", 10);
|
1131 |
-
remove_action("wplc_hook_push_js_to_front","wplc_cloud_hook_control_push_js_to_front", 10);
|
1132 |
-
remove_action("wplc_hook_chat_history","wplc_cloud_hook_control_chat_history", 1);
|
1133 |
-
remove_action("wplc_hook_chat_missed","wplc_cloud_hook_control_chat_missed", 1);
|
1134 |
-
remove_action("wplc_hook_initiate_check","wplc_cloud_hook_control_intiate_check", 1);
|
1135 |
-
remove_action("wplc_hook_history_draw_area","wplc_cloud_hook_control_history_draw_area", 1);
|
1136 |
-
remove_action("wplc_hook_change_status_on_answer","wplc_cloud_hook_control_change_status_on_answer", 1);
|
1137 |
-
remove_action("wplc_hook_update_agent_id","wplc_cloud_hook_control_update_agent_id", 1);
|
1138 |
-
remove_action('wplc_hook_accept_chat_url' , 'wplc_cloud_hook_control_accept_chat_url', 1);
|
1139 |
-
remove_action("wplc_hook_ma_check_if_answered_by_another_agent","wplc_cloud_hook_check_if_answered_by_another_agent", 1);
|
1140 |
-
remove_action("wplc_hook_settings_page_more_tabs","wplc_cloud_hook_control_settings_page_more_tabs");
|
1141 |
-
remove_action("init","wplc_cloud_first_run_check");
|
1142 |
-
remove_action('wplc_hook_admin_settings_save','wplc_cloud_save_settings');
|
1143 |
-
remove_action("wplc_api_route_hook", "wplc_api_node_routes_cloud", 1);
|
1144 |
-
remove_action('http_api_curl', 'wplc_cloud_http_api_curl', 100);
|
1145 |
-
remove_action("init", "wplc_cloud_additional_hooks", 1);
|
1146 |
-
|
1147 |
-
remove_filter("wplc_filter_get_chat_messages","wplc_cloud_filter_control_chat_messages",10);
|
1148 |
-
remove_filter("wplc_filter_get_chat_data","wplc_cloud_filter_control_chat_data",1);
|
1149 |
-
remove_filter("wplc_filter_chat_area_data","wplc_cloud_filter_control_chat_area_data",10);
|
1150 |
-
remove_filter("wplc_rating_data_filter","wplc_cloud_filter_control_get_rating_data",1);
|
1151 |
-
remove_filter("wplc_filter_admin_javascript","wplc_cloud_filter_control_admin_javascript");
|
1152 |
-
remove_filter("wplc_start_chat_user_form_after_filter", "wplc_start_chat_user_form_after_filter_remove_departments_cloud",2);
|
1153 |
-
remove_filter("wplc_after_chat_visitor_count_hook", "wplc_admin_cloud_remove_departments_chat_area_before_end_chat_button",2);
|
1154 |
-
remove_filter("wplc_admin_chat_area_before_end_chat_button", "wplc_admin_cloud_remove_transfer_button_chat_area_before_end_chat_button",2);
|
1155 |
-
remove_filter("wplc_filter_front_js_extra_data","wplc_cloud_filter_control_front_js_extra_data",10);
|
1156 |
-
remove_filter("wplc_filter_ajax_url","wplc_cloud_filter_control_ajax_url",10);
|
1157 |
-
remove_filter("wplc_filter_setting_tabs","wplc_cloud_filter_control_setting_tabs");
|
1158 |
-
remove_filter("wplc_filter_menu_api","wplc_cloud_filter_control_menu_api",1);
|
1159 |
-
remove_filter('http_request_args', 'wplc_cloud_http_request_args',100);
|
1160 |
-
}
|
1161 |
-
}
|
1162 |
-
}
|
1163 |
-
|
1164 |
-
add_action("init","wplc_node_mobile_integration_hook_handler");
|
1165 |
-
/**
|
1166 |
-
* V8 Mobile/Desktop Extension Action & Filter Handlers
|
1167 |
-
*/
|
1168 |
-
function wplc_node_mobile_integration_hook_handler() {
|
1169 |
-
$wplc_settings = get_option("WPLC_SETTINGS");
|
1170 |
-
if(isset($wplc_settings['wplc_use_node_server']) && $wplc_settings['wplc_use_node_server'] == 1){
|
1171 |
-
if(function_exists("wplc_md_load_updates")){
|
1172 |
-
remove_action("init","wplc_md_load_updates");
|
1173 |
-
remove_action("wplc_hook_settings_page_more_tabs","wplc_mobile_hook_control_settings_page_more_tabs");
|
1174 |
-
remove_action("init","wplc_mobile_first_run_check");
|
1175 |
-
remove_action('wplc_hook_admin_settings_save','wplc_mobile_save_settings');
|
1176 |
-
|
1177 |
-
remove_filter("wplc_filter_is_admin_logged_in","wplc_mobile_check_if_logged_in",10);
|
1178 |
-
remove_filter("wplc_filter_setting_tabs","wplc_mobile_filter_control_setting_tabs");
|
1179 |
-
remove_filter("wplc_filter_menu_api","wplc_mobile_filter_control_menu_api");
|
1180 |
-
}
|
1181 |
-
}
|
1182 |
-
}
|
1183 |
-
|
1184 |
-
|
1185 |
-
add_action("wplc_admin_remoter_dashboard_scripts_localizer", "wplc_admin_remote_dashboard_dynamic_translation_handler");
|
1186 |
-
/*
|
1187 |
-
* Localizes an array of strings and ids in the dashboard which need to be replaced
|
1188 |
-
* Loads the custom JS file responsible for replacing the content dynamically.
|
1189 |
-
*/
|
1190 |
-
function wplc_admin_remote_dashboard_dynamic_translation_handler(){
|
1191 |
-
|
1192 |
-
global $wplc_version;
|
1193 |
-
wp_register_script('wplc-admin-dynamic-translation', plugins_url( '../js/wplc_admin_dynamic_translations.js', __FILE__ ), array("wplc-admin-js-agent", "wplc-admin-js-sockets", "jquery"), $wplc_version, false); //Added this for async storage calls
|
1194 |
-
|
1195 |
-
$wplc_dynamic_translation_array = array(
|
1196 |
-
'nifty_bg_holder_text_inner' => __('Connecting...', 'wplivechat'),
|
1197 |
-
'nifty_admin_chat_prompt_title' => __('Please Confirm', 'wplivechat'),
|
1198 |
-
'nifty_admin_chat_prompt_confirm' => __('Confirm', 'wplivechat'),
|
1199 |
-
'nifty_admin_chat_prompt_cancel' => __('Cancel', 'wplivechat'),
|
1200 |
-
'active_count_string' => __(' Active visitors', 'wplivechat'),
|
1201 |
-
'wplc-agent-info' => __('Agent(s) Online', 'wplivechat'),
|
1202 |
-
'wplc_history_link' => __('Chat History', 'wplivechat'),
|
1203 |
-
'nifty_agent_heading' => __('Agents', 'wplivechat'),
|
1204 |
-
'drag_zone_inner_text' => __('Drag Files Here', 'wplivechat'),
|
1205 |
-
'chatTransferLink' => __('Transfer', 'wplivechat'),
|
1206 |
-
'chatTransferDepLink' => __('Department Transfer', 'wplivechat'),
|
1207 |
-
'chatDirectUserToPageLink' => __('Direct User To Page', 'wplivechat'),
|
1208 |
-
'chatCloseTitle' => __('Leave chat', 'wplivechat'),
|
1209 |
-
'chatEndTitle' => __('End chat', 'wplivechat'),
|
1210 |
-
'chatTransferUps' => __('Transfer', 'wplivechat'),
|
1211 |
-
'chatDirectUserToPageUps' => __('Direct User To Page', 'wplivechat'),
|
1212 |
-
'nifty_event_heading' => __('Events', 'wplivechat'),
|
1213 |
-
'nifty_join_chat_button' => __('Join chat', 'wplivechat'),
|
1214 |
-
'nifty_filter_button' => __('Filters', 'wplivechat'),
|
1215 |
-
'nifty_new_visitor_item' => __('New Visitors (3 Min)', 'wplivechat'),
|
1216 |
-
'nifty_active_chats_item' => __('Active Chats', 'wplivechat'),
|
1217 |
-
'nifty_clear_filters_item' => __('Clear Filters', 'wplivechat'),
|
1218 |
-
'nifty_active_chats_heading' => __('Active visitors', 'wplivechat'),
|
1219 |
-
'nifty_vis_col_heading' => __('Visitor', 'wplivechat'),
|
1220 |
-
'nifty_vis_info_heading' => __('Info', 'wplivechat'),
|
1221 |
-
'nifty_vis_page_heading' => __('Page', 'wplivechat'),
|
1222 |
-
'nifty_vis_status_heading' => __('Chat Status', 'wplivechat'),
|
1223 |
-
'nifty_vis_dep_heading' => __('Department', 'wplivechat'),
|
1224 |
-
'wdt-emoji-search-result-title' => __('Search Results', 'wplivechat'),
|
1225 |
-
'wdt-emoji-no-result' => __('No emoji found', 'wplivechat')
|
1226 |
-
);
|
1227 |
-
|
1228 |
-
apply_filters("wplc_adming_dynamic_translation_filter", $wplc_dynamic_translation_array);
|
1229 |
-
|
1230 |
-
|
1231 |
-
wp_localize_script('wplc-admin-dynamic-translation', 'wplc_dynamic_translation_array', $wplc_dynamic_translation_array);
|
1232 |
-
wp_enqueue_script('wplc-admin-dynamic-translation');
|
1233 |
-
|
1234 |
}
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Node Code -> Insert pun here
|
4 |
+
*/
|
5 |
+
|
6 |
+
define("BLEEPER_API_URL", "https://bleeper.io/app/api/v1/");
|
7 |
+
define("BLEEPER_REMOTE_DASH_ROUTE", "remote_dashboard.php");
|
8 |
+
|
9 |
+
define("BLEEPER_NODE_SERVER_URL", "https://bleeper.us-3.evennode.com");
|
10 |
+
|
11 |
+
//define("BLEEPER_NODE_SERVER_URL", "http://localhost:3000");
|
12 |
+
define("BLEEPER_NODE_END_POINTS_ROUTE", "api/v1/");
|
13 |
+
define("BLEEPER_NODE_END_POINT_TOKEN", "zf6fe1399sdfgsdfg02ad09ab6a8cb7345s");
|
14 |
+
|
15 |
+
|
16 |
+
add_action("wplc_activate_hook", "wplc_node_server_token_check", 10);
|
17 |
+
add_action("wplc_update_hook", "wplc_node_server_token_check", 10);
|
18 |
+
/**
|
19 |
+
* Checks if a secret key has been created.
|
20 |
+
* If not create one for use in the API
|
21 |
+
*
|
22 |
+
* @return void
|
23 |
+
*/
|
24 |
+
function wplc_node_server_token_check(){
|
25 |
+
if (!get_option("wplc_node_server_secret_token")) {
|
26 |
+
$user_token = wplc_node_server_token_create();
|
27 |
+
add_option("wplc_node_server_secret_token", $user_token);
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
add_action("wplc_admin_remote_dashboard_below", "wplc_admin_remote_dashboard_thank_you_footer");
|
32 |
+
/*
|
33 |
+
* Adds a simple thank you message to the footer of the dashboard
|
34 |
+
*/
|
35 |
+
function wplc_admin_remote_dashboard_thank_you_footer(){
|
36 |
+
echo "<p id='wplc_footer_message' style='display:none;'>";
|
37 |
+
echo __("Thank you for using WP Live Chat Support - Need assistance? Please get in touch here: ", "wplivechat");
|
38 |
+
echo "<a href='https://wp-livechat.com/contact-us/' rel='nofollow' target='_blank'>" . __("Contact us", "wplivechat") . "</a><span class='bleeper_stats'></span><span class='bleeper_instance'></span>";
|
39 |
+
echo "</p>";
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Generates a new Secret Token
|
44 |
+
*
|
45 |
+
* @return string
|
46 |
+
*/
|
47 |
+
function wplc_node_server_token_create(){
|
48 |
+
$the_code = rand(0, 1000) . rand(0, 1000) . rand(0, 1000) . rand(0, 1000) . rand(0, 1000);
|
49 |
+
$the_time = time();
|
50 |
+
$token = md5($the_code . $the_time);
|
51 |
+
return $token;
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Re-Generates the token
|
56 |
+
* @return void
|
57 |
+
*/
|
58 |
+
function wplc_node_server_token_regenerate(){
|
59 |
+
$wplc_node_token_new = wplc_node_server_token_create();
|
60 |
+
update_option("wplc_node_server_secret_token", $wplc_node_token_new);
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Post to the NODE server -
|
65 |
+
*
|
66 |
+
* @param string $route Route you would like to use for the node server
|
67 |
+
* @param string $form_data data to send
|
68 |
+
* @return string (or false on fail)
|
69 |
+
*/
|
70 |
+
function wplc_node_server_post($route, $form_data){
|
71 |
+
$url = trailingslashit(BLEEPER_NODE_SERVER_URL) . trailingslashit(BLEEPER_NODE_END_POINTS_ROUTE) . $route;
|
72 |
+
|
73 |
+
$wplc_end_point_override = get_option("wplc_end_point_override");
|
74 |
+
if($wplc_end_point_override !== false && $wplc_end_point_override !== ""){
|
75 |
+
$url = $wplc_end_point_override . BLEEPER_NODE_END_POINTS_ROUTE . $route; //Use the override URL
|
76 |
+
}
|
77 |
+
|
78 |
+
|
79 |
+
if(!isset($form_data['token'])){
|
80 |
+
$form_data['token'] = BLEEPER_NODE_END_POINT_TOKEN; //Add the security token
|
81 |
+
}
|
82 |
+
|
83 |
+
if(!isset($form_data['api_key'])){
|
84 |
+
$wplc_node_token = get_option("wplc_node_server_secret_token");
|
85 |
+
if(!$wplc_node_token){
|
86 |
+
if(function_exists("wplc_node_server_token_regenerate")){
|
87 |
+
wplc_node_server_token_regenerate();
|
88 |
+
$wplc_node_token = get_option("wplc_node_server_secret_token");
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
$form_data['api_key'] = $wplc_node_token; //Add the security token
|
93 |
+
}
|
94 |
+
|
95 |
+
if(!isset($form_data['origin_url'])){
|
96 |
+
$ajax_url = admin_url('admin-ajax.php');
|
97 |
+
$origin_url = str_replace("/wp-admin/admin-ajax.php", "", $ajax_url);
|
98 |
+
$form_data['origin_url'] = $origin_url; //Add the security token
|
99 |
+
}
|
100 |
+
|
101 |
+
$context = @stream_context_create($options);
|
102 |
+
$result = @file_get_contents($url . "?" . http_build_query($form_data), false, $context);
|
103 |
+
|
104 |
+
if ($result === FALSE) {
|
105 |
+
return false;
|
106 |
+
} else {
|
107 |
+
return $result;
|
108 |
+
}
|
109 |
+
}
|
110 |
+
|
111 |
+
add_action("wplc_hook_chat_notification","wplc_filter_notification_hook_node",20,3);
|
112 |
+
/**
|
113 |
+
* Send a system notification to the node server
|
114 |
+
*
|
115 |
+
* @return void
|
116 |
+
*/
|
117 |
+
function wplc_filter_notification_hook_node($type,$cid,$data){
|
118 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
119 |
+
if(isset($wplc_settings['wplc_use_node_server']) && intval($wplc_settings['wplc_use_node_server']) == 1) {
|
120 |
+
|
121 |
+
if(filter_var($cid, FILTER_VALIDATE_INT) ) {
|
122 |
+
//Let's reverse the CID back to it's rel counterpart
|
123 |
+
$cid = wplc_return_chat_rel_by_id($cid);
|
124 |
+
}
|
125 |
+
|
126 |
+
$msg = false;
|
127 |
+
switch($type){
|
128 |
+
case "doc_suggestion":
|
129 |
+
$msg = $data['formatted_msg'];
|
130 |
+
break;
|
131 |
+
default:
|
132 |
+
break;
|
133 |
+
}
|
134 |
+
|
135 |
+
if(isset($cid)){
|
136 |
+
if($msg !== false){
|
137 |
+
$form_data = array(
|
138 |
+
'chat_id' => $cid,
|
139 |
+
'notification_text' => $msg,
|
140 |
+
);
|
141 |
+
|
142 |
+
$user_request = wplc_node_server_post("user_chat_notification", $form_data);
|
143 |
+
|
144 |
+
if($user_request === false){
|
145 |
+
//Something is wrong
|
146 |
+
} else {
|
147 |
+
|
148 |
+
}
|
149 |
+
}
|
150 |
+
}
|
151 |
+
}
|
152 |
+
|
153 |
+
return;
|
154 |
+
}
|
155 |
+
|
156 |
+
add_action("wplc_api_route_hook", "wplc_api_node_routes");
|
157 |
+
/**
|
158 |
+
* Add a REST API routes for the node server
|
159 |
+
*
|
160 |
+
* @return void
|
161 |
+
*/
|
162 |
+
function wplc_api_node_routes(){
|
163 |
+
register_rest_route('wp_live_chat_support/v1','/async_storage', array(
|
164 |
+
'methods' => 'POST',
|
165 |
+
'callback' => 'wplc_node_async_storage_rest'
|
166 |
+
));
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* Handles Async storage REST -> Params are processed within the request
|
171 |
+
* Required POST variables:
|
172 |
+
* - Chat ID
|
173 |
+
* - Security Key
|
174 |
+
* - Message (JSON encoded array)
|
175 |
+
* - Action
|
176 |
+
*
|
177 |
+
* @param WP_REST_Request $request Request Data
|
178 |
+
* @return void
|
179 |
+
*/
|
180 |
+
function wplc_node_async_storage_rest(WP_REST_Request $request){
|
181 |
+
$return_array = array();
|
182 |
+
$return_array['request_status'] = false; //Default to be returned if something goes wrong
|
183 |
+
if(isset($request)){
|
184 |
+
if(isset($request['security'])){
|
185 |
+
$stored_token = get_option("wplc_node_server_secret_token");
|
186 |
+
$check = $_POST['server_token'] == $stored_token ? true : false;
|
187 |
+
if ($check) {
|
188 |
+
if(isset($request['chat_id'])){
|
189 |
+
if(isset($request['messages'])){
|
190 |
+
if(isset($request['relay_action'])){
|
191 |
+
$chat_id = sanitize_text_field($request['chat_id']);
|
192 |
+
$message_data = json_decode($request['messages']);
|
193 |
+
$chat_session = wplc_return_chat_session_variable($chat_id);
|
194 |
+
$action = $request['relay_action'];
|
195 |
+
if($message_data !== NULL){
|
196 |
+
if($action == "wplc_user_send_msg"){
|
197 |
+
foreach ($message_data as $message) {
|
198 |
+
$message = sanitize_text_field($message);
|
199 |
+
wplc_record_chat_msg("1", $chat_id, $message);
|
200 |
+
|
201 |
+
//wplc_update_user_on_page($chat_id, "3", $chat_session); //Keep timestamp active
|
202 |
+
wplc_update_active_timestamp($chat_id);
|
203 |
+
}
|
204 |
+
|
205 |
+
$return_array['request_status'] = true;
|
206 |
+
$return_array['request_information'] = __("Success", "wplivechat");
|
207 |
+
} else if ($action == "wplc_admin_send_msg"){
|
208 |
+
foreach ($message_data as $message) {
|
209 |
+
$message = sanitize_text_field($message);
|
210 |
+
wplc_record_chat_msg("2", $chat_id, $message, true);
|
211 |
+
|
212 |
+
//wplc_update_user_on_page($chat_id, "3", $chat_session); //Keep timestamp active
|
213 |
+
wplc_update_active_timestamp($chat_id);
|
214 |
+
}
|
215 |
+
|
216 |
+
$return_array['request_status'] = true;
|
217 |
+
$return_array['request_information'] = __("Success", "wplivechat");
|
218 |
+
}
|
219 |
+
} else {
|
220 |
+
$return_array['request_information'] = __("Message data is corrupt", "wplivechat");
|
221 |
+
}
|
222 |
+
} else {
|
223 |
+
$return_array['request_information'] = __("Action not set", "wplivechat");
|
224 |
+
}
|
225 |
+
} else {
|
226 |
+
$return_array['request_information'] = __("Message data array not set", "wplivechat");
|
227 |
+
}
|
228 |
+
} else {
|
229 |
+
$return_array['request_information'] = __("Chat ID is not set", "wplivechat");
|
230 |
+
}
|
231 |
+
}
|
232 |
+
} else {
|
233 |
+
$return_array['request_information'] = __("No security nonce found", "wplivechat");
|
234 |
+
}
|
235 |
+
}
|
236 |
+
|
237 |
+
return $return_array;
|
238 |
+
|
239 |
+
}
|
240 |
+
|
241 |
+
add_action("wp_ajax_wplc_node_async_storage_ajax", "wplc_node_async_storage_ajax");
|
242 |
+
add_action("wp_ajax_nopriv_wplc_node_async_storage_ajax", "wplc_node_async_storage_ajax");
|
243 |
+
/**
|
244 |
+
* Handles Async storage AJAX (Fallback for if REST is not present) -> Params are processed within the request
|
245 |
+
* Required POST variables:
|
246 |
+
* - Chat ID
|
247 |
+
* - Security Key
|
248 |
+
* - Message (JSON encoded array)
|
249 |
+
* - Action
|
250 |
+
*
|
251 |
+
* @return void
|
252 |
+
*/
|
253 |
+
function wplc_node_async_storage_ajax(){
|
254 |
+
$return_array = array();
|
255 |
+
$return_array['request_status'] = false; //Default to be returned if something goes wrong
|
256 |
+
if(isset($_POST)){
|
257 |
+
if(isset($_POST['server_token'])){
|
258 |
+
$stored_token = get_option("wplc_node_server_secret_token");
|
259 |
+
$check = $_POST['server_token'] == $stored_token ? true : false;
|
260 |
+
if ($check) {
|
261 |
+
if(isset($_POST['chat_id'])){
|
262 |
+
if(isset($_POST['messages'])){
|
263 |
+
if(isset($_POST['relay_action'])){
|
264 |
+
$chat_id = sanitize_text_field($_POST['chat_id']);
|
265 |
+
$message_data = json_decode($_POST['messages']);
|
266 |
+
$chat_session = wplc_return_chat_session_variable($chat_id);
|
267 |
+
$action = $_POST['relay_action'];
|
268 |
+
if($message_data !== NULL){
|
269 |
+
if($action == "wplc_user_send_msg"){
|
270 |
+
foreach ($message_data as $message) {
|
271 |
+
$message = sanitize_text_field($message);
|
272 |
+
wplc_record_chat_msg("1", $chat_id, $message);
|
273 |
+
//wplc_update_user_on_page($chat_id, "3", $chat_session); //Keep timestamp active
|
274 |
+
wplc_update_active_timestamp($chat_id);
|
275 |
+
|
276 |
+
}
|
277 |
+
|
278 |
+
$return_array['request_status'] = true;
|
279 |
+
$return_array['request_information'] = __("Success", "wplivechat");
|
280 |
+
} else if ($action == "wplc_admin_send_msg"){
|
281 |
+
foreach ($message_data as $message) {
|
282 |
+
$message = sanitize_text_field($message);
|
283 |
+
wplc_record_chat_msg("2", $chat_id, $message);
|
284 |
+
//wplc_update_user_on_page($chat_id, "3", $chat_session); //Keep timestamp active
|
285 |
+
wplc_update_active_timestamp($chat_id);
|
286 |
+
}
|
287 |
+
|
288 |
+
$return_array['request_status'] = true;
|
289 |
+
$return_array['request_information'] = __("Success", "wplivechat");
|
290 |
+
}
|
291 |
+
} else {
|
292 |
+
$return_array['request_information'] = __("Message data is corrupt", "wplivechat");
|
293 |
+
}
|
294 |
+
} else {
|
295 |
+
$return_array['request_information'] = __("Action not set", "wplivechat");
|
296 |
+
}
|
297 |
+
} else {
|
298 |
+
$return_array['request_information'] = __("Message data array not set", "wplivechat");
|
299 |
+
}
|
300 |
+
} else {
|
301 |
+
$return_array['request_information'] = __("Chat ID is not set", "wplivechat");
|
302 |
+
}
|
303 |
+
}
|
304 |
+
} else {
|
305 |
+
$return_array['request_information'] = __("No security nonce found", "wplivechat");
|
306 |
+
}
|
307 |
+
}
|
308 |
+
|
309 |
+
return $return_array;
|
310 |
+
|
311 |
+
}
|
312 |
+
|
313 |
+
/**
|
314 |
+
* Loads remote dashboard
|
315 |
+
*
|
316 |
+
* @return void
|
317 |
+
*/
|
318 |
+
function wplc_admin_dashboard_layout_node( $location = 'dashboard' ){
|
319 |
+
if ( $location === 'dashboard') {
|
320 |
+
|
321 |
+
if( ! get_user_meta( get_current_user_id(), 'wplc_ma_agent', true ) ){
|
322 |
+
echo "<div class='error below-h1'>";
|
323 |
+
echo "<h2>".__("Error", "wplivechat")."</h2>";
|
324 |
+
echo "<p>".__("Only chat agents can access this page.", "wplivechat")."</p>";
|
325 |
+
echo "</div>";
|
326 |
+
return;
|
327 |
+
}
|
328 |
+
|
329 |
+
do_action("wplc_admin_remote_dashboard_above");
|
330 |
+
|
331 |
+
echo "<div id='bleeper_content_wrapper'></div>";
|
332 |
+
|
333 |
+
if ( ! isset( $_GET['action'] ) || 'history' !== $_GET['action'] ) {
|
334 |
+
|
335 |
+
echo "<div class='wplc_remote_dash_below_contianer'>";
|
336 |
+
do_action("wplc_admin_remote_dashboard_below");
|
337 |
+
echo "</div>";
|
338 |
+
|
339 |
+
}
|
340 |
+
} else {
|
341 |
+
do_action("wplc_admin_remote_dashboard_above");
|
342 |
+
|
343 |
+
echo "<div id='bleeper_content_wrapper'></div>";
|
344 |
+
|
345 |
+
if ( ! empty( $_GET['page'] ) && 'wplivechat-menu' === $_GET['page'] ) { // This div is also hidden by js under the same conditions
|
346 |
+
|
347 |
+
echo "<div class='wplc_remote_dash_below_contianer'>";
|
348 |
+
do_action("wplc_admin_remote_dashboard_below");
|
349 |
+
echo "</div>";
|
350 |
+
|
351 |
+
}
|
352 |
+
}
|
353 |
+
}
|
354 |
+
|
355 |
+
add_action("wplc_admin_remote_dashboard_below", "wplc_admin_remote_dashboard_below_delegate");
|
356 |
+
/*
|
357 |
+
* Delegates the below dashboard hooks
|
358 |
+
*/
|
359 |
+
function wplc_admin_remote_dashboard_below_delegate(){
|
360 |
+
do_action("wplc_hook_chat_dashboard_bottom");
|
361 |
+
}
|
362 |
+
|
363 |
+
add_action("wplc_hook_chat_dashboard_bottom","wplc_hook_control_dashboard_bottom_loading_logo",1);
|
364 |
+
/**
|
365 |
+
* Decides whether or not to show the available extensions for this area.
|
366 |
+
* @return void
|
367 |
+
* @since 6.0.00
|
368 |
+
* @author Nick Duncan <nick@codecabin.co.za>
|
369 |
+
*/
|
370 |
+
function wplc_hook_control_dashboard_bottom_loading_logo() {
|
371 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
372 |
+
if(isset($wplc_settings['wplc_use_node_server']) && $wplc_settings['wplc_use_node_server'] == 1){
|
373 |
+
echo "<div id='wplc_footer_loading_icon'><img src='https://bleeper.io/app/assets/images/wplc_loading.png' width='50' /><br />Connecting...</div>";
|
374 |
+
}
|
375 |
+
}
|
376 |
+
|
377 |
+
add_action('admin_enqueue_scripts', 'wplc_enqueue_dashboard_popup_scripts');
|
378 |
+
/**
|
379 |
+
* Enqueues the scripts for the admin dashboard popup icon and chat box
|
380 |
+
* @return void
|
381 |
+
*/
|
382 |
+
function wplc_enqueue_dashboard_popup_scripts() {
|
383 |
+
global $wplc_version;
|
384 |
+
wp_enqueue_script('jquery-ui-draggable');
|
385 |
+
wp_enqueue_script('wplc-admin-popup', plugins_url('../js/wplc_admin_popup.js', __FILE__ ), array('jquery-ui-draggable'), $wplc_version);
|
386 |
+
|
387 |
+
wp_button_pointers_load_scripts('toplevel_page_wplivechat-menu');
|
388 |
+
}
|
389 |
+
|
390 |
+
add_action( "admin_footer", "wplc_dashboard_display_decide" );
|
391 |
+
/**
|
392 |
+
* Decide whether or not to display the dashboard layout on an admin page
|
393 |
+
* @return void
|
394 |
+
*/
|
395 |
+
function wplc_dashboard_display_decide() {
|
396 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
397 |
+
if ( isset( $wplc_settings['wplc_use_node_server'] ) && $wplc_settings['wplc_use_node_server'] == 1 ) {
|
398 |
+
//Node in use, load remote dashboard
|
399 |
+
if ( isset( $_GET['page'] ) && $_GET['page'] === 'wplivechat-menu') {
|
400 |
+
// we control this in the wplc_admin_menu_layout function
|
401 |
+
//wplc_admin_dashboard_layout_node('dashboard');
|
402 |
+
} else {
|
403 |
+
if (function_exists("wplc_pro_version_control")) {
|
404 |
+
global $wplc_pro_version;
|
405 |
+
$wplc_ver = str_replace('.', '', $wplc_pro_version);
|
406 |
+
$checker = intval($wplc_ver);
|
407 |
+
if (function_exists("wplc_pro_version_control") && $checker < 8000) {
|
408 |
+
/* ONLY SHOW THE POPOUT DASHBOARD IF THEY ARE USING PRO 8.0.00 and above */
|
409 |
+
return;
|
410 |
+
}
|
411 |
+
}
|
412 |
+
|
413 |
+
|
414 |
+
/**
|
415 |
+
* Check to see if we have enabled "Enable chat dashboard and notifications on all admin pages"
|
416 |
+
*/
|
417 |
+
|
418 |
+
if ( isset( $wplc_settings['wplc_enable_all_admin_pages'] ) && $wplc_settings['wplc_enable_all_admin_pages'] === '1' ) {
|
419 |
+
|
420 |
+
|
421 |
+
wplc_admin_dashboard_layout_node('other');
|
422 |
+
|
423 |
+
echo '<div class="floating-right-toolbar">';
|
424 |
+
echo '<label for="user_list_bleeper_control" style="margin-bottom: 0; display:none;"></label>';
|
425 |
+
|
426 |
+
echo '<i id="toolbar-item-open-bleeper" class="fa fa-fw" style="background:url(\''.plugins_url('../images/48px.png', __FILE__).'\') no-repeat; background-size: cover;"></i>';
|
427 |
+
echo '</div>';
|
428 |
+
}
|
429 |
+
|
430 |
+
}
|
431 |
+
}
|
432 |
+
|
433 |
+
|
434 |
+
|
435 |
+
}
|
436 |
+
|
437 |
+
|
438 |
+
/**
|
439 |
+
* Loads remote dashboard scripts and styles
|
440 |
+
*
|
441 |
+
* @return void
|
442 |
+
*/
|
443 |
+
function wplc_admin_remote_dashboard_scripts($wplc_settings){
|
444 |
+
global $wplc_version;
|
445 |
+
$wplc_current_user = get_current_user_id();
|
446 |
+
if( get_user_meta( $wplc_current_user, 'wplc_ma_agent', true )) {
|
447 |
+
|
448 |
+
$user_info = get_userdata(intval($wplc_current_user));
|
449 |
+
|
450 |
+
$user_array = get_users(array(
|
451 |
+
'meta_key' => 'wplc_ma_agent',
|
452 |
+
));
|
453 |
+
|
454 |
+
$a_array = array();
|
455 |
+
if ($user_array) {
|
456 |
+
foreach ($user_array as $user) {
|
457 |
+
$current_user_name = apply_filters("wplc_agent_display_name_filter", $user->display_name);
|
458 |
+
$a_array[$user->ID] = array();
|
459 |
+
$a_array[$user->ID]['name'] = $user->display_name;
|
460 |
+
$a_array[$user->ID]['display_name'] = $user->display_name;
|
461 |
+
$a_array[$user->ID]['md5'] = md5( $user->user_email );
|
462 |
+
$a_array[$user->ID]['email'] = md5( $user->user_email );
|
463 |
+
}
|
464 |
+
}
|
465 |
+
|
466 |
+
|
467 |
+
if( isset($wplc_settings['wplc_show_name']) && $wplc_settings['wplc_show_name'] == '1' ){ $wplc_show_name = true; } else { $wplc_show_name = false; }
|
468 |
+
if( isset($wplc_settings['wplc_show_avatar']) && $wplc_settings['wplc_show_avatar'] ){ $wplc_show_avatar = true; } else { $wplc_show_avatar = false; }
|
469 |
+
if( isset($wplc_settings['wplc_show_date']) && $wplc_settings['wplc_show_date'] == '1' ){ $wplc_show_date = true; } else { $wplc_show_date = false; }
|
470 |
+
if( isset($wplc_settings['wplc_show_time']) && $wplc_settings['wplc_show_time'] == '1' ){ $wplc_show_time = true; } else { $wplc_show_time = false; }
|
471 |
+
|
472 |
+
$wplc_chat_detail = array( 'name' => $wplc_show_name, 'avatar' => $wplc_show_avatar, 'date' => $wplc_show_date, 'time' => $wplc_show_time );
|
473 |
+
|
474 |
+
|
475 |
+
|
476 |
+
|
477 |
+
$wplc_end_point_override = get_option("wplc_end_point_override");
|
478 |
+
if($wplc_end_point_override !== false && $wplc_end_point_override !== ""){
|
479 |
+
$bleeper_url = $wplc_end_point_override; //Use the override URL
|
480 |
+
} else {
|
481 |
+
$bleeper_url = BLEEPER_NODE_SERVER_URL;
|
482 |
+
}
|
483 |
+
|
484 |
+
|
485 |
+
|
486 |
+
|
487 |
+
wp_register_script('wplc-admin-js-sockets', "https://bleeper.io/app/assets/js/vendor/socket.io/socket.io.slim.js", false, $wplc_version, false);
|
488 |
+
//wp_register_script('wplc-admin-js-sockets', trailingslashit( $bleeper_url ) . "socket.io/socket.io.js", false, $wplc_version, false);
|
489 |
+
//wp_register_script('wplc-admin-js-sockets', "http://localhost:3000/socket.io/socket.io.js", false, $wplc_version, false);
|
490 |
+
wp_enqueue_script('wplc-admin-js-sockets');
|
491 |
+
|
492 |
+
wp_register_script('wplc-admin-js-bootstrap', "https://bleeper.io/app/assets/js/bootstrap.js", array("wplc-admin-js-sockets"), $wplc_version, false);
|
493 |
+
wp_enqueue_script('wplc-admin-js-bootstrap');
|
494 |
+
|
495 |
+
// NB: This causes Failed to initVars ReferenceError: wplc_show_date is not defined when uncommented and enabled
|
496 |
+
if(empty($wplc_settings['wplc_disable_emojis']))
|
497 |
+
{
|
498 |
+
wp_register_script('wplc-admin-js-emoji', "https://bleeper.io/app/assets/wdt-emoji/emoji.min.js", array("wplc-admin-js-sockets"), $wplc_version, false);
|
499 |
+
wp_enqueue_script('wplc-admin-js-emoji');
|
500 |
+
|
501 |
+
wp_register_script('wplc-admin-js-emoji-bundle', "https://bleeper.io/app/assets/wdt-emoji/wdt-emoji-bundle.min.js", array("wplc-admin-js-emoji"), $wplc_version, false);
|
502 |
+
wp_enqueue_script('wplc-admin-js-emoji-bundle');
|
503 |
+
}
|
504 |
+
|
505 |
+
wp_register_script('md5', plugins_url( '../js/md5.js', __FILE__ ), array("wplc-admin-js-sockets"), false, false);
|
506 |
+
wp_enqueue_script('md5');
|
507 |
+
|
508 |
+
$dependencies = array();
|
509 |
+
if(empty($wplc_settings['wplc_disable_emojis']))
|
510 |
+
$dependencies[] = "wplc-admin-js-emoji-bundle";
|
511 |
+
wp_register_script('wplc-admin-js-agent', "https://bleeper.io/app/assets/js/bleeper-agent-dev.js", $dependencies, $wplc_version, false);
|
512 |
+
|
513 |
+
wp_localize_script('wplc-admin-js-agent', 'bleeper_remote_enabled', "true");
|
514 |
+
|
515 |
+
if (isset($wplc_settings['wplc_enable_msg_sound'])) {
|
516 |
+
|
517 |
+
if (intval($wplc_settings['wplc_enable_msg_sound']) == 1) {
|
518 |
+
wp_localize_script('wplc-admin-js-agent', "bleeper_ping_sound_notification_enabled", "true");
|
519 |
+
} else {
|
520 |
+
wp_localize_script('wplc-admin-js-agent', "bleeper_ping_sound_notification_enabled", "false");
|
521 |
+
}
|
522 |
+
|
523 |
+
}
|
524 |
+
|
525 |
+
wp_register_script('my-wplc-admin-chatbox-ui-events', plugins_url('../js/wplc_u_admin_chatbox_ui_events.js', __FILE__), array('jquery'), $wplc_version, true);
|
526 |
+
wp_enqueue_script('my-wplc-admin-chatbox-ui-events');
|
527 |
+
|
528 |
+
|
529 |
+
|
530 |
+
$wplc_et_ajax_nonce = wp_create_nonce( "wplc_et_nonce" );
|
531 |
+
wp_register_script( 'wplc_transcript_admin', plugins_url( '../js/wplc_transcript.js', __FILE__ ), null, '', true );
|
532 |
+
$wplc_transcript_localizations = array(
|
533 |
+
'ajax_nonce' => $wplc_et_ajax_nonce,
|
534 |
+
'string_loading' => __( "Sending transcript...", "wplivechat" ),
|
535 |
+
'string_title' => __( "Sending Transcript", "wplivechat" ),
|
536 |
+
'string_close' => __( "Close", "wplivechat" ),
|
537 |
+
'string_chat_emailed' => __( "The chat transcript has been emailed.", "wplivechat" ),
|
538 |
+
'string_error1' => sprintf( __( "There was a problem emailing the chat. Please <a target='_BLANK' href='%s'>contact support</a>.", "wplivechat" ), "http://wp-livechat.com/contact-us/?utm_source=plugin&utm_medium=link&utm_campaign=error_emailing_chat" )
|
539 |
+
);
|
540 |
+
wp_localize_script( 'wplc_transcript_admin', 'wplc_transcript_nonce', $wplc_transcript_localizations );
|
541 |
+
wp_enqueue_script( 'wplc_transcript_admin' );
|
542 |
+
|
543 |
+
$wplc_node_token = get_option("wplc_node_server_secret_token");
|
544 |
+
if(!$wplc_node_token){
|
545 |
+
if(function_exists("wplc_node_server_token_regenerate")){
|
546 |
+
wplc_node_server_token_regenerate();
|
547 |
+
$wplc_node_token = get_option("wplc_node_server_secret_token");
|
548 |
+
}
|
549 |
+
}
|
550 |
+
|
551 |
+
$form_data = array("node_token" => $wplc_node_token, "action" => "wordpress");
|
552 |
+
$form_data = apply_filters("wplc_admin_dashboard_layout_node_request_variable_filter", $form_data); //Filter for pro to add a few request variables to the mix for additional structure
|
553 |
+
|
554 |
+
/*$options = array(
|
555 |
+
'http' => array(
|
556 |
+
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
|
557 |
+
'method' => 'POST',
|
558 |
+
'content' => http_build_query($form_data)
|
559 |
+
)
|
560 |
+
);
|
561 |
+
$context = @stream_context_create($options);
|
562 |
+
$result = @file_get_contents(BLEEPER_API_URL . BLEEPER_REMOTE_DASH_ROUTE, false, $context);*/
|
563 |
+
|
564 |
+
wp_localize_script('wplc-admin-js-agent', 'bleeper_remote_form_data_array', $form_data);
|
565 |
+
wp_localize_script('wplc-admin-js-agent', 'bleeper_remote_form_api_url', BLEEPER_API_URL);
|
566 |
+
wp_localize_script('wplc-admin-js-agent', 'bleeper_remote_form_route', BLEEPER_REMOTE_DASH_ROUTE);
|
567 |
+
|
568 |
+
|
569 |
+
if ( isset( $_GET['page'] ) && $_GET['page'] === 'wplivechat-menu' ) {
|
570 |
+
wp_localize_script('wplc-admin-js-agent', 'bleeper_in_dashboard', '1');
|
571 |
+
} else {
|
572 |
+
wp_localize_script('wplc-admin-js-agent', 'bleeper_in_dashboard', '0');
|
573 |
+
}
|
574 |
+
|
575 |
+
$inline_error_message = "<div class='error below-h1' style='display:none;' id='bleeper_inline_connection_error'>
|
576 |
+
<p>" . __("Connection Error", "wplivechat") . "<br /></p>
|
577 |
+
<p>" . __("We are having some trouble contacting the server. Please try again later.", "wplivechat") . "</p>
|
578 |
+
</div>";
|
579 |
+
wp_localize_script('wplc-admin-js-agent', 'bleeper_remote_form_error', $inline_error_message);
|
580 |
+
|
581 |
+
|
582 |
+
|
583 |
+
|
584 |
+
|
585 |
+
if (isset($wplc_settings['wplc_enable_visitor_sound']) && intval($wplc_settings['wplc_enable_visitor_sound']) == 1) {
|
586 |
+
wp_localize_script('wplc-admin-js-agent', 'bleeper_enable_visitor_sound', '1');
|
587 |
+
} else {
|
588 |
+
wp_localize_script('wplc-admin-js-agent', 'bleeper_enable_visitor_sound', '0');
|
589 |
+
}
|
590 |
+
|
591 |
+
|
592 |
+
|
593 |
+
|
594 |
+
$agent_display_name = $user_info->display_name;
|
595 |
+
|
596 |
+
wp_localize_script('wplc-admin-js-agent', 'agent_id', "" . $wplc_current_user);
|
597 |
+
wp_localize_script('wplc-admin-js-agent', 'bleeper_agent_name', apply_filters("wplc_agent_display_name_filter", $agent_display_name) );
|
598 |
+
wp_localize_script('wplc-admin-js-agent', 'nifty_api_key', get_option("wplc_node_server_secret_token"));
|
599 |
+
|
600 |
+
//For node verification
|
601 |
+
if(function_exists("wplc_pro_activate")){
|
602 |
+
wp_localize_script('wplc-admin-js-agent', 'bleeper_pro_auth', get_option('wp-live-chat-support-pro_key', "false"));
|
603 |
+
} else {
|
604 |
+
wp_localize_script('wplc-admin-js-agent', 'bleeper_pro_auth', 'false');
|
605 |
+
}
|
606 |
+
wp_localize_script('wplc-admin-js-agent', 'bleeper_agent_verification_end_point', rest_url('wp_live_chat_support/v1/validate_agent'));
|
607 |
+
wp_localize_script('wplc-admin-js-agent', 'bleeper_disable_mongo', "true");
|
608 |
+
wp_localize_script('wplc-admin-js-agent', 'bleeper_disable_add_message', "true");
|
609 |
+
wp_localize_script('wplc-admin-js-agent', 'wplc_nonce', wp_create_nonce("wplc"));
|
610 |
+
wp_localize_script('wplc-admin-js-agent', 'wplc_cid', "null");
|
611 |
+
wp_localize_script('wplc-admin-js-agent', 'wplc_chat_name', "null");
|
612 |
+
//wp_localize_script('wplc-admin-js-agent', 'wplc_chat_email', "null"); //TODO: Parse the email
|
613 |
+
|
614 |
+
wp_localize_script( 'wplc-admin-js-agent', 'wplc_show_chat_detail', $wplc_chat_detail );
|
615 |
+
|
616 |
+
wp_localize_script('wplc-admin-js-agent', 'wplc_agent_data', $a_array);
|
617 |
+
wp_localize_script('wplc-admin-js-agent', 'all_agents', $a_array);
|
618 |
+
|
619 |
+
wp_localize_script('wplc-admin-js-agent', 'wplc_url', plugins_url( '', dirname( __FILE__ ) ) );
|
620 |
+
|
621 |
+
if( isset($wplc_settings['wplc_settings_enabled']) && intval($wplc_settings["wplc_settings_enabled"]) == 2) {
|
622 |
+
|
623 |
+
$wplc_disabled_html = __("Chat is disabled in settings area, re-enable", "wplivechat");
|
624 |
+
$wplc_disabled_html .= " <a href='?page=wplivechat-menu-settings'>" . __("here", "wplivechat") . "</a>";
|
625 |
+
|
626 |
+
wp_localize_script('wplc-admin-js-agent', 'wplc_disabled', 'true');
|
627 |
+
wp_localize_script('wplc-admin-js-agent', 'wplc_disabled_html', $wplc_disabled_html);
|
628 |
+
}
|
629 |
+
|
630 |
+
|
631 |
+
//Added rest nonces
|
632 |
+
if(class_exists("WP_REST_Request")) {
|
633 |
+
wp_localize_script('wplc-admin-js-agent', 'wplc_restapi_enabled', '1');
|
634 |
+
wp_localize_script('wplc-admin-js-agent', 'wplc_restapi_token', get_option('wplc_api_secret_token'));
|
635 |
+
wp_localize_script('wplc-admin-js-agent', 'wplc_restapi_endpoint', rest_url('wp_live_chat_support/v1'));
|
636 |
+
wp_localize_script('wplc-admin-js-agent', 'bleeper_override_upload_url', rest_url('wp_live_chat_support/v1/remote_upload'));
|
637 |
+
wp_localize_script('wplc-admin-js-agent', 'wplc_restapi_nonce', wp_create_nonce( 'wp_rest' ));
|
638 |
+
|
639 |
+
} else {
|
640 |
+
wp_localize_script('wplc-admin-js-agent', 'wplc_restapi_enabled', '0');
|
641 |
+
wp_localize_script('wplc-admin-js-agent', 'wplc_restapi_nonce', "false");
|
642 |
+
}
|
643 |
+
|
644 |
+
$agent_tagline = apply_filters( "wplc_filter_simple_agent_data_agent_tagline", '', get_current_user_id() );
|
645 |
+
$agent_bio = apply_filters( "wplc_filter_simple_agent_data_agent_bio", '', '', get_current_user_id() );
|
646 |
+
$social_links = apply_filters( "wplc_filter_simple_agent_data_social_links", '', get_current_user_id() );
|
647 |
+
$head_data = array(
|
648 |
+
'tagline' => $agent_tagline,
|
649 |
+
'bio' => $agent_bio,
|
650 |
+
'social' => $social_links
|
651 |
+
);
|
652 |
+
wp_localize_script( 'wplc-admin-js-agent', 'wplc_head_data', $head_data );
|
653 |
+
wp_localize_script( 'wplc-admin-js-agent', 'wplc_user_chat_notification_prefix', __("User received notification:", "wplivechat") );
|
654 |
+
|
655 |
+
wp_localize_script( 'wplc-admin-js-agent', 'bleeper_valid_direct_to_page_array', wplc_node_pages_posts_array() );
|
656 |
+
|
657 |
+
if( isset($wplc_settings['wplc_new_chat_ringer_count']) && $wplc_settings['wplc_new_chat_ringer_count'] !== "") {
|
658 |
+
$wplc_ringer_count = intval($wplc_settings['wplc_new_chat_ringer_count']);
|
659 |
+
wp_localize_script( 'wplc-admin-js-agent', 'bleeper_ringer_count', "" . $wplc_ringer_count );
|
660 |
+
}
|
661 |
+
|
662 |
+
|
663 |
+
$wplc_server_location = get_option( "wplc_server_location" );
|
664 |
+
$wplc_server_location = apply_filters('wplc_node_server_default_selection_override', $wplc_server_location, $wplc_settings);
|
665 |
+
|
666 |
+
if( $wplc_server_location !== false && $wplc_server_location !== "" && $wplc_server_location !== "auto" ){
|
667 |
+
if ( $wplc_server_location === "us1") { $wplc_server_location = "0"; }
|
668 |
+
else if ( $wplc_server_location === "us2") { $wplc_server_location = "3"; }
|
669 |
+
else if ( $wplc_server_location === "eu1") { $wplc_server_location = "1"; }
|
670 |
+
else if ( $wplc_server_location === "eu2") { $wplc_server_location = "2"; }
|
671 |
+
else { $wplc_server_location = "0"; }
|
672 |
+
wp_localize_script( 'wplc-admin-js-agent', 'bleeper_server_location', $wplc_server_location );
|
673 |
+
}
|
674 |
+
|
675 |
+
/* use the end point override as the final decision for identifying the actual end point override variable */
|
676 |
+
$wplc_end_point_override = get_option("wplc_end_point_override");
|
677 |
+
if($wplc_end_point_override !== false && $wplc_end_point_override !== ""){
|
678 |
+
wp_localize_script( 'wplc-admin-js-agent', 'bleeper_end_point_override', $wplc_end_point_override );
|
679 |
+
}
|
680 |
+
|
681 |
+
wp_localize_script( 'wplc-admin-js-agent', 'bleeper_new_chat_notification_title', __('New chat received', 'wplivechat') );
|
682 |
+
wp_localize_script( 'wplc-admin-js-agent', 'bleeper_new_chat_notification_text', __("A new chat has been received. Please go the 'Live Chat' page to accept the chat", "wplivechat") );
|
683 |
+
|
684 |
+
$wplc_notification_icon = plugin_dir_url(dirname(__FILE__)) . 'images/wplc_notification_icon.png';
|
685 |
+
wp_localize_script( 'wplc-admin-js-agent', 'bleeper_new_chat_notification_icon', $wplc_notification_icon );
|
686 |
+
|
687 |
+
do_action("wplc_admin_remoter_dashboard_scripts_localizer"); //For pro localization of agents list, and departments
|
688 |
+
|
689 |
+
wp_enqueue_script('wplc-admin-js-agent');
|
690 |
+
|
691 |
+
wp_register_script('wplc-admin-chat-server', plugins_url( '../js/wplc_server.js', __FILE__ ), array("wplc-admin-js-agent", "wplc-admin-js-sockets"), $wplc_version, false); //Added this for async storage calls
|
692 |
+
wp_enqueue_script('wplc-admin-chat-server');
|
693 |
+
|
694 |
+
wp_localize_script( 'wplc-admin-chat-server', 'wplc_datetime_format', array(
|
695 |
+
'date_format' => get_option( 'date_format' ),
|
696 |
+
'time_format' => get_option( 'time_format' ),
|
697 |
+
) );
|
698 |
+
|
699 |
+
wp_register_script('wplc-admin-chat-events', plugins_url( '../js/wplc_u_admin_events.js', __FILE__ ), array("wplc-admin-js-agent", "wplc-admin-js-sockets", "wplc-admin-chat-server"), $wplc_version, false); //Added this for async storage calls
|
700 |
+
wp_enqueue_script('wplc-admin-chat-events');
|
701 |
+
|
702 |
+
if (isset($wplc_settings['wplc_show_date']) && $wplc_settings["wplc_show_date"] == '1') {
|
703 |
+
wp_localize_script('wplc-admin-chat-server', 'wplc_show_date', 'true');
|
704 |
+
} else {
|
705 |
+
wp_localize_script('wplc-admin-chat-server', 'wplc_show_date', 'false');
|
706 |
+
}
|
707 |
+
|
708 |
+
if (isset($wplc_settings['wplc_show_time']) && $wplc_settings["wplc_show_time"] == '1') {
|
709 |
+
wp_localize_script('wplc-admin-chat-server', 'wplc_show_time', 'true');
|
710 |
+
} else {
|
711 |
+
wp_localize_script('wplc-admin-chat-server', 'wplc_show_time', 'false');
|
712 |
+
}
|
713 |
+
|
714 |
+
if (isset($wplc_settings['wplc_show_name']) && $wplc_settings["wplc_show_name"] == '1') {
|
715 |
+
wp_localize_script('wplc-admin-chat-server', 'wplc_show_name', 'true');
|
716 |
+
} else {
|
717 |
+
wp_localize_script('wplc-admin-chat-server', 'wplc_show_name', 'false');
|
718 |
+
}
|
719 |
+
|
720 |
+
if (isset($wplc_settings['wplc_show_avatar']) && $wplc_settings["wplc_show_avatar"] == '1') {
|
721 |
+
wp_localize_script('wplc-admin-chat-server', 'wplc_show_avatar', 'true');
|
722 |
+
} else {
|
723 |
+
wp_localize_script('wplc-admin-chat-server', 'wplc_show_avatar', 'false');
|
724 |
+
}
|
725 |
+
}
|
726 |
+
}
|
727 |
+
|
728 |
+
add_action("wplc_admin_remoter_dashboard_scripts_localizer", "wplc_admin_remote_dashboard_localize_upselling_tips");
|
729 |
+
/*
|
730 |
+
* Localizes an array of upselling tips
|
731 |
+
*/
|
732 |
+
function wplc_admin_remote_dashboard_localize_upselling_tips(){
|
733 |
+
$tips_header = __("Did you know?", "wplivechat");
|
734 |
+
|
735 |
+
$tips_array = array(
|
736 |
+
"0" => "<p><a href='http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=unlimited_agents_tip' title='".__("Add unlimited agents", "wplivechat")."' target=\"_BLANK\">".__("Add unlimited agents", "wplivechat")."</a> ".__(" with the Pro add-on of WP Live Chat Support","wplivechat")." "."<a href='http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=unlimited_agents_tip2' target='_BLANK'>".__("(once off payment).","wplivechat")."</a></p>",
|
737 |
+
"1" => "<p>".__("With the Pro add-on of WP Live Chat Support, you can", "wplivechat")." <a href='http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=initiate_tip' title='".__("see who's online and initiate chats", "wplivechat")."' target=\"_BLANK\">".__("initiate chats", "wplivechat")."</a> ".__("with your online visitors with the click of a button.", "wplivechat")." <br /><br /><a href='http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=initiate_tip2' title='".__("Buy the Pro add-on now (once off payment).", "wplivechat")."' target=\"_BLANK\"><strong>".__("Buy the Pro add-on now (once off payment).", "wplivechat")."</strong></a></p>",
|
738 |
+
"2" => "<p><a href='http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=transfer_tip' title='".__("Transfer Chats", "wplivechat")."' target=\"_BLANK\">".__("Transfer Chats", "wplivechat")."</a> ".__(" with the Pro add-on of WP Live Chat Support","wplivechat")." "."<a href='http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=transfer_tip2' target='_BLANK'>".__("(once off payment).","wplivechat")."</a></p>"
|
739 |
+
);
|
740 |
+
|
741 |
+
$tips_array = apply_filters("wplc_admin_remote_dashboard_localize_tips_array", $tips_array);
|
742 |
+
|
743 |
+
wp_localize_script( 'wplc-admin-js-agent', 'agent_to_agent_chat_upsell', sprintf(__('Chat to other agents with the <a href="%s" target="_BLANK">Pro version</a>.' ,'wplivechat'),'https://wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=a2achat'));
|
744 |
+
|
745 |
+
$initiate_upsell = "<i class='fa fa-horn'></i> ".__("With the Pro add-on of WP Live Chat Support, you can", "wplivechat");
|
746 |
+
$initiate_upsell .= ' <a href="https://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=initiate1" title="'.__("see who's online and initiate chats", "wplivechat").'" target=\"_BLANK\">';
|
747 |
+
$initiate_upsell .= __("initiate chats", "wplivechat");
|
748 |
+
$initiate_upsell .= '</a> '.__("with your online visitors with the click of a button.", "wplivechat");
|
749 |
+
$initiate_upsell .= ' <a href="https://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=initiate2" title="'.__("Buy the Pro add-on now.", "wplivechat").'" target=\"_BLANK\">';
|
750 |
+
$initiate_upsell .= '<strong>'.__("Buy the Pro add-on now.", "wplivechat").'</strong></a>';
|
751 |
+
|
752 |
+
|
753 |
+
|
754 |
+
wp_localize_script( 'wplc-admin-js-agent', 'initiate_chat_upsell', $initiate_upsell);
|
755 |
+
|
756 |
+
|
757 |
+
wp_localize_script( 'wplc-admin-js-agent', 'wplc_event_upsell', sprintf( __( 'Get detailed visitor events with the <a target="_BLANK" href="%s">Pro version</a>.', 'wplivechat'), 'https://wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=pro_events' ) );
|
758 |
+
|
759 |
+
wp_localize_script( 'wplc-admin-js-agent', 'wplc_tip_header', $tips_header );
|
760 |
+
wp_localize_script( 'wplc-admin-js-agent', 'wplc_tip_array', $tips_array );
|
761 |
+
|
762 |
+
if (!function_exists("wplc_pro_activate")) {
|
763 |
+
/* identify if the user wants to display the agent to agent chat upsell */
|
764 |
+
$wplc_current_user = get_current_user_id();
|
765 |
+
$check = get_user_meta( $wplc_current_user, "wplc_a2a_upsell" );
|
766 |
+
if ($check) {
|
767 |
+
wp_localize_script( 'wplc-admin-js-agent', 'wplc_upsell_a2a', '1' );
|
768 |
+
}
|
769 |
+
|
770 |
+
}
|
771 |
+
|
772 |
+
|
773 |
+
}
|
774 |
+
|
775 |
+
/**
|
776 |
+
* Loads remote dashboard styles
|
777 |
+
*
|
778 |
+
* @return void
|
779 |
+
*/
|
780 |
+
function wplc_admin_remote_dashboard_styles(){
|
781 |
+
global $wplc_version;
|
782 |
+
|
783 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
784 |
+
|
785 |
+
wp_register_style( 'wplc-admin-style', "https://bleeper.io/app/assets/css/chat_dashboard/admin_style.css", false, $wplc_version );
|
786 |
+
wp_enqueue_style( 'wplc-admin-style' );
|
787 |
+
|
788 |
+
if (!isset($wplc_settings['wplc_show_avatar']) || (isset($wplc_settings['wplc_show_avatar']) && intval($wplc_settings['wplc_show_avatar']) == 0) ) {
|
789 |
+
wp_add_inline_style( 'wplc-admin-style', ".wplc-user-message, .wplc-admin-message { padding-left: 0 !important; }" );
|
790 |
+
|
791 |
+
/*
|
792 |
+
if(!isset($wplc_settings['wplc_show_name']) || (isset($wplc_settings['wplc_show_name']) && intval($wplc_settings['wplc_show_name']) == 0) ){
|
793 |
+
//User is hiding both name and grav - add more inline styles
|
794 |
+
|
795 |
+
$current_agent_info = wp_get_current_user();
|
796 |
+
$current_agent_initial = "A"; //Default
|
797 |
+
|
798 |
+
if(isset($current_agent_info->display_name)){
|
799 |
+
$current_agent_initial = substr($current_agent_info->display_name, 0, 1);
|
800 |
+
}
|
801 |
+
|
802 |
+
|
803 |
+
$inline_identity_css =
|
804 |
+
"
|
805 |
+
.wplc-admin-message .messageBody::before {
|
806 |
+
display:inline-block; width: 15px; height: 15px; background:#333; content:'" . $current_agent_initial . "'; color:#fff; margin-right:10px; position:relative; top:px; text-align:center; font-size: 10px; border-radius:3px;
|
807 |
+
}
|
808 |
+
|
809 |
+
.wplc-user-message .messageBody::before {
|
810 |
+
display:inline-block; width: 15px; height: 15px; background:#2b97d2; content:'U'; color:#fff; margin-right:10px; position:relative; top:px; text-align:center; font-size: 10px; border-radius:3px;
|
811 |
+
}
|
812 |
+
";
|
813 |
+
|
814 |
+
wp_add_inline_style( 'wplc-admin-style', $inline_identity_css );
|
815 |
+
}*/
|
816 |
+
|
817 |
+
|
818 |
+
|
819 |
+
} else if( !isset($wplc_settings['wplc_show_name']) || (isset($wplc_settings['wplc_show_name']) && intval($wplc_settings['wplc_show_name']) == 0) ){
|
820 |
+
//User has enabled the gravatar, but has chosen to hide the user name.
|
821 |
+
//This causes some issues with admin display so let's just add some different styling to get around this
|
822 |
+
$inline_identity_css =
|
823 |
+
"
|
824 |
+
.wplc-admin-message-avatar, .wplc-user-message-avatar {
|
825 |
+
max-width:28px !important;
|
826 |
+
max-height:28px !important;
|
827 |
+
}
|
828 |
+
|
829 |
+
.wplc-admin-message, .wplc-user-message{
|
830 |
+
padding-left:25px !important;
|
831 |
+
}
|
832 |
+
|
833 |
+
.wplc-admin-message::before, .wplc-user-message::before {
|
834 |
+
content: ' ';
|
835 |
+
width: 7px;
|
836 |
+
height: 7px;
|
837 |
+
background:#343434;
|
838 |
+
position: absolute;
|
839 |
+
left: 12px;
|
840 |
+
border-radius: 2px;
|
841 |
+
z-index: 1;
|
842 |
+
}
|
843 |
+
|
844 |
+
.wplc-user-message::before {
|
845 |
+
background:#2b97d2;
|
846 |
+
}
|
847 |
+
";
|
848 |
+
|
849 |
+
wp_add_inline_style( 'wplc-admin-style', $inline_identity_css );
|
850 |
+
}
|
851 |
+
|
852 |
+
wp_register_style( 'wplc-admin-style-bootstrap', "https://bleeper.io/app/assets/css/bootstrap.css", false, $wplc_version );
|
853 |
+
wp_enqueue_style( 'wplc-admin-style-bootstrap' );
|
854 |
+
|
855 |
+
if(empty($wplc_settings['wplc_disable_emojis']))
|
856 |
+
{
|
857 |
+
wp_register_style( 'wplc-admin-style-emoji', "https://bleeper.io/app/assets/wdt-emoji/wdt-emoji-bundle.css", false, $wplc_version );
|
858 |
+
wp_enqueue_style( 'wplc-admin-style-emoji' );
|
859 |
+
}
|
860 |
+
|
861 |
+
do_action("wplc_admin_remote_dashboard_styles_hook");
|
862 |
+
}
|
863 |
+
|
864 |
+
add_action("wplc_admin_remote_dashboard_above", "wplc_limited_error_output");
|
865 |
+
/*
|
866 |
+
* Outputs an error for limitations due to API key
|
867 |
+
*/
|
868 |
+
function wplc_limited_error_output(){
|
869 |
+
if(function_exists("wplc_pro_activate")){
|
870 |
+
echo "<p id='wplc_limited_container' class='update-nag' style='display:none;'>";
|
871 |
+
echo "<strong>" . __("Dear Pro User,", "wplivechat") . "</strong><br>";
|
872 |
+
echo __("Your API Key could not be validated, some functionality may be limited", "wplivechat");
|
873 |
+
echo "</p>";
|
874 |
+
}
|
875 |
+
|
876 |
+
echo "<p id='wplc_agent_invalid_container' class='update-nag' style='display:none;'>";
|
877 |
+
echo __("You are not a verified agent, chat dashboard has been disabled", "wplivechat");
|
878 |
+
echo "</p>";
|
879 |
+
}
|
880 |
+
|
881 |
+
/*
|
882 |
+
* Add action for notice checks
|
883 |
+
*/
|
884 |
+
if ( ! function_exists( "wplc_active_chat_box_notices" ) ) {
|
885 |
+
if(isset($_GET['page']) && $_GET['page'] === "wplivechat-menu"){
|
886 |
+
add_action( "wplc_admin_remote_dashboard_above", "wplc_active_chat_box_notices" );
|
887 |
+
}
|
888 |
+
}
|
889 |
+
|
890 |
+
add_action("wplc_admin_general_node_compat_check", "wplc_node_compat_version_check");
|
891 |
+
add_action("wplc_admin_remote_dashboard_above", "wplc_node_compat_version_check", 1);
|
892 |
+
/*
|
893 |
+
* Checks if current Pro is compatible with node basic, if not, show notice, and localize scripts needed for conflict free execution
|
894 |
+
*/
|
895 |
+
function wplc_node_compat_version_check(){
|
896 |
+
global $wplc_pro_version;
|
897 |
+
$wplc_ver = str_replace('.', '', $wplc_pro_version);
|
898 |
+
$checker = intval($wplc_ver);
|
899 |
+
if (function_exists("wplc_pro_version_control") && $checker < 8000) {
|
900 |
+
$wpc_ma_js_strings = array(
|
901 |
+
'remove_agent' => __('Remove', 'wplivechat'),
|
902 |
+
'nonce' => wp_create_nonce("wplc"),
|
903 |
+
'user_id' => get_current_user_id(),
|
904 |
+
'typing_string' => __('Typing...', 'wplivechat')
|
905 |
+
|
906 |
+
);
|
907 |
+
wp_localize_script('wplc-admin-js-agent', 'wplc_admin_strings', $wpc_ma_js_strings);
|
908 |
+
|
909 |
+
if(isset($_GET['page']) && $_GET['page'] === "wplivechat-menu"){
|
910 |
+
wp_register_script('wplc-admin-force-offline-js', plugins_url('../js/wplc_node_offline_mode_controller.js', __FILE__), array('jquery'), '', true);
|
911 |
+
wp_enqueue_script('wplc-admin-force-offline-js');
|
912 |
+
}
|
913 |
+
|
914 |
+
$is_dashboard = (isset($_GET['page']) && $_GET['page'] === "wplivechat-menu") ? true : false;
|
915 |
+
?>
|
916 |
+
<div class="<?php echo ($is_dashboard ? "" : "update-nag"); ?>" id="wplc_offline_mode_prompt_container" style='margin-top:5px;margin-bottom:5px;<?php echo ($is_dashboard ? "display:none; " : ""); ?>'>
|
917 |
+
<div style="display: inline-block; width: 80px; position: absolute; padding-top: 1em;">
|
918 |
+
<img src="https://bleeper.io/app/assets/images/wplc_loading.png" />
|
919 |
+
</div>
|
920 |
+
<div style="display: inline-block; margin-left: 80px;">
|
921 |
+
<p style="display: none;"><strong id="wplc_offline_mode_prompt"><?php _e("WP Live Chat Support - Offline Mode", "wplivechat") ?></strong></p>
|
922 |
+
<?php echo wplc_node_compat_pro_update_nag_content(); ?>
|
923 |
+
</div>
|
924 |
+
</div>
|
925 |
+
<?php
|
926 |
+
}
|
927 |
+
}
|
928 |
+
|
929 |
+
/*
|
930 |
+
* Checks if the users Pro API key is expired - this will only be called if pro is active and is less than V8
|
931 |
+
* true -> Show link to my account page
|
932 |
+
* false -> Show link to update page
|
933 |
+
*/
|
934 |
+
function wplc_node_compat_pro_update_nag_content(){
|
935 |
+
$html_out = "<p id='wplc_offline_mode_reason'>";
|
936 |
+
|
937 |
+
$is_pro_valid = wplc_node_compat_pro_api_key_is_valid_post();
|
938 |
+
|
939 |
+
if($is_pro_valid){
|
940 |
+
$html_out .= sprintf(__("Chat is now in offline mode, please <a href='%s' target='_BLANK'>upgrade to Version 8</a> (or above) of the WP Live Chat Support Pro Add-on to ensure all functionality works as expected.", "wplivechat"), "update-core.php");
|
941 |
+
} else {
|
942 |
+
$html_out .= sprintf(__("Chat is now in offline mode, please renew your API key by visiting the <a href='%s' target='_BLANK'>My Account</a> area, and receive updates.", "wplivechat"), "https://wp-livechat.com/my-account");
|
943 |
+
}
|
944 |
+
|
945 |
+
$html_out .= "</p>";
|
946 |
+
|
947 |
+
$html_out .= "<p>";
|
948 |
+
$html_out .= __("Alternatively, please disable the node server option in the Live Chat settings area (Live Chat -> Settings -> Advanced Features)", "wplivechat");
|
949 |
+
$html_out .= "</p>";
|
950 |
+
|
951 |
+
if($is_pro_valid){
|
952 |
+
$html_out .= "<a href='update-core.php' class='button button-primary' target='_BLANK'>" . __("Upgrade", "wplivechat") . "</a>";
|
953 |
+
} else {
|
954 |
+
$html_out .= "<a href='update-core.php' class='button button-primary' target='_BLANK'>" . __("Renew License", "wplivechat") . "</a>";
|
955 |
+
}
|
956 |
+
|
957 |
+
if(!isset($_GET['page']) || $_GET['page'] !== "wplivechat-menu-settings"){
|
958 |
+
$html_out .= " <a href='?page=wplivechat-menu-settings#tabs-beta' class='button' target='_BLANK'>" . __("Settings", "wplivechat") . "</a>";
|
959 |
+
}
|
960 |
+
|
961 |
+
$html_out .= " <a href='?page=wplivechat-menu&action=welcome' class='button' target='_BLANK'>" . __("Whats new in Version 8", "wplivechat") . "</a>";
|
962 |
+
|
963 |
+
return $html_out;
|
964 |
+
|
965 |
+
}
|
966 |
+
|
967 |
+
/*
|
968 |
+
* Checks if the Pro API key is valid or not
|
969 |
+
* Returns true or false
|
970 |
+
*/
|
971 |
+
function wplc_node_compat_pro_api_key_is_valid_post(){
|
972 |
+
$wplc_pro_validation_url = "http://ccplugins.co/api-control/";
|
973 |
+
$wplc_pro_option_key = "wp-live-chat-support-pro_key";
|
974 |
+
$wplc_pro_slug = "wp-live-chat-support-pro";
|
975 |
+
$is_valid = false; //By default it is false
|
976 |
+
if (get_option($wplc_pro_option_key)) {
|
977 |
+
$args = array(
|
978 |
+
'slug' => $wplc_pro_slug,
|
979 |
+
);
|
980 |
+
$data_array = array(
|
981 |
+
'method' => 'POST',
|
982 |
+
'body' => array(
|
983 |
+
'action' => 'api_validation',
|
984 |
+
'd' => get_option('siteurl'),
|
985 |
+
'request' => serialize($args),
|
986 |
+
'api_key' => get_option($wplc_pro_option_key)
|
987 |
+
));
|
988 |
+
$response = wp_remote_post($wplc_pro_validation_url, $data_array);
|
989 |
+
if (is_array($response)) {
|
990 |
+
if ( $response['response']['code'] == "200" ) {
|
991 |
+
$data = $response['body'];
|
992 |
+
$data = unserialize($data);
|
993 |
+
|
994 |
+
if(isset($data['status']) && $data['status'] === "OK"){
|
995 |
+
$is_valid = true;
|
996 |
+
}
|
997 |
+
}
|
998 |
+
}
|
999 |
+
|
1000 |
+
}
|
1001 |
+
|
1002 |
+
return $is_valid;
|
1003 |
+
}
|
1004 |
+
|
1005 |
+
add_filter("wplc_loggedin_filter","wplc_node_compat_version_disable_chat",99,1);
|
1006 |
+
/*
|
1007 |
+
* Checks if user is using out-date pro with node server, if so, disable chat on front end
|
1008 |
+
*/
|
1009 |
+
function wplc_node_compat_version_disable_chat($logged_in) {
|
1010 |
+
global $wplc_pro_version;
|
1011 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
1012 |
+
if(isset($wplc_settings['wplc_use_node_server']) && $wplc_settings['wplc_use_node_server'] == 1){
|
1013 |
+
$wplc_ver = str_replace('.', '', $wplc_pro_version);
|
1014 |
+
$checker = intval($wplc_ver);
|
1015 |
+
if (function_exists("wplc_pro_version_control") && $checker < 8000) {
|
1016 |
+
return false; //Force chat offline
|
1017 |
+
}
|
1018 |
+
}
|
1019 |
+
return $logged_in;
|
1020 |
+
}
|
1021 |
+
|
1022 |
+
add_action("admin_notices", "wplc_node_v8_plus_notice_dismissable");
|
1023 |
+
/*
|
1024 |
+
* Displays an admin notice (which can be dismissed), to notify any V8+ users of the node option (if not already checked)
|
1025 |
+
*/
|
1026 |
+
function wplc_node_v8_plus_notice_dismissable(){
|
1027 |
+
if(isset($_GET['page']) && strpos($_GET['page'], 'wplivechat') !== FALSE){
|
1028 |
+
if(isset($_GET['wplc_dismiss_notice_v8']) && $_GET['wplc_dismiss_notice_v8'] === "true"){
|
1029 |
+
update_option("wplc_node_v8_plus_notice_dismissed", 'true');
|
1030 |
+
}
|
1031 |
+
|
1032 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
1033 |
+
if(isset($wplc_settings['wplc_use_node_server']) && $wplc_settings['wplc_use_node_server'] == 1){
|
1034 |
+
//Do Nothing
|
1035 |
+
} else {
|
1036 |
+
//User is not on node, let's check if they have seen this notice before, if not, let's show a notice
|
1037 |
+
$wplc_has_notice_been_dismissed = get_option("wplc_node_v8_plus_notice_dismissed", false);
|
1038 |
+
if($wplc_has_notice_been_dismissed === false){
|
1039 |
+
//Has not been dismissed
|
1040 |
+
$output = "<div class='notice notice-warning' style='border-color: #0180bc;'>";
|
1041 |
+
$output .= "<p><strong>" . __( 'Welcome to V8 of WP Live Chat Support', 'wplivechat' ) . "</strong></p>";
|
1042 |
+
$output .= "<p>" . __('Did you know, this version features high speed message delivery, agent to agent chat, and a single window layout?', 'wplivechat') . "</p>";
|
1043 |
+
$output .= "<p>" . __('To activate this functionality please navigate to Live Chat -> Settings -> Advanced Features -> And enable our Chat Server option.', 'wplivechat') . "</p>";
|
1044 |
+
|
1045 |
+
$output .= "<p>";
|
1046 |
+
$output .= "<a href='?page=wplivechat-menu-settings#tabs-beta' class='button button-primary'>" . __("Show me!", "wplivechat") . "</a> ";
|
1047 |
+
$output .= "<a href='?page=".$_GET['page']."&wplc_dismiss_notice_v8=true' id='wplc_v8_dismiss_node_notice' class='button'>" . __("Don't Show This Again", "wplivechat") . "</a>";
|
1048 |
+
$output .= "</p>";
|
1049 |
+
|
1050 |
+
$output .= "</div>";
|
1051 |
+
|
1052 |
+
echo $output;
|
1053 |
+
}
|
1054 |
+
}
|
1055 |
+
}
|
1056 |
+
}
|
1057 |
+
|
1058 |
+
add_filter("wplc_activate_default_settings_array", "wplc_node_set_default_settings", 10, 1);
|
1059 |
+
/*
|
1060 |
+
* Adds default node setting to the default settings array
|
1061 |
+
*/
|
1062 |
+
function wplc_node_set_default_settings($wplc_default_settings_array){
|
1063 |
+
if(is_array($wplc_default_settings_array)){
|
1064 |
+
if(!isset($wplc_default_settings_array['wplc_use_node_server'])){
|
1065 |
+
//Is not set already
|
1066 |
+
$wplc_default_settings_array['wplc_use_node_server'] = 1;
|
1067 |
+
}
|
1068 |
+
}
|
1069 |
+
return $wplc_default_settings_array;
|
1070 |
+
}
|
1071 |
+
|
1072 |
+
add_filter( 'rest_url', 'wplc_node_rest_url_ssl_fix');
|
1073 |
+
/**
|
1074 |
+
* Changes the REST URL to include the SSL version if we are using SSL
|
1075 |
+
* See https://core.trac.wordpress.org/ticket/36451
|
1076 |
+
*/
|
1077 |
+
function wplc_node_rest_url_ssl_fix($url){
|
1078 |
+
if (is_ssl()){
|
1079 |
+
$url = set_url_scheme( $url, 'https' );
|
1080 |
+
return $url;
|
1081 |
+
}
|
1082 |
+
return $url;
|
1083 |
+
}
|
1084 |
+
|
1085 |
+
/**
|
1086 |
+
* Returns an array of pages/posts available on the site
|
1087 |
+
*/
|
1088 |
+
function wplc_node_pages_posts_array(){
|
1089 |
+
$r = array(
|
1090 |
+
'depth' => 0,
|
1091 |
+
'child_of' => 0,
|
1092 |
+
'echo' => false,
|
1093 |
+
'id' => '',
|
1094 |
+
'class' => '',
|
1095 |
+
'show_option_none' => '',
|
1096 |
+
'show_option_no_change' => '',
|
1097 |
+
'option_none_value' => '',
|
1098 |
+
'value_field' => 'ID',
|
1099 |
+
);
|
1100 |
+
|
1101 |
+
$pages = get_pages($r);
|
1102 |
+
$posts = get_posts(array('posts_per_page' => -1));
|
1103 |
+
|
1104 |
+
$posts_pages = array_merge($pages,$posts);
|
1105 |
+
|
1106 |
+
$return_array = array();
|
1107 |
+
|
1108 |
+
foreach ($posts_pages as $key => $value) {
|
1109 |
+
$post_page_id = $value->ID;
|
1110 |
+
$post_page_title = $value->post_title;
|
1111 |
+
|
1112 |
+
$return_array[get_permalink($post_page_id)] = $post_page_title;
|
1113 |
+
}
|
1114 |
+
|
1115 |
+
return $return_array;
|
1116 |
+
}
|
1117 |
+
|
1118 |
+
|
1119 |
+
|
1120 |
+
add_action("init","wplc_node_cloud_server_integration_hook_handler");
|
1121 |
+
/**
|
1122 |
+
* V8 Cloud Action & Filter Handlers
|
1123 |
+
*/
|
1124 |
+
function wplc_node_cloud_server_integration_hook_handler() {
|
1125 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
1126 |
+
if(isset($wplc_settings['wplc_use_node_server']) && $wplc_settings['wplc_use_node_server'] == 1){
|
1127 |
+
if(function_exists("wplc_cloud_load_updates")){
|
1128 |
+
remove_action("init","wplc_cloud_load_updates");
|
1129 |
+
remove_action("wplc_hook_chat_dashboard_above","wplc_cloud_1_hook_chat_dashboard_above");
|
1130 |
+
remove_action("wplc_hook_admin_chatbox_javascript","wplc_cloud_hook_control_push_js_to_admin", 10);
|
1131 |
+
remove_action("wplc_hook_push_js_to_front","wplc_cloud_hook_control_push_js_to_front", 10);
|
1132 |
+
remove_action("wplc_hook_chat_history","wplc_cloud_hook_control_chat_history", 1);
|
1133 |
+
remove_action("wplc_hook_chat_missed","wplc_cloud_hook_control_chat_missed", 1);
|
1134 |
+
remove_action("wplc_hook_initiate_check","wplc_cloud_hook_control_intiate_check", 1);
|
1135 |
+
remove_action("wplc_hook_history_draw_area","wplc_cloud_hook_control_history_draw_area", 1);
|
1136 |
+
remove_action("wplc_hook_change_status_on_answer","wplc_cloud_hook_control_change_status_on_answer", 1);
|
1137 |
+
remove_action("wplc_hook_update_agent_id","wplc_cloud_hook_control_update_agent_id", 1);
|
1138 |
+
remove_action('wplc_hook_accept_chat_url' , 'wplc_cloud_hook_control_accept_chat_url', 1);
|
1139 |
+
remove_action("wplc_hook_ma_check_if_answered_by_another_agent","wplc_cloud_hook_check_if_answered_by_another_agent", 1);
|
1140 |
+
remove_action("wplc_hook_settings_page_more_tabs","wplc_cloud_hook_control_settings_page_more_tabs");
|
1141 |
+
remove_action("init","wplc_cloud_first_run_check");
|
1142 |
+
remove_action('wplc_hook_admin_settings_save','wplc_cloud_save_settings');
|
1143 |
+
remove_action("wplc_api_route_hook", "wplc_api_node_routes_cloud", 1);
|
1144 |
+
remove_action('http_api_curl', 'wplc_cloud_http_api_curl', 100);
|
1145 |
+
remove_action("init", "wplc_cloud_additional_hooks", 1);
|
1146 |
+
|
1147 |
+
remove_filter("wplc_filter_get_chat_messages","wplc_cloud_filter_control_chat_messages",10);
|
1148 |
+
remove_filter("wplc_filter_get_chat_data","wplc_cloud_filter_control_chat_data",1);
|
1149 |
+
remove_filter("wplc_filter_chat_area_data","wplc_cloud_filter_control_chat_area_data",10);
|
1150 |
+
remove_filter("wplc_rating_data_filter","wplc_cloud_filter_control_get_rating_data",1);
|
1151 |
+
remove_filter("wplc_filter_admin_javascript","wplc_cloud_filter_control_admin_javascript");
|
1152 |
+
remove_filter("wplc_start_chat_user_form_after_filter", "wplc_start_chat_user_form_after_filter_remove_departments_cloud",2);
|
1153 |
+
remove_filter("wplc_after_chat_visitor_count_hook", "wplc_admin_cloud_remove_departments_chat_area_before_end_chat_button",2);
|
1154 |
+
remove_filter("wplc_admin_chat_area_before_end_chat_button", "wplc_admin_cloud_remove_transfer_button_chat_area_before_end_chat_button",2);
|
1155 |
+
remove_filter("wplc_filter_front_js_extra_data","wplc_cloud_filter_control_front_js_extra_data",10);
|
1156 |
+
remove_filter("wplc_filter_ajax_url","wplc_cloud_filter_control_ajax_url",10);
|
1157 |
+
remove_filter("wplc_filter_setting_tabs","wplc_cloud_filter_control_setting_tabs");
|
1158 |
+
remove_filter("wplc_filter_menu_api","wplc_cloud_filter_control_menu_api",1);
|
1159 |
+
remove_filter('http_request_args', 'wplc_cloud_http_request_args',100);
|
1160 |
+
}
|
1161 |
+
}
|
1162 |
+
}
|
1163 |
+
|
1164 |
+
add_action("init","wplc_node_mobile_integration_hook_handler");
|
1165 |
+
/**
|
1166 |
+
* V8 Mobile/Desktop Extension Action & Filter Handlers
|
1167 |
+
*/
|
1168 |
+
function wplc_node_mobile_integration_hook_handler() {
|
1169 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
1170 |
+
if(isset($wplc_settings['wplc_use_node_server']) && $wplc_settings['wplc_use_node_server'] == 1){
|
1171 |
+
if(function_exists("wplc_md_load_updates")){
|
1172 |
+
remove_action("init","wplc_md_load_updates");
|
1173 |
+
remove_action("wplc_hook_settings_page_more_tabs","wplc_mobile_hook_control_settings_page_more_tabs");
|
1174 |
+
remove_action("init","wplc_mobile_first_run_check");
|
1175 |
+
remove_action('wplc_hook_admin_settings_save','wplc_mobile_save_settings');
|
1176 |
+
|
1177 |
+
remove_filter("wplc_filter_is_admin_logged_in","wplc_mobile_check_if_logged_in",10);
|
1178 |
+
remove_filter("wplc_filter_setting_tabs","wplc_mobile_filter_control_setting_tabs");
|
1179 |
+
remove_filter("wplc_filter_menu_api","wplc_mobile_filter_control_menu_api");
|
1180 |
+
}
|
1181 |
+
}
|
1182 |
+
}
|
1183 |
+
|
1184 |
+
|
1185 |
+
add_action("wplc_admin_remoter_dashboard_scripts_localizer", "wplc_admin_remote_dashboard_dynamic_translation_handler");
|
1186 |
+
/*
|
1187 |
+
* Localizes an array of strings and ids in the dashboard which need to be replaced
|
1188 |
+
* Loads the custom JS file responsible for replacing the content dynamically.
|
1189 |
+
*/
|
1190 |
+
function wplc_admin_remote_dashboard_dynamic_translation_handler(){
|
1191 |
+
|
1192 |
+
global $wplc_version;
|
1193 |
+
wp_register_script('wplc-admin-dynamic-translation', plugins_url( '../js/wplc_admin_dynamic_translations.js', __FILE__ ), array("wplc-admin-js-agent", "wplc-admin-js-sockets", "jquery"), $wplc_version, false); //Added this for async storage calls
|
1194 |
+
|
1195 |
+
$wplc_dynamic_translation_array = array(
|
1196 |
+
'nifty_bg_holder_text_inner' => __('Connecting...', 'wplivechat'),
|
1197 |
+
'nifty_admin_chat_prompt_title' => __('Please Confirm', 'wplivechat'),
|
1198 |
+
'nifty_admin_chat_prompt_confirm' => __('Confirm', 'wplivechat'),
|
1199 |
+
'nifty_admin_chat_prompt_cancel' => __('Cancel', 'wplivechat'),
|
1200 |
+
'active_count_string' => __(' Active visitors', 'wplivechat'),
|
1201 |
+
'wplc-agent-info' => __('Agent(s) Online', 'wplivechat'),
|
1202 |
+
'wplc_history_link' => __('Chat History', 'wplivechat'),
|
1203 |
+
'nifty_agent_heading' => __('Agents', 'wplivechat'),
|
1204 |
+
'drag_zone_inner_text' => __('Drag Files Here', 'wplivechat'),
|
1205 |
+
'chatTransferLink' => __('Transfer', 'wplivechat'),
|
1206 |
+
'chatTransferDepLink' => __('Department Transfer', 'wplivechat'),
|
1207 |
+
'chatDirectUserToPageLink' => __('Direct User To Page', 'wplivechat'),
|
1208 |
+
'chatCloseTitle' => __('Leave chat', 'wplivechat'),
|
1209 |
+
'chatEndTitle' => __('End chat', 'wplivechat'),
|
1210 |
+
'chatTransferUps' => __('Transfer', 'wplivechat'),
|
1211 |
+
'chatDirectUserToPageUps' => __('Direct User To Page', 'wplivechat'),
|
1212 |
+
'nifty_event_heading' => __('Events', 'wplivechat'),
|
1213 |
+
'nifty_join_chat_button' => __('Join chat', 'wplivechat'),
|
1214 |
+
'nifty_filter_button' => __('Filters', 'wplivechat'),
|
1215 |
+
'nifty_new_visitor_item' => __('New Visitors (3 Min)', 'wplivechat'),
|
1216 |
+
'nifty_active_chats_item' => __('Active Chats', 'wplivechat'),
|
1217 |
+
'nifty_clear_filters_item' => __('Clear Filters', 'wplivechat'),
|
1218 |
+
'nifty_active_chats_heading' => __('Active visitors', 'wplivechat'),
|
1219 |
+
'nifty_vis_col_heading' => __('Visitor', 'wplivechat'),
|
1220 |
+
'nifty_vis_info_heading' => __('Info', 'wplivechat'),
|
1221 |
+
'nifty_vis_page_heading' => __('Page', 'wplivechat'),
|
1222 |
+
'nifty_vis_status_heading' => __('Chat Status', 'wplivechat'),
|
1223 |
+
'nifty_vis_dep_heading' => __('Department', 'wplivechat'),
|
1224 |
+
'wdt-emoji-search-result-title' => __('Search Results', 'wplivechat'),
|
1225 |
+
'wdt-emoji-no-result' => __('No emoji found', 'wplivechat')
|
1226 |
+
);
|
1227 |
+
|
1228 |
+
apply_filters("wplc_adming_dynamic_translation_filter", $wplc_dynamic_translation_array);
|
1229 |
+
|
1230 |
+
|
1231 |
+
wp_localize_script('wplc-admin-dynamic-translation', 'wplc_dynamic_translation_array', $wplc_dynamic_translation_array);
|
1232 |
+
wp_enqueue_script('wplc-admin-dynamic-translation');
|
1233 |
+
|
1234 |
}
|
readme.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
=== WP Live Chat Support ===
|
2 |
Contributors: WP-LiveChat, NickDuncan, CodeCabin_, dylanauty
|
3 |
Donate link: http://www.wp-livechat.com
|
4 |
Tags: live chat, live support, chat plugin, live help, wordpress live chat, chat, live chat plugin, live support plugin, live chat support plugin, chat plugin, support plugin, live help
|
@@ -258,12 +258,21 @@ We have patched the PHPMailer vulnerability. Please update to version 7.0.02.
|
|
258 |
|
259 |
|
260 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
261 |
|
262 |
= 8.0.22 - 2019-02-04 - Low priority =
|
263 |
-
|
264 |
-
*
|
|
|
|
|
|
|
265 |
* Moved the warning regarding desktop notifications to the settings page only
|
266 |
|
|
|
267 |
= 8.0.21 - 2018-12-18 - Low priority =
|
268 |
* Readme Update: Coming soon features
|
269 |
* Readme Update: Features list
|
1 |
+
=== WP Live Chat Support ===
|
2 |
Contributors: WP-LiveChat, NickDuncan, CodeCabin_, dylanauty
|
3 |
Donate link: http://www.wp-livechat.com
|
4 |
Tags: live chat, live support, chat plugin, live help, wordpress live chat, chat, live chat plugin, live support plugin, live chat support plugin, chat plugin, support plugin, live help
|
258 |
|
259 |
|
260 |
== Changelog ==
|
261 |
+
= 8.0.23 - 2019-02-05 - Low priority =
|
262 |
+
|
263 |
+
* Fixed access to new dashboard for non admin agents
|
264 |
+
* Fixed documentation suggestions not working (Pro)
|
265 |
+
|
266 |
|
267 |
= 8.0.22 - 2019-02-04 - Low priority =
|
268 |
+
|
269 |
+
* Introduced a new dashboard that showcases latest blog posts, the latest podcast episode and the system status
|
270 |
+
|
271 |
+
* Moved GDPR warnings for first time users to the settings page only
|
272 |
+
|
273 |
* Moved the warning regarding desktop notifications to the settings page only
|
274 |
|
275 |
+
|
276 |
= 8.0.21 - 2018-12-18 - Low priority =
|
277 |
* Readme Update: Coming soon features
|
278 |
* Readme Update: Features list
|
wp-live-chat-support.php
CHANGED
@@ -1,6471 +1,6485 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Plugin Name: WP Live Chat Support
|
4 |
-
Plugin URI: http://www.wp-livechat.com
|
5 |
-
Description: The easiest to use website live chat plugin. Let your visitors chat with you and increase sales conversion rates with WP Live Chat Support.
|
6 |
-
Version: 8.0.
|
7 |
-
Author: WP-LiveChat
|
8 |
-
Author URI: http://www.wp-livechat.com
|
9 |
-
Text Domain: wplivechat
|
10 |
-
Domain Path: /languages
|
11 |
-
*/
|
12 |
-
|
13 |
-
/**
|
14 |
-
* 8.0.
|
15 |
-
*
|
16 |
-
*
|
17 |
-
*
|
18 |
-
*
|
19 |
-
*
|
20 |
-
*
|
21 |
-
*
|
22 |
-
*
|
23 |
-
*
|
24 |
-
*
|
25 |
-
*
|
26 |
-
*
|
27 |
-
*
|
28 |
-
*
|
29 |
-
*
|
30 |
-
*
|
31 |
-
*
|
32 |
-
*
|
33 |
-
*
|
34 |
-
* 8.0.
|
35 |
-
*
|
36 |
-
*
|
37 |
-
*
|
38 |
-
* 8.0.
|
39 |
-
*
|
40 |
-
*
|
41 |
-
*
|
42 |
-
*
|
43 |
-
*
|
44 |
-
*
|
45 |
-
*
|
46 |
-
*
|
47 |
-
*
|
48 |
-
*
|
49 |
-
*
|
50 |
-
*
|
51 |
-
*
|
52 |
-
* Fixed
|
53 |
-
* Fixed
|
54 |
-
* Fixed
|
55 |
-
* Fixed
|
56 |
-
*
|
57 |
-
*
|
58 |
-
*
|
59 |
-
*
|
60 |
-
* Updated
|
61 |
-
*
|
62 |
-
*
|
63 |
-
*
|
64 |
-
*
|
65 |
-
*
|
66 |
-
*
|
67 |
-
*
|
68 |
-
*
|
69 |
-
* Fixed
|
70 |
-
* Fixed
|
71 |
-
*
|
72 |
-
*
|
73 |
-
*
|
74 |
-
*
|
75 |
-
*
|
76 |
-
*
|
77 |
-
*
|
78 |
-
*
|
79 |
-
* Fixed
|
80 |
-
* Fixed
|
81 |
-
*
|
82 |
-
*
|
83 |
-
*
|
84 |
-
*
|
85 |
-
* Added
|
86 |
-
*
|
87 |
-
*
|
88 |
-
*
|
89 |
-
*
|
90 |
-
*
|
91 |
-
*
|
92 |
-
*
|
93 |
-
*
|
94 |
-
*
|
95 |
-
*
|
96 |
-
*
|
97 |
-
* 8.0.
|
98 |
-
* Fixed a bug
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
global $
|
107 |
-
global $
|
108 |
-
global $
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
$
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
global $
|
131 |
-
$
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
require_once (plugin_dir_path(__FILE__) . "
|
139 |
-
|
140 |
-
|
141 |
-
require_once (plugin_dir_path(__FILE__) . "
|
142 |
-
require_once (plugin_dir_path(__FILE__) . "
|
143 |
-
require_once (plugin_dir_path(__FILE__) . "
|
144 |
-
require_once (plugin_dir_path(__FILE__) . "
|
145 |
-
require_once (plugin_dir_path(__FILE__) . "
|
146 |
-
require_once (plugin_dir_path(__FILE__) . "modules/
|
147 |
-
require_once (plugin_dir_path(__FILE__) . "modules/
|
148 |
-
require_once (plugin_dir_path(__FILE__) . "modules/
|
149 |
-
require_once (plugin_dir_path(__FILE__) . "
|
150 |
-
require_once (plugin_dir_path(__FILE__) . "modules/
|
151 |
-
require_once (plugin_dir_path(__FILE__) . "modules/
|
152 |
-
|
153 |
-
|
154 |
-
require_once (plugin_dir_path(__FILE__) . "
|
155 |
-
require_once (plugin_dir_path(__FILE__) . "
|
156 |
-
|
157 |
-
//
|
158 |
-
require_once (plugin_dir_path(__FILE__) . "includes/
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
add_action( '
|
165 |
-
add_action( '
|
166 |
-
add_action( '
|
167 |
-
add_action( '
|
168 |
-
add_action(
|
169 |
-
add_action( '
|
170 |
-
add_action( '
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
add_action('
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
add_action('
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
function
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
$
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
$admins
|
293 |
-
$admins->add_cap('
|
294 |
-
$admins->add_cap('
|
295 |
-
$admins->add_cap('
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
if (!isset($wplc_settings['
|
307 |
-
if (!isset($wplc_settings['
|
308 |
-
if (!isset($wplc_settings['
|
309 |
-
if (!isset($wplc_settings['
|
310 |
-
if (!isset($wplc_settings['
|
311 |
-
if (!isset($wplc_settings['
|
312 |
-
if (!isset($wplc_settings['
|
313 |
-
if (!isset($wplc_settings['
|
314 |
-
if (!isset($wplc_settings['
|
315 |
-
if (!isset($wplc_settings['
|
316 |
-
if (!isset($wplc_settings['
|
317 |
-
if (!isset($wplc_settings['
|
318 |
-
if (!isset($wplc_settings['
|
319 |
-
if (!isset($wplc_settings['
|
320 |
-
if (!isset($wplc_settings['
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
if (!isset($wplc_settings['
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
if (!isset($wplc_settings['
|
345 |
-
|
346 |
-
if (!isset($wplc_settings['
|
347 |
-
|
348 |
-
if (!isset($wplc_settings['
|
349 |
-
|
350 |
-
if (!isset($wplc_settings['
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
}
|
366 |
-
if (!isset($wplc_settings['
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
}
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
function
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
$
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
"
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
}
|
441 |
-
if ($_POST['action'] == "
|
442 |
-
do_action("
|
443 |
-
|
444 |
-
}
|
445 |
-
if ($_POST['action'] ==
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
}
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
}
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
if(
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
}
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
if (
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
if (
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
wp_localize_script('wplc-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
$
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
}
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
}
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
$
|
1040 |
-
|
1041 |
-
$
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
.wplc-color-
|
1086 |
-
.wplc-color-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
}
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
}
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
}
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
*
|
1179 |
-
* @
|
1180 |
-
* @
|
1181 |
-
*/
|
1182 |
-
function
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
*
|
1223 |
-
* @
|
1224 |
-
* @
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
if ($
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
}
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
$
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
$ret_msg .= "
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
}
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
function
|
1324 |
-
|
1325 |
-
$
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
$
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
$
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
if (
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
if (
|
1402 |
-
$
|
1403 |
-
}
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
$ret_msg .= "<input type=\"text\" name=\"
|
1410 |
-
$ret_msg .=
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
$
|
1422 |
-
$ret_msg .= "<input type=\"hidden\" name=\"
|
1423 |
-
$ret_msg .=
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
*
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
-
|
1475 |
-
|
1476 |
-
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
|
1481 |
-
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
|
1486 |
-
|
1487 |
-
|
1488 |
-
|
1489 |
-
|
1490 |
-
|
1491 |
-
|
1492 |
-
|
1493 |
-
$
|
1494 |
-
|
1495 |
-
|
1496 |
-
|
1497 |
-
|
1498 |
-
|
1499 |
-
|
1500 |
-
|
1501 |
-
|
1502 |
-
|
1503 |
-
|
1504 |
-
|
1505 |
-
|
1506 |
-
|
1507 |
-
|
1508 |
-
|
1509 |
-
|
1510 |
-
|
1511 |
-
|
1512 |
-
|
1513 |
-
|
1514 |
-
|
1515 |
-
|
1516 |
-
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
|
1523 |
-
} else {
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
1530 |
-
$
|
1531 |
-
}
|
1532 |
-
|
1533 |
-
|
1534 |
-
|
1535 |
-
|
1536 |
-
|
1537 |
-
|
1538 |
-
|
1539 |
-
|
1540 |
-
|
1541 |
-
|
1542 |
-
|
1543 |
-
|
1544 |
-
|
1545 |
-
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
-
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
1553 |
-
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
1560 |
-
|
1561 |
-
|
1562 |
-
|
1563 |
-
|
1564 |
-
|
1565 |
-
|
1566 |
-
|
1567 |
-
|
1568 |
-
|
1569 |
-
|
1570 |
-
|
1571 |
-
|
1572 |
-
|
1573 |
-
|
1574 |
-
|
1575 |
-
|
1576 |
-
|
1577 |
-
|
1578 |
-
|
1579 |
-
|
1580 |
-
|
1581 |
-
|
1582 |
-
|
1583 |
-
|
1584 |
-
|
1585 |
-
|
1586 |
-
|
1587 |
-
|
1588 |
-
|
1589 |
-
|
1590 |
-
|
1591 |
-
|
1592 |
-
|
1593 |
-
|
1594 |
-
|
1595 |
-
|
1596 |
-
|
1597 |
-
|
1598 |
-
|
1599 |
-
|
1600 |
-
|
1601 |
-
|
1602 |
-
|
1603 |
-
|
1604 |
-
|
1605 |
-
|
1606 |
-
|
1607 |
-
|
1608 |
-
|
1609 |
-
|
1610 |
-
|
1611 |
-
|
1612 |
-
|
1613 |
-
|
1614 |
-
|
1615 |
-
|
1616 |
-
|
1617 |
-
|
1618 |
-
|
1619 |
-
|
1620 |
-
|
1621 |
-
|
1622 |
-
|
1623 |
-
|
1624 |
-
$
|
1625 |
-
|
1626 |
-
$ret_msg .= "<input type=\"
|
1627 |
-
$ret_msg .= "<
|
1628 |
-
|
1629 |
-
$
|
1630 |
-
|
1631 |
-
|
1632 |
-
|
1633 |
-
|
1634 |
-
|
1635 |
-
|
1636 |
-
|
1637 |
-
|
1638 |
-
|
1639 |
-
|
1640 |
-
|
1641 |
-
|
1642 |
-
|
1643 |
-
|
1644 |
-
|
1645 |
-
|
1646 |
-
|
1647 |
-
|
1648 |
-
|
1649 |
-
|
1650 |
-
|
1651 |
-
|
1652 |
-
|
1653 |
-
|
1654 |
-
|
1655 |
-
|
1656 |
-
|
1657 |
-
|
1658 |
-
|
1659 |
-
|
1660 |
-
|
1661 |
-
|
1662 |
-
|
1663 |
-
|
1664 |
-
|
1665 |
-
|
1666 |
-
|
1667 |
-
|
1668 |
-
|
1669 |
-
|
1670 |
-
*
|
1671 |
-
*/
|
1672 |
-
function
|
1673 |
-
|
1674 |
-
|
1675 |
-
|
1676 |
-
|
1677 |
-
|
1678 |
-
|
1679 |
-
|
1680 |
-
|
1681 |
-
|
1682 |
-
|
1683 |
-
|
1684 |
-
|
1685 |
-
|
1686 |
-
|
1687 |
-
|
1688 |
-
|
1689 |
-
|
1690 |
-
|
1691 |
-
|
1692 |
-
|
1693 |
-
|
1694 |
-
|
1695 |
-
|
1696 |
-
|
1697 |
-
|
1698 |
-
|
1699 |
-
|
1700 |
-
|
1701 |
-
|
1702 |
-
|
1703 |
-
|
1704 |
-
|
1705 |
-
|
1706 |
-
|
1707 |
-
|
1708 |
-
|
1709 |
-
|
1710 |
-
|
1711 |
-
|
1712 |
-
|
1713 |
-
|
1714 |
-
|
1715 |
-
|
1716 |
-
|
1717 |
-
|
1718 |
-
|
1719 |
-
|
1720 |
-
|
1721 |
-
|
1722 |
-
|
1723 |
-
|
1724 |
-
|
1725 |
-
|
1726 |
-
|
1727 |
-
|
1728 |
-
|
1729 |
-
|
1730 |
-
|
1731 |
-
|
1732 |
-
$
|
1733 |
-
|
1734 |
-
|
1735 |
-
|
1736 |
-
|
1737 |
-
|
1738 |
-
|
1739 |
-
|
1740 |
-
|
1741 |
-
|
1742 |
-
|
1743 |
-
|
1744 |
-
|
1745 |
-
|
1746 |
-
|
1747 |
-
|
1748 |
-
|
1749 |
-
|
1750 |
-
|
1751 |
-
|
1752 |
-
|
1753 |
-
|
1754 |
-
|
1755 |
-
|
1756 |
-
|
1757 |
-
|
1758 |
-
|
1759 |
-
|
1760 |
-
|
1761 |
-
|
1762 |
-
|
1763 |
-
|
1764 |
-
|
1765 |
-
|
1766 |
-
|
1767 |
-
|
1768 |
-
|
1769 |
-
|
1770 |
-
|
1771 |
-
|
1772 |
-
|
1773 |
-
|
1774 |
-
|
1775 |
-
|
1776 |
-
|
1777 |
-
|
1778 |
-
|
1779 |
-
|
1780 |
-
|
1781 |
-
$
|
1782 |
-
|
1783 |
-
$
|
1784 |
-
|
1785 |
-
|
1786 |
-
|
1787 |
-
|
1788 |
-
|
1789 |
-
|
1790 |
-
|
1791 |
-
|
1792 |
-
|
1793 |
-
|
1794 |
-
|
1795 |
-
|
1796 |
-
|
1797 |
-
$ret_msg .= "<div id
|
1798 |
-
|
1799 |
-
$ret_msg .= "
|
1800 |
-
|
1801 |
-
|
1802 |
-
$ret_msg .=
|
1803 |
-
|
1804 |
-
$ret_msg .=
|
1805 |
-
$
|
1806 |
-
$ret_msg .= "<
|
1807 |
-
|
1808 |
-
|
1809 |
-
|
1810 |
-
|
1811 |
-
|
1812 |
-
|
1813 |
-
$ret_msg .=
|
1814 |
-
|
1815 |
-
|
1816 |
-
$ret_msg .=
|
1817 |
-
|
1818 |
-
|
1819 |
-
$
|
1820 |
-
|
1821 |
-
|
1822 |
-
if($
|
1823 |
-
$ret_msg .= apply_filters("
|
1824 |
-
}
|
1825 |
-
|
1826 |
-
|
1827 |
-
$ret_msg .= "
|
1828 |
-
|
1829 |
-
|
1830 |
-
|
1831 |
-
|
1832 |
-
|
1833 |
-
|
1834 |
-
|
1835 |
-
|
1836 |
-
|
1837 |
-
|
1838 |
-
|
1839 |
-
|
1840 |
-
|
1841 |
-
|
1842 |
-
$ret_msg
|
1843 |
-
|
1844 |
-
|
1845 |
-
|
1846 |
-
|
1847 |
-
|
1848 |
-
|
1849 |
-
|
1850 |
-
|
1851 |
-
|
1852 |
-
|
1853 |
-
|
1854 |
-
|
1855 |
-
|
1856 |
-
|
1857 |
-
|
1858 |
-
|
1859 |
-
|
1860 |
-
|
1861 |
-
|
1862 |
-
$
|
1863 |
-
|
1864 |
-
|
1865 |
-
|
1866 |
-
|
1867 |
-
|
1868 |
-
|
1869 |
-
|
1870 |
-
|
1871 |
-
|
1872 |
-
|
1873 |
-
|
1874 |
-
|
1875 |
-
|
1876 |
-
|
1877 |
-
|
1878 |
-
|
1879 |
-
|
1880 |
-
|
1881 |
-
|
1882 |
-
|
1883 |
-
|
1884 |
-
|
1885 |
-
|
1886 |
-
|
1887 |
-
|
1888 |
-
|
1889 |
-
|
1890 |
-
|
1891 |
-
|
1892 |
-
|
1893 |
-
|
1894 |
-
|
1895 |
-
|
1896 |
-
|
1897 |
-
|
1898 |
-
|
1899 |
-
|
1900 |
-
|
1901 |
-
|
1902 |
-
|
1903 |
-
|
1904 |
-
|
1905 |
-
|
1906 |
-
|
1907 |
-
|
1908 |
-
|
1909 |
-
|
1910 |
-
|
1911 |
-
$
|
1912 |
-
|
1913 |
-
|
1914 |
-
|
1915 |
-
|
1916 |
-
|
1917 |
-
|
1918 |
-
|
1919 |
-
|
1920 |
-
|
1921 |
-
|
1922 |
-
|
1923 |
-
|
1924 |
-
|
1925 |
-
|
1926 |
-
|
1927 |
-
|
1928 |
-
|
1929 |
-
|
1930 |
-
|
1931 |
-
|
1932 |
-
|
1933 |
-
|
1934 |
-
|
1935 |
-
|
1936 |
-
|
1937 |
-
|
1938 |
-
|
1939 |
-
|
1940 |
-
|
1941 |
-
|
1942 |
-
|
1943 |
-
|
1944 |
-
|
1945 |
-
|
1946 |
-
|
1947 |
-
|
1948 |
-
|
1949 |
-
|
1950 |
-
|
1951 |
-
|
1952 |
-
|
1953 |
-
|
1954 |
-
|
1955 |
-
$
|
1956 |
-
|
1957 |
-
|
1958 |
-
|
1959 |
-
|
1960 |
-
|
1961 |
-
|
1962 |
-
|
1963 |
-
|
1964 |
-
|
1965 |
-
|
1966 |
-
|
1967 |
-
|
1968 |
-
|
1969 |
-
|
1970 |
-
|
1971 |
-
|
1972 |
-
|
1973 |
-
|
1974 |
-
|
1975 |
-
|
1976 |
-
|
1977 |
-
|
1978 |
-
|
1979 |
-
|
1980 |
-
|
1981 |
-
|
1982 |
-
|
1983 |
-
|
1984 |
-
|
1985 |
-
|
1986 |
-
|
1987 |
-
|
1988 |
-
|
1989 |
-
|
1990 |
-
|
1991 |
-
|
1992 |
-
|
1993 |
-
|
1994 |
-
|
1995 |
-
|
1996 |
-
|
1997 |
-
|
1998 |
-
|
1999 |
-
|
2000 |
-
|
2001 |
-
|
2002 |
-
|
2003 |
-
|
2004 |
-
|
2005 |
-
|
2006 |
-
|
2007 |
-
|
2008 |
-
|
2009 |
-
|
2010 |
-
'
|
2011 |
-
|
2012 |
-
|
2013 |
-
|
2014 |
-
|
2015 |
-
|
2016 |
-
|
2017 |
-
|
2018 |
-
|
2019 |
-
|
2020 |
-
|
2021 |
-
|
2022 |
-
|
2023 |
-
|
2024 |
-
|
2025 |
-
|
2026 |
-
|
2027 |
-
|
2028 |
-
|
2029 |
-
|
2030 |
-
|
2031 |
-
|
2032 |
-
|
2033 |
-
|
2034 |
-
|
2035 |
-
|
2036 |
-
|
2037 |
-
|
2038 |
-
|
2039 |
-
|
2040 |
-
|
2041 |
-
|
2042 |
-
|
2043 |
-
|
2044 |
-
|
2045 |
-
|
2046 |
-
|
2047 |
-
|
2048 |
-
|
2049 |
-
|
2050 |
-
|
2051 |
-
|
2052 |
-
|
2053 |
-
|
2054 |
-
|
2055 |
-
|
2056 |
-
|
2057 |
-
|
2058 |
-
$ret_msg .= "
|
2059 |
-
$ret_msg .=
|
2060 |
-
$ret_msg .=
|
2061 |
-
$ret_msg .= " <
|
2062 |
-
$ret_msg .= "
|
2063 |
-
$ret_msg .= "
|
2064 |
-
$ret_msg .=
|
2065 |
-
$ret_msg .=
|
2066 |
-
|
2067 |
-
|
2068 |
-
$ret_msg .= " <div id=\"wp-live-chat-
|
2069 |
-
$ret_msg .=
|
2070 |
-
$ret_msg .=
|
2071 |
-
|
2072 |
-
|
2073 |
-
|
2074 |
-
|
2075 |
-
|
2076 |
-
|
2077 |
-
|
2078 |
-
|
2079 |
-
|
2080 |
-
|
2081 |
-
|
2082 |
-
|
2083 |
-
|
2084 |
-
|
2085 |
-
|
2086 |
-
|
2087 |
-
|
2088 |
-
|
2089 |
-
|
2090 |
-
|
2091 |
-
|
2092 |
-
|
2093 |
-
|
2094 |
-
|
2095 |
-
|
2096 |
-
|
2097 |
-
|
2098 |
-
|
2099 |
-
|
2100 |
-
|
2101 |
-
|
2102 |
-
|
2103 |
-
|
2104 |
-
$
|
2105 |
-
|
2106 |
-
|
2107 |
-
|
2108 |
-
$
|
2109 |
-
$ret_msg
|
2110 |
-
$ret_msg .=
|
2111 |
-
$ret_msg .=
|
2112 |
-
$ret_msg .=
|
2113 |
-
$ret_msg .= "
|
2114 |
-
|
2115 |
-
|
2116 |
-
$ret_msg .= "
|
2117 |
-
$ret_msg .= "
|
2118 |
-
$ret_msg .= "
|
2119 |
-
$ret_msg .= apply_filters("
|
2120 |
-
$ret_msg .= "
|
2121 |
-
$ret_msg .= "
|
2122 |
-
$ret_msg .= "
|
2123 |
-
$ret_msg .=
|
2124 |
-
$ret_msg .=
|
2125 |
-
|
2126 |
-
$ret_msg .=
|
2127 |
-
|
2128 |
-
|
2129 |
-
|
2130 |
-
|
2131 |
-
|
2132 |
-
$ret_msg
|
2133 |
-
|
2134 |
-
|
2135 |
-
|
2136 |
-
|
2137 |
-
|
2138 |
-
|
2139 |
-
|
2140 |
-
|
2141 |
-
|
2142 |
-
|
2143 |
-
|
2144 |
-
|
2145 |
-
|
2146 |
-
|
2147 |
-
|
2148 |
-
|
2149 |
-
|
2150 |
-
|
2151 |
-
|
2152 |
-
|
2153 |
-
|
2154 |
-
|
2155 |
-
|
2156 |
-
|
2157 |
-
|
2158 |
-
|
2159 |
-
|
2160 |
-
|
2161 |
-
|
2162 |
-
|
2163 |
-
|
2164 |
-
|
2165 |
-
|
2166 |
-
|
2167 |
-
|
2168 |
-
|
2169 |
-
|
2170 |
-
|
2171 |
-
|
2172 |
-
|
2173 |
-
|
2174 |
-
|
2175 |
-
|
2176 |
-
|
2177 |
-
|
2178 |
-
|
2179 |
-
|
2180 |
-
|
2181 |
-
|
2182 |
-
|
2183 |
-
|
2184 |
-
|
2185 |
-
|
2186 |
-
|
2187 |
-
|
2188 |
-
|
2189 |
-
|
2190 |
-
|
2191 |
-
|
2192 |
-
|
2193 |
-
|
2194 |
-
|
2195 |
-
|
2196 |
-
|
2197 |
-
|
2198 |
-
|
2199 |
-
|
2200 |
-
|
2201 |
-
|
2202 |
-
}
|
2203 |
-
|
2204 |
-
|
2205 |
-
|
2206 |
-
|
2207 |
-
|
2208 |
-
|
2209 |
-
|
2210 |
-
|
2211 |
-
|
2212 |
-
|
2213 |
-
|
2214 |
-
|
2215 |
-
}
|
2216 |
-
|
2217 |
-
|
2218 |
-
|
2219 |
-
|
2220 |
-
|
2221 |
-
|
2222 |
-
|
2223 |
-
|
2224 |
-
|
2225 |
-
|
2226 |
-
|
2227 |
-
|
2228 |
-
|
2229 |
-
|
2230 |
-
|
2231 |
-
|
2232 |
-
|
2233 |
-
|
2234 |
-
|
2235 |
-
|
2236 |
-
|
2237 |
-
|
2238 |
-
|
2239 |
-
|
2240 |
-
|
2241 |
-
|
2242 |
-
|
2243 |
-
|
2244 |
-
|
2245 |
-
|
2246 |
-
|
2247 |
-
|
2248 |
-
|
2249 |
-
|
2250 |
-
|
2251 |
-
|
2252 |
-
|
2253 |
-
|
2254 |
-
|
2255 |
-
|
2256 |
-
|
2257 |
-
|
2258 |
-
|
2259 |
-
|
2260 |
-
|
2261 |
-
|
2262 |
-
|
2263 |
-
|
2264 |
-
|
2265 |
-
|
2266 |
-
|
2267 |
-
|
2268 |
-
|
2269 |
-
|
2270 |
-
|
2271 |
-
|
2272 |
-
|
2273 |
-
|
2274 |
-
|
2275 |
-
|
2276 |
-
|
2277 |
-
|
2278 |
-
|
2279 |
-
|
2280 |
-
|
2281 |
-
|
2282 |
-
|
2283 |
-
|
2284 |
-
|
2285 |
-
|
2286 |
-
|
2287 |
-
|
2288 |
-
|
2289 |
-
|
2290 |
-
|
2291 |
-
|
2292 |
-
$
|
2293 |
-
|
2294 |
-
|
2295 |
-
|
2296 |
-
|
2297 |
-
|
2298 |
-
|
2299 |
-
|
2300 |
-
|
2301 |
-
|
2302 |
-
|
2303 |
-
|
2304 |
-
|
2305 |
-
|
2306 |
-
|
2307 |
-
|
2308 |
-
|
2309 |
-
|
2310 |
-
|
2311 |
-
|
2312 |
-
|
2313 |
-
|
2314 |
-
|
2315 |
-
|
2316 |
-
|
2317 |
-
|
2318 |
-
|
2319 |
-
|
2320 |
-
|
2321 |
-
|
2322 |
-
|
2323 |
-
|
2324 |
-
|
2325 |
-
|
2326 |
-
|
2327 |
-
|
2328 |
-
|
2329 |
-
|
2330 |
-
|
2331 |
-
|
2332 |
-
|
2333 |
-
|
2334 |
-
|
2335 |
-
|
2336 |
-
|
2337 |
-
|
2338 |
-
|
2339 |
-
|
2340 |
-
|
2341 |
-
|
2342 |
-
|
2343 |
-
|
2344 |
-
|
2345 |
-
|
2346 |
-
|
2347 |
-
|
2348 |
-
|
2349 |
-
|
2350 |
-
|
2351 |
-
|
2352 |
-
|
2353 |
-
|
2354 |
-
|
2355 |
-
|
2356 |
-
|
2357 |
-
|
2358 |
-
|
2359 |
-
|
2360 |
-
|
2361 |
-
|
2362 |
-
|
2363 |
-
|
2364 |
-
|
2365 |
-
|
2366 |
-
|
2367 |
-
|
2368 |
-
|
2369 |
-
|
2370 |
-
|
2371 |
-
|
2372 |
-
|
2373 |
-
|
2374 |
-
|
2375 |
-
|
2376 |
-
|
2377 |
-
|
2378 |
-
|
2379 |
-
|
2380 |
-
|
2381 |
-
|
2382 |
-
|
2383 |
-
|
2384 |
-
|
2385 |
-
|
2386 |
-
|
2387 |
-
|
2388 |
-
|
2389 |
-
|
2390 |
-
|
2391 |
-
|
2392 |
-
|
2393 |
-
|
2394 |
-
|
2395 |
-
|
2396 |
-
|
2397 |
-
|
2398 |
-
|
2399 |
-
|
2400 |
-
|
2401 |
-
|
2402 |
-
|
2403 |
-
|
2404 |
-
|
2405 |
-
|
2406 |
-
|
2407 |
-
|
2408 |
-
|
2409 |
-
|
2410 |
-
|
2411 |
-
|
2412 |
-
|
2413 |
-
|
2414 |
-
|
2415 |
-
|
2416 |
-
|
2417 |
-
|
2418 |
-
|
2419 |
-
|
2420 |
-
|
2421 |
-
|
2422 |
-
|
2423 |
-
|
2424 |
-
|
2425 |
-
|
2426 |
-
|
2427 |
-
|
2428 |
-
|
2429 |
-
|
2430 |
-
|
2431 |
-
|
2432 |
-
|
2433 |
-
|
2434 |
-
|
2435 |
-
|
2436 |
-
|
2437 |
-
|
2438 |
-
|
2439 |
-
|
2440 |
-
|
2441 |
-
|
2442 |
-
|
2443 |
-
|
2444 |
-
|
2445 |
-
|
2446 |
-
|
2447 |
-
|
2448 |
-
|
2449 |
-
|
2450 |
-
|
2451 |
-
|
2452 |
-
}
|
2453 |
-
|
2454 |
-
|
2455 |
-
|
2456 |
-
|
2457 |
-
|
2458 |
-
|
2459 |
-
|
2460 |
-
|
2461 |
-
|
2462 |
-
|
2463 |
-
|
2464 |
-
|
2465 |
-
|
2466 |
-
|
2467 |
-
|
2468 |
-
|
2469 |
-
|
2470 |
-
|
2471 |
-
|
2472 |
-
|
2473 |
-
|
2474 |
-
|
2475 |
-
|
2476 |
-
|
2477 |
-
|
2478 |
-
|
2479 |
-
|
2480 |
-
|
2481 |
-
|
2482 |
-
|
2483 |
-
}
|
2484 |
-
|
2485 |
-
|
2486 |
-
|
2487 |
-
|
2488 |
-
|
2489 |
-
|
2490 |
-
|
2491 |
-
|
2492 |
-
|
2493 |
-
|
2494 |
-
|
2495 |
-
|
2496 |
-
|
2497 |
-
|
2498 |
-
|
2499 |
-
|
2500 |
-
|
2501 |
-
|
2502 |
-
|
2503 |
-
|
2504 |
-
|
2505 |
-
|
2506 |
-
|
2507 |
-
|
2508 |
-
|
2509 |
-
|
2510 |
-
|
2511 |
-
|
2512 |
-
|
2513 |
-
|
2514 |
-
|
2515 |
-
|
2516 |
-
|
2517 |
-
|
2518 |
-
|
2519 |
-
$
|
2520 |
-
|
2521 |
-
|
2522 |
-
|
2523 |
-
|
2524 |
-
|
2525 |
-
|
2526 |
-
|
2527 |
-
|
2528 |
-
|
2529 |
-
);
|
2530 |
-
wp_localize_script('wplc-admin-js', '
|
2531 |
-
|
2532 |
-
|
2533 |
-
|
2534 |
-
|
2535 |
-
|
2536 |
-
|
2537 |
-
|
2538 |
-
|
2539 |
-
|
2540 |
-
|
2541 |
-
|
2542 |
-
|
2543 |
-
|
2544 |
-
|
2545 |
-
|
2546 |
-
|
2547 |
-
|
2548 |
-
|
2549 |
-
|
2550 |
-
|
2551 |
-
|
2552 |
-
|
2553 |
-
|
2554 |
-
|
2555 |
-
|
2556 |
-
|
2557 |
-
|
2558 |
-
$
|
2559 |
-
|
2560 |
-
|
2561 |
-
|
2562 |
-
|
2563 |
-
<p><?php _e("
|
2564 |
-
<p><?php _e("You
|
2565 |
-
<p>
|
2566 |
-
|
2567 |
-
|
2568 |
-
|
2569 |
-
|
2570 |
-
|
2571 |
-
|
2572 |
-
|
2573 |
-
|
2574 |
-
|
2575 |
-
|
2576 |
-
|
2577 |
-
|
2578 |
-
|
2579 |
-
|
2580 |
-
|
2581 |
-
|
2582 |
-
|
2583 |
-
|
2584 |
-
|
2585 |
-
|
2586 |
-
|
2587 |
-
|
2588 |
-
|
2589 |
-
|
2590 |
-
|
2591 |
-
|
2592 |
-
|
2593 |
-
|
2594 |
-
|
2595 |
-
|
2596 |
-
|
2597 |
-
|
2598 |
-
|
2599 |
-
|
2600 |
-
|
2601 |
-
|
2602 |
-
|
2603 |
-
|
2604 |
-
|
2605 |
-
|
2606 |
-
}
|
2607 |
-
|
2608 |
-
|
2609 |
-
|
2610 |
-
|
2611 |
-
|
2612 |
-
|
2613 |
-
|
2614 |
-
|
2615 |
-
|
2616 |
-
|
2617 |
-
|
2618 |
-
|
2619 |
-
|
2620 |
-
|
2621 |
-
|
2622 |
-
|
2623 |
-
|
2624 |
-
|
2625 |
-
|
2626 |
-
|
2627 |
-
|
2628 |
-
|
2629 |
-
|
2630 |
-
|
2631 |
-
|
2632 |
-
|
2633 |
-
|
2634 |
-
|
2635 |
-
|
2636 |
-
|
2637 |
-
|
2638 |
-
|
2639 |
-
|
2640 |
-
|
2641 |
-
|
2642 |
-
|
2643 |
-
|
2644 |
-
|
2645 |
-
|
2646 |
-
|
2647 |
-
|
2648 |
-
|
2649 |
-
|
2650 |
-
|
2651 |
-
|
2652 |
-
|
2653 |
-
|
2654 |
-
|
2655 |
-
|
2656 |
-
|
2657 |
-
|
2658 |
-
|
2659 |
-
|
2660 |
-
|
2661 |
-
|
2662 |
-
|
2663 |
-
|
2664 |
-
|
2665 |
-
|
2666 |
-
|
2667 |
-
|
2668 |
-
|
2669 |
-
|
2670 |
-
|
2671 |
-
|
2672 |
-
|
2673 |
-
|
2674 |
-
|
2675 |
-
|
2676 |
-
|
2677 |
-
|
2678 |
-
|
2679 |
-
|
2680 |
-
|
2681 |
-
|
2682 |
-
|
2683 |
-
|
2684 |
-
|
2685 |
-
|
2686 |
-
|
2687 |
-
|
2688 |
-
|
2689 |
-
|
2690 |
-
|
2691 |
-
|
2692 |
-
|
2693 |
-
|
2694 |
-
|
2695 |
-
|
2696 |
-
|
2697 |
-
|
2698 |
-
|
2699 |
-
|
2700 |
-
|
2701 |
-
|
2702 |
-
|
2703 |
-
|
2704 |
-
|
2705 |
-
|
2706 |
-
|
2707 |
-
|
2708 |
-
|
2709 |
-
|
2710 |
-
|
2711 |
-
|
2712 |
-
|
2713 |
-
|
2714 |
-
|
2715 |
-
|
2716 |
-
|
2717 |
-
|
2718 |
-
|
2719 |
-
|
2720 |
-
|
2721 |
-
|
2722 |
-
|
2723 |
-
|
2724 |
-
|
2725 |
-
|
2726 |
-
|
2727 |
-
|
2728 |
-
|
2729 |
-
|
2730 |
-
|
2731 |
-
|
2732 |
-
|
2733 |
-
|
2734 |
-
|
2735 |
-
|
2736 |
-
|
2737 |
-
|
2738 |
-
|
2739 |
-
|
2740 |
-
|
2741 |
-
|
2742 |
-
|
2743 |
-
|
2744 |
-
|
2745 |
-
|
2746 |
-
|
2747 |
-
|
2748 |
-
|
2749 |
-
|
2750 |
-
|
2751 |
-
|
2752 |
-
|
2753 |
-
|
2754 |
-
|
2755 |
-
|
2756 |
-
|
2757 |
-
|
2758 |
-
|
2759 |
-
|
2760 |
-
|
2761 |
-
|
2762 |
-
|
2763 |
-
|
2764 |
-
|
2765 |
-
|
2766 |
-
|
2767 |
-
|
2768 |
-
|
2769 |
-
|
2770 |
-
|
2771 |
-
|
2772 |
-
|
2773 |
-
|
2774 |
-
|
2775 |
-
|
2776 |
-
|
2777 |
-
|
2778 |
-
|
2779 |
-
|
2780 |
-
|
2781 |
-
|
2782 |
-
|
2783 |
-
|
2784 |
-
|
2785 |
-
|
2786 |
-
|
2787 |
-
|
2788 |
-
|
2789 |
-
|
2790 |
-
|
2791 |
-
|
2792 |
-
|
2793 |
-
|
2794 |
-
|
2795 |
-
|
2796 |
-
|
2797 |
-
|
2798 |
-
|
2799 |
-
|
2800 |
-
}
|
2801 |
-
|
2802 |
-
|
2803 |
-
|
2804 |
-
|
2805 |
-
|
2806 |
-
|
2807 |
-
|
2808 |
-
|
2809 |
-
|
2810 |
-
|
2811 |
-
|
2812 |
-
|
2813 |
-
|
2814 |
-
|
2815 |
-
|
2816 |
-
|
2817 |
-
|
2818 |
-
|
2819 |
-
|
2820 |
-
|
2821 |
-
|
2822 |
-
|
2823 |
-
|
2824 |
-
|
2825 |
-
|
2826 |
-
|
2827 |
-
|
2828 |
-
|
2829 |
-
|
2830 |
-
|
2831 |
-
|
2832 |
-
|
2833 |
-
|
2834 |
-
|
2835 |
-
|
2836 |
-
|
2837 |
-
|
2838 |
-
|
2839 |
-
|
2840 |
-
|
2841 |
-
|
2842 |
-
|
2843 |
-
|
2844 |
-
|
2845 |
-
|
2846 |
-
|
2847 |
-
|
2848 |
-
|
2849 |
-
|
2850 |
-
|
2851 |
-
|
2852 |
-
|
2853 |
-
|
2854 |
-
|
2855 |
-
|
2856 |
-
|
2857 |
-
|
2858 |
-
|
2859 |
-
|
2860 |
-
|
2861 |
-
|
2862 |
-
|
2863 |
-
|
2864 |
-
|
2865 |
-
|
2866 |
-
|
2867 |
-
|
2868 |
-
|
2869 |
-
|
2870 |
-
|
2871 |
-
|
2872 |
-
}
|
2873 |
-
|
2874 |
-
|
2875 |
-
|
2876 |
-
|
2877 |
-
|
2878 |
-
|
2879 |
-
|
2880 |
-
|
2881 |
-
|
2882 |
-
|
2883 |
-
|
2884 |
-
|
2885 |
-
|
2886 |
-
|
2887 |
-
|
2888 |
-
|
2889 |
-
|
2890 |
-
|
2891 |
-
|
2892 |
-
|
2893 |
-
|
2894 |
-
|
2895 |
-
|
2896 |
-
|
2897 |
-
|
2898 |
-
|
2899 |
-
|
2900 |
-
|
2901 |
-
|
2902 |
-
|
2903 |
-
|
2904 |
-
|
2905 |
-
|
2906 |
-
|
2907 |
-
|
2908 |
-
|
2909 |
-
|
2910 |
-
|
2911 |
-
|
2912 |
-
|
2913 |
-
|
2914 |
-
|
2915 |
-
|
2916 |
-
|
2917 |
-
|
2918 |
-
|
2919 |
-
|
2920 |
-
|
2921 |
-
|
2922 |
-
|
2923 |
-
|
2924 |
-
|
2925 |
-
|
2926 |
-
|
2927 |
-
|
2928 |
-
|
2929 |
-
|
2930 |
-
|
2931 |
-
|
2932 |
-
|
2933 |
-
|
2934 |
-
|
2935 |
-
|
2936 |
-
}
|
2937 |
-
|
2938 |
-
|
2939 |
-
|
2940 |
-
|
2941 |
-
|
2942 |
-
|
2943 |
-
|
2944 |
-
|
2945 |
-
|
2946 |
-
|
2947 |
-
|
2948 |
-
|
2949 |
-
|
2950 |
-
|
2951 |
-
|
2952 |
-
|
2953 |
-
|
2954 |
-
|
2955 |
-
|
2956 |
-
|
2957 |
-
|
2958 |
-
|
2959 |
-
|
2960 |
-
|
2961 |
-
|
2962 |
-
|
2963 |
-
|
2964 |
-
|
2965 |
-
|
2966 |
-
|
2967 |
-
|
2968 |
-
|
2969 |
-
|
2970 |
-
|
2971 |
-
|
2972 |
-
|
2973 |
-
|
2974 |
-
|
2975 |
-
|
2976 |
-
|
2977 |
-
|
2978 |
-
|
2979 |
-
|
2980 |
-
|
2981 |
-
|
2982 |
-
|
2983 |
-
|
2984 |
-
|
2985 |
-
|
2986 |
-
|
2987 |
-
|
2988 |
-
|
2989 |
-
|
2990 |
-
|
2991 |
-
|
2992 |
-
|
2993 |
-
|
2994 |
-
|
2995 |
-
|
2996 |
-
|
2997 |
-
|
2998 |
-
|
2999 |
-
|
3000 |
-
|
3001 |
-
|
3002 |
-
|
3003 |
-
|
3004 |
-
|
3005 |
-
|
3006 |
-
|
3007 |
-
|
3008 |
-
|
3009 |
-
|
3010 |
-
|
3011 |
-
|
3012 |
-
|
3013 |
-
|
3014 |
-
|
3015 |
-
|
3016 |
-
|
3017 |
-
|
3018 |
-
|
3019 |
-
|
3020 |
-
|
3021 |
-
|
3022 |
-
|
3023 |
-
|
3024 |
-
|
3025 |
-
echo "<
|
3026 |
-
|
3027 |
-
|
3028 |
-
|
3029 |
-
do_action("
|
3030 |
-
|
3031 |
-
|
3032 |
-
|
3033 |
-
|
3034 |
-
|
3035 |
-
|
3036 |
-
|
3037 |
-
|
3038 |
-
|
3039 |
-
|
3040 |
-
|
3041 |
-
|
3042 |
-
|
3043 |
-
|
3044 |
-
|
3045 |
-
|
3046 |
-
|
3047 |
-
echo "
|
3048 |
-
|
3049 |
-
|
3050 |
-
echo "
|
3051 |
-
echo "
|
3052 |
-
|
3053 |
-
|
3054 |
-
|
3055 |
-
|
3056 |
-
echo " <div
|
3057 |
-
|
3058 |
-
echo " <
|
3059 |
-
echo "
|
3060 |
-
echo "
|
3061 |
-
echo "
|
3062 |
-
|
3063 |
-
|
3064 |
-
echo
|
3065 |
-
|
3066 |
-
echo "
|
3067 |
-
|
3068 |
-
echo "
|
3069 |
-
|
3070 |
-
|
3071 |
-
echo "<
|
3072 |
-
echo "
|
3073 |
-
|
3074 |
-
echo "</
|
3075 |
-
|
3076 |
-
|
3077 |
-
|
3078 |
-
|
3079 |
-
|
3080 |
-
|
3081 |
-
|
3082 |
-
|
3083 |
-
|
3084 |
-
|
3085 |
-
|
3086 |
-
|
3087 |
-
|
3088 |
-
|
3089 |
-
|
3090 |
-
|
3091 |
-
|
3092 |
-
|
3093 |
-
|
3094 |
-
|
3095 |
-
|
3096 |
-
|
3097 |
-
|
3098 |
-
|
3099 |
-
|
3100 |
-
|
3101 |
-
|
3102 |
-
|
3103 |
-
|
3104 |
-
|
3105 |
-
|
3106 |
-
|
3107 |
-
|
3108 |
-
|
3109 |
-
|
3110 |
-
$
|
3111 |
-
|
3112 |
-
|
3113 |
-
|
3114 |
-
|
3115 |
-
|
3116 |
-
|
3117 |
-
|
3118 |
-
|
3119 |
-
|
3120 |
-
|
3121 |
-
|
3122 |
-
|
3123 |
-
|
3124 |
-
|
3125 |
-
|
3126 |
-
|
3127 |
-
|
3128 |
-
|
3129 |
-
|
3130 |
-
|
3131 |
-
|
3132 |
-
|
3133 |
-
|
3134 |
-
|
3135 |
-
|
3136 |
-
|
3137 |
-
|
3138 |
-
|
3139 |
-
|
3140 |
-
|
3141 |
-
|
3142 |
-
|
3143 |
-
|
3144 |
-
|
3145 |
-
|
3146 |
-
|
3147 |
-
|
3148 |
-
|
3149 |
-
|
3150 |
-
|
3151 |
-
|
3152 |
-
|
3153 |
-
|
3154 |
-
|
3155 |
-
|
3156 |
-
|
3157 |
-
|
3158 |
-
|
3159 |
-
|
3160 |
-
|
3161 |
-
|
3162 |
-
|
3163 |
-
|
3164 |
-
|
3165 |
-
|
3166 |
-
|
3167 |
-
|
3168 |
-
|
3169 |
-
|
3170 |
-
|
3171 |
-
|
3172 |
-
|
3173 |
-
|
3174 |
-
|
3175 |
-
|
3176 |
-
|
3177 |
-
|
3178 |
-
|
3179 |
-
|
3180 |
-
|
3181 |
-
|
3182 |
-
|
3183 |
-
|
3184 |
-
|
3185 |
-
|
3186 |
-
|
3187 |
-
|
3188 |
-
|
3189 |
-
|
3190 |
-
|
3191 |
-
|
3192 |
-
|
3193 |
-
|
3194 |
-
|
3195 |
-
|
3196 |
-
|
3197 |
-
|
3198 |
-
|
3199 |
-
|
3200 |
-
|
3201 |
-
|
3202 |
-
|
3203 |
-
|
3204 |
-
|
3205 |
-
|
3206 |
-
|
3207 |
-
|
3208 |
-
|
3209 |
-
|
3210 |
-
|
3211 |
-
|
3212 |
-
|
3213 |
-
|
3214 |
-
|
3215 |
-
|
3216 |
-
|
3217 |
-
|
3218 |
-
|
3219 |
-
|
3220 |
-
|
3221 |
-
|
3222 |
-
|
3223 |
-
|
3224 |
-
|
3225 |
-
|
3226 |
-
|
3227 |
-
|
3228 |
-
|
3229 |
-
|
3230 |
-
|
3231 |
-
|
3232 |
-
|
3233 |
-
|
3234 |
-
|
3235 |
-
|
3236 |
-
|
3237 |
-
|
3238 |
-
|
3239 |
-
|
3240 |
-
|
3241 |
-
|
3242 |
-
|
3243 |
-
|
3244 |
-
|
3245 |
-
|
3246 |
-
|
3247 |
-
|
3248 |
-
|
3249 |
-
|
3250 |
-
|
3251 |
-
|
3252 |
-
|
3253 |
-
|
3254 |
-
|
3255 |
-
|
3256 |
-
} else {
|
3257 |
-
|
3258 |
-
|
3259 |
-
|
3260 |
-
|
3261 |
-
|
3262 |
-
|
3263 |
-
|
3264 |
-
|
3265 |
-
|
3266 |
-
|
3267 |
-
|
3268 |
-
|
3269 |
-
|
3270 |
-
|
3271 |
-
|
3272 |
-
|
3273 |
-
|
3274 |
-
|
3275 |
-
|
3276 |
-
|
3277 |
-
|
3278 |
-
|
3279 |
-
|
3280 |
-
|
3281 |
-
|
3282 |
-
|
3283 |
-
|
3284 |
-
|
3285 |
-
|
3286 |
-
|
3287 |
-
|
3288 |
-
|
3289 |
-
|
3290 |
-
|
3291 |
-
|
3292 |
-
|
3293 |
-
|
3294 |
-
|
3295 |
-
|
3296 |
-
|
3297 |
-
|
3298 |
-
|
3299 |
-
|
3300 |
-
|
3301 |
-
|
3302 |
-
|
3303 |
-
|
3304 |
-
|
3305 |
-
|
3306 |
-
|
3307 |
-
|
3308 |
-
|
3309 |
-
|
3310 |
-
|
3311 |
-
|
3312 |
-
|
3313 |
-
|
3314 |
-
|
3315 |
-
$
|
3316 |
-
|
3317 |
-
|
3318 |
-
|
3319 |
-
|
3320 |
-
|
3321 |
-
|
3322 |
-
|
3323 |
-
|
3324 |
-
|
3325 |
-
|
3326 |
-
|
3327 |
-
|
3328 |
-
|
3329 |
-
$
|
3330 |
-
|
3331 |
-
|
3332 |
-
|
3333 |
-
wp_localize_script('wplc-admin-chat-js', '
|
3334 |
-
wp_localize_script('wplc-admin-chat-js', '
|
3335 |
-
|
3336 |
-
|
3337 |
-
|
3338 |
-
|
3339 |
-
|
3340 |
-
|
3341 |
-
|
3342 |
-
|
3343 |
-
|
3344 |
-
|
3345 |
-
|
3346 |
-
|
3347 |
-
|
3348 |
-
|
3349 |
-
|
3350 |
-
|
3351 |
-
|
3352 |
-
|
3353 |
-
|
3354 |
-
|
3355 |
-
|
3356 |
-
|
3357 |
-
|
3358 |
-
|
3359 |
-
|
3360 |
-
|
3361 |
-
|
3362 |
-
|
3363 |
-
|
3364 |
-
|
3365 |
-
"
|
3366 |
-
"
|
3367 |
-
"
|
3368 |
-
"
|
3369 |
-
"
|
3370 |
-
"
|
3371 |
-
"
|
3372 |
-
"
|
3373 |
-
"
|
3374 |
-
"
|
3375 |
-
"
|
3376 |
-
"
|
3377 |
-
"
|
3378 |
-
"
|
3379 |
-
"
|
3380 |
-
"
|
3381 |
-
"
|
3382 |
-
"
|
3383 |
-
"
|
3384 |
-
"
|
3385 |
-
"
|
3386 |
-
"
|
3387 |
-
"
|
3388 |
-
"
|
3389 |
-
|
3390 |
-
|
3391 |
-
|
3392 |
-
|
3393 |
-
|
3394 |
-
|
3395 |
-
|
3396 |
-
|
3397 |
-
|
3398 |
-
|
3399 |
-
|
3400 |
-
|
3401 |
-
|
3402 |
-
|
3403 |
-
|
3404 |
-
|
3405 |
-
|
3406 |
-
|
3407 |
-
|
3408 |
-
|
3409 |
-
|
3410 |
-
|
3411 |
-
|
3412 |
-
|
3413 |
-
|
3414 |
-
|
3415 |
-
|
3416 |
-
|
3417 |
-
|
3418 |
-
|
3419 |
-
|
3420 |
-
|
3421 |
-
|
3422 |
-
|
3423 |
-
|
3424 |
-
|
3425 |
-
|
3426 |
-
|
3427 |
-
|
3428 |
-
|
3429 |
-
|
3430 |
-
|
3431 |
-
|
3432 |
-
|
3433 |
-
|
3434 |
-
|
3435 |
-
|
3436 |
-
|
3437 |
-
|
3438 |
-
|
3439 |
-
|
3440 |
-
|
3441 |
-
|
3442 |
-
|
3443 |
-
|
3444 |
-
|
3445 |
-
|
3446 |
-
|
3447 |
-
|
3448 |
-
|
3449 |
-
|
3450 |
-
|
3451 |
-
|
3452 |
-
|
3453 |
-
|
3454 |
-
|
3455 |
-
|
3456 |
-
|
3457 |
-
|
3458 |
-
|
3459 |
-
|
3460 |
-
|
3461 |
-
|
3462 |
-
|
3463 |
-
|
3464 |
-
|
3465 |
-
|
3466 |
-
|
3467 |
-
|
3468 |
-
|
3469 |
-
|
3470 |
-
|
3471 |
-
|
3472 |
-
|
3473 |
-
|
3474 |
-
|
3475 |
-
|
3476 |
-
|
3477 |
-
|
3478 |
-
|
3479 |
-
|
3480 |
-
|
3481 |
-
|
3482 |
-
|
3483 |
-
$
|
3484 |
-
|
3485 |
-
|
3486 |
-
|
3487 |
-
|
3488 |
-
|
3489 |
-
|
3490 |
-
|
3491 |
-
|
3492 |
-
|
3493 |
-
|
3494 |
-
";
|
3495 |
-
|
3496 |
-
|
3497 |
-
|
3498 |
-
|
3499 |
-
|
3500 |
-
|
3501 |
-
|
3502 |
-
|
3503 |
-
|
3504 |
-
|
3505 |
-
|
3506 |
-
|
3507 |
-
|
3508 |
-
|
3509 |
-
|
3510 |
-
|
3511 |
-
|
3512 |
-
|
3513 |
-
|
3514 |
-
|
3515 |
-
|
3516 |
-
|
3517 |
-
|
3518 |
-
|
3519 |
-
|
3520 |
-
|
3521 |
-
|
3522 |
-
|
3523 |
-
|
3524 |
-
|
3525 |
-
|
3526 |
-
|
3527 |
-
|
3528 |
-
|
3529 |
-
|
3530 |
-
|
3531 |
-
|
3532 |
-
|
3533 |
-
|
3534 |
-
|
3535 |
-
|
3536 |
-
|
3537 |
-
|
3538 |
-
|
3539 |
-
|
3540 |
-
|
3541 |
-
|
3542 |
-
|
3543 |
-
|
3544 |
-
|
3545 |
-
|
3546 |
-
|
3547 |
-
|
3548 |
-
|
3549 |
-
|
3550 |
-
|
3551 |
-
$icon =
|
3552 |
-
|
3553 |
-
|
3554 |
-
|
3555 |
-
|
3556 |
-
|
3557 |
-
|
3558 |
-
|
3559 |
-
|
3560 |
-
|
3561 |
-
|
3562 |
-
|
3563 |
-
|
3564 |
-
|
3565 |
-
|
3566 |
-
|
3567 |
-
|
3568 |
-
|
3569 |
-
|
3570 |
-
|
3571 |
-
|
3572 |
-
|
3573 |
-
|
3574 |
-
$
|
3575 |
-
|
3576 |
-
|
3577 |
-
|
3578 |
-
|
3579 |
-
|
3580 |
-
|
3581 |
-
|
3582 |
-
|
3583 |
-
|
3584 |
-
|
3585 |
-
|
3586 |
-
|
3587 |
-
|
3588 |
-
|
3589 |
-
|
3590 |
-
|
3591 |
-
|
3592 |
-
|
3593 |
-
|
3594 |
-
|
3595 |
-
|
3596 |
-
|
3597 |
-
|
3598 |
-
|
3599 |
-
|
3600 |
-
|
3601 |
-
|
3602 |
-
|
3603 |
-
|
3604 |
-
|
3605 |
-
|
3606 |
-
|
3607 |
-
|
3608 |
-
|
3609 |
-
|
3610 |
-
|
3611 |
-
|
3612 |
-
|
3613 |
-
|
3614 |
-
|
3615 |
-
|
3616 |
-
|
3617 |
-
|
3618 |
-
|
3619 |
-
|
3620 |
-
|
3621 |
-
|
3622 |
-
|
3623 |
-
|
3624 |
-
|
3625 |
-
|
3626 |
-
|
3627 |
-
|
3628 |
-
|
3629 |
-
|
3630 |
-
|
3631 |
-
|
3632 |
-
|
3633 |
-
|
3634 |
-
if ($wplc_settings[
|
3635 |
-
|
3636 |
-
|
3637 |
-
|
3638 |
-
|
3639 |
-
|
3640 |
-
|
3641 |
-
|
3642 |
-
|
3643 |
-
|
3644 |
-
|
3645 |
-
|
3646 |
-
}
|
3647 |
-
|
3648 |
-
|
3649 |
-
|
3650 |
-
|
3651 |
-
|
3652 |
-
|
3653 |
-
|
3654 |
-
|
3655 |
-
|
3656 |
-
|
3657 |
-
|
3658 |
-
|
3659 |
-
|
3660 |
-
|
3661 |
-
|
3662 |
-
|
3663 |
-
|
3664 |
-
|
3665 |
-
|
3666 |
-
|
3667 |
-
|
3668 |
-
|
3669 |
-
|
3670 |
-
|
3671 |
-
|
3672 |
-
|
3673 |
-
|
3674 |
-
|
3675 |
-
|
3676 |
-
|
3677 |
-
|
3678 |
-
|
3679 |
-
|
3680 |
-
|
3681 |
-
|
3682 |
-
|
3683 |
-
|
3684 |
-
|
3685 |
-
|
3686 |
-
|
3687 |
-
|
3688 |
-
|
3689 |
-
|
3690 |
-
|
3691 |
-
|
3692 |
-
|
3693 |
-
|
3694 |
-
|
3695 |
-
|
3696 |
-
|
3697 |
-
|
3698 |
-
|
3699 |
-
|
3700 |
-
|
3701 |
-
|
3702 |
-
|
3703 |
-
|
3704 |
-
|
3705 |
-
|
3706 |
-
|
3707 |
-
|
3708 |
-
|
3709 |
-
|
3710 |
-
|
3711 |
-
|
3712 |
-
|
3713 |
-
|
3714 |
-
|
3715 |
-
|
3716 |
-
|
3717 |
-
|
3718 |
-
|
3719 |
-
|
3720 |
-
|
3721 |
-
|
3722 |
-
|
3723 |
-
|
3724 |
-
|
3725 |
-
|
3726 |
-
|
3727 |
-
|
3728 |
-
|
3729 |
-
|
3730 |
-
|
3731 |
-
|
3732 |
-
|
3733 |
-
|
3734 |
-
|
3735 |
-
|
3736 |
-
|
3737 |
-
|
3738 |
-
|
3739 |
-
|
3740 |
-
|
3741 |
-
|
3742 |
-
|
3743 |
-
|
3744 |
-
|
3745 |
-
|
3746 |
-
|
3747 |
-
|
3748 |
-
|
3749 |
-
|
3750 |
-
|
3751 |
-
|
3752 |
-
|
3753 |
-
|
3754 |
-
|
3755 |
-
|
3756 |
-
|
3757 |
-
|
3758 |
-
|
3759 |
-
|
3760 |
-
|
3761 |
-
|
3762 |
-
|
3763 |
-
|
3764 |
-
|
3765 |
-
|
3766 |
-
|
3767 |
-
|
3768 |
-
|
3769 |
-
|
3770 |
-
|
3771 |
-
|
3772 |
-
|
3773 |
-
|
3774 |
-
|
3775 |
-
|
3776 |
-
|
3777 |
-
|
3778 |
-
|
3779 |
-
|
3780 |
-
|
3781 |
-
|
3782 |
-
|
3783 |
-
|
3784 |
-
|
3785 |
-
|
3786 |
-
|
3787 |
-
|
3788 |
-
|
3789 |
-
|
3790 |
-
|
3791 |
-
|
3792 |
-
|
3793 |
-
|
3794 |
-
|
3795 |
-
|
3796 |
-
|
3797 |
-
|
3798 |
-
|
3799 |
-
|
3800 |
-
|
3801 |
-
|
3802 |
-
|
3803 |
-
|
3804 |
-
|
3805 |
-
|
3806 |
-
|
3807 |
-
|
3808 |
-
|
3809 |
-
|
3810 |
-
|
3811 |
-
|
3812 |
-
|
3813 |
-
|
3814 |
-
|
3815 |
-
|
3816 |
-
|
3817 |
-
|
3818 |
-
|
3819 |
-
|
3820 |
-
|
3821 |
-
|
3822 |
-
|
3823 |
-
|
3824 |
-
|
3825 |
-
|
3826 |
-
|
3827 |
-
|
3828 |
-
|
3829 |
-
|
3830 |
-
|
3831 |
-
|
3832 |
-
|
3833 |
-
|
3834 |
-
|
3835 |
-
|
3836 |
-
|
3837 |
-
|
3838 |
-
|
3839 |
-
|
3840 |
-
|
3841 |
-
|
3842 |
-
|
3843 |
-
|
3844 |
-
|
3845 |
-
|
3846 |
-
|
3847 |
-
|
3848 |
-
|
3849 |
-
|
3850 |
-
|
3851 |
-
|
3852 |
-
|
3853 |
-
|
3854 |
-
|
3855 |
-
|
3856 |
-
|
3857 |
-
|
3858 |
-
|
3859 |
-
|
3860 |
-
|
3861 |
-
|
3862 |
-
|
3863 |
-
|
3864 |
-
|
3865 |
-
|
3866 |
-
|
3867 |
-
|
3868 |
-
*
|
3869 |
-
* @
|
3870 |
-
|
3871 |
-
|
3872 |
-
|
3873 |
-
|
3874 |
-
|
3875 |
-
|
3876 |
-
|
3877 |
-
|
3878 |
-
|
3879 |
-
*
|
3880 |
-
* @param int
|
3881 |
-
* @
|
3882 |
-
* @
|
3883 |
-
* @
|
3884 |
-
|
3885 |
-
|
3886 |
-
|
3887 |
-
|
3888 |
-
|
3889 |
-
|
3890 |
-
|
3891 |
-
|
3892 |
-
|
3893 |
-
|
3894 |
-
|
3895 |
-
|
3896 |
-
|
3897 |
-
|
3898 |
-
|
3899 |
-
|
3900 |
-
|
3901 |
-
|
3902 |
-
|
3903 |
-
|
3904 |
-
|
3905 |
-
|
3906 |
-
|
3907 |
-
|
3908 |
-
|
3909 |
-
|
3910 |
-
|
3911 |
-
|
3912 |
-
|
3913 |
-
|
3914 |
-
|
3915 |
-
|
3916 |
-
|
3917 |
-
|
3918 |
-
|
3919 |
-
|
3920 |
-
|
3921 |
-
|
3922 |
-
|
3923 |
-
|
3924 |
-
|
3925 |
-
|
3926 |
-
|
3927 |
-
|
3928 |
-
|
3929 |
-
|
3930 |
-
|
3931 |
-
|
3932 |
-
|
3933 |
-
|
3934 |
-
|
3935 |
-
|
3936 |
-
|
3937 |
-
|
3938 |
-
|
3939 |
-
|
3940 |
-
|
3941 |
-
|
3942 |
-
|
3943 |
-
|
3944 |
-
|
3945 |
-
|
3946 |
-
|
3947 |
-
|
3948 |
-
|
3949 |
-
|
3950 |
-
|
3951 |
-
|
3952 |
-
|
3953 |
-
|
3954 |
-
|
3955 |
-
|
3956 |
-
|
3957 |
-
|
3958 |
-
|
3959 |
-
|
3960 |
-
|
3961 |
-
|
3962 |
-
|
3963 |
-
|
3964 |
-
|
3965 |
-
|
3966 |
-
|
3967 |
-
|
3968 |
-
|
3969 |
-
|
3970 |
-
|
3971 |
-
|
3972 |
-
|
3973 |
-
|
3974 |
-
|
3975 |
-
|
3976 |
-
|
3977 |
-
|
3978 |
-
|
3979 |
-
|
3980 |
-
|
3981 |
-
|
3982 |
-
|
3983 |
-
|
3984 |
-
|
3985 |
-
<
|
3986 |
-
|
3987 |
-
|
3988 |
-
|
3989 |
-
|
3990 |
-
|
3991 |
-
|
3992 |
-
|
3993 |
-
|
3994 |
-
|
3995 |
-
|
3996 |
-
|
3997 |
-
|
3998 |
-
|
3999 |
-
|
4000 |
-
|
4001 |
-
|
4002 |
-
|
4003 |
-
|
4004 |
-
|
4005 |
-
|
4006 |
-
|
4007 |
-
|
4008 |
-
|
4009 |
-
|
4010 |
-
|
4011 |
-
|
4012 |
-
|
4013 |
-
|
4014 |
-
|
4015 |
-
|
4016 |
-
|
4017 |
-
|
4018 |
-
|
4019 |
-
|
4020 |
-
|
4021 |
-
|
4022 |
-
|
4023 |
-
|
4024 |
-
|
4025 |
-
|
4026 |
-
|
4027 |
-
|
4028 |
-
|
4029 |
-
|
4030 |
-
|
4031 |
-
|
4032 |
-
|
4033 |
-
|
4034 |
-
|
4035 |
-
|
4036 |
-
|
4037 |
-
|
4038 |
-
|
4039 |
-
|
4040 |
-
|
4041 |
-
|
4042 |
-
|
4043 |
-
|
4044 |
-
|
4045 |
-
|
4046 |
-
|
4047 |
-
|
4048 |
-
|
4049 |
-
|
4050 |
-
|
4051 |
-
|
4052 |
-
|
4053 |
-
|
4054 |
-
|
4055 |
-
|
4056 |
-
|
4057 |
-
|
4058 |
-
|
4059 |
-
|
4060 |
-
|
4061 |
-
|
4062 |
-
|
4063 |
-
|
4064 |
-
|
4065 |
-
|
4066 |
-
|
4067 |
-
|
4068 |
-
|
4069 |
-
|
4070 |
-
|
4071 |
-
|
4072 |
-
|
4073 |
-
|
4074 |
-
|
4075 |
-
|
4076 |
-
|
4077 |
-
|
4078 |
-
|
4079 |
-
|
4080 |
-
|
4081 |
-
|
4082 |
-
|
4083 |
-
|
4084 |
-
|
4085 |
-
|
4086 |
-
|
4087 |
-
|
4088 |
-
|
4089 |
-
|
4090 |
-
|
4091 |
-
|
4092 |
-
|
4093 |
-
|
4094 |
-
|
4095 |
-
|
4096 |
-
|
4097 |
-
|
4098 |
-
|
4099 |
-
|
4100 |
-
|
4101 |
-
|
4102 |
-
|
4103 |
-
|
4104 |
-
|
4105 |
-
|
4106 |
-
|
4107 |
-
|
4108 |
-
|
4109 |
-
|
4110 |
-
|
4111 |
-
|
4112 |
-
|
4113 |
-
|
4114 |
-
|
4115 |
-
|
4116 |
-
|
4117 |
-
|
4118 |
-
|
4119 |
-
|
4120 |
-
|
4121 |
-
|
4122 |
-
|
4123 |
-
|
4124 |
-
|
4125 |
-
|
4126 |
-
|
4127 |
-
|
4128 |
-
|
4129 |
-
|
4130 |
-
|
4131 |
-
|
4132 |
-
|
4133 |
-
|
4134 |
-
|
4135 |
-
|
4136 |
-
|
4137 |
-
|
4138 |
-
|
4139 |
-
|
4140 |
-
|
4141 |
-
|
4142 |
-
|
4143 |
-
|
4144 |
-
|
4145 |
-
|
4146 |
-
|
4147 |
-
|
4148 |
-
|
4149 |
-
|
4150 |
-
|
4151 |
-
|
4152 |
-
|
4153 |
-
|
4154 |
-
|
4155 |
-
|
4156 |
-
|
4157 |
-
|
4158 |
-
|
4159 |
-
|
4160 |
-
|
4161 |
-
|
4162 |
-
|
4163 |
-
|
4164 |
-
|
4165 |
-
|
4166 |
-
|
4167 |
-
|
4168 |
-
|
4169 |
-
|
4170 |
-
|
4171 |
-
|
4172 |
-
|
4173 |
-
|
4174 |
-
|
4175 |
-
|
4176 |
-
|
4177 |
-
|
4178 |
-
|
4179 |
-
|
4180 |
-
|
4181 |
-
|
4182 |
-
*
|
4183 |
-
|
4184 |
-
|
4185 |
-
|
4186 |
-
if (
|
4187 |
-
|
4188 |
-
|
4189 |
-
|
4190 |
-
|
4191 |
-
|
4192 |
-
|
4193 |
-
|
4194 |
-
|
4195 |
-
|
4196 |
-
|
4197 |
-
|
4198 |
-
|
4199 |
-
|
4200 |
-
|
4201 |
-
$wplc_stats[$sec]["
|
4202 |
-
|
4203 |
-
|
4204 |
-
|
4205 |
-
|
4206 |
-
|
4207 |
-
|
4208 |
-
|
4209 |
-
|
4210 |
-
|
4211 |
-
|
4212 |
-
|
4213 |
-
|
4214 |
-
|
4215 |
-
|
4216 |
-
|
4217 |
-
|
4218 |
-
}
|
4219 |
-
|
4220 |
-
|
4221 |
-
|
4222 |
-
|
4223 |
-
|
4224 |
-
|
4225 |
-
|
4226 |
-
|
4227 |
-
|
4228 |
-
|
4229 |
-
|
4230 |
-
|
4231 |
-
|
4232 |
-
|
4233 |
-
|
4234 |
-
|
4235 |
-
|
4236 |
-
*
|
4237 |
-
* @return
|
4238 |
-
*/
|
4239 |
-
function
|
4240 |
-
$
|
4241 |
-
|
4242 |
-
|
4243 |
-
|
4244 |
-
|
4245 |
-
|
4246 |
-
|
4247 |
-
|
4248 |
-
|
4249 |
-
|
4250 |
-
|
4251 |
-
|
4252 |
-
|
4253 |
-
|
4254 |
-
|
4255 |
-
|
4256 |
-
|
4257 |
-
|
4258 |
-
|
4259 |
-
|
4260 |
-
|
4261 |
-
|
4262 |
-
|
4263 |
-
|
4264 |
-
|
4265 |
-
|
4266 |
-
|
4267 |
-
|
4268 |
-
|
4269 |
-
|
4270 |
-
|
4271 |
-
|
4272 |
-
|
4273 |
-
if (isset($_POST['
|
4274 |
-
|
4275 |
-
|
4276 |
-
if (isset($_POST['
|
4277 |
-
if (isset($_POST['
|
4278 |
-
|
4279 |
-
if (isset($_POST['
|
4280 |
-
|
4281 |
-
if (isset($_POST['
|
4282 |
-
if (isset($_POST['
|
4283 |
-
|
4284 |
-
if (isset($_POST['
|
4285 |
-
if (isset($_POST['
|
4286 |
-
if (isset($_POST['
|
4287 |
-
if (isset($_POST['
|
4288 |
-
|
4289 |
-
|
4290 |
-
|
4291 |
-
|
4292 |
-
|
4293 |
-
|
4294 |
-
|
4295 |
-
|
4296 |
-
if(isset($_POST['
|
4297 |
-
|
4298 |
-
if(isset($_POST['
|
4299 |
-
|
4300 |
-
|
4301 |
-
|
4302 |
-
|
4303 |
-
|
4304 |
-
|
4305 |
-
|
4306 |
-
if
|
4307 |
-
|
4308 |
-
|
4309 |
-
|
4310 |
-
if
|
4311 |
-
|
4312 |
-
if
|
4313 |
-
|
4314 |
-
|
4315 |
-
if
|
4316 |
-
|
4317 |
-
|
4318 |
-
if (isset($_POST['
|
4319 |
-
if (isset($_POST['
|
4320 |
-
if (isset($_POST['
|
4321 |
-
|
4322 |
-
if (isset($_POST['
|
4323 |
-
|
4324 |
-
if (isset($_POST['
|
4325 |
-
if (isset($_POST['
|
4326 |
-
if (isset($_POST['
|
4327 |
-
|
4328 |
-
|
4329 |
-
|
4330 |
-
|
4331 |
-
|
4332 |
-
|
4333 |
-
|
4334 |
-
if(isset($_POST['
|
4335 |
-
if(isset($_POST['
|
4336 |
-
if(isset($_POST['
|
4337 |
-
|
4338 |
-
if(isset($_POST['
|
4339 |
-
if(isset($_POST['
|
4340 |
-
if(isset($_POST['
|
4341 |
-
|
4342 |
-
if(isset($_POST['
|
4343 |
-
|
4344 |
-
|
4345 |
-
|
4346 |
-
|
4347 |
-
|
4348 |
-
|
4349 |
-
|
4350 |
-
|
4351 |
-
|
4352 |
-
|
4353 |
-
|
4354 |
-
|
4355 |
-
|
4356 |
-
|
4357 |
-
$
|
4358 |
-
|
4359 |
-
|
4360 |
-
|
4361 |
-
|
4362 |
-
|
4363 |
-
|
4364 |
-
|
4365 |
-
|
4366 |
-
|
4367 |
-
|
4368 |
-
|
4369 |
-
|
4370 |
-
|
4371 |
-
$
|
4372 |
-
|
4373 |
-
|
4374 |
-
|
4375 |
-
|
4376 |
-
|
4377 |
-
|
4378 |
-
|
4379 |
-
|
4380 |
-
if(
|
4381 |
-
|
4382 |
-
|
4383 |
-
|
4384 |
-
|
4385 |
-
|
4386 |
-
|
4387 |
-
update_option(
|
4388 |
-
}
|
4389 |
-
|
4390 |
-
}
|
4391 |
-
|
4392 |
-
|
4393 |
-
$
|
4394 |
-
if
|
4395 |
-
|
4396 |
-
|
4397 |
-
|
4398 |
-
|
4399 |
-
update_option('
|
4400 |
-
|
4401 |
-
|
4402 |
-
|
4403 |
-
|
4404 |
-
|
4405 |
-
|
4406 |
-
|
4407 |
-
|
4408 |
-
|
4409 |
-
|
4410 |
-
|
4411 |
-
|
4412 |
-
|
4413 |
-
|
4414 |
-
|
4415 |
-
|
4416 |
-
|
4417 |
-
|
4418 |
-
|
4419 |
-
|
4420 |
-
|
4421 |
-
|
4422 |
-
|
4423 |
-
|
4424 |
-
|
4425 |
-
|
4426 |
-
|
4427 |
-
|
4428 |
-
|
4429 |
-
|
4430 |
-
|
4431 |
-
|
4432 |
-
|
4433 |
-
|
4434 |
-
|
4435 |
-
|
4436 |
-
|
4437 |
-
|
4438 |
-
|
4439 |
-
|
4440 |
-
|
4441 |
-
|
4442 |
-
|
4443 |
-
|
4444 |
-
|
4445 |
-
|
4446 |
-
|
4447 |
-
|
4448 |
-
|
4449 |
-
|
4450 |
-
|
4451 |
-
|
4452 |
-
|
4453 |
-
|
4454 |
-
|
4455 |
-
|
4456 |
-
|
4457 |
-
|
4458 |
-
|
4459 |
-
|
4460 |
-
|
4461 |
-
|
4462 |
-
|
4463 |
-
|
4464 |
-
if(
|
4465 |
-
|
4466 |
-
|
4467 |
-
|
4468 |
-
|
4469 |
-
|
4470 |
-
|
4471 |
-
|
4472 |
-
|
4473 |
-
|
4474 |
-
|
4475 |
-
|
4476 |
-
|
4477 |
-
|
4478 |
-
|
4479 |
-
|
4480 |
-
|
4481 |
-
|
4482 |
-
|
4483 |
-
|
4484 |
-
|
4485 |
-
$
|
4486 |
-
|
4487 |
-
|
4488 |
-
|
4489 |
-
|
4490 |
-
|
4491 |
-
|
4492 |
-
|
4493 |
-
|
4494 |
-
|
4495 |
-
|
4496 |
-
|
4497 |
-
|
4498 |
-
|
4499 |
-
|
4500 |
-
|
4501 |
-
|
4502 |
-
|
4503 |
-
|
4504 |
-
|
4505 |
-
|
4506 |
-
|
4507 |
-
|
4508 |
-
|
4509 |
-
|
4510 |
-
|
4511 |
-
|
4512 |
-
|
4513 |
-
|
4514 |
-
|
4515 |
-
|
4516 |
-
|
4517 |
-
|
4518 |
-
|
4519 |
-
|
4520 |
-
|
4521 |
-
|
4522 |
-
|
4523 |
-
|
4524 |
-
|
4525 |
-
|
4526 |
-
|
4527 |
-
|
4528 |
-
|
4529 |
-
|
4530 |
-
|
4531 |
-
|
4532 |
-
|
4533 |
-
|
4534 |
-
|
4535 |
-
<
|
4536 |
-
|
4537 |
-
|
4538 |
-
<
|
4539 |
-
|
4540 |
-
|
4541 |
-
|
4542 |
-
|
4543 |
-
|
4544 |
-
|
4545 |
-
|
4546 |
-
|
4547 |
-
|
4548 |
-
|
4549 |
-
|
4550 |
-
|
4551 |
-
|
4552 |
-
|
4553 |
-
|
4554 |
-
|
4555 |
-
|
4556 |
-
|
4557 |
-
$
|
4558 |
-
|
4559 |
-
|
4560 |
-
|
4561 |
-
|
4562 |
-
|
4563 |
-
|
4564 |
-
|
4565 |
-
|
4566 |
-
|
4567 |
-
|
4568 |
-
|
4569 |
-
|
4570 |
-
|
4571 |
-
|
4572 |
-
|
4573 |
-
|
4574 |
-
|
4575 |
-
|
4576 |
-
|
4577 |
-
|
4578 |
-
|
4579 |
-
|
4580 |
-
|
4581 |
-
|
4582 |
-
|
4583 |
-
|
4584 |
-
|
4585 |
-
|
4586 |
-
|
4587 |
-
|
4588 |
-
|
4589 |
-
|
4590 |
-
|
4591 |
-
);
|
4592 |
-
|
4593 |
-
|
4594 |
-
|
4595 |
-
|
4596 |
-
|
4597 |
-
|
4598 |
-
|
4599 |
-
|
4600 |
-
|
4601 |
-
|
4602 |
-
|
4603 |
-
|
4604 |
-
|
4605 |
-
|
4606 |
-
|
4607 |
-
|
4608 |
-
|
4609 |
-
|
4610 |
-
|
4611 |
-
|
4612 |
-
|
4613 |
-
|
4614 |
-
|
4615 |
-
$output .=
|
4616 |
-
$output .= '</
|
4617 |
-
|
4618 |
-
|
4619 |
-
|
4620 |
-
|
4621 |
-
|
4622 |
-
|
4623 |
-
|
4624 |
-
|
4625 |
-
|
4626 |
-
|
4627 |
-
|
4628 |
-
|
4629 |
-
|
4630 |
-
|
4631 |
-
}
|
4632 |
-
|
4633 |
-
|
4634 |
-
|
4635 |
-
|
4636 |
-
|
4637 |
-
|
4638 |
-
|
4639 |
-
|
4640 |
-
|
4641 |
-
|
4642 |
-
|
4643 |
-
|
4644 |
-
|
4645 |
-
|
4646 |
-
|
4647 |
-
|
4648 |
-
|
4649 |
-
|
4650 |
-
|
4651 |
-
|
4652 |
-
|
4653 |
-
|
4654 |
-
|
4655 |
-
|
4656 |
-
|
4657 |
-
|
4658 |
-
<
|
4659 |
-
<
|
4660 |
-
<p><?php _e("
|
4661 |
-
<
|
4662 |
-
|
4663 |
-
<li><a href='https://wp-livechat.com/documentation/
|
4664 |
-
<li><a href='https://wp-livechat.com/documentation/
|
4665 |
-
<li><a href='https://wp-livechat.com/this-
|
4666 |
-
<li><a href='https://wp-livechat.com/
|
4667 |
-
<li><a href='https://wp-livechat.com/documentation/
|
4668 |
-
<li><a href='https://wp-livechat.com/
|
4669 |
-
</ul>
|
4670 |
-
</div>
|
4671 |
-
<div class='wplc_row_col' style='background-color:#FFF;'>
|
4672 |
-
<h2><i class="fa fa-
|
4673 |
-
<hr />
|
4674 |
-
<p><?php _e("
|
4675 |
-
<
|
4676 |
-
|
4677 |
-
<li><a href='https://wp-livechat.com/
|
4678 |
-
|
4679 |
-
|
4680 |
-
|
4681 |
-
<?php
|
4682 |
-
|
4683 |
-
|
4684 |
-
|
4685 |
-
|
4686 |
-
|
4687 |
-
|
4688 |
-
|
4689 |
-
|
4690 |
-
|
4691 |
-
|
4692 |
-
|
4693 |
-
|
4694 |
-
|
4695 |
-
|
4696 |
-
|
4697 |
-
|
4698 |
-
|
4699 |
-
|
4700 |
-
|
4701 |
-
|
4702 |
-
|
4703 |
-
|
4704 |
-
|
4705 |
-
|
4706 |
-
|
4707 |
-
|
4708 |
-
|
4709 |
-
|
4710 |
-
|
4711 |
-
|
4712 |
-
|
4713 |
-
|
4714 |
-
|
4715 |
-
|
4716 |
-
|
4717 |
-
|
4718 |
-
|
4719 |
-
|
4720 |
-
|
4721 |
-
|
4722 |
-
|
4723 |
-
|
4724 |
-
|
4725 |
-
|
4726 |
-
|
4727 |
-
|
4728 |
-
|
4729 |
-
|
4730 |
-
|
4731 |
-
|
4732 |
-
|
4733 |
-
|
4734 |
-
|
4735 |
-
|
4736 |
-
|
4737 |
-
|
4738 |
-
|
4739 |
-
|
4740 |
-
|
4741 |
-
|
4742 |
-
|
4743 |
-
|
4744 |
-
|
4745 |
-
|
4746 |
-
|
4747 |
-
|
4748 |
-
|
4749 |
-
|
4750 |
-
|
4751 |
-
|
4752 |
-
|
4753 |
-
|
4754 |
-
|
4755 |
-
|
4756 |
-
|
4757 |
-
|
4758 |
-
|
4759 |
-
|
4760 |
-
|
4761 |
-
|
4762 |
-
|
4763 |
-
|
4764 |
-
|
4765 |
-
|
4766 |
-
|
4767 |
-
|
4768 |
-
|
4769 |
-
|
4770 |
-
|
4771 |
-
|
4772 |
-
|
4773 |
-
|
4774 |
-
|
4775 |
-
|
4776 |
-
|
4777 |
-
|
4778 |
-
|
4779 |
-
|
4780 |
-
|
4781 |
-
|
4782 |
-
|
4783 |
-
|
4784 |
-
|
4785 |
-
|
4786 |
-
|
4787 |
-
|
4788 |
-
|
4789 |
-
|
4790 |
-
|
4791 |
-
|
4792 |
-
|
4793 |
-
|
4794 |
-
|
4795 |
-
|
4796 |
-
|
4797 |
-
|
4798 |
-
|
4799 |
-
|
4800 |
-
|
4801 |
-
|
4802 |
-
|
4803 |
-
|
4804 |
-
|
4805 |
-
|
4806 |
-
|
4807 |
-
|
4808 |
-
|
4809 |
-
|
4810 |
-
|
4811 |
-
|
4812 |
-
|
4813 |
-
|
4814 |
-
|
4815 |
-
|
4816 |
-
|
4817 |
-
|
4818 |
-
|
4819 |
-
|
4820 |
-
|
4821 |
-
|
4822 |
-
|
4823 |
-
$wplc_agents .= "
|
4824 |
-
|
4825 |
-
|
4826 |
-
|
4827 |
-
|
4828 |
-
|
4829 |
-
|
4830 |
-
|
4831 |
-
|
4832 |
-
|
4833 |
-
|
4834 |
-
|
4835 |
-
|
4836 |
-
|
4837 |
-
|
4838 |
-
|
4839 |
-
|
4840 |
-
|
4841 |
-
|
4842 |
-
|
4843 |
-
|
4844 |
-
|
4845 |
-
|
4846 |
-
|
4847 |
-
|
4848 |
-
|
4849 |
-
|
4850 |
-
|
4851 |
-
|
4852 |
-
|
4853 |
-
|
4854 |
-
|
4855 |
-
|
4856 |
-
|
4857 |
-
|
4858 |
-
|
4859 |
-
|
4860 |
-
|
4861 |
-
|
4862 |
-
|
4863 |
-
|
4864 |
-
|
4865 |
-
|
4866 |
-
|
4867 |
-
|
4868 |
-
|
4869 |
-
|
4870 |
-
|
4871 |
-
|
4872 |
-
|
4873 |
-
|
4874 |
-
|
4875 |
-
|
4876 |
-
|
4877 |
-
|
4878 |
-
|
4879 |
-
|
4880 |
-
|
4881 |
-
|
4882 |
-
|
4883 |
-
|
4884 |
-
|
4885 |
-
|
4886 |
-
|
4887 |
-
|
4888 |
-
|
4889 |
-
|
4890 |
-
|
4891 |
-
|
4892 |
-
|
4893 |
-
|
4894 |
-
|
4895 |
-
|
4896 |
-
|
4897 |
-
|
4898 |
-
|
4899 |
-
|
4900 |
-
|
4901 |
-
|
4902 |
-
|
4903 |
-
|
4904 |
-
|
4905 |
-
|
4906 |
-
|
4907 |
-
|
4908 |
-
|
4909 |
-
|
4910 |
-
|
4911 |
-
|
4912 |
-
|
4913 |
-
|
4914 |
-
|
4915 |
-
|
4916 |
-
|
4917 |
-
|
4918 |
-
|
4919 |
-
|
4920 |
-
|
4921 |
-
|
4922 |
-
|
4923 |
-
|
4924 |
-
|
4925 |
-
|
4926 |
-
|
4927 |
-
|
4928 |
-
|
4929 |
-
|
4930 |
-
|
4931 |
-
|
4932 |
-
|
4933 |
-
|
4934 |
-
|
4935 |
-
|
4936 |
-
|
4937 |
-
|
4938 |
-
|
4939 |
-
|
4940 |
-
|
4941 |
-
|
4942 |
-
|
4943 |
-
|
4944 |
-
|
4945 |
-
|
4946 |
-
|
4947 |
-
|
4948 |
-
|
4949 |
-
|
4950 |
-
|
4951 |
-
|
4952 |
-
|
4953 |
-
|
4954 |
-
|
4955 |
-
|
4956 |
-
|
4957 |
-
|
4958 |
-
|
4959 |
-
|
4960 |
-
|
4961 |
-
|
4962 |
-
|
4963 |
-
|
4964 |
-
|
4965 |
-
|
4966 |
-
|
4967 |
-
|
4968 |
-
|
4969 |
-
|
4970 |
-
|
4971 |
-
|
4972 |
-
|
4973 |
-
|
4974 |
-
|
4975 |
-
|
4976 |
-
|
4977 |
-
|
4978 |
-
|
4979 |
-
|
4980 |
-
|
4981 |
-
|
4982 |
-
|
4983 |
-
|
4984 |
-
|
4985 |
-
|
4986 |
-
|
4987 |
-
|
4988 |
-
|
4989 |
-
|
4990 |
-
|
4991 |
-
|
4992 |
-
|
4993 |
-
|
4994 |
-
|
4995 |
-
|
4996 |
-
|
4997 |
-
|
4998 |
-
|
4999 |
-
|
5000 |
-
|
5001 |
-
|
5002 |
-
|
5003 |
-
|
5004 |
-
|
5005 |
-
|
5006 |
-
|
5007 |
-
|
5008 |
-
|
5009 |
-
|
5010 |
-
|
5011 |
-
|
5012 |
-
|
5013 |
-
|
5014 |
-
if ($data['string'] == "
|
5015 |
-
$link = "";
|
5016 |
-
$image = "https://ccplugins.co/api-wplc-extensions/images/
|
5017 |
-
}
|
5018 |
-
|
5019 |
-
|
5020 |
-
|
5021 |
-
|
5022 |
-
$
|
5023 |
-
|
5024 |
-
|
5025 |
-
|
5026 |
-
|
5027 |
-
|
5028 |
-
$
|
5029 |
-
|
5030 |
-
|
5031 |
-
|
5032 |
-
|
5033 |
-
|
5034 |
-
|
5035 |
-
|
5036 |
-
|
5037 |
-
|
5038 |
-
|
5039 |
-
$page_content .= '
|
5040 |
-
$page_content .=
|
5041 |
-
|
5042 |
-
|
5043 |
-
|
5044 |
-
|
5045 |
-
|
5046 |
-
$page_content .= '</
|
5047 |
-
|
5048 |
-
|
5049 |
-
|
5050 |
-
|
5051 |
-
|
5052 |
-
|
5053 |
-
$page_content .= '</
|
5054 |
-
|
5055 |
-
|
5056 |
-
|
5057 |
-
|
5058 |
-
|
5059 |
-
}
|
5060 |
-
|
5061 |
-
|
5062 |
-
|
5063 |
-
|
5064 |
-
|
5065 |
-
|
5066 |
-
|
5067 |
-
|
5068 |
-
|
5069 |
-
|
5070 |
-
|
5071 |
-
|
5072 |
-
|
5073 |
-
|
5074 |
-
|
5075 |
-
|
5076 |
-
|
5077 |
-
|
5078 |
-
|
5079 |
-
|
5080 |
-
$text
|
5081 |
-
|
5082 |
-
|
5083 |
-
|
5084 |
-
$text
|
5085 |
-
|
5086 |
-
|
5087 |
-
|
5088 |
-
|
5089 |
-
|
5090 |
-
|
5091 |
-
|
5092 |
-
|
5093 |
-
|
5094 |
-
|
5095 |
-
|
5096 |
-
|
5097 |
-
|
5098 |
-
|
5099 |
-
|
5100 |
-
$
|
5101 |
-
|
5102 |
-
|
5103 |
-
|
5104 |
-
|
5105 |
-
|
5106 |
-
|
5107 |
-
$text
|
5108 |
-
|
5109 |
-
|
5110 |
-
|
5111 |
-
$text
|
5112 |
-
|
5113 |
-
|
5114 |
-
|
5115 |
-
|
5116 |
-
|
5117 |
-
|
5118 |
-
|
5119 |
-
|
5120 |
-
|
5121 |
-
|
5122 |
-
|
5123 |
-
|
5124 |
-
|
5125 |
-
|
5126 |
-
|
5127 |
-
$
|
5128 |
-
|
5129 |
-
|
5130 |
-
|
5131 |
-
|
5132 |
-
|
5133 |
-
|
5134 |
-
$text
|
5135 |
-
|
5136 |
-
|
5137 |
-
|
5138 |
-
$text
|
5139 |
-
|
5140 |
-
|
5141 |
-
|
5142 |
-
|
5143 |
-
|
5144 |
-
|
5145 |
-
|
5146 |
-
|
5147 |
-
|
5148 |
-
|
5149 |
-
|
5150 |
-
|
5151 |
-
|
5152 |
-
|
5153 |
-
|
5154 |
-
|
5155 |
-
|
5156 |
-
|
5157 |
-
|
5158 |
-
|
5159 |
-
|
5160 |
-
|
5161 |
-
|
5162 |
-
|
5163 |
-
|
5164 |
-
|
5165 |
-
|
5166 |
-
|
5167 |
-
|
5168 |
-
|
5169 |
-
|
5170 |
-
|
5171 |
-
|
5172 |
-
|
5173 |
-
|
5174 |
-
echo "
|
5175 |
-
|
5176 |
-
|
5177 |
-
|
5178 |
-
|
5179 |
-
|
5180 |
-
|
5181 |
-
|
5182 |
-
|
5183 |
-
|
5184 |
-
|
5185 |
-
|
5186 |
-
|
5187 |
-
|
5188 |
-
|
5189 |
-
|
5190 |
-
|
5191 |
-
|
5192 |
-
|
5193 |
-
|
5194 |
-
|
5195 |
-
|
5196 |
-
|
5197 |
-
|
5198 |
-
|
5199 |
-
|
5200 |
-
|
5201 |
-
|
5202 |
-
|
5203 |
-
|
5204 |
-
|
5205 |
-
|
5206 |
-
|
5207 |
-
|
5208 |
-
|
5209 |
-
|
5210 |
-
|
5211 |
-
|
5212 |
-
|
5213 |
-
|
5214 |
-
|
5215 |
-
|
5216 |
-
}
|
5217 |
-
|
5218 |
-
|
5219 |
-
|
5220 |
-
|
5221 |
-
|
5222 |
-
|
5223 |
-
|
5224 |
-
|
5225 |
-
|
5226 |
-
|
5227 |
-
|
5228 |
-
|
5229 |
-
|
5230 |
-
|
5231 |
-
|
5232 |
-
|
5233 |
-
|
5234 |
-
global $wpdb;
|
5235 |
-
|
5236 |
-
|
5237 |
-
|
5238 |
-
|
5239 |
-
|
5240 |
-
|
5241 |
-
|
5242 |
-
|
5243 |
-
|
5244 |
-
|
5245 |
-
|
5246 |
-
|
5247 |
-
|
5248 |
-
|
5249 |
-
|
5250 |
-
|
5251 |
-
|
5252 |
-
|
5253 |
-
|
5254 |
-
|
5255 |
-
|
5256 |
-
|
5257 |
-
|
5258 |
-
|
5259 |
-
|
5260 |
-
|
5261 |
-
|
5262 |
-
|
5263 |
-
|
5264 |
-
|
5265 |
-
|
5266 |
-
|
5267 |
-
|
5268 |
-
|
5269 |
-
|
5270 |
-
|
5271 |
-
|
5272 |
-
|
5273 |
-
|
5274 |
-
|
5275 |
-
|
5276 |
-
|
5277 |
-
|
5278 |
-
|
5279 |
-
|
5280 |
-
|
5281 |
-
|
5282 |
-
|
5283 |
-
|
5284 |
-
|
5285 |
-
|
5286 |
-
|
5287 |
-
|
5288 |
-
|
5289 |
-
|
5290 |
-
|
5291 |
-
|
5292 |
-
|
5293 |
-
|
5294 |
-
|
5295 |
-
|
5296 |
-
|
5297 |
-
|
5298 |
-
|
5299 |
-
|
5300 |
-
|
5301 |
-
|
5302 |
-
|
5303 |
-
|
5304 |
-
|
5305 |
-
|
5306 |
-
|
5307 |
-
|
5308 |
-
|
5309 |
-
|
5310 |
-
|
5311 |
-
|
5312 |
-
|
5313 |
-
|
5314 |
-
|
5315 |
-
|
5316 |
-
|
5317 |
-
|
5318 |
-
|
5319 |
-
|
5320 |
-
|
5321 |
-
|
5322 |
-
|
5323 |
-
|
5324 |
-
|
5325 |
-
|
5326 |
-
|
5327 |
-
|
5328 |
-
|
5329 |
-
|
5330 |
-
|
5331 |
-
|
5332 |
-
|
5333 |
-
|
5334 |
-
|
5335 |
-
|
5336 |
-
|
5337 |
-
|
5338 |
-
|
5339 |
-
|
5340 |
-
|
5341 |
-
|
5342 |
-
|
5343 |
-
|
5344 |
-
|
5345 |
-
$
|
5346 |
-
|
5347 |
-
|
5348 |
-
|
5349 |
-
|
5350 |
-
|
5351 |
-
|
5352 |
-
|
5353 |
-
|
5354 |
-
|
5355 |
-
|
5356 |
-
|
5357 |
-
|
5358 |
-
|
5359 |
-
|
5360 |
-
|
5361 |
-
|
5362 |
-
|
5363 |
-
|
5364 |
-
|
5365 |
-
|
5366 |
-
|
5367 |
-
|
5368 |
-
|
5369 |
-
|
5370 |
-
|
5371 |
-
|
5372 |
-
}
|
5373 |
-
|
5374 |
-
|
5375 |
-
*
|
5376 |
-
* @
|
5377 |
-
|
5378 |
-
|
5379 |
-
|
5380 |
-
|
5381 |
-
|
5382 |
-
|
5383 |
-
|
5384 |
-
|
5385 |
-
|
5386 |
-
|
5387 |
-
|
5388 |
-
|
5389 |
-
|
5390 |
-
|
5391 |
-
|
5392 |
-
|
5393 |
-
|
5394 |
-
|
5395 |
-
|
5396 |
-
|
5397 |
-
|
5398 |
-
|
5399 |
-
|
5400 |
-
|
5401 |
-
|
5402 |
-
|
5403 |
-
|
5404 |
-
|
5405 |
-
|
5406 |
-
|
5407 |
-
*/
|
5408 |
-
|
5409 |
-
|
5410 |
-
|
5411 |
-
|
5412 |
-
|
5413 |
-
|
5414 |
-
|
5415 |
-
|
5416 |
-
|
5417 |
-
|
5418 |
-
|
5419 |
-
|
5420 |
-
|
5421 |
-
|
5422 |
-
|
5423 |
-
|
5424 |
-
|
5425 |
-
if (!isset($wplc_settings['
|
5426 |
-
if (!isset($wplc_settings['
|
5427 |
-
if (!isset($wplc_settings['
|
5428 |
-
if (!isset($wplc_settings['
|
5429 |
-
if (!isset($wplc_settings['
|
5430 |
-
|
5431 |
-
|
5432 |
-
|
5433 |
-
}
|
5434 |
-
|
5435 |
-
|
5436 |
-
|
5437 |
-
|
5438 |
-
|
5439 |
-
|
5440 |
-
|
5441 |
-
|
5442 |
-
if(!
|
5443 |
-
|
5444 |
-
|
5445 |
-
|
5446 |
-
|
5447 |
-
|
5448 |
-
|
5449 |
-
|
5450 |
-
|
5451 |
-
|
5452 |
-
|
5453 |
-
|
5454 |
-
|
5455 |
-
|
5456 |
-
|
5457 |
-
|
5458 |
-
|
5459 |
-
|
5460 |
-
|
5461 |
-
|
5462 |
-
|
5463 |
-
|
5464 |
-
|
5465 |
-
|
5466 |
-
|
5467 |
-
|
5468 |
-
|
5469 |
-
|
5470 |
-
|
5471 |
-
|
5472 |
-
|
5473 |
-
|
5474 |
-
|
5475 |
-
|
5476 |
-
|
5477 |
-
|
5478 |
-
|
5479 |
-
|
5480 |
-
|
5481 |
-
|
5482 |
-
|
5483 |
-
|
5484 |
-
|
5485 |
-
|
5486 |
-
|
5487 |
-
|
5488 |
-
|
5489 |
-
|
5490 |
-
|
5491 |
-
|
5492 |
-
|
5493 |
-
|
5494 |
-
|
5495 |
-
|
5496 |
-
|
5497 |
-
|
5498 |
-
|
5499 |
-
|
5500 |
-
|
5501 |
-
|
5502 |
-
|
5503 |
-
|
5504 |
-
|
5505 |
-
|
5506 |
-
|
5507 |
-
|
5508 |
-
|
5509 |
-
|
5510 |
-
|
5511 |
-
|
5512 |
-
|
5513 |
-
|
5514 |
-
|
5515 |
-
|
5516 |
-
|
5517 |
-
|
5518 |
-
|
5519 |
-
|
5520 |
-
|
5521 |
-
|
5522 |
-
|
5523 |
-
|
5524 |
-
|
5525 |
-
|
5526 |
-
|
5527 |
-
|
5528 |
-
|
5529 |
-
|
5530 |
-
</tr>
|
5531 |
-
|
5532 |
-
|
5533 |
-
|
5534 |
-
|
5535 |
-
|
5536 |
-
|
5537 |
-
|
5538 |
-
|
5539 |
-
|
5540 |
-
<
|
5541 |
-
|
5542 |
-
|
5543 |
-
|
5544 |
-
|
5545 |
-
|
5546 |
-
|
5547 |
-
|
5548 |
-
|
5549 |
-
|
5550 |
-
|
5551 |
-
|
5552 |
-
|
5553 |
-
|
5554 |
-
|
5555 |
-
|
5556 |
-
|
5557 |
-
|
5558 |
-
|
5559 |
-
|
5560 |
-
|
5561 |
-
|
5562 |
-
|
5563 |
-
|
5564 |
-
|
5565 |
-
|
5566 |
-
|
5567 |
-
|
5568 |
-
|
5569 |
-
|
5570 |
-
|
5571 |
-
|
5572 |
-
|
5573 |
-
|
5574 |
-
|
5575 |
-
|
5576 |
-
|
5577 |
-
|
5578 |
-
|
5579 |
-
$content
|
5580 |
-
|
5581 |
-
$content .=
|
5582 |
-
$content .=
|
5583 |
-
$content .=
|
5584 |
-
|
5585 |
-
|
5586 |
-
|
5587 |
-
|
5588 |
-
|
5589 |
-
|
5590 |
-
|
5591 |
-
|
5592 |
-
|
5593 |
-
|
5594 |
-
|
5595 |
-
$content .=
|
5596 |
-
$content .=
|
5597 |
-
$content .=
|
5598 |
-
|
5599 |
-
|
5600 |
-
|
5601 |
-
|
5602 |
-
|
5603 |
-
|
5604 |
-
|
5605 |
-
|
5606 |
-
|
5607 |
-
|
5608 |
-
|
5609 |
-
|
5610 |
-
|
5611 |
-
|
5612 |
-
|
5613 |
-
|
5614 |
-
|
5615 |
-
|
5616 |
-
|
5617 |
-
|
5618 |
-
|
5619 |
-
|
5620 |
-
|
5621 |
-
|
5622 |
-
|
5623 |
-
|
5624 |
-
|
5625 |
-
|
5626 |
-
|
5627 |
-
|
5628 |
-
|
5629 |
-
|
5630 |
-
|
5631 |
-
|
5632 |
-
|
5633 |
-
|
5634 |
-
|
5635 |
-
|
5636 |
-
|
5637 |
-
|
5638 |
-
|
5639 |
-
|
5640 |
-
|
5641 |
-
|
5642 |
-
|
5643 |
-
|
5644 |
-
|
5645 |
-
$content .=
|
5646 |
-
$content .=
|
5647 |
-
$content .=
|
5648 |
-
$content .= "
|
5649 |
-
|
5650 |
-
|
5651 |
-
|
5652 |
-
|
5653 |
-
|
5654 |
-
|
5655 |
-
|
5656 |
-
|
5657 |
-
|
5658 |
-
|
5659 |
-
|
5660 |
-
$content .=
|
5661 |
-
$content .=
|
5662 |
-
$content .=
|
5663 |
-
|
5664 |
-
|
5665 |
-
|
5666 |
-
|
5667 |
-
|
5668 |
-
|
5669 |
-
|
5670 |
-
|
5671 |
-
|
5672 |
-
|
5673 |
-
|
5674 |
-
$content .=
|
5675 |
-
$content .= "
|
5676 |
-
$content .=
|
5677 |
-
|
5678 |
-
|
5679 |
-
|
5680 |
-
|
5681 |
-
|
5682 |
-
|
5683 |
-
|
5684 |
-
|
5685 |
-
|
5686 |
-
$content
|
5687 |
-
|
5688 |
-
|
5689 |
-
|
5690 |
-
|
5691 |
-
|
5692 |
-
|
5693 |
-
|
5694 |
-
|
5695 |
-
|
5696 |
-
|
5697 |
-
|
5698 |
-
$content .=
|
5699 |
-
$content .=
|
5700 |
-
$content .=
|
5701 |
-
|
5702 |
-
|
5703 |
-
|
5704 |
-
|
5705 |
-
|
5706 |
-
|
5707 |
-
|
5708 |
-
|
5709 |
-
|
5710 |
-
|
5711 |
-
|
5712 |
-
|
5713 |
-
|
5714 |
-
|
5715 |
-
|
5716 |
-
|
5717 |
-
|
5718 |
-
|
5719 |
-
|
5720 |
-
|
5721 |
-
|
5722 |
-
|
5723 |
-
|
5724 |
-
|
5725 |
-
|
5726 |
-
|
5727 |
-
|
5728 |
-
|
5729 |
-
|
5730 |
-
|
5731 |
-
|
5732 |
-
|
5733 |
-
|
5734 |
-
|
5735 |
-
|
5736 |
-
|
5737 |
-
|
5738 |
-
|
5739 |
-
|
5740 |
-
|
5741 |
-
|
5742 |
-
|
5743 |
-
|
5744 |
-
|
5745 |
-
|
5746 |
-
|
5747 |
-
|
5748 |
-
|
5749 |
-
|
5750 |
-
|
5751 |
-
|
5752 |
-
|
5753 |
-
|
5754 |
-
|
5755 |
-
|
5756 |
-
|
5757 |
-
|
5758 |
-
|
5759 |
-
|
5760 |
-
|
5761 |
-
|
5762 |
-
|
5763 |
-
|
5764 |
-
|
5765 |
-
|
5766 |
-
|
5767 |
-
|
5768 |
-
|
5769 |
-
|
5770 |
-
|
5771 |
-
|
5772 |
-
|
5773 |
-
|
5774 |
-
|
5775 |
-
|
5776 |
-
|
5777 |
-
|
5778 |
-
|
5779 |
-
|
5780 |
-
|
5781 |
-
|
5782 |
-
|
5783 |
-
|
5784 |
-
|
5785 |
-
|
5786 |
-
|
5787 |
-
|
5788 |
-
|
5789 |
-
|
5790 |
-
|
5791 |
-
|
5792 |
-
|
5793 |
-
|
5794 |
-
|
5795 |
-
|
5796 |
-
|
5797 |
-
|
5798 |
-
|
5799 |
-
|
5800 |
-
|
5801 |
-
|
5802 |
-
|
5803 |
-
|
5804 |
-
|
5805 |
-
|
5806 |
-
|
5807 |
-
|
5808 |
-
|
5809 |
-
|
5810 |
-
|
5811 |
-
|
5812 |
-
|
5813 |
-
|
5814 |
-
|
5815 |
-
|
5816 |
-
|
5817 |
-
|
5818 |
-
|
5819 |
-
|
5820 |
-
|
5821 |
-
|
5822 |
-
|
5823 |
-
|
5824 |
-
|
5825 |
-
|
5826 |
-
|
5827 |
-
$
|
5828 |
-
|
5829 |
-
$content
|
5830 |
-
|
5831 |
-
|
5832 |
-
|
5833 |
-
|
5834 |
-
$content .= "
|
5835 |
-
|
5836 |
-
|
5837 |
-
|
5838 |
-
|
5839 |
-
|
5840 |
-
|
5841 |
-
|
5842 |
-
|
5843 |
-
|
5844 |
-
|
5845 |
-
|
5846 |
-
|
5847 |
-
|
5848 |
-
|
5849 |
-
|
5850 |
-
|
5851 |
-
|
5852 |
-
|
5853 |
-
|
5854 |
-
|
5855 |
-
|
5856 |
-
|
5857 |
-
|
5858 |
-
|
5859 |
-
|
5860 |
-
|
5861 |
-
|
5862 |
-
|
5863 |
-
|
5864 |
-
|
5865 |
-
|
5866 |
-
|
5867 |
-
|
5868 |
-
|
5869 |
-
|
5870 |
-
|
5871 |
-
|
5872 |
-
|
5873 |
-
|
5874 |
-
|
5875 |
-
|
5876 |
-
|
5877 |
-
|
5878 |
-
|
5879 |
-
|
5880 |
-
|
5881 |
-
|
5882 |
-
|
5883 |
-
|
5884 |
-
|
5885 |
-
|
5886 |
-
|
5887 |
-
|
5888 |
-
|
5889 |
-
|
5890 |
-
|
5891 |
-
|
5892 |
-
|
5893 |
-
|
5894 |
-
|
5895 |
-
|
5896 |
-
|
5897 |
-
|
5898 |
-
|
5899 |
-
|
5900 |
-
|
5901 |
-
|
5902 |
-
|
5903 |
-
|
5904 |
-
|
5905 |
-
|
5906 |
-
|
5907 |
-
|
5908 |
-
|
5909 |
-
|
5910 |
-
|
5911 |
-
|
5912 |
-
|
5913 |
-
|
5914 |
-
|
5915 |
-
|
5916 |
-
|
5917 |
-
|
5918 |
-
|
5919 |
-
|
5920 |
-
|
5921 |
-
|
5922 |
-
|
5923 |
-
|
5924 |
-
|
5925 |
-
|
5926 |
-
|
5927 |
-
|
5928 |
-
|
5929 |
-
|
5930 |
-
|
5931 |
-
|
5932 |
-
|
5933 |
-
|
5934 |
-
|
5935 |
-
|
5936 |
-
|
5937 |
-
|
5938 |
-
|
5939 |
-
|
5940 |
-
|
5941 |
-
|
5942 |
-
|
5943 |
-
|
5944 |
-
|
5945 |
-
|
5946 |
-
|
5947 |
-
|
5948 |
-
|
5949 |
-
|
5950 |
-
|
5951 |
-
|
5952 |
-
|
5953 |
-
|
5954 |
-
|
5955 |
-
|
5956 |
-
|
5957 |
-
|
5958 |
-
|
5959 |
-
|
5960 |
-
|
5961 |
-
|
5962 |
-
|
5963 |
-
}
|
5964 |
-
|
5965 |
-
|
5966 |
-
|
5967 |
-
|
5968 |
-
*
|
5969 |
-
*
|
5970 |
-
*
|
5971 |
-
*
|
5972 |
-
|
5973 |
-
|
5974 |
-
|
5975 |
-
|
5976 |
-
|
5977 |
-
|
5978 |
-
|
5979 |
-
|
5980 |
-
|
5981 |
-
|
5982 |
-
|
5983 |
-
|
5984 |
-
|
5985 |
-
|
5986 |
-
|
5987 |
-
|
5988 |
-
|
5989 |
-
|
5990 |
-
|
5991 |
-
|
5992 |
-
|
5993 |
-
|
5994 |
-
|
5995 |
-
|
5996 |
-
|
5997 |
-
|
5998 |
-
|
5999 |
-
|
6000 |
-
|
6001 |
-
|
6002 |
-
|
6003 |
-
|
6004 |
-
|
6005 |
-
|
6006 |
-
$
|
6007 |
-
|
6008 |
-
|
6009 |
-
|
6010 |
-
|
6011 |
-
|
6012 |
-
|
6013 |
-
|
6014 |
-
|
6015 |
-
|
6016 |
-
|
6017 |
-
|
6018 |
-
|
6019 |
-
|
6020 |
-
|
6021 |
-
|
6022 |
-
|
6023 |
-
|
6024 |
-
|
6025 |
-
|
6026 |
-
|
6027 |
-
|
6028 |
-
|
6029 |
-
|
6030 |
-
<
|
6031 |
-
|
6032 |
-
|
6033 |
-
|
6034 |
-
|
6035 |
-
|
6036 |
-
|
6037 |
-
|
6038 |
-
<
|
6039 |
-
|
6040 |
-
|
6041 |
-
|
6042 |
-
|
6043 |
-
|
6044 |
-
|
6045 |
-
|
6046 |
-
|
6047 |
-
|
6048 |
-
|
6049 |
-
|
6050 |
-
|
6051 |
-
|
6052 |
-
|
6053 |
-
|
6054 |
-
|
6055 |
-
|
6056 |
-
|
6057 |
-
|
6058 |
-
|
6059 |
-
|
6060 |
-
$
|
6061 |
-
|
6062 |
-
|
6063 |
-
|
6064 |
-
|
6065 |
-
|
6066 |
-
|
6067 |
-
|
6068 |
-
|
6069 |
-
|
6070 |
-
|
6071 |
-
|
6072 |
-
|
6073 |
-
|
6074 |
-
|
6075 |
-
|
6076 |
-
|
6077 |
-
|
6078 |
-
|
6079 |
-
|
6080 |
-
|
6081 |
-
|
6082 |
-
|
6083 |
-
|
6084 |
-
|
6085 |
-
|
6086 |
-
|
6087 |
-
|
6088 |
-
|
6089 |
-
|
6090 |
-
|
6091 |
-
|
6092 |
-
|
6093 |
-
|
6094 |
-
|
6095 |
-
|
6096 |
-
|
6097 |
-
|
6098 |
-
|
6099 |
-
|
6100 |
-
|
6101 |
-
|
6102 |
-
|
6103 |
-
|
6104 |
-
|
6105 |
-
|
6106 |
-
|
6107 |
-
|
6108 |
-
|
6109 |
-
|
6110 |
-
|
6111 |
-
|
6112 |
-
|
6113 |
-
|
6114 |
-
|
6115 |
-
|
6116 |
-
|
6117 |
-
|
6118 |
-
|
6119 |
-
|
6120 |
-
|
6121 |
-
|
6122 |
-
|
6123 |
-
|
6124 |
-
|
6125 |
-
|
6126 |
-
|
6127 |
-
|
6128 |
-
|
6129 |
-
|
6130 |
-
|
6131 |
-
|
6132 |
-
|
6133 |
-
|
6134 |
-
|
6135 |
-
|
6136 |
-
|
6137 |
-
|
6138 |
-
|
6139 |
-
|
6140 |
-
|
6141 |
-
|
6142 |
-
|
6143 |
-
|
6144 |
-
|
6145 |
-
|
6146 |
-
|
6147 |
-
|
6148 |
-
|
6149 |
-
|
6150 |
-
|
6151 |
-
|
6152 |
-
$
|
6153 |
-
|
6154 |
-
|
6155 |
-
|
6156 |
-
|
6157 |
-
|
6158 |
-
|
6159 |
-
|
6160 |
-
|
6161 |
-
|
6162 |
-
|
6163 |
-
|
6164 |
-
|
6165 |
-
|
6166 |
-
|
6167 |
-
|
6168 |
-
|
6169 |
-
|
6170 |
-
|
6171 |
-
|
6172 |
-
|
6173 |
-
|
6174 |
-
|
6175 |
-
|
6176 |
-
|
6177 |
-
|
6178 |
-
|
6179 |
-
|
6180 |
-
|
6181 |
-
|
6182 |
-
|
6183 |
-
|
6184 |
-
|
6185 |
-
|
6186 |
-
|
6187 |
-
|
6188 |
-
|
6189 |
-
|
6190 |
-
|
6191 |
-
|
6192 |
-
|
6193 |
-
|
6194 |
-
|
6195 |
-
|
6196 |
-
|
6197 |
-
|
6198 |
-
|
6199 |
-
|
6200 |
-
|
6201 |
-
|
6202 |
-
|
6203 |
-
|
6204 |
-
|
6205 |
-
|
6206 |
-
|
6207 |
-
|
6208 |
-
|
6209 |
-
|
6210 |
-
|
6211 |
-
|
6212 |
-
|
6213 |
-
|
6214 |
-
|
6215 |
-
|
6216 |
-
|
6217 |
-
|
6218 |
-
|
6219 |
-
|
6220 |
-
|
6221 |
-
|
6222 |
-
|
6223 |
-
}
|
6224 |
-
|
6225 |
-
|
6226 |
-
|
6227 |
-
|
6228 |
-
|
6229 |
-
|
6230 |
-
|
6231 |
-
|
6232 |
-
|
6233 |
-
|
6234 |
-
|
6235 |
-
|
6236 |
-
|
6237 |
-
|
6238 |
-
|
6239 |
-
|
6240 |
-
|
6241 |
-
|
6242 |
-
$
|
6243 |
-
|
6244 |
-
|
6245 |
-
|
6246 |
-
|
6247 |
-
|
6248 |
-
|
6249 |
-
|
6250 |
-
|
6251 |
-
|
6252 |
-
|
6253 |
-
|
6254 |
-
|
6255 |
-
|
6256 |
-
|
6257 |
-
|
6258 |
-
|
6259 |
-
|
6260 |
-
|
6261 |
-
|
6262 |
-
|
6263 |
-
|
6264 |
-
|
6265 |
-
|
6266 |
-
|
6267 |
-
|
6268 |
-
|
6269 |
-
|
6270 |
-
|
6271 |
-
|
6272 |
-
|
6273 |
-
|
6274 |
-
|
6275 |
-
|
6276 |
-
|
6277 |
-
|
6278 |
-
|
6279 |
-
|
6280 |
-
|
6281 |
-
|
6282 |
-
|
6283 |
-
|
6284 |
-
|
6285 |
-
|
6286 |
-
|
6287 |
-
|
6288 |
-
|
6289 |
-
|
6290 |
-
|
6291 |
-
|
6292 |
-
|
6293 |
-
|
6294 |
-
|
6295 |
-
|
6296 |
-
|
6297 |
-
|
6298 |
-
|
6299 |
-
|
6300 |
-
|
6301 |
-
</
|
6302 |
-
|
6303 |
-
|
6304 |
-
|
6305 |
-
|
6306 |
-
|
6307 |
-
|
6308 |
-
|
6309 |
-
|
6310 |
-
|
6311 |
-
|
6312 |
-
|
6313 |
-
|
6314 |
-
|
6315 |
-
|
6316 |
-
|
6317 |
-
|
6318 |
-
|
6319 |
-
|
6320 |
-
|
6321 |
-
|
6322 |
-
|
6323 |
-
|
6324 |
-
|
6325 |
-
|
6326 |
-
|
6327 |
-
|
6328 |
-
|
6329 |
-
|
6330 |
-
|
6331 |
-
|
6332 |
-
$wplc_et_data['
|
6333 |
-
}
|
6334 |
-
|
6335 |
-
|
6336 |
-
|
6337 |
-
|
6338 |
-
|
6339 |
-
|
6340 |
-
|
6341 |
-
|
6342 |
-
|
6343 |
-
|
6344 |
-
|
6345 |
-
|
6346 |
-
|
6347 |
-
|
6348 |
-
|
6349 |
-
|
6350 |
-
|
6351 |
-
|
6352 |
-
|
6353 |
-
|
6354 |
-
|
6355 |
-
|
6356 |
-
echo "
|
6357 |
-
echo "
|
6358 |
-
echo "
|
6359 |
-
echo "
|
6360 |
-
echo "
|
6361 |
-
|
6362 |
-
|
6363 |
-
|
6364 |
-
|
6365 |
-
|
6366 |
-
|
6367 |
-
|
6368 |
-
|
6369 |
-
|
6370 |
-
echo "
|
6371 |
-
echo " </td>";
|
6372 |
-
echo "
|
6373 |
-
|
6374 |
-
echo "
|
6375 |
-
|
6376 |
-
|
6377 |
-
|
6378 |
-
|
6379 |
-
|
6380 |
-
|
6381 |
-
|
6382 |
-
|
6383 |
-
echo "
|
6384 |
-
|
6385 |
-
echo "
|
6386 |
-
echo "
|
6387 |
-
|
6388 |
-
echo "
|
6389 |
-
|
6390 |
-
|
6391 |
-
|
6392 |
-
|
6393 |
-
|
6394 |
-
|
6395 |
-
|
6396 |
-
|
6397 |
-
echo "
|
6398 |
-
|
6399 |
-
echo "
|
6400 |
-
echo "
|
6401 |
-
|
6402 |
-
|
6403 |
-
|
6404 |
-
|
6405 |
-
|
6406 |
-
echo "
|
6407 |
-
|
6408 |
-
echo "
|
6409 |
-
|
6410 |
-
|
6411 |
-
echo "
|
6412 |
-
|
6413 |
-
|
6414 |
-
|
6415 |
-
|
6416 |
-
|
6417 |
-
|
6418 |
-
|
6419 |
-
|
6420 |
-
echo "</
|
6421 |
-
|
6422 |
-
|
6423 |
-
|
6424 |
-
|
6425 |
-
|
6426 |
-
$
|
6427 |
-
|
6428 |
-
|
6429 |
-
|
6430 |
-
|
6431 |
-
|
6432 |
-
|
6433 |
-
|
6434 |
-
|
6435 |
-
|
6436 |
-
|
6437 |
-
|
6438 |
-
|
6439 |
-
|
6440 |
-
|
6441 |
-
|
6442 |
-
|
6443 |
-
|
6444 |
-
}
|
6445 |
-
|
6446 |
-
|
6447 |
-
|
6448 |
-
|
6449 |
-
|
6450 |
-
|
6451 |
-
$
|
6452 |
-
|
6453 |
-
$
|
6454 |
-
|
6455 |
-
|
6456 |
-
|
6457 |
-
|
6458 |
-
|
6459 |
-
|
6460 |
-
|
6461 |
-
|
6462 |
-
|
6463 |
-
|
6464 |
-
|
6465 |
-
$
|
6466 |
-
|
6467 |
-
|
6468 |
-
|
6469 |
-
|
6470 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6471 |
}
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: WP Live Chat Support
|
4 |
+
Plugin URI: http://www.wp-livechat.com
|
5 |
+
Description: The easiest to use website live chat plugin. Let your visitors chat with you and increase sales conversion rates with WP Live Chat Support.
|
6 |
+
Version: 8.0.23
|
7 |
+
Author: WP-LiveChat
|
8 |
+
Author URI: http://www.wp-livechat.com
|
9 |
+
Text Domain: wplivechat
|
10 |
+
Domain Path: /languages
|
11 |
+
*/
|
12 |
+
|
13 |
+
/**
|
14 |
+
* 8.0.23 - 2019-02-05 - Low priority
|
15 |
+
* Fixed access to new dashboard for non admin agents
|
16 |
+
* Fixed documentation suggestions not working (Pro)
|
17 |
+
*
|
18 |
+
* 8.0.22 - 2019-02-04 - Low priority
|
19 |
+
* Introduced a new dashboard that showcases latest blog posts, the latest podcast episode and the system status
|
20 |
+
* Moved GDPR warnings for first time users to the settings page only
|
21 |
+
* Moved the warning regarding desktop notifications to the settings page only
|
22 |
+
*
|
23 |
+
* 8.0.21 - 2018-12-18 - Low priority
|
24 |
+
* Readme Update: Coming soon features
|
25 |
+
* Readme Update: Features list
|
26 |
+
* Tested on WordPress 5.0.1
|
27 |
+
* Updated ZH_CN translation files. Thanks to Air
|
28 |
+
*
|
29 |
+
* 8.0.20 - 2018-11-29 - Medium priority
|
30 |
+
* Fixed issue where relay server requests were made via a shortpoll. (Performance Update)
|
31 |
+
* Re-enabled automatic server location selection for new insttalations
|
32 |
+
* GDPR Compliance is now disabled by default for new installations
|
33 |
+
*
|
34 |
+
* 8.0.19 - 2018-11-19 - Medium priority
|
35 |
+
* Tested on WordPress 5 Beta
|
36 |
+
* Tested Basic Gutenberg Block Support
|
37 |
+
*
|
38 |
+
* 8.0.18 - 2018-11-01 - High Priority
|
39 |
+
* Fixed XSS vulnerability within the GDPR search system (Thanks to Tim Coen)
|
40 |
+
* Fixed Self-XSS vulnerability within the message input field on both dashboard and chat box (Thanks to Tim Coen)
|
41 |
+
*
|
42 |
+
* 8.0.17 - 2018-10-19 - Low priority
|
43 |
+
* Removes WP User Avatar option from settings page. This was incorrectly included in the last release.
|
44 |
+
*
|
45 |
+
* 8.0.16 - 2018-10-18 - Low priority
|
46 |
+
* Fixed undefined 'wplc_user_avatars' not defined error on frontend
|
47 |
+
*
|
48 |
+
* 8.0.15 - 2018-10-11 - High priority
|
49 |
+
* Added WP User Avatar integration
|
50 |
+
* Added jQuery 3 compatibility as per WordPress.org guidelines
|
51 |
+
* Added auto hide of chat ended prompt on close or restart
|
52 |
+
* Fixed a possible injection issue within the notification control (Thanks to Nico from https://serhack.me)
|
53 |
+
* Fixed Gutenberg and Yoast compatibility issue
|
54 |
+
* Fixed minor issue with rest storage module
|
55 |
+
* Fixed minor styling issue with popup dashbaord
|
56 |
+
* Fixed some core issues which influenced custom fields (Pro)
|
57 |
+
* Fixed issue with Android Browser image missing in dashboard
|
58 |
+
* Fixed delete chat history not deleting messages
|
59 |
+
* Fixed nonce checking for non-logged in users failing on cached pages for AJAX and WP API
|
60 |
+
* Updated NL translation with GDPR strings (Google Translate)
|
61 |
+
* Updated EL translation files. Thanks to Ioannis Barkouzos
|
62 |
+
* Updated FR translation files. Thanks to Freitas Junior
|
63 |
+
* Updated IT translation files. Thanks to Carlo Piazzano
|
64 |
+
* Updated AR translation files.
|
65 |
+
*
|
66 |
+
* 8.0.14 - 2018-07-19 - Low priority
|
67 |
+
* Removed 'let' from wplc_server.js file (Adds Safari compatibility)
|
68 |
+
* Fixed issues with Google Analytics integration when using our servers
|
69 |
+
* Fixed issues with chat box styling with classic theme and GDPR module enabled
|
70 |
+
* Fixed issues with Contact From Ready integration styling with modern theme
|
71 |
+
* Fixed issues with Slack integration extension
|
72 |
+
* Bulgarian Translation Added (Thank you Emil Genchev!)
|
73 |
+
* Fixed erroneous display of set_time_limit and safe_mode warnings
|
74 |
+
* Fixed a big that lead to the deletion of sessions and not messages when a chat was marked for deletion
|
75 |
+
* Improved security in the chat history code
|
76 |
+
* Added better styling support for smaller width devices (<500px)
|
77 |
+
* Updated Swedish translation files
|
78 |
+
* Added Arabic translation files
|
79 |
+
* Fixed the duplicate message history loading in the history area
|
80 |
+
* Fixed core framework issues with Voice Note system
|
81 |
+
* Fixed an issue where invalid query selectors would break the 'Open chat via' functionality
|
82 |
+
* Fixed an issue with username encoding
|
83 |
+
* Fixed issue with surveys showing after chat end
|
84 |
+
* Fixed an issue with classic theme display when anchored to left/right positions
|
85 |
+
* Added auto transcript mailing to frontend end chat button, and REST API
|
86 |
+
* Added an 'incomplete' class when GDPR checkbox is not ticket, to draw attention to this input field
|
87 |
+
* Tested Multi-Site compatibility
|
88 |
+
* Updated all PO/MO files with updated sources
|
89 |
+
* Added default GDPR translations for DE, FR, ES, and IT languages (Using Google Translate)
|
90 |
+
*
|
91 |
+
* 8.0.13 - 2018-06-06 - Medium priority
|
92 |
+
* Fix chat delay not working for first visit and offline
|
93 |
+
* Optimize images
|
94 |
+
* Mootools compatibility
|
95 |
+
* Fix new chat request email notifications when Pro is active
|
96 |
+
*
|
97 |
+
* 8.0.12 - 2018-05-29 - High priority
|
98 |
+
* Fixed a bug which caused the chat box not to display on some sites
|
99 |
+
* Fixed minor styling issues
|
100 |
+
*
|
101 |
+
* 8.0.11 - 2018-05-28 - High priority
|
102 |
+
* Fixed a bug that caused a fatal error on PHP 5.3 and below
|
103 |
+
*/
|
104 |
+
|
105 |
+
//error_reporting(E_ERROR);
|
106 |
+
global $wplc_version;
|
107 |
+
global $wplc_p_version;
|
108 |
+
global $wplc_tblname;
|
109 |
+
global $wpdb;
|
110 |
+
global $wplc_tblname_chats;
|
111 |
+
global $wplc_tblname_msgs;
|
112 |
+
global $wplc_tblname_offline_msgs;
|
113 |
+
|
114 |
+
/**
|
115 |
+
* This stores the admin chat data once so that we do not need to keep sourcing it via the WP DB or Cloud DB
|
116 |
+
*/
|
117 |
+
global $admin_chat_data;
|
118 |
+
$admin_chat_data = false;
|
119 |
+
|
120 |
+
global $debug_start;
|
121 |
+
|
122 |
+
$wplc_tblname_offline_msgs = $wpdb->prefix . "wplc_offline_messages";
|
123 |
+
$wplc_tblname_chats = $wpdb->prefix . "wplc_chat_sessions";
|
124 |
+
$wplc_tblname_msgs = $wpdb->prefix . "wplc_chat_msgs";
|
125 |
+
$wplc_version = "8.0.23";
|
126 |
+
|
127 |
+
define('WPLC_BASIC_PLUGIN_DIR', dirname(__FILE__));
|
128 |
+
define('WPLC_BASIC_PLUGIN_URL', plugins_url( '/', __FILE__ ) );
|
129 |
+
define('WPLC_PLUGIN', plugin_basename( __FILE__ ) );
|
130 |
+
global $wplc_basic_plugin_url;
|
131 |
+
$wplc_basic_plugin_url = WPLC_BASIC_PLUGIN_URL;
|
132 |
+
|
133 |
+
|
134 |
+
global $wplc_pro_version;
|
135 |
+
$wplc_ver = str_replace('.', '', $wplc_pro_version);
|
136 |
+
$checker = intval($wplc_ver);
|
137 |
+
if (function_exists("wplc_pro_version_control") && $checker < 6000) { } else {
|
138 |
+
require_once (plugin_dir_path(__FILE__) . "ajax_new.php");
|
139 |
+
}
|
140 |
+
|
141 |
+
require_once (plugin_dir_path(__FILE__) . "functions.php");
|
142 |
+
require_once (plugin_dir_path(__FILE__) . "includes/deprecated.php");
|
143 |
+
require_once (plugin_dir_path(__FILE__) . "includes/surveys.php");
|
144 |
+
require_once (plugin_dir_path(__FILE__) . "includes/notification_control.php");
|
145 |
+
require_once (plugin_dir_path(__FILE__) . "includes/modal_control.php");
|
146 |
+
require_once (plugin_dir_path(__FILE__) . "modules/documentation_suggestions.php");
|
147 |
+
require_once (plugin_dir_path(__FILE__) . "modules/offline_messages_custom_fields.php");
|
148 |
+
require_once (plugin_dir_path(__FILE__) . "modules/google_analytics.php");
|
149 |
+
require_once (plugin_dir_path(__FILE__) . "modules/api/wplc-api.php");
|
150 |
+
require_once (plugin_dir_path(__FILE__) . "modules/beta_features.php");
|
151 |
+
require_once (plugin_dir_path(__FILE__) . "modules/node_server.php");
|
152 |
+
require_once (plugin_dir_path(__FILE__) . "modules/module_gif.php");
|
153 |
+
require_once (plugin_dir_path(__FILE__) . "includes/update_control.class.php");
|
154 |
+
require_once (plugin_dir_path(__FILE__) . "modules/webhooks_manager.php");
|
155 |
+
require_once (plugin_dir_path(__FILE__) . "modules/privacy.php");
|
156 |
+
|
157 |
+
// Gutenberg Blocks
|
158 |
+
require_once (plugin_dir_path(__FILE__) . "includes/blocks/wplc-chat-box/index.php");
|
159 |
+
require_once (plugin_dir_path(__FILE__) . "includes/blocks/wplc-inline-chat-box/index.php");
|
160 |
+
|
161 |
+
// Shortcodes
|
162 |
+
require_once (plugin_dir_path(__FILE__) . "includes/shortcodes.php");
|
163 |
+
|
164 |
+
add_action( 'wp_ajax_wplc_admin_set_transient', 'wplc_action_callback' );
|
165 |
+
add_action( 'wp_ajax_wplc_admin_remove_transient', 'wplc_action_callback' );
|
166 |
+
add_action( 'wp_ajax_wplc_hide_ftt', 'wplc_action_callback' );
|
167 |
+
add_action( 'wp_ajax_nopriv_wplc_user_send_offline_message', 'wplc_action_callback' );
|
168 |
+
add_action( 'wp_ajax_wplc_user_send_offline_message', 'wplc_action_callback' );
|
169 |
+
add_action( 'wp_ajax_delete_offline_message', 'wplc_action_callback' );
|
170 |
+
add_action( 'wp_ajax_wplc_a2a_dismiss', 'wplc_action_callback' );
|
171 |
+
add_action( 'init', 'wplc_version_control' );
|
172 |
+
add_action( "activated_plugin", "wplc_redirect_on_activate" );
|
173 |
+
add_action( 'wp_footer', 'wplc_display_box' );
|
174 |
+
add_action( 'init', 'wplc_init' );
|
175 |
+
|
176 |
+
|
177 |
+
|
178 |
+
if (function_exists('wplc_head_pro')) {
|
179 |
+
add_action('admin_init', 'wplc_head_pro');
|
180 |
+
} else {
|
181 |
+
add_action('admin_init', 'wplc_head_basic');
|
182 |
+
}
|
183 |
+
|
184 |
+
add_action('wp_enqueue_scripts', 'wplc_add_user_stylesheet');
|
185 |
+
add_action('admin_enqueue_scripts', 'wplc_add_admin_stylesheet');
|
186 |
+
|
187 |
+
if (function_exists('wplc_admin_menu_pro')) {
|
188 |
+
add_action('admin_menu', 'wplc_admin_menu_pro');
|
189 |
+
} else {
|
190 |
+
add_action('admin_menu', 'wplc_admin_menu', 4);
|
191 |
+
}
|
192 |
+
add_action('admin_head', 'wplc_superadmin_javascript');
|
193 |
+
register_activation_hook(__FILE__, 'wplc_activate');
|
194 |
+
|
195 |
+
|
196 |
+
function wplc_basic_check() {
|
197 |
+
// check if basic exists if pro is installed
|
198 |
+
}
|
199 |
+
|
200 |
+
function wplc_init() {
|
201 |
+
$plugin_dir = basename(dirname(__FILE__)) . "/languages/";
|
202 |
+
load_plugin_textdomain('wplivechat', false, $plugin_dir);
|
203 |
+
|
204 |
+
|
205 |
+
}
|
206 |
+
|
207 |
+
|
208 |
+
/**
|
209 |
+
* Redirect the user to the welcome page on plugin activate
|
210 |
+
* @param string $plugin
|
211 |
+
* @return void
|
212 |
+
*/
|
213 |
+
function wplc_redirect_on_activate( $plugin ) {
|
214 |
+
|
215 |
+
if( $plugin == plugin_basename( __FILE__ ) ) {
|
216 |
+
if (get_option("WPLC_V8_FIRST_TIME") == true) {
|
217 |
+
update_option("WPLC_V8_FIRST_TIME",false);
|
218 |
+
// clean the output header and redirect the user
|
219 |
+
@ob_flush();
|
220 |
+
@ob_end_flush();
|
221 |
+
@ob_end_clean();
|
222 |
+
exit( wp_redirect( admin_url( 'admin.php?page=wplivechat-menu&action=welcome' ) ) );
|
223 |
+
}
|
224 |
+
}
|
225 |
+
}
|
226 |
+
|
227 |
+
|
228 |
+
add_action( 'admin_init', 'wplc_redirect_on_activate' );
|
229 |
+
|
230 |
+
|
231 |
+
|
232 |
+
function wplc_version_control() {
|
233 |
+
|
234 |
+
global $wplc_version;
|
235 |
+
|
236 |
+
|
237 |
+
$current_version = get_option("wplc_current_version");
|
238 |
+
if (!isset($current_version) || $current_version != $wplc_version) {
|
239 |
+
|
240 |
+
$wplc_settings = get_option( 'WPLC_SETTINGS' );
|
241 |
+
|
242 |
+
/**
|
243 |
+
* Are we updating from a version before version 8?
|
244 |
+
* If yes, set NODE to enabled
|
245 |
+
*/
|
246 |
+
if ( isset( $current_version ) ) {
|
247 |
+
$main_ver = intval( $current_version[0] );
|
248 |
+
if ( $main_ver < 8 ) {
|
249 |
+
if ( $wplc_settings ) {
|
250 |
+
$wplc_settings['wplc_use_node_server'] = 1;
|
251 |
+
|
252 |
+
update_option( "WPLC_V8_FIRST_TIME", true );
|
253 |
+
|
254 |
+
}
|
255 |
+
}
|
256 |
+
|
257 |
+
}
|
258 |
+
|
259 |
+
|
260 |
+
$admins = get_role('administrator');
|
261 |
+
if( $admins !== null ) {
|
262 |
+
$admins->add_cap('wplc_ma_agent');
|
263 |
+
}
|
264 |
+
|
265 |
+
$uid = get_current_user_id();
|
266 |
+
update_user_meta($uid, 'wplc_ma_agent', 1);
|
267 |
+
update_user_meta($uid, "wplc_chat_agent_online", time());
|
268 |
+
|
269 |
+
/*$wplc_super_admins = get_super_admins();
|
270 |
+
|
271 |
+
foreach( $wplc_super_admins as $super_admin ){
|
272 |
+
|
273 |
+
$user = get_user_by( 'login', $super_admin );
|
274 |
+
|
275 |
+
$wplc_super_admin_id = $user->ID;
|
276 |
+
|
277 |
+
update_user_meta( $wplc_super_admin_id, 'wplc_ma_agent', 1);
|
278 |
+
update_user_meta( $wplc_super_admin_id, "wplc_chat_agent_online", time());
|
279 |
+
|
280 |
+
break;
|
281 |
+
|
282 |
+
}
|
283 |
+
*/
|
284 |
+
|
285 |
+
|
286 |
+
/* add caps to admin */
|
287 |
+
if (current_user_can('manage_options')) {
|
288 |
+
global $user_ID;
|
289 |
+
$user = new WP_User($user_ID);
|
290 |
+
foreach ($user->roles as $urole) {
|
291 |
+
if ($urole == "administrator") {
|
292 |
+
$admins = get_role('administrator');
|
293 |
+
$admins->add_cap('edit_wplc_quick_response');
|
294 |
+
$admins->add_cap('edit_wplc_quick_response');
|
295 |
+
$admins->add_cap('edit_other_wplc_quick_response');
|
296 |
+
$admins->add_cap('publish_wplc_quick_response');
|
297 |
+
$admins->add_cap('read_wplc_quick_response');
|
298 |
+
$admins->add_cap('read_private_wplc_quick_response');
|
299 |
+
$admins->add_cap('delete_wplc_quick_response');
|
300 |
+
}
|
301 |
+
}
|
302 |
+
}
|
303 |
+
|
304 |
+
|
305 |
+
|
306 |
+
if (!isset($wplc_settings['wplc_pro_na'])) { $wplc_settings["wplc_pro_na"] = __("Chat offline. Leave a message", "wplivechat"); }
|
307 |
+
if (!isset($wplc_settings['wplc_pro_intro'])) { $wplc_settings["wplc_pro_intro"] = __("Hello. Please input your details so that I may help you.", "wplivechat"); }
|
308 |
+
if (!isset($wplc_settings['wplc_pro_offline1'])) { $wplc_settings["wplc_pro_offline1"] = __("We are currently offline. Please leave a message and we'll get back to you shortly.", "wplivechat"); }
|
309 |
+
if (!isset($wplc_settings['wplc_pro_offline2'])) { $wplc_settings["wplc_pro_offline2"] = __("Sending message...", "wplivechat"); }
|
310 |
+
if (!isset($wplc_settings['wplc_pro_offline3'])) { $wplc_settings["wplc_pro_offline3"] = __("Thank you for your message. We will be in contact soon.", "wplivechat"); }
|
311 |
+
if (!isset($wplc_settings['wplc_pro_offline_btn']) || (isset($wplc_settings['wplc_pro_offline_btn']) && $wplc_settings['wplc_pro_offline_btn'] == "")) { $wplc_settings["wplc_pro_offline_btn"] = __("Leave a message", "wplivechat"); }
|
312 |
+
if (!isset($wplc_settings['wplc_pro_offline_btn_send']) || (isset($wplc_settings['wplc_pro_offline_btn_send']) && $wplc_settings['wplc_pro_offline_btn_send'] == "")) { $wplc_settings["wplc_pro_offline_btn_send"] = __("Send message", "wplivechat"); }
|
313 |
+
if (!isset($wplc_settings['wplc_pro_fst1'])) { $wplc_settings["wplc_pro_fst1"] = __("Questions?", "wplivechat"); }
|
314 |
+
if (!isset($wplc_settings['wplc_pro_fst2'])) { $wplc_settings["wplc_pro_fst2"] = __("Chat with us", "wplivechat"); }
|
315 |
+
if (!isset($wplc_settings['wplc_pro_fst3'])) { $wplc_settings["wplc_pro_fst3"] = __("Start live chat", "wplivechat"); }
|
316 |
+
if (!isset($wplc_settings['wplc_pro_sst1'])) { $wplc_settings["wplc_pro_sst1"] = __("Start Chat", "wplivechat"); }
|
317 |
+
if (!isset($wplc_settings['wplc_pro_sst1_survey'])) { $wplc_settings["wplc_pro_sst1_survey"] = __("Or chat to an agent now", "wplivechat"); }
|
318 |
+
if (!isset($wplc_settings['wplc_pro_sst1e_survey'])) { $wplc_settings["wplc_pro_sst1e_survey"] = __("Chat ended", "wplivechat"); }
|
319 |
+
if (!isset($wplc_settings['wplc_pro_sst2'])) { $wplc_settings["wplc_pro_sst2"] = __("Connecting. Please be patient...", "wplivechat"); }
|
320 |
+
if (!isset($wplc_settings['wplc_pro_tst1'])) { $wplc_settings["wplc_pro_tst1"] = __("Reactivating your previous chat...", "wplivechat"); }
|
321 |
+
if (!isset($wplc_settings['wplc_user_welcome_chat'])) { $wplc_settings["wplc_user_welcome_chat"] = __("Welcome. How may I help you?", "wplivechat"); }
|
322 |
+
if (!isset($wplc_settings['wplc_welcome_msg'])) { $wplc_settings['wplc_welcome_msg'] = __("Please standby for an agent. While you wait for the agent you may type your message.","wplivechat"); }
|
323 |
+
if (!isset($wplc_settings['wplc_user_enter'])) { $wplc_settings["wplc_user_enter"] = __("Press ENTER to send your message", "wplivechat"); }
|
324 |
+
if (!isset($wplc_settings['wplc_close_btn_text'])) { $wplc_settings["wplc_close_btn_text"] = __("close", "wplivechat"); }
|
325 |
+
|
326 |
+
|
327 |
+
if (!isset($wplc_settings['wplc_powered_by_link'])) { $wplc_settings["wplc_powered_by_link"] = "0"; }
|
328 |
+
|
329 |
+
|
330 |
+
|
331 |
+
/* users who are updating will stay on the existing theme */
|
332 |
+
if (get_option("WPLC_V8_FIRST_TIME")) {} else {
|
333 |
+
if (!isset($wplc_settings['wplc_newtheme'])) { $wplc_settings["wplc_newtheme"] = "theme-2"; }
|
334 |
+
}
|
335 |
+
|
336 |
+
|
337 |
+
if (!isset($wplc_settings['wplc_settings_color1'])) { $wplc_settings["wplc_settings_color1"] = "ED832F"; }
|
338 |
+
if (!isset($wplc_settings['wplc_settings_color2'])) { $wplc_settings["wplc_settings_color2"] = "FFFFFF"; }
|
339 |
+
if (!isset($wplc_settings['wplc_settings_color3'])) { $wplc_settings["wplc_settings_color3"] = "EEEEEE"; }
|
340 |
+
if (!isset($wplc_settings['wplc_settings_color4'])) { $wplc_settings["wplc_settings_color4"] = "666666"; }
|
341 |
+
|
342 |
+
|
343 |
+
|
344 |
+
if (!isset($wplc_settings['wplc_settings_align'])) { $wplc_settings["wplc_settings_align"] = 2; }
|
345 |
+
|
346 |
+
if (!isset($wplc_settings['wplc_settings_enabled'])) { $wplc_settings["wplc_settings_enabled"] = 1; }
|
347 |
+
|
348 |
+
if (!isset($wplc_settings['wplc_settings_fill'])) { $wplc_settings["wplc_settings_fill"] = "ed832f"; }
|
349 |
+
|
350 |
+
if (!isset($wplc_settings['wplc_settings_font'])) { $wplc_settings["wplc_settings_font"] = "FFFFFF"; }
|
351 |
+
|
352 |
+
if (!isset($wplc_settings['wplc_preferred_gif_provider'])) { $wplc_settings["wplc_preferred_gif_provider"] = 1; }
|
353 |
+
if (!isset($wplc_settings['wplc_giphy_api_key'])) { $wplc_settings["wplc_giphy_api_key"] = ""; }
|
354 |
+
if (!isset($wplc_settings['wplc_tenor_api_key'])) { $wplc_settings["wplc_tenor_api_key"] = ""; }
|
355 |
+
|
356 |
+
wplc_handle_db();
|
357 |
+
update_option("wplc_current_version", $wplc_version);
|
358 |
+
|
359 |
+
|
360 |
+
if (!isset($wplc_settings['wplc_require_user_info'])) { $wplc_settings['wplc_require_user_info'] = "1"; }
|
361 |
+
if (!isset($wplc_settings['wplc_user_default_visitor_name'])) {
|
362 |
+
$wplc_default_visitor_name = __( "Guest", "wplivechat" );
|
363 |
+
$wplc_settings['wplc_user_default_visitor_name'] = $wplc_default_visitor_name;
|
364 |
+
}
|
365 |
+
if (!isset($wplc_settings['wplc_loggedin_user_info'])) { $wplc_settings['wplc_loggedin_user_info'] = "1"; }
|
366 |
+
if (!isset($wplc_settings['wplc_user_alternative_text'])) {
|
367 |
+
$wplc_alt_text = __("Please click \'Start Chat\' to initiate a chat with an agent", "wplivechat");
|
368 |
+
$wplc_settings['wplc_user_alternative_text'] = $wplc_alt_text;
|
369 |
+
}
|
370 |
+
if (!isset($wplc_settings['wplc_enabled_on_mobile'])) { $wplc_settings['wplc_enabled_on_mobile'] = "1"; }
|
371 |
+
if(!isset($wplc_settings['wplc_record_ip_address'])){ $wplc_settings['wplc_record_ip_address'] = "0"; }
|
372 |
+
if(!isset($wplc_settings['wplc_enable_msg_sound'])){ $wplc_settings['wplc_enable_msg_sound'] = "1"; }
|
373 |
+
if(!isset($wplc_settings['wplc_enable_font_awesome'])){ $wplc_settings['wplc_enable_font_awesome'] = "1"; }
|
374 |
+
if(!isset($wplc_settings['wplc_using_localization_plugin'])){ $wplc_settings['wplc_using_localization_plugin'] = 0; }
|
375 |
+
|
376 |
+
$wplc_settings = apply_filters('wplc_update_settings_between_versions_hook', $wplc_settings); //Added in 8.0.09
|
377 |
+
|
378 |
+
update_option("WPLC_SETTINGS", $wplc_settings);
|
379 |
+
|
380 |
+
do_action("wplc_update_hook");
|
381 |
+
}
|
382 |
+
|
383 |
+
|
384 |
+
|
385 |
+
}
|
386 |
+
|
387 |
+
add_action("wplc_hook_set_transient","wplc_hook_control_set_transient",10);
|
388 |
+
function wplc_hook_control_set_transient() {
|
389 |
+
$should_set_transient = apply_filters("wplc_filter_control_set_transient",true);
|
390 |
+
if ($should_set_transient) {
|
391 |
+
set_transient("wplc_is_admin_logged_in", "1", 70);
|
392 |
+
}
|
393 |
+
}
|
394 |
+
|
395 |
+
add_action("wplc_hook_remove_transient","wplc_hook_control_remove_transient",10);
|
396 |
+
function wplc_hook_control_remove_transient() {
|
397 |
+
delete_transient('wplc_is_admin_logged_in');
|
398 |
+
}
|
399 |
+
|
400 |
+
function wplc_action_callback() {
|
401 |
+
global $wpdb;
|
402 |
+
global $wplc_tblname_chats;
|
403 |
+
$check = check_ajax_referer('wplc', 'security');
|
404 |
+
|
405 |
+
if ($check == 1) {
|
406 |
+
|
407 |
+
if( $_POST['action'] == 'wplc_a2a_dismiss' ){
|
408 |
+
$uid = get_current_user_id();
|
409 |
+
update_user_meta($uid, 'wplc_a2a_upsell', 1);
|
410 |
+
}
|
411 |
+
|
412 |
+
if( $_POST['action'] == 'delete_offline_message' ){
|
413 |
+
|
414 |
+
global $wplc_tblname_offline_msgs;
|
415 |
+
|
416 |
+
$mid = sanitize_text_field( $_POST['mid'] );
|
417 |
+
|
418 |
+
$sql = "DELETE FROM `$wplc_tblname_offline_msgs` WHERE `id` = '$mid'";
|
419 |
+
$query = $wpdb->Query($sql);
|
420 |
+
|
421 |
+
if( $query ){
|
422 |
+
|
423 |
+
echo 1;
|
424 |
+
|
425 |
+
}
|
426 |
+
|
427 |
+
}
|
428 |
+
|
429 |
+
if ($_POST['action'] == "wplc_user_send_offline_message") {
|
430 |
+
if(function_exists('wplc_send_offline_msg')){ wplc_send_offline_msg($_POST['name'], $_POST['email'], $_POST['msg'], $_POST['cid']); }
|
431 |
+
if(function_exists('wplc_store_offline_message')){ wplc_store_offline_message($_POST['name'], $_POST['email'], $_POST['msg']); }
|
432 |
+
do_action("wplc_hook_offline_message",array(
|
433 |
+
"cid"=>$_POST['cid'],
|
434 |
+
"name"=>$_POST['name'],
|
435 |
+
"email"=>$_POST['email'],
|
436 |
+
"url"=>get_site_url(),
|
437 |
+
"msg"=>$_POST['msg']
|
438 |
+
)
|
439 |
+
);
|
440 |
+
}
|
441 |
+
if ($_POST['action'] == "wplc_admin_set_transient") {
|
442 |
+
do_action("wplc_hook_set_transient");
|
443 |
+
|
444 |
+
}
|
445 |
+
if ($_POST['action'] == "wplc_admin_remove_transient") {
|
446 |
+
do_action("wplc_hook_remove_transient");
|
447 |
+
|
448 |
+
}
|
449 |
+
if ($_POST['action'] == 'wplc_hide_ftt') {
|
450 |
+
update_option("WPLC_FIRST_TIME_TUTORIAL",true);
|
451 |
+
}
|
452 |
+
do_action("wplc_hook_action_callback");
|
453 |
+
}
|
454 |
+
die(); // this is required to return a proper result
|
455 |
+
}
|
456 |
+
|
457 |
+
|
458 |
+
|
459 |
+
/**
|
460 |
+
* Decide who gets to see the various main menus (left navigation)
|
461 |
+
* @return array
|
462 |
+
* @since 6.0.00
|
463 |
+
* @author Nick Duncan <nick@codecabin.co.za>
|
464 |
+
*/
|
465 |
+
add_filter("wplc_ma_filter_menu_control","wplc_filter_control_menu_control",10,1);
|
466 |
+
function wplc_filter_control_menu_control() {
|
467 |
+
$array = array(
|
468 |
+
0 => 'read', /* main menu */
|
469 |
+
1 => 'read', /* settings */
|
470 |
+
2 => 'read', /* history */
|
471 |
+
3 => 'read', /* missed chats */
|
472 |
+
4 => 'read', /* offline messages */
|
473 |
+
5 => 'read', /* feedback */
|
474 |
+
6 => 'read' /* surveys */
|
475 |
+
);
|
476 |
+
return $array;
|
477 |
+
}
|
478 |
+
|
479 |
+
add_action('admin_init', 'wplc_metric_dashboard_redirect');
|
480 |
+
function wplc_metric_dashboard_redirect(){
|
481 |
+
try{
|
482 |
+
$cap = apply_filters("wplc_ma_filter_menu_control",array());
|
483 |
+
if(current_user_can($cap[1])){
|
484 |
+
if (isset($_GET['page'])) {
|
485 |
+
if ($_GET['page'] === 'wplivechat-menu') {
|
486 |
+
// check if we are overriding this redirect because the user pressed the "Chat now" button in the dashboard
|
487 |
+
if (isset($_GET['subaction']) && $_GET['subaction'] == 'override') { } else {
|
488 |
+
if(!isset($_COOKIE['wplcfirstsession'])) {
|
489 |
+
@setcookie("wplcfirstsession", true, time() + (60 * 10)); // 60 seconds ( 1 minute) * 20 = 20 minutes
|
490 |
+
@Header("Location: ./admin.php?page=wplivechat-menu-dashboard");
|
491 |
+
exit();
|
492 |
+
}
|
493 |
+
}
|
494 |
+
|
495 |
+
}
|
496 |
+
}
|
497 |
+
}
|
498 |
+
} catch (Exception $ex){
|
499 |
+
|
500 |
+
}
|
501 |
+
}
|
502 |
+
|
503 |
+
function wplc_admin_menu() {
|
504 |
+
|
505 |
+
$cap = apply_filters("wplc_ma_filter_menu_control",array());
|
506 |
+
if ( get_option("wplc_seen_surveys") ) { $survey_new = ""; } else { $survey_new = ' <span class="update-plugins"><span class="plugin-count">New</span></span>'; }
|
507 |
+
|
508 |
+
$wplc_current_user = get_current_user_id();
|
509 |
+
|
510 |
+
/* If user is either an agent or an admin, access the page. */
|
511 |
+
if( get_user_meta( $wplc_current_user, 'wplc_ma_agent', true ) || current_user_can("wplc_ma_agent")){
|
512 |
+
$wplc_mainpage = add_menu_page('WP Live Chat', __('Live Chat', 'wplivechat'), $cap[0], 'wplivechat-menu', 'wplc_admin_menu_layout', 'dashicons-format-chat');
|
513 |
+
add_submenu_page('wplivechat-menu', __('Dashboard', 'wplivechat'), __('Dashboard', 'wplivechat'), $cap[1], 'wplivechat-menu-dashboard', 'wplc_admin_dashboard_layout');
|
514 |
+
add_submenu_page('wplivechat-menu', __('Settings', 'wplivechat'), __('Settings', 'wplivechat'), $cap[1], 'wplivechat-menu-settings', 'wplc_admin_settings_layout');
|
515 |
+
add_submenu_page('wplivechat-menu', __('Surveys', 'wplivechat'), __('Surveys', 'wplivechat'). $survey_new, $cap[2], 'wplivechat-menu-survey', 'wplc_admin_survey_layout');
|
516 |
+
}
|
517 |
+
|
518 |
+
//Only if pro is not active
|
519 |
+
if(!function_exists("wplc_pro_reporting_page")){
|
520 |
+
add_submenu_page('wplivechat-menu', __('Reporting', 'wplivechat'), __('Reporting', 'edit_posts') . ' <span class="update-plugins"><span class="plugin-count">Pro</span></span>', $cap[0], 'wplc-basic-reporting', 'wplc_basic_reporting_page');
|
521 |
+
}
|
522 |
+
|
523 |
+
|
524 |
+
//Only if pro is not active
|
525 |
+
if(!function_exists("wplc_pro_triggers_page")){
|
526 |
+
add_submenu_page('wplivechat-menu', __('Triggers', 'wplivechat'), __('Triggers', 'edit_posts') . ' <span class="update-plugins"><span class="plugin-count">Pro</span></span>', $cap[0], 'wplc-basic-triggers', 'wplc_basic_triggers_page');
|
527 |
+
}
|
528 |
+
|
529 |
+
/* only if user is both an agent and an admin that has the cap assigned, can they access these pages */
|
530 |
+
if( get_user_meta( $wplc_current_user, 'wplc_ma_agent', true ) && current_user_can("wplc_ma_agent")){
|
531 |
+
|
532 |
+
add_submenu_page('wplivechat-menu', __('History', 'wplivechat'), __('History', 'wplivechat'), $cap[2], 'wplivechat-menu-history', 'wplc_admin_history_layout');
|
533 |
+
add_submenu_page('wplivechat-menu', __('Missed Chats', 'wplivechat'), __('Missed Chats', 'wplivechat'), $cap[3], 'wplivechat-menu-missed-chats', 'wplc_admin_missed_chats');
|
534 |
+
|
535 |
+
/* TO DO
|
536 |
+
Add a hook here so that the other plugins can add to the menu
|
537 |
+
Also make sure the function below is controled differently as the pro will not longer exist
|
538 |
+
*/
|
539 |
+
|
540 |
+
if (function_exists("wplc_admin_menu_pro")) {
|
541 |
+
global $wplc_pro_version;
|
542 |
+
if (intval(str_replace(".","",$wplc_pro_version)) <= 5100) {
|
543 |
+
/* do nothing as they have the pro active and their version of the pro makes use of offline messages */
|
544 |
+
|
545 |
+
} else {
|
546 |
+
add_submenu_page('wplivechat-menu', __('Offline Messages', 'wplivechat'), __('Offline Messages', 'wplivechat'), $cap[4], 'wplivechat-menu-offline-messages', 'wplc_admin_offline_messages');
|
547 |
+
}
|
548 |
+
} else {
|
549 |
+
add_submenu_page('wplivechat-menu', __('Offline Messages', 'wplivechat'), __('Offline Messages', 'wplivechat'), $cap[4], 'wplivechat-menu-offline-messages', 'wplc_admin_offline_messages');
|
550 |
+
|
551 |
+
}
|
552 |
+
do_action("wplc_hook_menu_mid",$cap);
|
553 |
+
|
554 |
+
|
555 |
+
add_submenu_page('wplivechat-menu', __('Support', 'wplivechat'), __('Support', 'wplivechat'), 'manage_options', 'wplivechat-menu-support-page', 'wplc_support_menu');
|
556 |
+
add_submenu_page('wplivechat-menu', __('Extensions', 'wplivechat'), __('Extensions', 'wplivechat'), 'manage_options', 'wplivechat-menu-extensions-page', 'wplc_extensions_menu');
|
557 |
+
}
|
558 |
+
do_action("wplc_hook_menu");
|
559 |
+
}
|
560 |
+
|
561 |
+
|
562 |
+
add_action("wplc_hook_menu","wplc_hook_control_menu");
|
563 |
+
function wplc_hook_control_menu() {
|
564 |
+
$check = apply_filters("wplc_filter_menu_api",0);
|
565 |
+
if ($check > 0) {
|
566 |
+
add_submenu_page('wplivechat-menu', __('API Keys', 'wplivechat'), __('API Keys', 'wplivechat'), 'manage_options', 'wplivechat-menu-api-keys-page', 'wplc_api_keys_menu');
|
567 |
+
}
|
568 |
+
}
|
569 |
+
|
570 |
+
|
571 |
+
function wplc_api_keys_menu() {
|
572 |
+
$page_content = "<h1>".__("Premium Extension API Keys","wplivechat")."</h3>";
|
573 |
+
$page_content .= "<p>".__("To find and manage your premium API keys, please visit your <a target='_BLANK' href='https://wp-livechat.com/my-account/'>my account</a> page.","")."</p>";
|
574 |
+
|
575 |
+
$page_content .= "<hr />";
|
576 |
+
$page_content = apply_filters("wplc_filter_api_page",$page_content);
|
577 |
+
|
578 |
+
|
579 |
+
echo $page_content;
|
580 |
+
}
|
581 |
+
|
582 |
+
|
583 |
+
add_action("wp_head","wplc_load_user_js",0);
|
584 |
+
|
585 |
+
|
586 |
+
function wplc_load_user_js () {
|
587 |
+
if (!is_admin()) {
|
588 |
+
if (in_array($GLOBALS['pagenow'], array('wp-login.php', 'wp-register.php'))) {
|
589 |
+
return false;
|
590 |
+
}
|
591 |
+
|
592 |
+
|
593 |
+
if(function_exists('wplc_display_chat_contents')){
|
594 |
+
$display_contents = wplc_display_chat_contents();
|
595 |
+
} else {
|
596 |
+
$display_contents = 1;
|
597 |
+
}
|
598 |
+
|
599 |
+
if(function_exists('wplc_is_user_banned_basic')){
|
600 |
+
$user_banned = wplc_is_user_banned_basic();
|
601 |
+
} else {
|
602 |
+
$user_banned = 0;
|
603 |
+
}
|
604 |
+
$display_contents = apply_filters("wplc_filter_display_contents",$display_contents);
|
605 |
+
|
606 |
+
if($display_contents && $user_banned == 0){
|
607 |
+
|
608 |
+
/* do not show if pro is outdated */
|
609 |
+
global $wplc_pro_version;
|
610 |
+
if (isset($wplc_pro_version)) {
|
611 |
+
$float_version = floatval($wplc_pro_version);
|
612 |
+
if ($float_version < 4 || $wplc_pro_version == "4.1.0" || $wplc_pro_version == "4.1.1") {
|
613 |
+
return;
|
614 |
+
}
|
615 |
+
}
|
616 |
+
|
617 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
618 |
+
if (!class_exists('Mobile_Detect')) {
|
619 |
+
require_once (plugin_dir_path(__FILE__) . 'includes/Mobile_Detect.php');
|
620 |
+
}
|
621 |
+
$wplc_detect_device = new Mobile_Detect;
|
622 |
+
$wplc_is_mobile = $wplc_detect_device->isMobile();
|
623 |
+
|
624 |
+
if ($wplc_is_mobile && isset($wplc_settings['wplc_enabled_on_mobile']) && $wplc_settings['wplc_enabled_on_mobile'] == '0') {
|
625 |
+
return;
|
626 |
+
}
|
627 |
+
|
628 |
+
if (function_exists("wplc_register_pro_version")) {
|
629 |
+
if (function_exists('wplc_basic_hide_chat_when_offline')) {
|
630 |
+
$wplc_hide_chat = wplc_basic_hide_chat_when_offline();
|
631 |
+
if (!$wplc_hide_chat) {
|
632 |
+
if (function_exists("wplc_push_js_to_front_pro")) {
|
633 |
+
wplc_push_js_to_front_pro();
|
634 |
+
}
|
635 |
+
}
|
636 |
+
} else {
|
637 |
+
if (function_exists("wplc_push_js_to_front_pro")) {
|
638 |
+
wplc_push_js_to_front_pro();
|
639 |
+
}
|
640 |
+
}
|
641 |
+
} else {
|
642 |
+
wplc_push_js_to_front_basic();
|
643 |
+
}
|
644 |
+
}
|
645 |
+
}
|
646 |
+
|
647 |
+
|
648 |
+
|
649 |
+
|
650 |
+
|
651 |
+
}
|
652 |
+
|
653 |
+
function wplc_push_js_to_front_basic() {
|
654 |
+
global $wplc_is_mobile;
|
655 |
+
global $wplc_version;
|
656 |
+
|
657 |
+
wp_register_script('wplc-user-jquery-cookie', plugins_url('/js/jquery-cookie.js', __FILE__), array('jquery'),false, false);
|
658 |
+
wp_enqueue_script('wplc-user-jquery-cookie');
|
659 |
+
|
660 |
+
wp_enqueue_script('jquery');
|
661 |
+
|
662 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
663 |
+
$wplc_acbc_data = get_option("WPLC_ACBC_SETTINGS");
|
664 |
+
$wplc_ga_enabled = get_option("WPLC_GA_SETTINGS");
|
665 |
+
|
666 |
+
if (isset($wplc_settings['wplc_display_to_loggedin_only']) && $wplc_settings['wplc_display_to_loggedin_only'] == 1) {
|
667 |
+
/* Only show to users that are logged in */
|
668 |
+
if (!is_user_logged_in()) {
|
669 |
+
return;
|
670 |
+
}
|
671 |
+
}
|
672 |
+
|
673 |
+
/* is the chat enabled? */
|
674 |
+
if ($wplc_settings["wplc_settings_enabled"] == 2) { return; }
|
675 |
+
|
676 |
+
wp_register_script('wplc-md5', plugins_url('/js/md5.js', __FILE__),array('wplc-user-script'),$wplc_version);
|
677 |
+
wp_enqueue_script('wplc-md5');
|
678 |
+
if (isset($wplc_settings['wplc_display_name']) && $wplc_settings['wplc_display_name'] == 1) {
|
679 |
+
$wplc_display = 'display';
|
680 |
+
} else {
|
681 |
+
$wplc_display = 'hide';
|
682 |
+
}
|
683 |
+
|
684 |
+
|
685 |
+
if (isset($wplc_settings['wplc_enable_msg_sound']) && intval($wplc_settings['wplc_enable_msg_sound']) == 1) { $wplc_ding = '1'; } else { $wplc_ding = '0'; }
|
686 |
+
|
687 |
+
$ajax_nonce = wp_create_nonce("wplc");
|
688 |
+
if (!function_exists("wplc_register_pro_version")) {
|
689 |
+
$ajaxurl = admin_url('admin-ajax.php');
|
690 |
+
$wplc_ajaxurl = $ajaxurl;
|
691 |
+
}
|
692 |
+
|
693 |
+
|
694 |
+
wp_register_script('wplc-server-script', plugins_url('/js/wplc_server.js', __FILE__), array('jquery'), $wplc_version);
|
695 |
+
wp_enqueue_script('wplc-server-script');
|
696 |
+
|
697 |
+
wp_localize_script( 'wplc-server-script', 'wplc_datetime_format', array(
|
698 |
+
'date_format' => get_option( 'date_format' ),
|
699 |
+
'time_format' => get_option( 'time_format' ),
|
700 |
+
) );
|
701 |
+
|
702 |
+
if(isset($wplc_settings['wplc_use_node_server']) && $wplc_settings['wplc_use_node_server'] == 1){
|
703 |
+
wp_localize_script('wplc-server-script', 'wplc_use_node_server', "true");
|
704 |
+
|
705 |
+
$wplc_node_token = get_option("wplc_node_server_secret_token");
|
706 |
+
if(!$wplc_node_token){
|
707 |
+
if(function_exists("wplc_node_server_token_regenerate")){
|
708 |
+
wplc_node_server_token_regenerate();
|
709 |
+
$wplc_node_token = get_option("wplc_node_server_secret_token");
|
710 |
+
}
|
711 |
+
}
|
712 |
+
wp_localize_script('wplc-server-script', 'bleeper_api_key', $wplc_node_token);
|
713 |
+
|
714 |
+
|
715 |
+
|
716 |
+
$wplc_end_point_override = get_option("wplc_end_point_override");
|
717 |
+
if($wplc_end_point_override !== false && $wplc_end_point_override !== ""){
|
718 |
+
$bleeper_url = $wplc_end_point_override; //Use the override URL
|
719 |
+
} else {
|
720 |
+
$bleeper_url = BLEEPER_NODE_SERVER_URL;
|
721 |
+
}
|
722 |
+
//wp_register_script('wplc-node-server-script', trailingslashit( $bleeper_url ) . "socket.io/socket.io.js", array('jquery'), $wplc_version);
|
723 |
+
wp_register_script('wplc-node-server-script', "https://bleeper.io/app/assets/js/vendor/socket.io/socket.io.slim.js", array('jquery'), $wplc_version);
|
724 |
+
|
725 |
+
|
726 |
+
//wp_register_script('wplc-node-server-script', 'http://localhost:3000/socket.io/socket.io.js', array('jquery'), $wplc_version);
|
727 |
+
wp_enqueue_script('wplc-node-server-script');
|
728 |
+
wp_register_script('wplc-user-events-script', plugins_url('/js/wplc_u_node_events.js', __FILE__),array('jquery', 'wplc-server-script'),$wplc_version);
|
729 |
+
|
730 |
+
wp_localize_script('wplc-server-script', 'bleeper_override_upload_url', rest_url( 'wp_live_chat_support/v1/remote_upload' ) );
|
731 |
+
|
732 |
+
/** DEPRECATED BY GDPR */
|
733 |
+
/*if(isset($wplc_settings['wplc_record_ip_address']) && $wplc_settings['wplc_record_ip_address'] == 1) {
|
734 |
+
$ip_address = false;
|
735 |
+
if(isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR'] != '') { $ip_address = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { $ip_address = $_SERVER['REMOTE_ADDR']; }
|
736 |
+
|
737 |
+
if($ip_address !== false){
|
738 |
+
wp_localize_script('wplc-server-script', 'bleeper_user_ip_address', $ip_address);
|
739 |
+
}
|
740 |
+
}*/
|
741 |
+
|
742 |
+
$wplc_server_location = get_option( "wplc_server_location" );
|
743 |
+
$wplc_server_location = apply_filters('wplc_node_server_default_selection_override', $wplc_server_location, $wplc_settings);
|
744 |
+
|
745 |
+
if( $wplc_server_location !== false && $wplc_server_location !== "" && $wplc_server_location !== "auto" ){
|
746 |
+
if ( $wplc_server_location === "us1") { $wplc_server_location = "0"; }
|
747 |
+
else if ( $wplc_server_location === "us2") { $wplc_server_location = "3"; }
|
748 |
+
else if ( $wplc_server_location === "eu1") { $wplc_server_location = "1"; }
|
749 |
+
else if ( $wplc_server_location === "eu2") { $wplc_server_location = "2"; }
|
750 |
+
else { $wplc_server_location = "0"; }
|
751 |
+
wp_localize_script( 'wplc-server-script', 'bleeper_server_location', $wplc_server_location );
|
752 |
+
}
|
753 |
+
|
754 |
+
|
755 |
+
$wplc_end_point_override = get_option("wplc_end_point_override");
|
756 |
+
if($wplc_end_point_override !== false && $wplc_end_point_override !== ""){
|
757 |
+
wp_localize_script( 'wplc-server-script', 'bleeper_end_point_override', $wplc_end_point_override );
|
758 |
+
}
|
759 |
+
//For node verification
|
760 |
+
if(function_exists("wplc_pro_activate")){
|
761 |
+
wp_localize_script('wplc-server-script', 'bleeper_pro_auth', get_option('wp-live-chat-support-pro_key', "false"));
|
762 |
+
} else {
|
763 |
+
wp_localize_script('wplc-server-script', 'bleeper_pro_auth', 'false');
|
764 |
+
}
|
765 |
+
|
766 |
+
|
767 |
+
|
768 |
+
//Emoji Libs
|
769 |
+
if(empty($wplc_settings['wplc_disable_emojis'])) {
|
770 |
+
//wp_register_script('wplc-user-js-emoji', "https://bleeper.io/app/assets/wdt-emoji/emoji.min.js", array("wplc-server-script", "wplc-server-script"), $wplc_version, false);
|
771 |
+
//wp_enqueue_script('wplc-user-js-emoji');
|
772 |
+
//wp_register_script('wplc-user-js-emoji-bundle', "https://bleeper.io/app/assets/wdt-emoji/wdt-emoji-bundle.min.js", array("wplc-server-script", "wplc-server-script", "wplc-user-js-emoji"), $wplc_version, false);
|
773 |
+
//wp_enqueue_script('wplc-user-js-emoji-bundle');
|
774 |
+
|
775 |
+
wp_register_script('wplc-user-js-emoji-concat', "https://bleeper.io/app/assets/wdt-emoji/wdt-emoji-concat.min.js", array("wplc-server-script", "wplc-server-script"), $wplc_version, false);
|
776 |
+
wp_enqueue_script('wplc-user-js-emoji-concat');
|
777 |
+
|
778 |
+
wp_register_style( 'wplc-admin-style-emoji', "https://bleeper.io/app/assets/wdt-emoji/wdt-emoji-bundle.css", false, $wplc_version );
|
779 |
+
wp_enqueue_style( 'wplc-admin-style-emoji' );
|
780 |
+
}
|
781 |
+
|
782 |
+
} else {
|
783 |
+
/* not using the node server, load traditional event handler JS */
|
784 |
+
wp_register_script('wplc-user-events-script', plugins_url('/js/wplc_u_events.js', __FILE__),array('jquery', 'wplc-server-script'),$wplc_version);
|
785 |
+
}
|
786 |
+
|
787 |
+
|
788 |
+
|
789 |
+
|
790 |
+
wp_register_script('wplc-user-script', plugins_url('/js/wplc_u.js', __FILE__),array('jquery', 'wplc-server-script'),$wplc_version);
|
791 |
+
|
792 |
+
|
793 |
+
/**
|
794 |
+
* No longer in use as of 6.2.11 as using the minified file causes issues on sites that are minified.
|
795 |
+
* @deprecated 6.2.11
|
796 |
+
*/
|
797 |
+
// wp_register_script('wplc-user-script', plugins_url('/js/wplc_u.min.js', __FILE__),array('jquery'),$wplc_version);
|
798 |
+
|
799 |
+
wp_enqueue_script('wplc-user-script');
|
800 |
+
wp_enqueue_script('wplc-user-events-script');
|
801 |
+
|
802 |
+
if (isset($wplc_settings['wplc_newtheme'])) { $wplc_newtheme = $wplc_settings['wplc_newtheme']; } else { $wplc_newtheme = "theme-2"; }
|
803 |
+
if (isset($wplc_newtheme)) {
|
804 |
+
if($wplc_newtheme == 'theme-1') {
|
805 |
+
wp_register_script('wplc-theme-classic', plugins_url('/js/themes/classic.js', __FILE__),array('wplc-user-script'),$wplc_version);
|
806 |
+
wp_enqueue_script('wplc-theme-classic');
|
807 |
+
$avatars = wplc_all_avatars();
|
808 |
+
wp_localize_script('wplc-theme-classic', 'wplc_user_avatars', $avatars);
|
809 |
+
|
810 |
+
}
|
811 |
+
else if($wplc_newtheme == 'theme-2') {
|
812 |
+
wp_register_script('wplc-theme-modern', plugins_url('/js/themes/modern.js', __FILE__),array('wplc-user-script'),$wplc_version);
|
813 |
+
wp_enqueue_script('wplc-theme-modern');
|
814 |
+
$avatars = wplc_all_avatars();
|
815 |
+
wp_localize_script('wplc-theme-modern', 'wplc_user_avatars', $avatars);
|
816 |
+
}
|
817 |
+
} else {
|
818 |
+
wp_register_script('wplc-theme-classic', plugins_url('/js/themes/classic.js', __FILE__),array('wplc-user-script'),$wplc_version);
|
819 |
+
wp_enqueue_script('wplc-theme-classic');
|
820 |
+
$avatars = wplc_all_avatars();
|
821 |
+
wp_localize_script('wplc-theme-classic', 'wplc_user_avatars', $avatars);
|
822 |
+
}
|
823 |
+
|
824 |
+
$ajax_url = admin_url('admin-ajax.php');
|
825 |
+
$home_ajax_url = $ajax_url;
|
826 |
+
|
827 |
+
$wplc_ajax_url = apply_filters("wplc_filter_ajax_url",$ajax_url);
|
828 |
+
wp_localize_script('wplc-admin-chat-js', 'wplc_ajaxurl', $wplc_ajax_url);
|
829 |
+
wp_localize_script('wplc-ma-js', 'wplc_home_ajaxurl', $home_ajax_url);
|
830 |
+
|
831 |
+
//Added rest security nonces
|
832 |
+
if(class_exists("WP_REST_Request")) {
|
833 |
+
wp_localize_script('wplc-user-script', 'wplc_restapi_enabled', '1');
|
834 |
+
wp_localize_script('wplc-user-script', 'wplc_restapi_token', get_option('wplc_api_secret_token'));
|
835 |
+
wp_localize_script('wplc-user-script', 'wplc_restapi_endpoint', rest_url('wp_live_chat_support/v1'));
|
836 |
+
wp_localize_script('wplc-user-script', 'wplc_restapi_nonce', wp_create_nonce( 'wp_rest' ));
|
837 |
+
} else {
|
838 |
+
wp_localize_script('wplc-user-script', 'wplc_restapi_enabled', '0');
|
839 |
+
wp_localize_script('wplc-user-script', 'wplc_restapi_nonce', "false");
|
840 |
+
}
|
841 |
+
|
842 |
+
|
843 |
+
if (isset($wplc_ga_enabled['wplc_enable_ga']) && $wplc_ga_enabled['wplc_enable_ga'] == '1') {
|
844 |
+
wp_localize_script('wplc-user-script', 'wplc_enable_ga', '1');
|
845 |
+
}
|
846 |
+
|
847 |
+
$wplc_ding_file = apply_filters( 'wplc_filter_message_sound', '' );
|
848 |
+
if ( ! empty( $wplc_ding_file ) ) {
|
849 |
+
wp_localize_script( 'wplc-user-script', 'bleeper_message_override', $wplc_ding_file );
|
850 |
+
}
|
851 |
+
|
852 |
+
$wplc_detect_device = new Mobile_Detect;
|
853 |
+
$wplc_is_mobile = $wplc_detect_device->isMobile() ? 'true' : 'false';
|
854 |
+
wp_localize_script('wplc-user-script', 'wplc_is_mobile', $wplc_is_mobile);
|
855 |
+
|
856 |
+
|
857 |
+
wp_localize_script('wplc-user-script', 'wplc_ajaxurl', $wplc_ajax_url);
|
858 |
+
wp_localize_script('wplc-user-script', 'wplc_ajaxurl_site', admin_url('admin-ajax.php'));
|
859 |
+
wp_localize_script('wplc-user-script', 'wplc_nonce', $ajax_nonce);
|
860 |
+
wp_localize_script('wplc-user-script', 'wplc_plugin_url', WPLC_BASIC_PLUGIN_URL);
|
861 |
+
|
862 |
+
$wplc_display = false;
|
863 |
+
|
864 |
+
$wplc_images = apply_filters( 'wplc_get_images_to_preload', array(), $wplc_acbc_data );
|
865 |
+
wp_localize_script( 'wplc-user-script', 'wplc_preload_images', $wplc_images );
|
866 |
+
|
867 |
+
|
868 |
+
|
869 |
+
|
870 |
+
if( isset($wplc_settings['wplc_show_name']) && $wplc_settings['wplc_show_name'] == '1' ){ $wplc_show_name = true; } else { $wplc_show_name = false; }
|
871 |
+
if( isset($wplc_settings['wplc_show_avatar']) && $wplc_settings['wplc_show_avatar'] ){ $wplc_show_avatar = true; } else { $wplc_show_avatar = false; }
|
872 |
+
if( isset($wplc_settings['wplc_show_date']) && $wplc_settings['wplc_show_date'] == '1' ){ $wplc_show_date = true; } else { $wplc_show_date = false; }
|
873 |
+
if( isset($wplc_settings['wplc_show_time']) && $wplc_settings['wplc_show_time'] == '1' ){ $wplc_show_time = true; } else { $wplc_show_time = false; }
|
874 |
+
|
875 |
+
$wplc_chat_detail = array( 'name' => $wplc_show_name, 'avatar' => $wplc_show_avatar, 'date' => $wplc_show_date, 'time' => $wplc_show_time );
|
876 |
+
|
877 |
+
|
878 |
+
|
879 |
+
if( $wplc_display !== FALSE && $wplc_display !== 'hide' ){
|
880 |
+
wp_localize_script('wplc-user-script', 'wplc_display_name', $wplc_display);
|
881 |
+
} else {
|
882 |
+
wp_localize_script( 'wplc-user-script', 'wplc_show_chat_detail', $wplc_chat_detail );
|
883 |
+
}
|
884 |
+
|
885 |
+
|
886 |
+
|
887 |
+
/**
|
888 |
+
* Create a JS object for all Agent ID's and Gravatar MD5's
|
889 |
+
*/
|
890 |
+
$user_array = get_users(array(
|
891 |
+
'meta_key' => 'wplc_ma_agent',
|
892 |
+
));
|
893 |
+
|
894 |
+
$a_array = array();
|
895 |
+
if ($user_array) {
|
896 |
+
foreach ($user_array as $user) {
|
897 |
+
$a_array[$user->ID] = array();
|
898 |
+
$a_array[$user->ID]['name'] = apply_filters( "wplc_decide_agents_name", $user->display_name, $wplc_acbc_data );
|
899 |
+
$a_array[$user->ID]['md5'] = md5( $user->user_email );
|
900 |
+
}
|
901 |
+
}
|
902 |
+
wp_localize_script('wplc-user-script', 'wplc_agent_data', $a_array);
|
903 |
+
|
904 |
+
|
905 |
+
$wplc_error_messages = array(
|
906 |
+
'valid_name' => __( "Please enter your name", "wplivechat" ),
|
907 |
+
'valid_email' => __( "Please enter your email address", "wplivechat" ),
|
908 |
+
'server_connection_lost' => __("Connection to server lost. Please reload this page. Error: ", "wplivechat"),
|
909 |
+
'chat_ended_by_operator' => ( empty( $wplc_settings['wplc_text_chat_ended'] ) ) ? __("The chat has been ended by the operator.", "wplivechat") : esc_attr( $wplc_settings['wplc_text_chat_ended'] ) ,
|
910 |
+
'empty_message' => __( "Please enter a message", "wplivechat" ),
|
911 |
+
'disconnected_message' => __("Disconnected, attempting to reconnect...", "wplivechat"),
|
912 |
+
);
|
913 |
+
|
914 |
+
$wplc_error_messages = apply_filters( "wplc_user_error_messages_filter", $wplc_error_messages );
|
915 |
+
|
916 |
+
wp_localize_script('wplc-user-script', 'wplc_error_messages', $wplc_error_messages);
|
917 |
+
wp_localize_script('wplc-user-script', 'wplc_enable_ding', $wplc_ding);
|
918 |
+
$wplc_run_override = "0";
|
919 |
+
$wplc_run_override = apply_filters("wplc_filter_run_override",$wplc_run_override);
|
920 |
+
wp_localize_script('wplc-user-script', 'wplc_filter_run_override', $wplc_run_override);
|
921 |
+
|
922 |
+
if (!isset($wplc_settings['wplc_pro_offline1'])) { $wplc_settings["wplc_pro_offline1"] = __("We are currently offline. Please leave a message and we'll get back to you shortly.", "wplivechat"); }
|
923 |
+
if (!isset($wplc_settings['wplc_pro_offline2'])) { $wplc_settings["wplc_pro_offline2"] = __("Sending message...", "wplivechat"); }
|
924 |
+
if (!isset($wplc_settings['wplc_pro_offline3'])) { $wplc_settings["wplc_pro_offline3"] = __("Thank you for your message. We will be in contact soon.", "wplivechat"); }
|
925 |
+
|
926 |
+
|
927 |
+
wp_localize_script('wplc-user-script', 'wplc_offline_msg', __(stripslashes($wplc_settings['wplc_pro_offline2']), 'wplivechat'));
|
928 |
+
wp_localize_script('wplc-user-script', 'wplc_offline_msg3',__(stripslashes($wplc_settings['wplc_pro_offline3']), 'wplivechat'));
|
929 |
+
wp_localize_script('wplc-user-script', 'wplc_welcome_msg', __(stripslashes($wplc_settings['wplc_welcome_msg']), 'wplivechat'));
|
930 |
+
wp_localize_script('wplc-user-script', 'wplc_pro_sst1', __(stripslashes($wplc_settings['wplc_pro_sst1']), 'wplivechat') );
|
931 |
+
wp_localize_script('wplc-user-script', 'wplc_pro_offline_btn_send', __(stripslashes($wplc_settings['wplc_pro_offline_btn_send']), 'wplivechat') );
|
932 |
+
wp_localize_script('wplc-user-script', 'wplc_user_default_visitor_name', __(stripslashes($wplc_settings['wplc_user_default_visitor_name']), 'wplivechat') );
|
933 |
+
|
934 |
+
if( isset( $wplc_acbc_data['wplc_use_wp_name'] ) && $wplc_acbc_data['wplc_use_wp_name'] == '1' ){
|
935 |
+
if( isset( $_COOKIE['wplc_cid'] ) ){
|
936 |
+
$chat_data = wplc_get_chat_data( $_COOKIE['wplc_cid'] );
|
937 |
+
if ( isset($chat_data->agent_id ) ) {
|
938 |
+
$user_info = get_userdata( intval( $chat_data->agent_id ) );
|
939 |
+
if( $user_info ){
|
940 |
+
$agent = $user_info->display_name;
|
941 |
+
} else {
|
942 |
+
$agent = "agent";
|
943 |
+
}
|
944 |
+
} else {
|
945 |
+
$agent = 'agent';
|
946 |
+
}
|
947 |
+
} else {
|
948 |
+
$agent = 'agent';
|
949 |
+
}
|
950 |
+
|
951 |
+
} else {
|
952 |
+
if (!empty($wplc_acbc_data['wplc_chat_name'])) {
|
953 |
+
$agent = $wplc_acbc_data['wplc_chat_name'];
|
954 |
+
} else {
|
955 |
+
$agent = 'agent';
|
956 |
+
}
|
957 |
+
}
|
958 |
+
wp_localize_script('wplc-user-script', 'wplc_localized_string_is_typing', $agent . __(" is typing...","wplivechat"));
|
959 |
+
wp_localize_script('wplc-user-script', 'wplc_localized_string_is_typing_single', __(" is typing...","wplivechat"));
|
960 |
+
|
961 |
+
$bleeper_string_array = array(
|
962 |
+
__(" has joined.","wplivechat"),
|
963 |
+
__(" has left.","wplivechat"),
|
964 |
+
__(" has ended the chat.", "wplivechat"),
|
965 |
+
__(" has disconnected.", "wplivechat"),
|
966 |
+
__("(edited)", "wplivechat"),
|
967 |
+
__("Type here","wplivechat")
|
968 |
+
);
|
969 |
+
|
970 |
+
wp_localize_script('wplc-user-script', 'bleeper_localized_strings', $bleeper_string_array );
|
971 |
+
|
972 |
+
if( isset( $wplc_settings['wplc_elem_trigger_id'] ) && trim( $wplc_settings['wplc_elem_trigger_id'] ) !== "" ) {
|
973 |
+
if( isset( $wplc_settings['wplc_elem_trigger_action'] ) ){
|
974 |
+
wp_localize_script( 'wplc-user-script', 'wplc_elem_trigger_action', stripslashes( $wplc_settings['wplc_elem_trigger_action'] ) );
|
975 |
+
}
|
976 |
+
if( isset( $wplc_settings['wplc_elem_trigger_type'] ) ){
|
977 |
+
wp_localize_script( 'wplc-user-script', 'wplc_elem_trigger_type', stripslashes( $wplc_settings['wplc_elem_trigger_type'] ) );
|
978 |
+
}
|
979 |
+
wp_localize_script( 'wplc-user-script', 'wplc_elem_trigger_id', stripslashes( $wplc_settings['wplc_elem_trigger_id'] ) );
|
980 |
+
}
|
981 |
+
|
982 |
+
$extra_data_array = array("object_switch" => true);
|
983 |
+
$extra_data_array = apply_filters("wplc_filter_front_js_extra_data",$extra_data_array);
|
984 |
+
wp_localize_script('wplc-user-script', 'wplc_extra_data',$extra_data_array);
|
985 |
+
|
986 |
+
|
987 |
+
if (isset($_COOKIE['wplc_email']) && $_COOKIE['wplc_email'] != "") { $wplc_user_gravatar = sanitize_text_field(md5(strtolower(trim($_COOKIE['wplc_email'])))); } else {$wplc_user_gravatar = ""; }
|
988 |
+
|
989 |
+
if ($wplc_user_gravatar != "") { $wplc_grav_image = "<img src='//www.gravatar.com/avatar/$wplc_user_gravatar?s=30' class='wplc-user-message-avatar' />";} else { $wplc_grav_image = "";}
|
990 |
+
|
991 |
+
if ( ! empty( $wplc_grav_image ) ) {
|
992 |
+
wp_localize_script('wplc-user-script', 'wplc_gravatar_image', $wplc_grav_image);
|
993 |
+
}
|
994 |
+
|
995 |
+
$wplc_hide_chat = "";
|
996 |
+
if (get_option('WPLC_HIDE_CHAT') == TRUE) { $wplc_hide_chat = "yes"; } else { $wplc_hide_chat = null; }
|
997 |
+
wp_localize_script('wplc-user-script', 'wplc_hide_chat', $wplc_hide_chat);
|
998 |
+
|
999 |
+
if(isset($wplc_settings['wplc_redirect_to_thank_you_page']) && isset($wplc_settings['wplc_redirect_thank_you_url']) && $wplc_settings['wplc_redirect_thank_you_url'] !== "" && $wplc_settings['wplc_redirect_thank_you_url'] !== " "){
|
1000 |
+
wp_localize_script('wplc-user-script', 'wplc_redirect_thank_you', urldecode($wplc_settings['wplc_redirect_thank_you_url']));
|
1001 |
+
}
|
1002 |
+
|
1003 |
+
wp_enqueue_script('jquery-ui-core',false,array('wplc-user-script'),false,false);
|
1004 |
+
wp_enqueue_script('jquery-ui-draggable',false,array('wplc-user-script'),false,false);
|
1005 |
+
|
1006 |
+
do_action("wplc_hook_push_js_to_front");
|
1007 |
+
|
1008 |
+
}
|
1009 |
+
if (function_exists('wplc_pro_user_top_js')) {
|
1010 |
+
add_action('wp_head', 'wplc_pro_user_top_js');
|
1011 |
+
|
1012 |
+
} else {
|
1013 |
+
add_action('wp_head', 'wplc_user_top_js');
|
1014 |
+
|
1015 |
+
}
|
1016 |
+
|
1017 |
+
|
1018 |
+
|
1019 |
+
/**
|
1020 |
+
* Add to the array to determine which images need to be preloaded via JS on the front end.
|
1021 |
+
*
|
1022 |
+
* @param array $images Array of images to be preloaded
|
1023 |
+
* @return array
|
1024 |
+
*/
|
1025 |
+
add_filter( "wplc_get_images_to_preload", "wplc_filter_control_get_images_to_preload", 10, 2 );
|
1026 |
+
function wplc_filter_control_get_images_to_preload( $images, $wplc_acbc_data ) {
|
1027 |
+
$icon = plugins_url('images/iconRetina.png', __FILE__);
|
1028 |
+
$close_icon = plugins_url('images/iconCloseRetina.png', __FILE__);
|
1029 |
+
array_push( $images, $icon );
|
1030 |
+
array_push( $images, $close_icon );
|
1031 |
+
return $images;
|
1032 |
+
}
|
1033 |
+
|
1034 |
+
|
1035 |
+
|
1036 |
+
function wplc_user_top_js() {
|
1037 |
+
|
1038 |
+
if(function_exists('wplc_display_chat_contents')){
|
1039 |
+
$display_contents = wplc_display_chat_contents();
|
1040 |
+
} else {
|
1041 |
+
$display_contents = 1;
|
1042 |
+
}
|
1043 |
+
if($display_contents >= 1){
|
1044 |
+
/*echo "<!-- DEFINING DO NOT CACHE -->";
|
1045 |
+
if (!defined('DONOTCACHEPAGE')) {
|
1046 |
+
define('DONOTCACHEPAGE', true);
|
1047 |
+
}
|
1048 |
+
if (!defined('DONOTCACHEDB')) {
|
1049 |
+
define('DONOTCACHEDB', true);
|
1050 |
+
}
|
1051 |
+
*/
|
1052 |
+
$ajax_nonce = wp_create_nonce("wplc");
|
1053 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
1054 |
+
$ajax_url = admin_url('admin-ajax.php');
|
1055 |
+
$wplc_ajax_url = apply_filters("wplc_filter_ajax_url",$ajax_url);
|
1056 |
+
?>
|
1057 |
+
|
1058 |
+
<script type="text/javascript">
|
1059 |
+
<?php if (!function_exists("wplc_register_pro_version")) { ?>
|
1060 |
+
var wplc_ajaxurl = '<?php echo $wplc_ajax_url; ?>';
|
1061 |
+
<?php } ?>
|
1062 |
+
var wplc_nonce = '<?php echo $ajax_nonce; ?>';
|
1063 |
+
</script>
|
1064 |
+
|
1065 |
+
|
1066 |
+
|
1067 |
+
|
1068 |
+
<?php
|
1069 |
+
|
1070 |
+
$wplc_settings = get_option('WPLC_SETTINGS');
|
1071 |
+
if (isset($wplc_settings['wplc_theme'])) { $wplc_theme = $wplc_settings['wplc_theme']; } else { $wplc_theme = "theme-default"; }
|
1072 |
+
if (isset($wplc_theme)) {
|
1073 |
+
|
1074 |
+
if($wplc_theme == 'theme-6') {
|
1075 |
+
/* custom */
|
1076 |
+
|
1077 |
+
if (isset($wplc_settings["wplc_settings_color1"])) { $wplc_settings_color1 = $wplc_settings["wplc_settings_color1"]; } else { $wplc_settings_color1 = "ED832F"; }
|
1078 |
+
if (isset($wplc_settings["wplc_settings_color2"])) { $wplc_settings_color2 = $wplc_settings["wplc_settings_color2"]; } else { $wplc_settings_color2 = "FFFFFF"; }
|
1079 |
+
if (isset($wplc_settings["wplc_settings_color3"])) { $wplc_settings_color3 = $wplc_settings["wplc_settings_color3"]; } else { $wplc_settings_color3 = "EEEEEE"; }
|
1080 |
+
if (isset($wplc_settings["wplc_settings_color4"])) { $wplc_settings_color4 = $wplc_settings["wplc_settings_color4"]; } else { $wplc_settings_color4 = "666666"; }
|
1081 |
+
|
1082 |
+
|
1083 |
+
?>
|
1084 |
+
<style>
|
1085 |
+
.wplc-color-1 { color: #<?php echo $wplc_settings_color1; ?> !important; }
|
1086 |
+
.wplc-color-2 { color: #<?php echo $wplc_settings_color2; ?> !important; }
|
1087 |
+
.wplc-color-3 { color: #<?php echo $wplc_settings_color3; ?> !important; }
|
1088 |
+
.wplc-color-4 { color: #<?php echo $wplc_settings_color4; ?> !important; }
|
1089 |
+
.wplc-color-bg-1 { background-color: #<?php echo $wplc_settings_color1; ?> !important; }
|
1090 |
+
.wplc-color-bg-2 { background-color: #<?php echo $wplc_settings_color2; ?> !important; }
|
1091 |
+
.wplc-color-bg-3 { background-color: #<?php echo $wplc_settings_color3; ?> !important; }
|
1092 |
+
.wplc-color-bg-4 { background-color: #<?php echo $wplc_settings_color4; ?> !important; }
|
1093 |
+
.wplc-color-border-1 { border-color: #<?php echo $wplc_settings_color1; ?> !important; }
|
1094 |
+
.wplc-color-border-2 { border-color: #<?php echo $wplc_settings_color2; ?> !important; }
|
1095 |
+
.wplc-color-border-3 { border-color: #<?php echo $wplc_settings_color3; ?> !important; }
|
1096 |
+
.wplc-color-border-4 { border-color: #<?php echo $wplc_settings_color4; ?> !important; }
|
1097 |
+
.wplc-color-border-1:before { border-color: transparent #<?php echo $wplc_settings_color1; ?> !important; }
|
1098 |
+
.wplc-color-border-2:before { border-color: transparent #<?php echo $wplc_settings_color2; ?> !important; }
|
1099 |
+
.wplc-color-border-3:before { border-color: transparent #<?php echo $wplc_settings_color3; ?> !important; }
|
1100 |
+
.wplc-color-border-4:before { border-color: transparent #<?php echo $wplc_settings_color4; ?> !important; }
|
1101 |
+
</style>
|
1102 |
+
|
1103 |
+
<?php
|
1104 |
+
|
1105 |
+
|
1106 |
+
}
|
1107 |
+
}
|
1108 |
+
|
1109 |
+
|
1110 |
+
}
|
1111 |
+
}
|
1112 |
+
|
1113 |
+
|
1114 |
+
|
1115 |
+
|
1116 |
+
/**
|
1117 |
+
* Detect if the user is using blocked in the live chat settings 'blocked IP' section
|
1118 |
+
* @return void
|
1119 |
+
* @since 6.0.00
|
1120 |
+
* @author Nick Duncan <nick@codecabin.co.za>
|
1121 |
+
*/
|
1122 |
+
function wplc_hook_control_banned_users() {
|
1123 |
+
if (function_exists('wplc_is_user_banned_basic')){
|
1124 |
+
$user_banned = wplc_is_user_banned_basic();
|
1125 |
+
} else {
|
1126 |
+
$user_banned = 0;
|
1127 |
+
}
|
1128 |
+
if ($user_banned) {
|
1129 |
+
remove_action("wplc_hook_output_box_body","wplc_hook_control_show_chat_box");
|
1130 |
+
remove_action("wplc_hook_output_box_footer","wplc_action_control_hook_output_box_footer");
|
1131 |
+
}
|
1132 |
+
}
|
1133 |
+
|
1134 |
+
/**
|
1135 |
+
* Detect if the user is using a mobile phone or not and decides to show the chat box depending on the admins settings
|
1136 |
+
* @return void
|
1137 |
+
* @since 6.0.00
|
1138 |
+
* @author Nick Duncan <nick@codecabin.co.za>
|
1139 |
+
*/
|
1140 |
+
function wplc_hook_control_check_mobile() {
|
1141 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
1142 |
+
|
1143 |
+
$draw_box = false;
|
1144 |
+
|
1145 |
+
if (!class_exists('Mobile_Detect')) {
|
1146 |
+
require_once (plugin_dir_path(__FILE__) . 'includes/Mobile_Detect.php');
|
1147 |
+
}
|
1148 |
+
|
1149 |
+
$wplc_detect_device = new Mobile_Detect;
|
1150 |
+
$wplc_is_mobile = $wplc_detect_device->isMobile();
|
1151 |
+
|
1152 |
+
if ($wplc_is_mobile && !isset($wplc_settings['wplc_enabled_on_mobile']) && $wplc_settings['wplc_enabled_on_mobile'] != 1) {
|
1153 |
+
return "";
|
1154 |
+
}
|
1155 |
+
|
1156 |
+
if (function_exists('wplc_basic_hide_chat_when_offline')) {
|
1157 |
+
$wplc_hide_chat = wplc_basic_hide_chat_when_offline();
|
1158 |
+
if (!$wplc_hide_chat) {
|
1159 |
+
$draw_box = true;
|
1160 |
+
}
|
1161 |
+
} else {
|
1162 |
+
$draw_box = true;
|
1163 |
+
}
|
1164 |
+
if (!$draw_box) {
|
1165 |
+
remove_action("wplc_hook_output_box_body","wplc_hook_control_show_chat_box");
|
1166 |
+
remove_action("wplc_hook_output_box_footer","wplc_action_control_hook_output_box_footer");
|
1167 |
+
}
|
1168 |
+
|
1169 |
+
}
|
1170 |
+
|
1171 |
+
|
1172 |
+
add_action("wplc_hook_output_box_footer","wplc_action_control_hook_output_box_footer",10,1);
|
1173 |
+
function wplc_action_control_hook_output_box_footer() {
|
1174 |
+
/* nothing here */
|
1175 |
+
}
|
1176 |
+
|
1177 |
+
/**
|
1178 |
+
* Decides whether or not to show the chat box based on the main setting in the settings page
|
1179 |
+
* @return void
|
1180 |
+
* @since 6.0.00
|
1181 |
+
*/
|
1182 |
+
function wplc_hook_control_is_chat_enabled() {
|
1183 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
1184 |
+
if ($wplc_settings["wplc_settings_enabled"] == 2) {
|
1185 |
+
remove_action("wplc_hook_output_box_body","wplc_hook_control_show_chat_box");
|
1186 |
+
remove_action("wplc_hook_output_box_footer","wplc_action_control_hook_output_box_footer");
|
1187 |
+
}
|
1188 |
+
}
|
1189 |
+
|
1190 |
+
/**
|
1191 |
+
* Backwards compatibility for the control of the chat box
|
1192 |
+
* @return string
|
1193 |
+
* @since 6.0.00
|
1194 |
+
* @author Nick Duncan - nick@codecabin.co.za
|
1195 |
+
*/
|
1196 |
+
function wplc_hook_control_show_chat_box($cid) {
|
1197 |
+
if (function_exists("wplc_pro_version_control")) {
|
1198 |
+
global $wplc_pro_version;
|
1199 |
+
if (intval(str_replace(".","",$wplc_pro_version)) < 5100) {
|
1200 |
+
|
1201 |
+
echo wplc_output_box_ajax();
|
1202 |
+
|
1203 |
+
} else {
|
1204 |
+
echo wplc_output_box_ajax_new($cid);
|
1205 |
+
}
|
1206 |
+
} else {
|
1207 |
+
echo wplc_output_box_ajax_new($cid);
|
1208 |
+
|
1209 |
+
}
|
1210 |
+
|
1211 |
+
}
|
1212 |
+
|
1213 |
+
/* basic */
|
1214 |
+
add_action("wplc_hook_output_box_header","wplc_hook_control_banned_users");
|
1215 |
+
add_action("wplc_hook_output_box_header","wplc_hook_control_check_mobile");
|
1216 |
+
add_action("wplc_hook_output_box_header","wplc_hook_control_is_chat_enabled");
|
1217 |
+
|
1218 |
+
add_action("wplc_hook_output_box_body","wplc_hook_control_show_chat_box",10,1);
|
1219 |
+
|
1220 |
+
/**
|
1221 |
+
* Build the chat box
|
1222 |
+
* @return void
|
1223 |
+
* @since 6.0.00
|
1224 |
+
* @author Nick Duncan <nick@codecabin.co.za>
|
1225 |
+
*/
|
1226 |
+
function wplc_output_box_5100($cid = null) {
|
1227 |
+
wplc_string_check();
|
1228 |
+
do_action("wplc_hook_output_box_header",$cid);
|
1229 |
+
do_action("wplc_hook_output_box_body",$cid);
|
1230 |
+
do_action("wplc_hook_output_box_footer",$cid);
|
1231 |
+
}
|
1232 |
+
|
1233 |
+
|
1234 |
+
|
1235 |
+
/**
|
1236 |
+
* Filter to control the top MAIN DIV of the chat box
|
1237 |
+
* @param array $wplc_settings Live chat settings array
|
1238 |
+
* @return string
|
1239 |
+
* @since 6.0.00
|
1240 |
+
* @author Nick Duncan <nick@codecabin.co.za>
|
1241 |
+
*/
|
1242 |
+
function wplc_filter_control_live_chat_box_html_main_div_top($wplc_settings,$logged_in,$wplc_using_locale) {
|
1243 |
+
$ret_msg = "";
|
1244 |
+
$wplc_class = "";
|
1245 |
+
// $wplc_settings = get_option("WPLC_SETTINGS");
|
1246 |
+
|
1247 |
+
if ($wplc_settings["wplc_settings_align"] == 1) {
|
1248 |
+
$original_pos = "bottom_left";
|
1249 |
+
} else if ($wplc_settings["wplc_settings_align"] == 2) {
|
1250 |
+
$original_pos = "bottom_right";
|
1251 |
+
} else if ($wplc_settings["wplc_settings_align"] == 3) {
|
1252 |
+
$original_pos = "left";
|
1253 |
+
$wplc_class = "wplc_left";
|
1254 |
+
} else if ($wplc_settings["wplc_settings_align"] == 4) {
|
1255 |
+
$original_pos = "right";
|
1256 |
+
$wplc_class = "wplc_right";
|
1257 |
+
}
|
1258 |
+
|
1259 |
+
|
1260 |
+
$animations = wplc_return_animations_basic();
|
1261 |
+
if ($animations) {
|
1262 |
+
isset($animations['animation']) ? $wplc_animation = $animations['animation'] : $wplc_animation = 'animation-4';
|
1263 |
+
isset($animations['starting_point']) ? $wplc_starting_point = $animations['starting_point'] : $wplc_starting_point = 'display: none;';
|
1264 |
+
isset($animations['box_align']) ? $wplc_box_align = $animations['box_align'] : $wplc_box_align = '';
|
1265 |
+
}
|
1266 |
+
else {
|
1267 |
+
|
1268 |
+
if ($wplc_settings["wplc_settings_align"] == 1) {
|
1269 |
+
$original_pos = "bottom_left";
|
1270 |
+
$wplc_box_align = "left:20px; bottom:0px;";
|
1271 |
+
} else if ($wplc_settings["wplc_settings_align"] == 2) {
|
1272 |
+
$original_pos = "bottom_right";
|
1273 |
+
$wplc_box_align = "right:20px; bottom:0px;";
|
1274 |
+
} else if ($wplc_settings["wplc_settings_align"] == 3) {
|
1275 |
+
$original_pos = "left";
|
1276 |
+
$wplc_box_align = "left:0; bottom:100px;";
|
1277 |
+
$wplc_class = "wplc_left";
|
1278 |
+
} else if ($wplc_settings["wplc_settings_align"] == 4) {
|
1279 |
+
$original_pos = "right";
|
1280 |
+
$wplc_box_align = "right:0; bottom:100px;";
|
1281 |
+
$wplc_class = "wplc_right";
|
1282 |
+
}
|
1283 |
+
}
|
1284 |
+
|
1285 |
+
|
1286 |
+
$wplc_extra_attr = apply_filters("wplc_filter_chat_header_extra_attr","");
|
1287 |
+
if (isset($wplc_settings['wplc_newtheme'])) { $wplc_newtheme = $wplc_settings['wplc_newtheme']; } else { $wplc_newtheme = "theme-2"; }
|
1288 |
+
if (isset($wplc_newtheme)) {
|
1289 |
+
if($wplc_newtheme == 'theme-1') { $wplc_theme_type = "classic"; }
|
1290 |
+
else if($wplc_newtheme == 'theme-2') { $wplc_theme_type = "modern"; }
|
1291 |
+
else { $wplc_theme_type = "modern"; }
|
1292 |
+
}
|
1293 |
+
|
1294 |
+
if(!isset($wplc_settings['wplc_newtheme'])){ $wplc_settings['wplc_newtheme'] = "theme-2"; }
|
1295 |
+
if (isset($wplc_settings['wplc_newtheme']) && $wplc_settings['wplc_newtheme'] == "theme-2") {
|
1296 |
+
$hovercard_content = "<div class='wplc_hovercard_content_left'>".apply_filters("wplc_filter_modern_theme_hovercard_content_left","")."</div><div class='wplc_hovercard_content_right'>".apply_filters("wplc_filter_live_chat_box_html_1st_layer",wplc_filter_control_live_chat_box_html_1st_layer($wplc_settings,$logged_in,$wplc_using_locale,'wplc-color-4'))."</div>";
|
1297 |
+
$hovercard_content = apply_filters("wplc_filter_hovercard_content", $hovercard_content);
|
1298 |
+
|
1299 |
+
$ret_msg .= "<div id='wplc_hovercard' style='display:none' class='".$wplc_theme_type."'>";
|
1300 |
+
//$ret_msg .= "<div id='wplc_hovercard_min' class='wplc_button_standard wplc-color-border-1 wplc-color-bg-1'>".stripslashes( $wplc_settings['wplc_close_btn_text'] )."</div>";
|
1301 |
+
$ret_msg .= "<div id='wplc_hovercard_content'>".apply_filters("wplc_filter_live_chat_box_pre_layer1","").$hovercard_content."</div>";
|
1302 |
+
$ret_msg .= "<div id='wplc_hovercard_bottom'>".apply_filters("wplc_filter_hovercard_bottom_before","").apply_filters("wplc_filter_live_chat_box_hover_html_start_chat_button","",$wplc_settings,$logged_in,$wplc_using_locale)."</div>";
|
1303 |
+
$ret_msg .= "</div>";
|
1304 |
+
|
1305 |
+
} else if (isset($wplc_settings['wplc_newtheme']) && $wplc_settings['wplc_newtheme'] == "theme-1"){
|
1306 |
+
$hovercard_content = "<div class='wplc_hovercard_content_right'>".apply_filters("wplc_filter_live_chat_box_html_1st_layer",wplc_filter_control_live_chat_box_html_1st_layer($wplc_settings,$logged_in,$wplc_using_locale, "wplc-color-2"))."</div>";
|
1307 |
+
$hovercard_content = apply_filters("wplc_filter_hovercard_content", $hovercard_content);
|
1308 |
+
|
1309 |
+
$ret_msg .= "<div id='wplc_hovercard' style='display:none' class='".$wplc_theme_type."'>";
|
1310 |
+
//$ret_msg .= "<div id='wplc_hovercard_min' class='wplc_button_standard wplc-color-border-1 wplc-color-bg-1'>".__("close", "wplivechat")."</div>";
|
1311 |
+
$ret_msg .= "<div id='wplc_hovercard_content'>".apply_filters("wplc_filter_live_chat_box_pre_layer1","").$hovercard_content."</div>";
|
1312 |
+
$ret_msg .= "<div id='wplc_hovercard_bottom'>".apply_filters("wplc_filter_hovercard_bottom_before","").apply_filters("wplc_filter_live_chat_box_hover_html_start_chat_button","",$wplc_settings,$logged_in,$wplc_using_locale)."</div>";
|
1313 |
+
$ret_msg .= "</div>";
|
1314 |
+
}
|
1315 |
+
|
1316 |
+
$ret_msg .= "<div id=\"wp-live-chat\" wplc_animation=\"".$wplc_animation."\" style=\"".$wplc_starting_point." ".$wplc_box_align.";\" class=\"".$wplc_theme_type." ".$wplc_class." wplc_close\" original_pos=\"".$original_pos."\" ".$wplc_extra_attr." > ";
|
1317 |
+
return $ret_msg;
|
1318 |
+
}
|
1319 |
+
|
1320 |
+
|
1321 |
+
|
1322 |
+
add_filter("wplc_filter_modern_theme_hovercard_content_left","wplc_filter_control_modern_theme_hovercard_content_left",10,1);
|
1323 |
+
function wplc_filter_control_modern_theme_hovercard_content_left($msg) {
|
1324 |
+
|
1325 |
+
$msg .= "<div class='wplc_left_logo' style='background:url(".plugins_url('images/iconmicro.png', __FILE__).") no-repeat; background-size: cover;'></div>";
|
1326 |
+
$msg = apply_filters("wplc_filter_microicon",$msg);
|
1327 |
+
return $msg;
|
1328 |
+
}
|
1329 |
+
|
1330 |
+
/**
|
1331 |
+
* Filter to control the top HEADER DIV of the chat box
|
1332 |
+
* @param array $wplc_settings Live chat settings array
|
1333 |
+
* @return string
|
1334 |
+
* @since 6.0.00
|
1335 |
+
* @author Nick Duncan <nick@codecabin.co.za>
|
1336 |
+
*/
|
1337 |
+
function wplc_filter_control_live_chat_box_html_header_div_top($wplc_settings) {
|
1338 |
+
|
1339 |
+
$ret_msg = "";
|
1340 |
+
|
1341 |
+
$current_theme = isset($wplc_settings['wplc_newtheme']) ? $wplc_settings['wplc_newtheme'] : "theme-2";
|
1342 |
+
if($current_theme === "theme-1"){
|
1343 |
+
$ret_msg .= apply_filters("wplc_filter_chat_header_above","", $wplc_settings); //Ratings/Social Icon Filter
|
1344 |
+
}
|
1345 |
+
|
1346 |
+
$ret_msg .= "<div id=\"wp-live-chat-header\" class='wplc-color-bg-1 wplc-color-2'>";
|
1347 |
+
$ret_msg .= apply_filters("wplc_filter_chat_header_under","",$wplc_settings);
|
1348 |
+
return $ret_msg;
|
1349 |
+
}
|
1350 |
+
|
1351 |
+
|
1352 |
+
add_filter("wplc_filter_chat_header_under","wplc_filter_control_chat_header_under",1,2);
|
1353 |
+
function wplc_filter_control_chat_header_under($ret_msg,$wplc_settings) {
|
1354 |
+
$current_theme = isset($wplc_settings['wplc_newtheme']) ? $wplc_settings['wplc_newtheme'] : "theme-2";
|
1355 |
+
if($current_theme === "theme-2"){
|
1356 |
+
|
1357 |
+
if (function_exists("wplc_acbc_filter_control_chat_header_under")) {
|
1358 |
+
remove_filter("wplc_filter_chat_header_under","wplc_acbc_filter_control_chat_header_under");
|
1359 |
+
}
|
1360 |
+
}
|
1361 |
+
|
1362 |
+
return $ret_msg;
|
1363 |
+
|
1364 |
+
}
|
1365 |
+
|
1366 |
+
|
1367 |
+
|
1368 |
+
/**
|
1369 |
+
* Filter to control the user details section - custom fields coming soon
|
1370 |
+
* @param array $wplc_settings Live chat settings array
|
1371 |
+
* @return string
|
1372 |
+
* @since 6.0.00
|
1373 |
+
* @author Nick Duncan <nick@codecabin.co.za>
|
1374 |
+
*/
|
1375 |
+
function wplc_filter_control_live_chat_box_html_ask_user_detail($wplc_settings) {
|
1376 |
+
$ret_msg = "";
|
1377 |
+
if (isset($wplc_settings['wplc_loggedin_user_info']) && $wplc_settings['wplc_loggedin_user_info'] == 1) {
|
1378 |
+
$wplc_use_loggedin_user_details = 1;
|
1379 |
+
} else {
|
1380 |
+
$wplc_use_loggedin_user_details = 0;
|
1381 |
+
}
|
1382 |
+
|
1383 |
+
if (isset($wplc_settings['wplc_require_user_info']) && ( $wplc_settings['wplc_require_user_info'] == 1 || $wplc_settings['wplc_require_user_info'] == 'name' )) {
|
1384 |
+
$wplc_ask_user_details = 1;
|
1385 |
+
} else {
|
1386 |
+
$wplc_ask_user_details = 0;
|
1387 |
+
}
|
1388 |
+
|
1389 |
+
$wplc_loggedin_user_name = "";
|
1390 |
+
$wplc_loggedin_user_email = "";
|
1391 |
+
|
1392 |
+
if ($wplc_use_loggedin_user_details == 1 && is_user_logged_in()) {
|
1393 |
+
global $current_user;
|
1394 |
+
|
1395 |
+
if ($current_user->data != null) {
|
1396 |
+
//Logged in. Get name and email
|
1397 |
+
$wplc_loggedin_user_name = $current_user->user_nicename;
|
1398 |
+
$wplc_loggedin_user_email = $current_user->user_email;
|
1399 |
+
}
|
1400 |
+
} else {
|
1401 |
+
if ( $wplc_ask_user_details == 0 ) {
|
1402 |
+
$wplc_loggedin_user_name = stripslashes( $wplc_settings['wplc_user_default_visitor_name'] );
|
1403 |
+
}
|
1404 |
+
}
|
1405 |
+
|
1406 |
+
if (isset($wplc_settings['wplc_require_user_info']) && $wplc_settings['wplc_require_user_info'] == 1) {
|
1407 |
+
//Ask the user to enter name and email
|
1408 |
+
|
1409 |
+
$ret_msg .= "<input type=\"text\" name=\"wplc_name\" id=\"wplc_name\" value='" . $wplc_loggedin_user_name . "' placeholder=\"" . __( "Name", "wplivechat" ) . "\" />";
|
1410 |
+
$ret_msg .= "<input type=\"text\" name=\"wplc_email\" id=\"wplc_email\" wplc_hide=\"0\" value=\"" . $wplc_loggedin_user_email . "\" placeholder=\"" . __( "Email", "wplivechat" ) . "\" />";
|
1411 |
+
$ret_msg .= apply_filters( "wplc_start_chat_user_form_after_filter", "" );
|
1412 |
+
|
1413 |
+
} elseif (isset($wplc_settings['wplc_require_user_info']) && $wplc_settings['wplc_require_user_info'] == 'email') {
|
1414 |
+
/*$ret_msg .= "<div style=\"padding: 7px; text-align: center;\">";
|
1415 |
+
if (isset($wplc_settings['wplc_user_alternative_text'])) {
|
1416 |
+
$ret_msg .= html_entity_decode( stripslashes($wplc_settings['wplc_user_alternative_text']) );
|
1417 |
+
}
|
1418 |
+
$ret_msg .= '</div>';*/
|
1419 |
+
|
1420 |
+
$wplc_random_user_number = rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9);
|
1421 |
+
if ($wplc_loggedin_user_name != '') { $wplc_lin = $wplc_loggedin_user_name; } else { $wplc_lin = 'user' . $wplc_random_user_number; }
|
1422 |
+
$ret_msg .= "<input type=\"hidden\" name=\"wplc_name\" id=\"wplc_name\" value=\"".$wplc_lin."\" />";
|
1423 |
+
$ret_msg .= "<input type=\"text\" name=\"wplc_email\" id=\"wplc_email\" wplc_hide=\"0\" value=\"" . $wplc_loggedin_user_email . "\" placeholder=\"" . __( "Email", "wplivechat" ) . "\" />";
|
1424 |
+
$ret_msg .= apply_filters("wplc_start_chat_user_form_after_filter", "");
|
1425 |
+
} elseif (isset($wplc_settings['wplc_require_user_info']) && $wplc_settings['wplc_require_user_info'] == 'name') {
|
1426 |
+
/*
|
1427 |
+
$ret_msg .= "<div style=\"padding: 7px; text-align: center;\">";
|
1428 |
+
if (isset($wplc_settings['wplc_user_alternative_text'])) {
|
1429 |
+
$ret_msg .= html_entity_decode( stripslashes($wplc_settings['wplc_user_alternative_text']) );
|
1430 |
+
}
|
1431 |
+
$ret_msg .= '</div>';*/
|
1432 |
+
|
1433 |
+
$wplc_random_user_number = rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9);
|
1434 |
+
if ($wplc_loggedin_user_email != '' && $wplc_loggedin_user_email != null) { $wplc_lie = $wplc_loggedin_user_email; } else { $wplc_lie = $wplc_random_user_number . '@' . $wplc_random_user_number . '.com'; }
|
1435 |
+
$ret_msg .= "<input type=\"text\" name=\"wplc_name\" id=\"wplc_name\" value='" . $wplc_loggedin_user_name . "' placeholder=\"" . __( "Name", "wplivechat" ) . "\" />";
|
1436 |
+
$ret_msg .= "<input type=\"hidden\" name=\"wplc_email\" id=\"wplc_email\" wplc_hide=\"1\" value=\"".$wplc_lie."\" />";
|
1437 |
+
$ret_msg .= apply_filters("wplc_start_chat_user_form_after_filter", "");
|
1438 |
+
} else {
|
1439 |
+
//Dont ask the user
|
1440 |
+
|
1441 |
+
$ret_msg .= "<div style=\"padding: 7px; text-align: center;\">";
|
1442 |
+
if (isset($wplc_settings['wplc_user_alternative_text'])) {
|
1443 |
+
$ret_msg .= html_entity_decode( stripslashes($wplc_settings['wplc_user_alternative_text']) );
|
1444 |
+
}
|
1445 |
+
$ret_msg .= '</div>';
|
1446 |
+
|
1447 |
+
$wplc_random_user_number = rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9);
|
1448 |
+
//$wplc_loggedin_user_email = $wplc_random_user_number."@".$wplc_random_user_number.".com";
|
1449 |
+
if ($wplc_loggedin_user_name != '') { $wplc_lin = $wplc_loggedin_user_name; } else { $wplc_lin = 'user' . $wplc_random_user_number; }
|
1450 |
+
if ($wplc_loggedin_user_email != '' && $wplc_loggedin_user_email != null) { $wplc_lie = $wplc_loggedin_user_email; } else { $wplc_lie = $wplc_random_user_number . '@' . $wplc_random_user_number . '.com'; }
|
1451 |
+
$ret_msg .= "<input type=\"hidden\" name=\"wplc_name\" id=\"wplc_name\" value=\"".$wplc_lin."\" />";
|
1452 |
+
$ret_msg .= "<input type=\"hidden\" name=\"wplc_email\" id=\"wplc_email\" wplc_hide=\"1\" value=\"".$wplc_lie."\" />";
|
1453 |
+
$ret_msg .= apply_filters("wplc_start_chat_user_form_after_filter", "");
|
1454 |
+
}
|
1455 |
+
return $ret_msg;
|
1456 |
+
}
|
1457 |
+
|
1458 |
+
|
1459 |
+
/**
|
1460 |
+
* Filter to control the start chat button
|
1461 |
+
* @param array $wplc_settings Live chat settings array
|
1462 |
+
* @return string
|
1463 |
+
* @since 6.0.00
|
1464 |
+
* @author Nick Duncan <nick@codecabin.co.za>
|
1465 |
+
*/
|
1466 |
+
function wplc_filter_control_live_chat_box_html_start_chat_button($wplc_settings,$wplc_using_locale ) {
|
1467 |
+
$wplc_sst_1 = __('Start chat', 'wplivechat');
|
1468 |
+
if (!isset($wplc_settings['wplc_pro_sst1']) || $wplc_settings['wplc_pro_sst1'] == "") { $wplc_settings['wplc_pro_sst1'] = $wplc_sst_1; }
|
1469 |
+
$text = ($wplc_using_locale ? $wplc_sst_1 : stripslashes($wplc_settings['wplc_pro_sst1']));
|
1470 |
+
$custom_attr = apply_filters('wplc_start_button_custom_attributes_filter', "", $wplc_settings);
|
1471 |
+
return "<button id=\"wplc_start_chat_btn\" type=\"button\" class='wplc-color-bg-1 wplc-color-2' $custom_attr>$text</button>";
|
1472 |
+
}
|
1473 |
+
|
1474 |
+
|
1475 |
+
|
1476 |
+
|
1477 |
+
/**
|
1478 |
+
* Filter to control the hover card start chat button
|
1479 |
+
* @param array $wplc_settings Live chat settings array
|
1480 |
+
* @return string
|
1481 |
+
* @since 6.1.00
|
1482 |
+
* @author Nick Duncan <nick@codecabin.co.za>
|
1483 |
+
*/
|
1484 |
+
add_filter("wplc_filter_live_chat_box_hover_html_start_chat_button","wplc_filter_control_live_chat_box_html_hovercard_chat_button",10,4);
|
1485 |
+
function wplc_filter_control_live_chat_box_html_hovercard_chat_button($content,$wplc_settings,$logged_in,$wplc_using_locale ) {
|
1486 |
+
if ($logged_in) {
|
1487 |
+
$wplc_sst_1 = __('Start chat', 'wplivechat');
|
1488 |
+
|
1489 |
+
if (!isset($wplc_settings['wplc_pro_sst1']) || $wplc_settings['wplc_pro_sst1'] == "") { $wplc_settings['wplc_pro_sst1'] = $wplc_sst_1; }
|
1490 |
+
$text = ($wplc_using_locale ? $wplc_sst_1 : stripslashes($wplc_settings['wplc_pro_sst1']));
|
1491 |
+
return "<button id=\"speeching_button\" type=\"button\" class='wplc-color-bg-1 wplc-color-2'>$text</button>";
|
1492 |
+
} else {
|
1493 |
+
$wplc_sst_1 = stripslashes($wplc_settings['wplc_pro_offline_btn']);
|
1494 |
+
return "<button id=\"speeching_button\" type=\"button\" class='wplc-color-bg-1 wplc-color-2'>$wplc_sst_1</button>";
|
1495 |
+
|
1496 |
+
}
|
1497 |
+
}
|
1498 |
+
|
1499 |
+
/**
|
1500 |
+
* Filter to control the offline message button
|
1501 |
+
* @param array $wplc_settings Live chat settings array
|
1502 |
+
* @return string
|
1503 |
+
* @since 6.0.00
|
1504 |
+
* @author Nick Duncan <nick@codecabin.co.za>
|
1505 |
+
*/
|
1506 |
+
function wplc_filter_control_live_chat_box_html_send_offline_message_button($wplc_settings) {
|
1507 |
+
$wplc_settings = get_option('WPLC_SETTINGS');
|
1508 |
+
if (isset($wplc_settings['wplc_theme'])) { $wplc_theme = $wplc_settings['wplc_theme']; } else { }
|
1509 |
+
|
1510 |
+
if (isset($wplc_theme)) {
|
1511 |
+
if($wplc_theme == 'theme-1') {
|
1512 |
+
$wplc_settings_fill = "#DB0000";
|
1513 |
+
$wplc_settings_font = "#FFFFFF";
|
1514 |
+
} else if ($wplc_theme == 'theme-2'){
|
1515 |
+
$wplc_settings_fill = "#000000";
|
1516 |
+
$wplc_settings_font = "#FFFFFF";
|
1517 |
+
} else if ($wplc_theme == 'theme-3'){
|
1518 |
+
$wplc_settings_fill = "#DB30B3";
|
1519 |
+
$wplc_settings_font = "#FFFFFF";
|
1520 |
+
} else if ($wplc_theme == 'theme-4'){
|
1521 |
+
$wplc_settings_fill = "#1A14DB";
|
1522 |
+
$wplc_settings_font = "#F7FF0F";
|
1523 |
+
} else if ($wplc_theme == 'theme-5'){
|
1524 |
+
$wplc_settings_fill = "#3DCC13";
|
1525 |
+
$wplc_settings_font = "#FF0808";
|
1526 |
+
} else if ($wplc_theme == 'theme-6'){
|
1527 |
+
if ($wplc_settings["wplc_settings_fill"]) {
|
1528 |
+
$wplc_settings_fill = "#" . $wplc_settings["wplc_settings_fill"];
|
1529 |
+
} else {
|
1530 |
+
$wplc_settings_fill = "#ec832d";
|
1531 |
+
}
|
1532 |
+
if ($wplc_settings["wplc_settings_font"]) {
|
1533 |
+
$wplc_settings_font = "#" . $wplc_settings["wplc_settings_font"];
|
1534 |
+
} else {
|
1535 |
+
$wplc_settings_font = "#FFFFFF";
|
1536 |
+
}
|
1537 |
+
} else {
|
1538 |
+
if ($wplc_settings["wplc_settings_fill"]) {
|
1539 |
+
$wplc_settings_fill = "#" . $wplc_settings["wplc_settings_fill"];
|
1540 |
+
} else {
|
1541 |
+
$wplc_settings_fill = "#ec832d";
|
1542 |
+
}
|
1543 |
+
if ($wplc_settings["wplc_settings_font"]) {
|
1544 |
+
$wplc_settings_font = "#" . $wplc_settings["wplc_settings_font"];
|
1545 |
+
} else {
|
1546 |
+
$wplc_settings_font = "#FFFFFF";
|
1547 |
+
}
|
1548 |
+
}
|
1549 |
+
} else {
|
1550 |
+
if ($wplc_settings["wplc_settings_fill"]) {
|
1551 |
+
$wplc_settings_fill = "#" . $wplc_settings["wplc_settings_fill"];
|
1552 |
+
} else {
|
1553 |
+
$wplc_settings_fill = "#ec832d";
|
1554 |
+
}
|
1555 |
+
if ($wplc_settings["wplc_settings_font"]) {
|
1556 |
+
$wplc_settings_font = "#" . $wplc_settings["wplc_settings_font"];
|
1557 |
+
} else {
|
1558 |
+
$wplc_settings_font = "#FFFFFF";
|
1559 |
+
}
|
1560 |
+
}
|
1561 |
+
$custom_attr = apply_filters('wplc_offline_message_button_custom_attributes_filter', "", $wplc_settings);
|
1562 |
+
$ret_msg = "<input id=\"wplc_na_msg_btn\" type=\"button\" value=\"".stripslashes($wplc_settings['wplc_pro_offline_btn_send'])."\" style=\"background: ".$wplc_settings_fill." !important; background-color: ".$wplc_settings_fill." !important; color: ".$wplc_settings_font." !important;\" $custom_attr/>";
|
1563 |
+
return $ret_msg;
|
1564 |
+
}
|
1565 |
+
|
1566 |
+
|
1567 |
+
|
1568 |
+
/**
|
1569 |
+
* Filter to control the 2nd layer of the chat window (online/offline)
|
1570 |
+
* @param array $wplc_settings Live chat settings array
|
1571 |
+
* @param bool $logged_in Is the user logged in or not
|
1572 |
+
* @return string
|
1573 |
+
* @since 6.0.00
|
1574 |
+
* @author Nick Duncan <nick@codecabin.co.za>
|
1575 |
+
*/
|
1576 |
+
function wplc_filter_control_live_chat_box_html_2nd_layer($wplc_settings,$logged_in,$wplc_using_locale, $cid) {
|
1577 |
+
|
1578 |
+
if ($logged_in) {
|
1579 |
+
$wplc_intro = __('Hello. Please input your details so that I may help you.', 'wplivechat');
|
1580 |
+
if (!isset($wplc_settings['wplc_pro_intro']) || $wplc_settings['wplc_pro_intro'] == "") { $wplc_settings['wplc_pro_intro'] = $wplc_intro; }
|
1581 |
+
$text = ($wplc_using_locale ? $wplc_intro : stripslashes($wplc_settings['wplc_pro_intro']));
|
1582 |
+
|
1583 |
+
$ret_msg = "<div id=\"wp-live-chat-2-inner\">";
|
1584 |
+
$ret_msg .= " <div id=\"wp-live-chat-2-info\" class='wplc-color-4'>";
|
1585 |
+
$ret_msg .= apply_filters("wplc_filter_intro_text_heading", $text, $wplc_settings);
|
1586 |
+
$ret_msg .= " </div>";
|
1587 |
+
$ret_msg .= apply_filters("wplc_filter_live_chat_box_html_ask_user_details",wplc_filter_control_live_chat_box_html_ask_user_detail($wplc_settings));
|
1588 |
+
$ret_msg .= apply_filters("wplc_filter_live_chat_box_html_start_chat_button",wplc_filter_control_live_chat_box_html_start_chat_button($wplc_settings,$wplc_using_locale ), $cid);
|
1589 |
+
$ret_msg .= "</div>";
|
1590 |
+
} else {
|
1591 |
+
if ( isset( $wplc_settings['wplc_loggedin_user_info'] ) && $wplc_settings['wplc_loggedin_user_info'] == 1 ) {
|
1592 |
+
$wplc_use_loggedin_user_details = 1;
|
1593 |
+
} else {
|
1594 |
+
$wplc_use_loggedin_user_details = 0;
|
1595 |
+
}
|
1596 |
+
|
1597 |
+
$wplc_loggedin_user_name = '';
|
1598 |
+
$wplc_loggedin_user_email = '';
|
1599 |
+
|
1600 |
+
if ( $wplc_use_loggedin_user_details == 1 ) {
|
1601 |
+
global $current_user;
|
1602 |
+
|
1603 |
+
if ( $current_user->data != null ) {
|
1604 |
+
if ( is_user_logged_in() ) {
|
1605 |
+
//Logged in. Get name and email
|
1606 |
+
$wplc_loggedin_user_name = $current_user->user_nicename;
|
1607 |
+
$wplc_loggedin_user_email = $current_user->user_email;
|
1608 |
+
} else {
|
1609 |
+
$wplc_loggedin_user_name = stripslashes( $wplc_settings['wplc_user_default_visitor_name'] );
|
1610 |
+
}
|
1611 |
+
}
|
1612 |
+
} else {
|
1613 |
+
$wplc_loggedin_user_name = '';
|
1614 |
+
$wplc_loggedin_user_email = '';
|
1615 |
+
}
|
1616 |
+
|
1617 |
+
/* admin not logged in, show offline messages */
|
1618 |
+
$wplc_offline = __("We are currently offline. Please leave a message and we'll get back to you shortly.", "wplivechat");
|
1619 |
+
$text = ($wplc_using_locale ? $wplc_offline : stripslashes($wplc_settings['wplc_pro_offline1']));
|
1620 |
+
|
1621 |
+
$ret_msg = "<div id=\"wp-live-chat-2-info\" class=\"wplc-color-bg-1 wplc-color-2\">";
|
1622 |
+
$ret_msg .= $text;
|
1623 |
+
$ret_msg .= "</div>";
|
1624 |
+
$ret_msg .= "<div id=\"wplc_message_div\">";
|
1625 |
+
$ret_msg .= "<input type=\"text\" name=\"wplc_name\" id=\"wplc_name\" value=\"$wplc_loggedin_user_name\" placeholder=\"".__("Name", "wplivechat")."\" />";
|
1626 |
+
$ret_msg .= "<input type=\"text\" name=\"wplc_email\" id=\"wplc_email\" value=\"$wplc_loggedin_user_email\" placeholder=\"".__("Email", "wplivechat")."\" />";
|
1627 |
+
$ret_msg .= "<textarea name=\"wplc_message\" id=\"wplc_message\" placeholder=\"".__("Message", "wplivechat")."\"></textarea>";
|
1628 |
+
|
1629 |
+
if(isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR'] != '') {
|
1630 |
+
$ip_address = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
1631 |
+
} else {
|
1632 |
+
$ip_address = $_SERVER['REMOTE_ADDR'];
|
1633 |
+
}
|
1634 |
+
|
1635 |
+
/** DEPRECATED BY GDPR */
|
1636 |
+
/*if(isset($wplc_settings['wplc_record_ip_address']) && $wplc_settings['wplc_record_ip_address'] == 1) { $offline_ip_address = $ip_address; } else { $offline_ip_address = ""; }*/
|
1637 |
+
|
1638 |
+
$offline_ip_address = "";
|
1639 |
+
|
1640 |
+
$ret_msg .= "<input type=\"hidden\" name=\"wplc_ip_address\" id=\"wplc_ip_address\" value=\"".$offline_ip_address."\" />";
|
1641 |
+
$ret_msg .= "<input type=\"hidden\" name=\"wplc_domain_offline\" id=\"wplc_domain_offline\" value=\"".site_url()."\" />";
|
1642 |
+
$ret_msg .= apply_filters("wplc_filter_live_chat_box_html_send_offline_message_button",wplc_filter_control_live_chat_box_html_send_offline_message_button($wplc_settings));
|
1643 |
+
$ret_msg .= "</div>";
|
1644 |
+
|
1645 |
+
|
1646 |
+
|
1647 |
+
}
|
1648 |
+
$data = array(
|
1649 |
+
'ret_msg' => $ret_msg,
|
1650 |
+
'wplc_settings' => $wplc_settings,
|
1651 |
+
'logged_in' => $logged_in,
|
1652 |
+
'wplc_using_locale' => $wplc_using_locale
|
1653 |
+
);
|
1654 |
+
|
1655 |
+
|
1656 |
+
$ret_msg = apply_filters( "wplc_filter_2nd_layer_modify" , $data );
|
1657 |
+
if( is_array( $ret_msg ) ){
|
1658 |
+
/* if nothing uses this filter is comes back as an array, so return the original message in that array */
|
1659 |
+
return $ret_msg['ret_msg'];
|
1660 |
+
} else {
|
1661 |
+
return $ret_msg;
|
1662 |
+
}
|
1663 |
+
}
|
1664 |
+
|
1665 |
+
/**
|
1666 |
+
* Filter to control the 3rd layer of the chat window
|
1667 |
+
* @param array $wplc_settings live chat settings array
|
1668 |
+
* @return string
|
1669 |
+
* @since 6.0.00
|
1670 |
+
* @author Nick Duncan <nick@codecabin.co.za>
|
1671 |
+
*/
|
1672 |
+
function wplc_filter_control_live_chat_box_html_3rd_layer($wplc_settings,$wplc_using_locale) {
|
1673 |
+
|
1674 |
+
$wplc_sst_2 = __('Connecting. Please be patient...', 'wplivechat');
|
1675 |
+
if (!isset($wplc_settings['wplc_pro_sst2']) || $wplc_settings['wplc_pro_sst2'] == "") { $wplc_settings['wplc_pro_sst2'] = $wplc_sst_2; }
|
1676 |
+
$text = ($wplc_using_locale ? $wplc_sst_2 : stripslashes($wplc_settings['wplc_pro_sst2']));
|
1677 |
+
|
1678 |
+
$ret_msg = "<p class=''wplc-color-4>".$text."</p>";
|
1679 |
+
return $ret_msg;
|
1680 |
+
}
|
1681 |
+
|
1682 |
+
add_filter("wplc_filter_intro_text_heading", "wplc_filter_control_intro_text_heading", 10, 2);
|
1683 |
+
/**
|
1684 |
+
* Filters intro text
|
1685 |
+
*/
|
1686 |
+
function wplc_filter_control_intro_text_heading($content, $wplc_settings){
|
1687 |
+
|
1688 |
+
if (isset($wplc_settings['wplc_require_user_info']) && $wplc_settings['wplc_require_user_info'] == 1) {
|
1689 |
+
|
1690 |
+
} elseif (isset($wplc_settings['wplc_require_user_info']) && $wplc_settings['wplc_require_user_info'] == 'email') {
|
1691 |
+
|
1692 |
+
} elseif (isset($wplc_settings['wplc_require_user_info']) && $wplc_settings['wplc_require_user_info'] == 'name') {
|
1693 |
+
|
1694 |
+
} else {
|
1695 |
+
$content = "";
|
1696 |
+
}
|
1697 |
+
|
1698 |
+
return $content;
|
1699 |
+
}
|
1700 |
+
|
1701 |
+
|
1702 |
+
add_filter("wplc_filter_live_chat_box_above_main_div","wplc_filter_control_live_chat_box_above_main_div",10,3);
|
1703 |
+
function wplc_filter_control_live_chat_box_above_main_div( $msg, $wplc_settings, $cid ) {
|
1704 |
+
if(!isset($wplc_settings['wplc_newtheme'])){ $wplc_settings['wplc_newtheme'] = "theme-2"; }
|
1705 |
+
if (isset($wplc_settings['wplc_newtheme']) && $wplc_settings['wplc_newtheme'] == "theme-2") {
|
1706 |
+
|
1707 |
+
$agent_info = '';
|
1708 |
+
$cbox_header_bg = '';
|
1709 |
+
$agent_tagline = '';
|
1710 |
+
$agent_bio = '';
|
1711 |
+
|
1712 |
+
$a_twitter = '';
|
1713 |
+
$a_linkedin = '';
|
1714 |
+
$a_facebook = '';
|
1715 |
+
$a_website = '';
|
1716 |
+
$social_links = '';
|
1717 |
+
$agent_string = '';
|
1718 |
+
|
1719 |
+
if(isset($wplc_settings['wplc_use_node_server']) && intval($wplc_settings['wplc_use_node_server']) == 1) {} else {
|
1720 |
+
if ( $cid ) {
|
1721 |
+
$cid = wplc_return_chat_id_by_rel($cid);
|
1722 |
+
$chat_data = wplc_get_chat_data( $cid );
|
1723 |
+
|
1724 |
+
if ( isset( $chat_data->agent_id ) ) {
|
1725 |
+
$agent_id = intval( $chat_data->agent_id );
|
1726 |
+
} else {
|
1727 |
+
$agent_id = get_current_user_id();
|
1728 |
+
}
|
1729 |
+
|
1730 |
+
if ( $agent_id ) {
|
1731 |
+
|
1732 |
+
$wplc_acbc_data = get_option("WPLC_ACBC_SETTINGS");
|
1733 |
+
$user_info = get_userdata( $agent_id );
|
1734 |
+
|
1735 |
+
|
1736 |
+
if( isset( $wplc_acbc_data['wplc_use_wp_name'] ) && $wplc_acbc_data['wplc_use_wp_name'] == '1' ){
|
1737 |
+
|
1738 |
+
$agent = $user_info->display_name;
|
1739 |
+
} else {
|
1740 |
+
if (!empty($wplc_acbc_data['wplc_chat_name'])) {
|
1741 |
+
$agent = $wplc_acbc_data['wplc_chat_name'];
|
1742 |
+
} else {
|
1743 |
+
$agent = 'Admin';
|
1744 |
+
}
|
1745 |
+
}
|
1746 |
+
$cbox_header_bg = "style='background-image:url(https://www.gravatar.com/avatar/".md5($user_info->user_email)."?s=380); no-repeat; cover;'";
|
1747 |
+
|
1748 |
+
$extra = apply_filters( "wplc_filter_further_live_chat_box_above_main_div", '', $wplc_settings, $cid, $chat_data, $agent );
|
1749 |
+
|
1750 |
+
$agent_string = '
|
1751 |
+
<p style="text-align:center;">
|
1752 |
+
<img class="img-thumbnail img-circle wplc_thumb32 wplc_agent_involved" style="max-width:inherit;" id="agent_grav_'.$agent_id.'" title="'.$agent.'" src="https://www.gravatar.com/avatar/'.md5($user_info->user_email).'?s=60" /><br />
|
1753 |
+
<span class="wplc_agent_name wplc-color-2">'.$agent.'</span>
|
1754 |
+
'.$extra.'
|
1755 |
+
<span class="bleeper_pullup down"><i class="fa fa-angle-up"></i></span>
|
1756 |
+
</p>';
|
1757 |
+
|
1758 |
+
}
|
1759 |
+
}
|
1760 |
+
|
1761 |
+
}
|
1762 |
+
|
1763 |
+
$msg .= "<div id='wplc_chatbox_header_bg' ".$cbox_header_bg."><div id='wplc_chatbox_header' class='wplc-color-bg-1 wplc-color-4'><div class='wplc_agent_info'>".$agent_string."</div></div></div>";
|
1764 |
+
|
1765 |
+
}
|
1766 |
+
return $msg;
|
1767 |
+
}
|
1768 |
+
|
1769 |
+
/**
|
1770 |
+
* Filter to control the 4th layer of the chat window
|
1771 |
+
* @param array $wplc_settings live chat settings array
|
1772 |
+
* @return string
|
1773 |
+
* @since 6.0.00
|
1774 |
+
* @author Nick Duncan <nick@codecabin.co.za>
|
1775 |
+
*/
|
1776 |
+
function wplc_filter_control_live_chat_box_html_4th_layer($wplc_settings,$wplc_using_locale, $cid ) {
|
1777 |
+
$wplc_enter = __('Connecting. Please be patient...', 'wplivechat');
|
1778 |
+
if (!isset($wplc_settings['wplc_user_enter']) || $wplc_settings['wplc_user_enter'] == "") { $wplc_settings['wplc_pro_sst2'] = $wplc_enter; }
|
1779 |
+
$text = ($wplc_using_locale ? $wplc_enter : stripslashes($wplc_settings['wplc_user_enter']));
|
1780 |
+
|
1781 |
+
$wplc_welcome = __('Welcome. How may I help you?', 'wplivechat');
|
1782 |
+
if (!isset($wplc_settings['wplc_user_welcome_chat']) || $wplc_settings['wplc_user_welcome_chat'] == "") { $wplc_settings['wplc_user_welcome_chat'] = $wplc_welcome; }
|
1783 |
+
$text2 = ($wplc_using_locale ? $wplc_welcome : stripslashes($wplc_settings['wplc_user_welcome_chat']));
|
1784 |
+
|
1785 |
+
|
1786 |
+
|
1787 |
+
|
1788 |
+
|
1789 |
+
$ret_msg = "";
|
1790 |
+
if(!isset($wplc_settings['wplc_newtheme'])){ $wplc_settings['wplc_newtheme'] = "theme-2"; }
|
1791 |
+
if (isset($wplc_settings['wplc_newtheme']) && $wplc_settings['wplc_newtheme'] == 'theme-1') {
|
1792 |
+
$ret_msg .= apply_filters("wplc_filter_typing_control_div","");
|
1793 |
+
}
|
1794 |
+
|
1795 |
+
$ret_msg .= apply_filters("wplc_filter_inner_live_chat_box_4th_layer","", $wplc_settings);
|
1796 |
+
|
1797 |
+
$ret_msg .= "<div id=\"wplc_sound_update\" style=\"height:0; width:0; display:none; border:0;\"></div>";
|
1798 |
+
|
1799 |
+
$ret_msg .= apply_filters("wplc_filter_live_chat_box_above_main_div","",$wplc_settings, $cid);
|
1800 |
+
|
1801 |
+
|
1802 |
+
$ret_msg .= "<div id=\"wplc_chatbox\">";
|
1803 |
+
// $ret_msg .= "<span class='wplc-admin-message'>";
|
1804 |
+
// $ret_msg .= $text2;
|
1805 |
+
// $ret_msg .= "</span>";
|
1806 |
+
// $ret_msg .= "<br />";
|
1807 |
+
// $ret_msg .= "<div class='wplc-clear-float-message'></div>";
|
1808 |
+
$ret_msg .= "</div>";
|
1809 |
+
|
1810 |
+
$ret_msg .= "<div id='bleeper_chat_ended' style='display:none;'></div>";
|
1811 |
+
$ret_msg .= "<div id='wplc_user_message_div'>";
|
1812 |
+
|
1813 |
+
$ret_msg .= "<p id='wplc_msg_notice'>".$text."</p>";
|
1814 |
+
|
1815 |
+
//Editor Controls
|
1816 |
+
$ret_msg .= apply_filters("wplc_filter_chat_text_editor","");
|
1817 |
+
|
1818 |
+
$ret_msg .= "<p>";
|
1819 |
+
$placeholder = __('Type here','wplivechat');
|
1820 |
+
$ret_msg .= "<textarea type=\"text\" name=\"wplc_chatmsg\" id=\"wplc_chatmsg\" placeholder=\"".$placeholder."\" onclick=\"jQuery(this).select();\" class='wdt-emoji-bundle-enabled'></textarea>";
|
1821 |
+
if(!isset($wplc_settings['wplc_newtheme'])){ $wplc_settings['wplc_newtheme'] = "theme-2"; }
|
1822 |
+
if (isset($wplc_settings['wplc_newtheme']) && $wplc_settings['wplc_newtheme'] == 'theme-2') {
|
1823 |
+
$ret_msg .= apply_filters("wplc_filter_typing_control_div_theme_2","");
|
1824 |
+
}
|
1825 |
+
|
1826 |
+
//Upload Controls
|
1827 |
+
$ret_msg .= apply_filters("wplc_filter_chat_upload","");
|
1828 |
+
|
1829 |
+
$ret_msg .= "<input type=\"hidden\" name=\"wplc_cid\" id=\"wplc_cid\" value=\"\" />";
|
1830 |
+
$ret_msg .= "<input id=\"wplc_send_msg\" type=\"button\" value=\"".__("Send", "wplivechat")."\" style=\"display:none;\" />";
|
1831 |
+
$ret_msg .= "</p>";
|
1832 |
+
|
1833 |
+
$ret_msg .= function_exists("wplc_emoji_selector_div") ? wplc_emoji_selector_div() : "";
|
1834 |
+
|
1835 |
+
$current_theme = isset($wplc_settings['wplc_newtheme']) ? $wplc_settings['wplc_newtheme'] : "theme-2";
|
1836 |
+
if($current_theme === "theme-2"){
|
1837 |
+
$ret_msg .= apply_filters("wplc_filter_chat_4th_layer_below_input","", $wplc_settings); //Ratings/Social Icon Filter
|
1838 |
+
}
|
1839 |
+
|
1840 |
+
$ret_msg .= "</div>";
|
1841 |
+
$ret_msg .= "</div>";
|
1842 |
+
return $ret_msg;
|
1843 |
+
}
|
1844 |
+
|
1845 |
+
/**
|
1846 |
+
* Filter to control the 1st layer of the chat window
|
1847 |
+
* @param array $wplc_settings live chat settings array
|
1848 |
+
* @param bool $logged_in Is the admin logged in or not
|
1849 |
+
* @param bool $wplc_using_locale Are they using a localization plugin
|
1850 |
+
* @return string
|
1851 |
+
* @since 6.0.00
|
1852 |
+
* @author Nick Duncan <nick@codecabin.co.za>
|
1853 |
+
*/
|
1854 |
+
function wplc_filter_control_live_chat_box_html_1st_layer($wplc_settings,$logged_in,$wplc_using_locale, $class_override = false) {
|
1855 |
+
|
1856 |
+
$ret_msg = "<div id='wplc_first_message'>";
|
1857 |
+
|
1858 |
+
if(!isset($wplc_settings['wplc_newtheme'])){ $wplc_settings['wplc_newtheme'] = "theme-2"; }
|
1859 |
+
|
1860 |
+
if ($logged_in) {
|
1861 |
+
$wplc_fst_1 = __('Questions?', 'wplivechat');
|
1862 |
+
$wplc_fst_2 = __('Chat with us', 'wplivechat');
|
1863 |
+
if (isset($wplc_settings['wplc_newtheme']) && $wplc_settings['wplc_newtheme'] == "theme-2") {
|
1864 |
+
$coltheme = "wplc-color-4";
|
1865 |
+
} else {
|
1866 |
+
$coltheme = "wplc-color-2";
|
1867 |
+
}
|
1868 |
+
|
1869 |
+
if($class_override){
|
1870 |
+
//Override color class
|
1871 |
+
$coltheme = $class_override;
|
1872 |
+
}
|
1873 |
+
|
1874 |
+
$wplc_tl_msg = "<div class='$coltheme'><strong>" . ($wplc_using_locale ? $wplc_fst_1 : stripslashes($wplc_settings['wplc_pro_fst1'])) . "</strong> " . ( $wplc_using_locale ? $wplc_fst_2 : stripslashes($wplc_settings['wplc_pro_fst2'])) ."</div>";
|
1875 |
+
|
1876 |
+
$ret_msg .= $wplc_tl_msg;
|
1877 |
+
} else {
|
1878 |
+
|
1879 |
+
|
1880 |
+
$wplc_na = __('Chat offline. Leave a message', 'wplivechat');
|
1881 |
+
$wplc_tl_msg = "<span class='wplc_offline'>" . ($wplc_using_locale ? $wplc_na : stripslashes($wplc_settings['wplc_pro_na'])) . "</span>";
|
1882 |
+
$ret_msg .= $wplc_tl_msg;
|
1883 |
+
}
|
1884 |
+
$ret_msg .= "</div>";
|
1885 |
+
|
1886 |
+
|
1887 |
+
|
1888 |
+
return $ret_msg;
|
1889 |
+
|
1890 |
+
}
|
1891 |
+
|
1892 |
+
/**
|
1893 |
+
* Build the initiate teaser
|
1894 |
+
* @return void
|
1895 |
+
* @since 6.0.00
|
1896 |
+
* @author Nick Duncan <nick@codecabin.co.za>
|
1897 |
+
*/
|
1898 |
+
add_filter( 'wplc_filter_list_chats_actions', 'wplc_initiate_chat_button', 12, 3);
|
1899 |
+
function wplc_initiate_chat_button($actions,$result,$post_data) {
|
1900 |
+
|
1901 |
+
|
1902 |
+
if(intval($result->status) == 5 ){
|
1903 |
+
$actions = "<a href=\"javascript:void(0);\" id=\"wplc_initiate_chat\" class=\"wplc_initiate_chat button button-secondary\">".__("Initiate Chat","wplivechat")."</a>";
|
1904 |
+
}
|
1905 |
+
return $actions;
|
1906 |
+
}
|
1907 |
+
|
1908 |
+
|
1909 |
+
add_filter("wplc_loggedin_filter","wplc_filter_control_loggedin",10,1);
|
1910 |
+
function wplc_filter_control_loggedin($logged_in) {
|
1911 |
+
$wplc_is_admin_logged_in = get_transient("wplc_is_admin_logged_in");
|
1912 |
+
|
1913 |
+
if (!function_exists("wplc_register_pro_version") && $wplc_is_admin_logged_in != 1) {
|
1914 |
+
$logged_in = false;
|
1915 |
+
} else {
|
1916 |
+
$logged_in = true;
|
1917 |
+
}
|
1918 |
+
|
1919 |
+
$logged_in_checks = apply_filters("wplc_filter_is_admin_logged_in",array());
|
1920 |
+
|
1921 |
+
/* if we are logged in ANYWHERE, set this to true */
|
1922 |
+
foreach($logged_in_checks as $key => $val) {
|
1923 |
+
if ($val) { $logged_in = true; break; }
|
1924 |
+
}
|
1925 |
+
$logged_in_via_app = false;
|
1926 |
+
if (isset($logged_in_checks['app']) && $logged_in_checks['app'] == true) { $logged_in_via_app = true; }
|
1927 |
+
|
1928 |
+
$logged_in = apply_filters("wplc_final_loggedin_control",$logged_in,$logged_in_via_app);
|
1929 |
+
|
1930 |
+
/* admin is using the basic version and is logged in */
|
1931 |
+
if ($wplc_is_admin_logged_in) { $logged_in = true; }
|
1932 |
+
|
1933 |
+
return $logged_in;
|
1934 |
+
}
|
1935 |
+
|
1936 |
+
function wplc_shortenurl($url) {
|
1937 |
+
if ( strlen($url) > 45) {
|
1938 |
+
return substr($url, 0, 30)."[...]".substr($url, -15);
|
1939 |
+
} else {
|
1940 |
+
return $url;
|
1941 |
+
}
|
1942 |
+
}
|
1943 |
+
|
1944 |
+
|
1945 |
+
/**
|
1946 |
+
* The function that builds the chat box
|
1947 |
+
* @since 6.0.00
|
1948 |
+
* @author Nick Duncan <nick@codecabin.co.za>
|
1949 |
+
* @return JSON encoded HTML
|
1950 |
+
*/
|
1951 |
+
function wplc_output_box_ajax_new($cid = null) {
|
1952 |
+
|
1953 |
+
|
1954 |
+
$ret_msg = array();
|
1955 |
+
$logged_in = false;
|
1956 |
+
|
1957 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
1958 |
+
|
1959 |
+
if(isset($wplc_settings['wplc_using_localization_plugin']) && $wplc_settings['wplc_using_localization_plugin'] == 1){ $wplc_using_locale = true; } else { $wplc_using_locale = false; }
|
1960 |
+
|
1961 |
+
|
1962 |
+
$logged_in = apply_filters("wplc_loggedin_filter",false);
|
1963 |
+
|
1964 |
+
$ret_msg['cbox'] = apply_filters("wplc_theme_control",$wplc_settings,$logged_in,$wplc_using_locale,$cid);
|
1965 |
+
|
1966 |
+
$ret_msg['online'] = $logged_in;
|
1967 |
+
|
1968 |
+
global $wplc_pro_version;
|
1969 |
+
$wplc_ver = str_replace('.', '', $wplc_pro_version);
|
1970 |
+
$checker = intval($wplc_ver);
|
1971 |
+
|
1972 |
+
if ($cid !== null && $cid !== '') {
|
1973 |
+
$ret_msg['cid'] = $cid;
|
1974 |
+
$chat_data = wplc_get_chat_data( $cid );
|
1975 |
+
wplc_record_chat_notification('user_loaded',$cid,array('uri' => $_SERVER['HTTP_REFERER'], 'chat_data' => $chat_data ));
|
1976 |
+
|
1977 |
+
|
1978 |
+
|
1979 |
+
if ( !isset($chat_data) || !$chat_data->agent_id ) {
|
1980 |
+
$ret_msg['type'] = 'new';
|
1981 |
+
} else {
|
1982 |
+
$ret_msg['type'] = 'returning';
|
1983 |
+
|
1984 |
+
if(isset($wplc_settings['wplc_use_node_server']) && intval($wplc_settings['wplc_use_node_server']) == 1) {
|
1985 |
+
//This is using node, we shouldn't generate the header data as part of the chat box.
|
1986 |
+
//We will do this dynamically on the front end
|
1987 |
+
|
1988 |
+
//var_dump("NOPEEE");
|
1989 |
+
|
1990 |
+
} else {
|
1991 |
+
/* build the AGENT DATA array */
|
1992 |
+
$wplc_acbc_data = get_option("WPLC_ACBC_SETTINGS");
|
1993 |
+
$user_info = get_userdata( intval( $chat_data->agent_id ) );
|
1994 |
+
|
1995 |
+
$agent_tagline = '';
|
1996 |
+
$agent_bio = '';
|
1997 |
+
$a_twitter = '';
|
1998 |
+
$a_linkedin = '';
|
1999 |
+
$a_facebook = '';
|
2000 |
+
$a_website = '';
|
2001 |
+
$social_links = '';
|
2002 |
+
|
2003 |
+
if( isset( $wplc_acbc_data['wplc_use_wp_name'] ) && $wplc_acbc_data['wplc_use_wp_name'] == '1' ){
|
2004 |
+
|
2005 |
+
$agent = $user_info->display_name;
|
2006 |
+
} else {
|
2007 |
+
if (!empty($wplc_acbc_data['wplc_chat_name'])) {
|
2008 |
+
$agent = $wplc_acbc_data['wplc_chat_name'];
|
2009 |
+
} else {
|
2010 |
+
$agent = 'Admin';
|
2011 |
+
}
|
2012 |
+
}
|
2013 |
+
|
2014 |
+
if( !isset( $data ) ){ $data = false; }
|
2015 |
+
|
2016 |
+
$agent_tagline = apply_filters( "wplc_filter_agent_data_agent_tagline", $agent_tagline, $cid, $chat_data, $agent, $wplc_acbc_data, $user_info, $data );
|
2017 |
+
$agent_bio = apply_filters( "wplc_filter_agent_data_agent_bio", $agent_bio, $cid, $chat_data, $agent, $wplc_acbc_data, $user_info, $data );
|
2018 |
+
$social_links = apply_filters( "wplc_filter_agent_data_social_links", $social_links, $cid, $chat_data, $agent, $wplc_acbc_data, $user_info, $data);
|
2019 |
+
|
2020 |
+
$ret_msg['agent_data'] = array(
|
2021 |
+
'email' => md5($user_info->user_email),
|
2022 |
+
'name' => $agent,
|
2023 |
+
'aid' => $user_info->ID,
|
2024 |
+
'agent_tagline' => $agent_tagline,
|
2025 |
+
'agent_bio' => $agent_bio,
|
2026 |
+
"social_links" => $social_links
|
2027 |
+
);
|
2028 |
+
}
|
2029 |
+
|
2030 |
+
}
|
2031 |
+
|
2032 |
+
|
2033 |
+
} else {
|
2034 |
+
$ret_msg['type'] = 'new';
|
2035 |
+
}
|
2036 |
+
|
2037 |
+
|
2038 |
+
if (function_exists("wplc_pro_version_control")) {
|
2039 |
+
if ($checker < 6000) {
|
2040 |
+
/* backwards compatibilitty for the old pro version */
|
2041 |
+
return json_encode($ret_msg['cbox']);
|
2042 |
+
} else {
|
2043 |
+
return json_encode($ret_msg);
|
2044 |
+
}
|
2045 |
+
|
2046 |
+
} else {
|
2047 |
+
return json_encode($ret_msg);
|
2048 |
+
}
|
2049 |
+
|
2050 |
+
|
2051 |
+
|
2052 |
+
|
2053 |
+
|
2054 |
+
|
2055 |
+
}
|
2056 |
+
function wplc_return_default_theme($wplc_settings,$logged_in,$wplc_using_locale,$cid) {
|
2057 |
+
$ret_msg = apply_filters("wplc_filter_live_chat_box_html_main_div_top",wplc_filter_control_live_chat_box_html_main_div_top($wplc_settings,$logged_in,$wplc_using_locale));
|
2058 |
+
$ret_msg .= "<div class=\"wp-live-chat-wraper\">";
|
2059 |
+
$ret_msg .= "<div id='bleeper_bell' class='wplc-color-bg-1 wplc-color-2' style='display:none;'><i class='fa fa-bell'></i></div>";
|
2060 |
+
$ret_msg .= apply_filters("wplc_filter_live_chat_box_html_header_div_top",wplc_filter_control_live_chat_box_html_header_div_top($wplc_settings));
|
2061 |
+
$ret_msg .= " <i id=\"wp-live-chat-minimize\" class=\"fa fa-minus wplc-color-bg-2 wplc-color-1\" style=\"display:none;\"></i>";
|
2062 |
+
$ret_msg .= " <i id=\"wp-live-chat-close\" class=\"fa fa-times\" style=\"display:none;\" ></i>";
|
2063 |
+
$ret_msg .= " <div id=\"wp-live-chat-1\" >";
|
2064 |
+
$ret_msg .= apply_filters("wplc_filter_live_chat_box_html_1st_layer",wplc_filter_control_live_chat_box_html_1st_layer($wplc_settings,$logged_in,$wplc_using_locale,'wplc-color-2'));
|
2065 |
+
$ret_msg .= " </div>";
|
2066 |
+
$ret_msg .= '<div id="wplc-chat-alert" class="wplc-chat-alert wplc-chat-alert--' . $wplc_settings["wplc_theme"] . '"></div>';
|
2067 |
+
$ret_msg .= " </div>";
|
2068 |
+
$ret_msg .= " <div id=\"wp-live-chat-2\" style=\"display:none;\">";
|
2069 |
+
$ret_msg .= apply_filters("wplc_filter_live_chat_box_survey","");
|
2070 |
+
$ret_msg .= apply_filters("wplc_filter_live_chat_box_html_2nd_layer",wplc_filter_control_live_chat_box_html_2nd_layer($wplc_settings,$logged_in,$wplc_using_locale,$cid), $cid);
|
2071 |
+
$ret_msg .= " </div>";
|
2072 |
+
$ret_msg .= " <div id=\"wp-live-chat-3\" style=\"display:none;\">";
|
2073 |
+
$ret_msg .= apply_filters("wplc_filter_live_chat_box_html_3rd_layer",wplc_filter_control_live_chat_box_html_3rd_layer($wplc_settings,$wplc_using_locale));
|
2074 |
+
$ret_msg .= " </div>";
|
2075 |
+
$ret_msg .= " <div id=\"wp-live-chat-react\" style=\"display:none;\">";
|
2076 |
+
$ret_msg .= " <p>".__("Reactivating your previous chat...", "wplivechat")."</p>";
|
2077 |
+
$ret_msg .= " </div>";
|
2078 |
+
$ret_msg .= " <div id=\"wplc-extra-div\" style=\"display:none;\">";
|
2079 |
+
$ret_msg .= apply_filters("wplc_filter_wplc_extra_div","",$wplc_settings,$wplc_using_locale);
|
2080 |
+
$ret_msg .= "</div>";
|
2081 |
+
$ret_msg .= "</div>";
|
2082 |
+
$ret_msg .= " <div id=\"wp-live-chat-4\" style=\"display:none;\">";
|
2083 |
+
$ret_msg .= apply_filters("wplc_filter_live_chat_box_html_4th_layer",wplc_filter_control_live_chat_box_html_4th_layer($wplc_settings,$wplc_using_locale, $cid));
|
2084 |
+
$ret_msg .= "</div>";
|
2085 |
+
return $ret_msg;
|
2086 |
+
}
|
2087 |
+
|
2088 |
+
|
2089 |
+
add_filter("wplc_theme_control","wplc_theme_control_function",10,4);
|
2090 |
+
function wplc_theme_control_function($wplc_settings,$logged_in,$wplc_using_locale, $cid) {
|
2091 |
+
|
2092 |
+
if (!$wplc_settings) { return ""; }
|
2093 |
+
if (isset($wplc_settings['wplc_newtheme'])) { $wplc_newtheme = $wplc_settings['wplc_newtheme']; } else { $wplc_newtheme = "theme-2"; }
|
2094 |
+
|
2095 |
+
$default_theme = wplc_return_default_theme($wplc_settings,$logged_in,$wplc_using_locale, $cid);
|
2096 |
+
if (isset($wplc_newtheme)) {
|
2097 |
+
|
2098 |
+
|
2099 |
+
|
2100 |
+
|
2101 |
+
|
2102 |
+
|
2103 |
+
|
2104 |
+
if($wplc_newtheme == 'theme-1') {
|
2105 |
+
$ret_msg = $default_theme;
|
2106 |
+
|
2107 |
+
}
|
2108 |
+
else if($wplc_newtheme == 'theme-2') {
|
2109 |
+
$ret_msg = apply_filters("wplc_filter_live_chat_box_html_main_div_top",wplc_filter_control_live_chat_box_html_main_div_top($wplc_settings,$logged_in,$wplc_using_locale));
|
2110 |
+
$ret_msg .= "<div class=\"wp-live-chat-wraper\">";
|
2111 |
+
$ret_msg .= "<div id='bleeper_bell' class='wplc-color-bg-1 wplc-color-2' style='display:none;'><i class='fa fa-bell'></i></div>";
|
2112 |
+
$ret_msg .= apply_filters("wplc_filter_live_chat_box_html_header_div_top",wplc_filter_control_live_chat_box_html_header_div_top($wplc_settings));
|
2113 |
+
$ret_msg .= " </div>";
|
2114 |
+
$ret_msg .= '<div id="wplc-chat-alert" class="wplc-chat-alert wplc-chat-alert--' . $wplc_settings["wplc_theme"] . '"></div>';
|
2115 |
+
$ret_msg .= " <div id=\"wp-live-chat-2\" style=\"display:none;\">";
|
2116 |
+
$ret_msg .= " <i id=\"wp-live-chat-minimize\" class=\"fa fa-minus wplc-color-bg-2 wplc-color-1\" style=\"display:none;\" ></i>";
|
2117 |
+
$ret_msg .= " <i id=\"wp-live-chat-close\" class=\"fa fa-times\" style=\"display:none;\" ></i>";
|
2118 |
+
$ret_msg .= " <div id=\"wplc-extra-div\" style=\"display:none;\">";
|
2119 |
+
$ret_msg .= apply_filters("wplc_filter_wplc_extra_div","",$wplc_settings,$wplc_using_locale);
|
2120 |
+
$ret_msg .= " </div>";
|
2121 |
+
$ret_msg .= " <div id='wp-live-chat-inner-container'>";
|
2122 |
+
$ret_msg .= " <div id='wp-live-chat-inner'>";
|
2123 |
+
$ret_msg .= " <div id=\"wp-live-chat-1\" class=\"wplc-color-2 wplc-color-bg-1\" >";
|
2124 |
+
$ret_msg .= apply_filters("wplc_filter_live_chat_box_html_1st_layer",wplc_filter_control_live_chat_box_html_1st_layer($wplc_settings,$logged_in,$wplc_using_locale,'wplc-color-2'));
|
2125 |
+
$ret_msg .= " </div>";
|
2126 |
+
$ret_msg .= apply_filters("wplc_filter_live_chat_box_html_2nd_layer",wplc_filter_control_live_chat_box_html_2nd_layer($wplc_settings,$logged_in,$wplc_using_locale, $cid), $cid);
|
2127 |
+
$ret_msg .= " </div>";
|
2128 |
+
$ret_msg .= " <div id=\"wp-live-chat-react\" style=\"display:none;\">";
|
2129 |
+
$ret_msg .= " <p>".__("Reactivating your previous chat...", "wplivechat")."</p>";
|
2130 |
+
$ret_msg .= " </div>";
|
2131 |
+
$ret_msg .= " </div>";
|
2132 |
+
$ret_msg .= " <div id=\"wp-live-chat-3\" style=\"display:none;\">";
|
2133 |
+
$ret_msg .= apply_filters("wplc_filter_live_chat_box_html_3rd_layer",wplc_filter_control_live_chat_box_html_3rd_layer($wplc_settings,$wplc_using_locale));
|
2134 |
+
$ret_msg .= " </div>";
|
2135 |
+
$ret_msg .= " </div>";
|
2136 |
+
$ret_msg .= " <div id=\"wp-live-chat-4\" style=\"display:none;\">";
|
2137 |
+
$ret_msg .= apply_filters("wplc_filter_live_chat_box_html_4th_layer",wplc_filter_control_live_chat_box_html_4th_layer($wplc_settings,$wplc_using_locale, $cid));
|
2138 |
+
$ret_msg .= " </div>";
|
2139 |
+
|
2140 |
+
$ret_msg .= "</div>";
|
2141 |
+
|
2142 |
+
} else {
|
2143 |
+
$ret_msg = $default_theme;
|
2144 |
+
}
|
2145 |
+
} else {
|
2146 |
+
$ret_msg = $default_theme;
|
2147 |
+
}
|
2148 |
+
|
2149 |
+
return $ret_msg;
|
2150 |
+
}
|
2151 |
+
|
2152 |
+
|
2153 |
+
/**
|
2154 |
+
* THIS FUNCTION ONLY RUNS IF THE PRO VERSION IS LESS THAN 5.0.1
|
2155 |
+
* The new method is being handled with ajax
|
2156 |
+
* @return void
|
2157 |
+
*/
|
2158 |
+
function wplc_display_box() {
|
2159 |
+
|
2160 |
+
global $wplc_pro_version;
|
2161 |
+
$wplc_ver = str_replace('.', '', $wplc_pro_version);
|
2162 |
+
$checker = intval($wplc_ver);
|
2163 |
+
|
2164 |
+
if (function_exists("wplc_pro_version_control") && ($checker <= 501 || $checker == 4410)) {
|
2165 |
+
/* prior to latest pro version with ajax handling */
|
2166 |
+
|
2167 |
+
if(function_exists('wplc_display_chat_contents')){
|
2168 |
+
$display_contents = wplc_display_chat_contents();
|
2169 |
+
} else {
|
2170 |
+
$display_contents = 1;
|
2171 |
+
}
|
2172 |
+
|
2173 |
+
if(function_exists('wplc_is_user_banned_basic')){
|
2174 |
+
$user_banned = wplc_is_user_banned_basic();
|
2175 |
+
} else {
|
2176 |
+
$user_banned = 0;
|
2177 |
+
}
|
2178 |
+
if($display_contents && $user_banned == 0){
|
2179 |
+
$wplc_is_admin_logged_in = get_transient("wplc_is_admin_logged_in");
|
2180 |
+
if ($wplc_is_admin_logged_in != 1) {
|
2181 |
+
echo "<!-- wplc a-n-c -->";
|
2182 |
+
}
|
2183 |
+
|
2184 |
+
/* do not show if pro is outdated */
|
2185 |
+
global $wplc_pro_version;
|
2186 |
+
if (isset($wplc_pro_version)) {
|
2187 |
+
$float_version = floatval($wplc_pro_version);
|
2188 |
+
if ($float_version < 4 || $wplc_pro_version == "4.1.0" || $wplc_pro_version == "4.1.1") {
|
2189 |
+
return;
|
2190 |
+
}
|
2191 |
+
}
|
2192 |
+
|
2193 |
+
if (function_exists("wplc_register_pro_version")) {
|
2194 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
2195 |
+
if (!class_exists('Mobile_Detect')) {
|
2196 |
+
require_once (plugin_dir_path(__FILE__) . 'includes/Mobile_Detect.php');
|
2197 |
+
}
|
2198 |
+
$wplc_detect_device = new Mobile_Detect;
|
2199 |
+
$wplc_is_mobile = $wplc_detect_device->isMobile();
|
2200 |
+
if ($wplc_is_mobile && !isset($wplc_settings['wplc_enabled_on_mobile']) && $wplc_settings['wplc_enabled_on_mobile'] != 1) {
|
2201 |
+
return;
|
2202 |
+
}
|
2203 |
+
if (function_exists('wplc_basic_hide_chat_when_offline')) {
|
2204 |
+
$wplc_hide_chat = wplc_basic_hide_chat_when_offline();
|
2205 |
+
if (!$wplc_hide_chat) {
|
2206 |
+
wplc_pro_draw_user_box();
|
2207 |
+
}
|
2208 |
+
} else {
|
2209 |
+
wplc_pro_draw_user_box();
|
2210 |
+
}
|
2211 |
+
} else {
|
2212 |
+
wplc_draw_user_box();
|
2213 |
+
}
|
2214 |
+
}
|
2215 |
+
}
|
2216 |
+
}
|
2217 |
+
function wplc_display_box_ajax() {
|
2218 |
+
|
2219 |
+
if(function_exists('wplc_display_chat_contents')){
|
2220 |
+
$display_contents = wplc_display_chat_contents();
|
2221 |
+
} else {
|
2222 |
+
$display_contents = 1;
|
2223 |
+
}
|
2224 |
+
|
2225 |
+
if(function_exists('wplc_is_user_banned')){
|
2226 |
+
$user_banned = wplc_is_user_banned();
|
2227 |
+
} else if (function_exists('wplc_is_user_banned')){
|
2228 |
+
$user_banned = wplc_is_user_banned_basic();
|
2229 |
+
} else {
|
2230 |
+
$user_banned = 0;
|
2231 |
+
}
|
2232 |
+
if($display_contents && $user_banned == 0){
|
2233 |
+
$wplc_is_admin_logged_in = get_transient("wplc_is_admin_logged_in");
|
2234 |
+
if ($wplc_is_admin_logged_in != 1) {
|
2235 |
+
return "";
|
2236 |
+
}
|
2237 |
+
|
2238 |
+
/* do not show if pro is outdated */
|
2239 |
+
global $wplc_pro_version;
|
2240 |
+
if (isset($wplc_pro_version)) {
|
2241 |
+
$float_version = floatval($wplc_pro_version);
|
2242 |
+
if ($float_version < 4 || $wplc_pro_version == "4.1.0" || $wplc_pro_version == "4.1.1") {
|
2243 |
+
return;
|
2244 |
+
}
|
2245 |
+
}
|
2246 |
+
|
2247 |
+
if (function_exists("wplc_register_pro_version")) {
|
2248 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
2249 |
+
if (!class_exists('Mobile_Detect')) {
|
2250 |
+
require_once (plugin_dir_path(__FILE__) . 'includes/Mobile_Detect.php');
|
2251 |
+
}
|
2252 |
+
$wplc_detect_device = new Mobile_Detect;
|
2253 |
+
$wplc_is_mobile = $wplc_detect_device->isMobile();
|
2254 |
+
if ($wplc_is_mobile && !isset($wplc_settings['wplc_enabled_on_mobile']) && $wplc_settings['wplc_enabled_on_mobile'] != 1) {
|
2255 |
+
return;
|
2256 |
+
}
|
2257 |
+
if (function_exists('wplc_basic_hide_chat_when_offline')) {
|
2258 |
+
$wplc_hide_chat = wplc_basic_hide_chat_when_offline();
|
2259 |
+
if (!$wplc_hide_chat) {
|
2260 |
+
wplc_pro_draw_user_box();
|
2261 |
+
}
|
2262 |
+
} else {
|
2263 |
+
wplc_pro_draw_user_box();
|
2264 |
+
}
|
2265 |
+
} else {
|
2266 |
+
wplc_draw_user_box();
|
2267 |
+
}
|
2268 |
+
}
|
2269 |
+
}
|
2270 |
+
|
2271 |
+
function wplc_admin_display_chat($cid) {
|
2272 |
+
global $wpdb;
|
2273 |
+
global $wplc_tblname_msgs;
|
2274 |
+
$results = $wpdb->get_results(
|
2275 |
+
"
|
2276 |
+
SELECT *
|
2277 |
+
FROM $wplc_tblname_msgs
|
2278 |
+
WHERE `chat_sess_id` = '$cid'
|
2279 |
+
ORDER BY `timestamp` DESC
|
2280 |
+
LIMIT 0, 100
|
2281 |
+
"
|
2282 |
+
);
|
2283 |
+
foreach ($results as $result) {
|
2284 |
+
$from = $result->msgfrom;
|
2285 |
+
$msg = stripslashes($result->msg);
|
2286 |
+
$msg_hist .= "$from: $msg<br />";
|
2287 |
+
}
|
2288 |
+
echo $msg_hist;
|
2289 |
+
}
|
2290 |
+
|
2291 |
+
function wplc_admin_accept_chat($cid) {
|
2292 |
+
$user_ID = get_current_user_id();
|
2293 |
+
wplc_change_chat_status(sanitize_text_field($cid), 3,$user_ID);
|
2294 |
+
return true;
|
2295 |
+
}
|
2296 |
+
|
2297 |
+
add_action('admin_head', 'wplc_update_chat_statuses');
|
2298 |
+
|
2299 |
+
|
2300 |
+
//add_action("wplc_hook_superadmin_head","wplc_hook_control_superadmin_head",10);
|
2301 |
+
// Deprecated as this as now been added to wplc_heartbeat.js
|
2302 |
+
function wplc_hook_control_superadmin_head() {
|
2303 |
+
$wplc_current_user = get_current_user_id();
|
2304 |
+
|
2305 |
+
if( get_user_meta( $wplc_current_user, 'wplc_ma_agent', true )) {
|
2306 |
+
$ajax_nonce = wp_create_nonce("wplc");
|
2307 |
+
?>
|
2308 |
+
<script type="text/javascript">
|
2309 |
+
jQuery(function () {
|
2310 |
+
|
2311 |
+
|
2312 |
+
var wplc_set_transient = null;
|
2313 |
+
|
2314 |
+
wplc_set_transient = setInterval(function () {
|
2315 |
+
wpcl_admin_set_transient();
|
2316 |
+
}, 60000);
|
2317 |
+
wpcl_admin_set_transient();
|
2318 |
+
function wpcl_admin_set_transient() {
|
2319 |
+
var data = {
|
2320 |
+
action: 'wplc_admin_set_transient',
|
2321 |
+
security: '<?php echo $ajax_nonce; ?>'
|
2322 |
+
|
2323 |
+
};
|
2324 |
+
jQuery.post(ajaxurl, data, function (response) {
|
2325 |
+
|
2326 |
+
});
|
2327 |
+
}
|
2328 |
+
|
2329 |
+
});
|
2330 |
+
</script>
|
2331 |
+
<?php
|
2332 |
+
}
|
2333 |
+
}
|
2334 |
+
|
2335 |
+
|
2336 |
+
function wplc_superadmin_javascript() {
|
2337 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
2338 |
+
|
2339 |
+
if(isset($wplc_settings['wplc_use_node_server']) && $wplc_settings['wplc_use_node_server'] == 1 && (!isset($_GET['action']) || $_GET['action'] !== "history") ){
|
2340 |
+
|
2341 |
+
//Using node, remote scripts please
|
2342 |
+
if ( isset( $wplc_settings['wplc_enable_all_admin_pages'] ) && $wplc_settings['wplc_enable_all_admin_pages'] === '1' ) {
|
2343 |
+
/* Run admin JS on all admin pages */
|
2344 |
+
if ( isset( $_GET['action'] ) && $_GET['action'] == "history" ) { }else {
|
2345 |
+
wplc_admin_remote_dashboard_scripts($wplc_settings);
|
2346 |
+
}
|
2347 |
+
} else {
|
2348 |
+
/* Only run admin JS on the chat dashboard page */
|
2349 |
+
if ( isset( $_GET['page'] ) && $_GET['page'] === 'wplivechat-menu' && !isset( $_GET['action'] ) ) {
|
2350 |
+
wplc_admin_remote_dashboard_scripts($wplc_settings);
|
2351 |
+
}
|
2352 |
+
}
|
2353 |
+
|
2354 |
+
if( isset( $_GET['page'] ) && $_GET['page'] === "wplivechat-menu-offline-messages"){
|
2355 |
+
wplc_admin_output_js();
|
2356 |
+
}
|
2357 |
+
} else {
|
2358 |
+
do_action("wplc_hook_superadmin_head");
|
2359 |
+
|
2360 |
+
if ( isset( $_GET['page'] ) && isset( $_GET['action'] ) && $_GET['page'] == "wplivechat-menu" && ( $_GET['action'] != 'welcome' && $_GET['action'] != 'credits' ) ) {
|
2361 |
+
/* admin chat box page */
|
2362 |
+
if (function_exists("wplc_register_pro_version")) {
|
2363 |
+
wplc_return_pro_admin_chat_javascript(sanitize_text_field($_GET['cid']));
|
2364 |
+
} else {
|
2365 |
+
|
2366 |
+
/** set the global chat data here so we dont need to keep getting it from the DB or Cloud server */
|
2367 |
+
global $admin_chat_data;
|
2368 |
+
$admin_chat_data = wplc_get_chat_data($_GET['cid'], __LINE__);
|
2369 |
+
|
2370 |
+
wplc_return_admin_chat_javascript(sanitize_text_field($_GET['cid']));
|
2371 |
+
|
2372 |
+
|
2373 |
+
}
|
2374 |
+
do_action("wplc_hook_admin_javascript_chat");
|
2375 |
+
} else {
|
2376 |
+
/* load this on every other admin page */
|
2377 |
+
if (function_exists("wplc_register_pro_version")) {
|
2378 |
+
wplc_pro_admin_javascript();
|
2379 |
+
} else {
|
2380 |
+
wplc_admin_javascript();
|
2381 |
+
}
|
2382 |
+
do_action("wplc_hook_admin_javascript");
|
2383 |
+
}
|
2384 |
+
|
2385 |
+
|
2386 |
+
?>
|
2387 |
+
<script type="text/javascript">
|
2388 |
+
|
2389 |
+
|
2390 |
+
function wplc_desktop_notification() {
|
2391 |
+
if (typeof Notification !== 'undefined') {
|
2392 |
+
if (!Notification) {
|
2393 |
+
return;
|
2394 |
+
}
|
2395 |
+
if (Notification.permission !== "granted")
|
2396 |
+
Notification.requestPermission();
|
2397 |
+
|
2398 |
+
var wplc_desktop_notification = new Notification('<?php _e('New chat received', 'wplivechat'); ?>', {
|
2399 |
+
icon: wplc_notification_icon_url,
|
2400 |
+
body: "<?php _e("A new chat has been received. Please go the 'Live Chat' page to accept the chat", "wplivechat"); ?>"
|
2401 |
+
});
|
2402 |
+
//Notification.close()
|
2403 |
+
}
|
2404 |
+
}
|
2405 |
+
|
2406 |
+
</script>
|
2407 |
+
<?php
|
2408 |
+
|
2409 |
+
}
|
2410 |
+
}
|
2411 |
+
|
2412 |
+
function old_wplc_superadmin_javascript() {
|
2413 |
+
|
2414 |
+
if (isset($_GET['page']) && ($_GET['page'] == 'wplivechat-menu' || $_GET['page'] == 'wplivechat-menu-settings' || $_GET['page'] == 'wplivechat-menu-offline-messages' || $_GET['page'] == 'wplc-pro-custom-fields' ) ) {
|
2415 |
+
|
2416 |
+
if (!isset($_GET['action'])) {
|
2417 |
+
if (function_exists("wplc_register_pro_version")) {
|
2418 |
+
wplc_pro_admin_javascript();
|
2419 |
+
} else {
|
2420 |
+
wplc_admin_javascript();
|
2421 |
+
}
|
2422 |
+
do_action("wplc_hook_admin_javascript");
|
2423 |
+
} // main page
|
2424 |
+
else if ( isset($_GET['action']) && ( $_GET['action'] != 'welcome' && $_GET['action'] != 'credits' && $_GET['action'] != 'history' ) ) {
|
2425 |
+
if (function_exists("wplc_register_pro_version")) {
|
2426 |
+
wplc_return_pro_admin_chat_javascript(sanitize_text_field($_GET['cid']));
|
2427 |
+
} else {
|
2428 |
+
|
2429 |
+
/** set the global chat data here so we dont need to keep getting it from the DB or Cloud server */
|
2430 |
+
global $admin_chat_data;
|
2431 |
+
$admin_chat_data = wplc_get_chat_data($_GET['cid'], __LINE__);
|
2432 |
+
|
2433 |
+
wplc_return_admin_chat_javascript(sanitize_text_field($_GET['cid']));
|
2434 |
+
|
2435 |
+
|
2436 |
+
}
|
2437 |
+
do_action("wplc_hook_admin_javascript_chat");
|
2438 |
+
}
|
2439 |
+
}
|
2440 |
+
|
2441 |
+
|
2442 |
+
do_action("wplc_hook_superadmin_head");
|
2443 |
+
|
2444 |
+
?>
|
2445 |
+
<script type="text/javascript">
|
2446 |
+
|
2447 |
+
|
2448 |
+
function wplc_desktop_notification() {
|
2449 |
+
if (typeof Notification !== 'undefined') {
|
2450 |
+
if (!Notification) {
|
2451 |
+
return;
|
2452 |
+
}
|
2453 |
+
if (Notification.permission !== "granted")
|
2454 |
+
Notification.requestPermission();
|
2455 |
+
|
2456 |
+
var wplc_desktop_notification = new Notification('<?php _e('New chat received', 'wplivechat'); ?>', {
|
2457 |
+
icon: wplc_notification_icon_url,
|
2458 |
+
body: "<?php _e("A new chat has been received. Please go the 'Live Chat' page to accept the chat", "wplivechat"); ?>"
|
2459 |
+
});
|
2460 |
+
//Notification.close()
|
2461 |
+
}
|
2462 |
+
}
|
2463 |
+
|
2464 |
+
</script>
|
2465 |
+
<?php
|
2466 |
+
}
|
2467 |
+
|
2468 |
+
|
2469 |
+
/**
|
2470 |
+
* Admin JS set up
|
2471 |
+
* @return void
|
2472 |
+
* @since 6.0.00
|
2473 |
+
* @author Nick Duncan <nick@codecabin.co.za>
|
2474 |
+
*/
|
2475 |
+
function wplc_admin_javascript() {
|
2476 |
+
|
2477 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
2478 |
+
if ( isset( $wplc_settings['wplc_enable_all_admin_pages'] ) && $wplc_settings['wplc_enable_all_admin_pages'] === '1' ) {
|
2479 |
+
/* Run admin JS on all admin pages */
|
2480 |
+
if ( isset( $_GET['action'] ) && $_GET['action'] == "history" ) { return; }
|
2481 |
+
else {
|
2482 |
+
wplc_admin_output_js();
|
2483 |
+
}
|
2484 |
+
} else {
|
2485 |
+
/* Only run admin JS on the chat dashboard page */
|
2486 |
+
if ( isset( $_GET['page'] ) && $_GET['page'] === 'wplivechat-menu' && !isset( $_GET['action'] ) ) {
|
2487 |
+
wplc_admin_output_js();
|
2488 |
+
}
|
2489 |
+
}
|
2490 |
+
|
2491 |
+
|
2492 |
+
|
2493 |
+
|
2494 |
+
|
2495 |
+
|
2496 |
+
|
2497 |
+
}
|
2498 |
+
|
2499 |
+
/**
|
2500 |
+
* Outputs the admin JS on to the relevant pages, controlled by wplc_admin_javascript();
|
2501 |
+
*
|
2502 |
+
* @return void
|
2503 |
+
* @since 7.1.00
|
2504 |
+
* @author Nick Duncan
|
2505 |
+
*/
|
2506 |
+
function wplc_admin_output_js() {
|
2507 |
+
$continue = apply_filters( "wplc_version_check_continue", true );
|
2508 |
+
if ($continue === true) {
|
2509 |
+
|
2510 |
+
|
2511 |
+
$ajax_nonce = wp_create_nonce("wplc");
|
2512 |
+
global $wplc_version;
|
2513 |
+
|
2514 |
+
$wplc_current_user = get_current_user_id();
|
2515 |
+
if( get_user_meta( $wplc_current_user, 'wplc_ma_agent', true )) {
|
2516 |
+
|
2517 |
+
wp_register_script('wplc-admin-js', plugins_url('js/wplc_u_admin.js', __FILE__), false, $wplc_version, false);
|
2518 |
+
wp_enqueue_script('wplc-admin-js');
|
2519 |
+
$not_icon = plugins_url('/images/wplc_notification_icon.png', __FILE__);
|
2520 |
+
|
2521 |
+
$wplc_wav_file = plugins_url('/ring.wav', __FILE__);
|
2522 |
+
$wplc_wav_file = apply_filters("wplc_filter_wav_file",$wplc_wav_file);
|
2523 |
+
wp_localize_script('wplc-admin-js', 'wplc_wav_file', $wplc_wav_file);
|
2524 |
+
|
2525 |
+
wp_localize_script('wplc-admin-js', 'wplc_ajax_nonce', $ajax_nonce);
|
2526 |
+
|
2527 |
+
wp_localize_script('wplc-admin-js', 'wplc_notification_icon', $not_icon);
|
2528 |
+
|
2529 |
+
$extra_data = apply_filters("wplc_filter_admin_javascript",array());
|
2530 |
+
wp_localize_script('wplc-admin-js', 'wplc_extra_data', $extra_data);
|
2531 |
+
|
2532 |
+
$ajax_url = admin_url('admin-ajax.php');
|
2533 |
+
$wplc_ajax_url = apply_filters("wplc_filter_ajax_url",$ajax_url);
|
2534 |
+
wp_localize_script('wplc-admin-js', 'wplc_ajaxurl', $wplc_ajax_url);
|
2535 |
+
wp_localize_script('wplc-admin-js', 'wplc_ajaxurl_home', admin_url( 'admin-ajax.php' ) );
|
2536 |
+
|
2537 |
+
$wpc_ma_js_strings = array(
|
2538 |
+
'remove_agent' => __('Remove', 'wplivechat'),
|
2539 |
+
'nonce' => wp_create_nonce("wplc"),
|
2540 |
+
'user_id' => get_current_user_id(),
|
2541 |
+
'typing_string' => __('Typing...', 'wplivechat')
|
2542 |
+
|
2543 |
+
);
|
2544 |
+
wp_localize_script('wplc-admin-js', 'wplc_admin_strings', $wpc_ma_js_strings);
|
2545 |
+
|
2546 |
+
}
|
2547 |
+
}
|
2548 |
+
}
|
2549 |
+
|
2550 |
+
function wplc_admin_menu_layout() {
|
2551 |
+
|
2552 |
+
|
2553 |
+
|
2554 |
+
|
2555 |
+
do_action("wplc_hook_admin_menu_layout");
|
2556 |
+
if (function_exists("wplc_register_pro_version")) {
|
2557 |
+
global $wplc_pro_version;
|
2558 |
+
if (floatval($wplc_pro_version) < 4 || $wplc_pro_version == "4.1.0" || $wplc_pro_version == "4.1.1") {
|
2559 |
+
?>
|
2560 |
+
<div class='error below-h1'>
|
2561 |
+
|
2562 |
+
<p><?php _e("Dear Pro User", "wplivechat") ?><br /></p>
|
2563 |
+
<p><?php _e("You are using an outdated version of <strong>WP Live Chat Support Pro</strong>. Please", "wplivechat") ?> <a href="https://wp-livechat.com/get-updated-version/" target=\"_BLANK\"><?php _e("update to at least version", "wplivechat") ?> 4.0</a> <?php _e("to ensure all functionality is in working order", "wplivechat") ?>.</p>
|
2564 |
+
<p><strong><?php _e("You're live chat box on your website has been temporarily disabled until the Pro plugin has been updated. This is to ensure a smooth and hassle-free user experience for both yourself and your visitors.", "wplivechat") ?></strong></p>
|
2565 |
+
<p><?php _e("You can update your plugin <a href='./update-core.php'>here</a>, <a href='./plugins.php'>here</a> or <a href='https://wp-livechat.com/get-updated-version/' target='_BLANK'>here</a>.", "wplivechat") ?></strong></p>
|
2566 |
+
<p><?php _e("If you are having difficulty updating the plugin, please contact", "wplivechat") ?> nick@wp-livechat.com</p>
|
2567 |
+
|
2568 |
+
</div>
|
2569 |
+
<?php
|
2570 |
+
}
|
2571 |
+
$wplc_ver = str_replace('.', '', $wplc_pro_version);
|
2572 |
+
$wplc_ver = intval($wplc_ver);
|
2573 |
+
if ($wplc_ver < 501) {
|
2574 |
+
?>
|
2575 |
+
<div class='error below-h1'>
|
2576 |
+
|
2577 |
+
<p><?php _e("Dear Pro User", "wplivechat") ?><br /></p>
|
2578 |
+
<p><?php _e("You are using an outdated version of <strong>WP Live Chat Support Pro</strong>.", "wplivechat") ?></p>
|
2579 |
+
<p>
|
2580 |
+
<strong><?php _e("Please update to the latest version of WP Live Chat Support Pro", 'wplivechat'); ?>
|
2581 |
+
<a href="https://wp-livechat.com/get-updated-version/" target=\"_BLANK\"> <?php _e("Version 5.0.1", "wplivechat"); ?></a>
|
2582 |
+
<?php _e("to ensure everything is working correctly.", "wplivechat"); ?>
|
2583 |
+
</strong>
|
2584 |
+
</p>
|
2585 |
+
<p><?php _e("You can update your plugin <a href='./update-core.php'>here</a>, <a href='./plugins.php'>here</a> or <a href='https://wp-livechat.com/get-updated-version/' target='_BLANK'>here</a>.", "wplivechat") ?></strong></p>
|
2586 |
+
<p><?php _e("If you are having difficulty updating the plugin, please contact", "wplivechat") ?> nick@wp-livechat.com</p>
|
2587 |
+
|
2588 |
+
</div>
|
2589 |
+
<?php
|
2590 |
+
}
|
2591 |
+
}
|
2592 |
+
if ( ( get_option("WPLC_V8_FIRST_TIME") == true && !class_exists("APC_Object_Cache") ) || ( isset( $_GET['action'] ) && ( $_GET['action'] == 'welcome' || $_GET['action'] == 'credits' ) ) ){
|
2593 |
+
include 'includes/welcome_page.php';
|
2594 |
+
update_option('WPLC_V8_FIRST_TIME', false);
|
2595 |
+
} else {
|
2596 |
+
|
2597 |
+
update_option('WPLC_V8_FIRST_TIME', false);
|
2598 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
2599 |
+
if ( isset( $wplc_settings['wplc_use_node_server'] ) && $wplc_settings['wplc_use_node_server'] == 1 ) {
|
2600 |
+
//Node in use, load remote dashboard
|
2601 |
+
if ( $_GET['page'] === 'wplivechat-menu') {
|
2602 |
+
wplc_admin_dashboard_layout_node('dashboard');
|
2603 |
+
|
2604 |
+
if( isset($_GET['action']) ){
|
2605 |
+
wplc_admin_menu_layout_display();
|
2606 |
+
}
|
2607 |
+
} else {
|
2608 |
+
// we'll control this in admin_footer
|
2609 |
+
//wplc_admin_dashboard_layout_node('other');
|
2610 |
+
}
|
2611 |
+
|
2612 |
+
} else {
|
2613 |
+
if (function_exists("wplc_register_pro_version")) {
|
2614 |
+
wplc_pro_admin_menu_layout_display();
|
2615 |
+
} else {
|
2616 |
+
wplc_admin_menu_layout_display();
|
2617 |
+
}
|
2618 |
+
}
|
2619 |
+
}
|
2620 |
+
}
|
2621 |
+
|
2622 |
+
|
2623 |
+
|
2624 |
+
function wplc_first_time_tutorial() {
|
2625 |
+
if (!get_option('WPLC_FIRST_TIME_TUTORIAL')) {
|
2626 |
+
|
2627 |
+
global $wplc_basic_plugin_url;
|
2628 |
+
?>
|
2629 |
+
|
2630 |
+
|
2631 |
+
<div id="wplcftt" style='margin-top:30px; margin-bottom:20px; width: 65%; background-color: #FFF; box-shadow: 1px 1px 3px #ccc; display:block; padding:10px; text-align:center; margin-left:auto; margin-right:auto;'>
|
2632 |
+
<img src='<?php echo $wplc_basic_plugin_url; ?>/images/wplc_notification_icon.png' width="130" align="center" />
|
2633 |
+
<h1 style='font-weight: 300; font-size: 50px; line-height: 50px;'><strong style="color: #ec822c;"><?php _e("Congratulations","wplivechat"); ?></strong></h1>
|
2634 |
+
<h2><strong><?php _e("You are now accepting live chat requests on your site.","wplivechat"); ?></strong></h2>
|
2635 |
+
<p><?php _e("The live chat box has automatically been enabled on your website.","wplivechat"); ?></p>
|
2636 |
+
<p><?php _e("Chat notifications will start appearing once visitors send a request.","wplivechat"); ?></p>
|
2637 |
+
<p><?php _e("You may <a href='?page=wplivechat-menu-settings' target='_BLANK'>modify your chat box settings here.","wplivechat"); ?></a></p>
|
2638 |
+
<p><?php _e("Experiencing issues?","wplivechat"); ?> <a href="https://wp-livechat.com/documentation/troubleshooting/" target="_BLANK" title=""><?php _e("Visit our troubleshooting section.","wplivechat"); ?></a></p>
|
2639 |
+
|
2640 |
+
<p><button id="wplc_close_ftt" class="button button-secondary"><?php _e("Hide","wplivechat"); ?></button></p>
|
2641 |
+
|
2642 |
+
</div>
|
2643 |
+
|
2644 |
+
<?php }
|
2645 |
+
}
|
2646 |
+
|
2647 |
+
|
2648 |
+
/**
|
2649 |
+
* Control the content below the visitor count
|
2650 |
+
* @return void
|
2651 |
+
* @since 6.0.00
|
2652 |
+
* @author Nick Duncan <nick@codecabin.co.za>
|
2653 |
+
*/
|
2654 |
+
add_filter("wplc_filter_chat_dahsboard_visitors_online_bottom","wplc_filter_control_chat_dashboard_visitors_online_bottom",10);
|
2655 |
+
function wplc_filter_control_chat_dashboard_visitors_online_bottom($text) {
|
2656 |
+
$text = "<hr />";
|
2657 |
+
$text .= "<p class='wplc-agent-info' id='wplc-agent-info'>";
|
2658 |
+
$text .= " <span class='wplc_agents_online'>1</span>";
|
2659 |
+
$text .= " <a href='javascript:void(0);'>".__("Agent(s) online","wplivechat")."</a>";
|
2660 |
+
$text .= "</p>";
|
2661 |
+
return $text;
|
2662 |
+
}
|
2663 |
+
|
2664 |
+
|
2665 |
+
add_action("wplc_hook_chat_dashboard_bottom","wplc_hook_control_chat_dashboard_bottom",10);
|
2666 |
+
/**
|
2667 |
+
* Decides whether or not to show the available extensions for this area.
|
2668 |
+
* @return void
|
2669 |
+
* @since 6.0.00
|
2670 |
+
* @author Nick Duncan <nick@codecabin.co.za>
|
2671 |
+
*/
|
2672 |
+
function wplc_hook_control_chat_dashboard_bottom() {
|
2673 |
+
echo "<p id='wplc_footer_message' style='display:none;'>";
|
2674 |
+
?>
|
2675 |
+
<?php _e("With the Pro add-on of WP Live Chat Support, you can", "wplivechat"); ?>
|
2676 |
+
<a href="http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=initiate1" title="<?php _e("see who's online and initiate chats", "wplivechat"); ?>" target=\"_BLANK\">
|
2677 |
+
<?php _e("initiate chats", "wplivechat"); ?>
|
2678 |
+
</a> <?php _e("with your online visitors with the click of a button.", "wplivechat"); ?>
|
2679 |
+
<a href="http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=initiate2" title="<?php _e("Buy the Pro add-on now.", "wplivechat"); ?>" target=\"_BLANK\">
|
2680 |
+
<strong>
|
2681 |
+
<?php _e("Buy the Pro add-on now.", "wplivechat"); ?>
|
2682 |
+
</strong>
|
2683 |
+
</a>
|
2684 |
+
<?php
|
2685 |
+
echo "</p>";
|
2686 |
+
|
2687 |
+
|
2688 |
+
|
2689 |
+
}
|
2690 |
+
|
2691 |
+
|
2692 |
+
function wplc_admin_menu_layout_display() {
|
2693 |
+
|
2694 |
+
$wplc_current_user = get_current_user_id();
|
2695 |
+
|
2696 |
+
if( get_user_meta( $wplc_current_user, 'wplc_ma_agent', true ) ){
|
2697 |
+
/*
|
2698 |
+
-- modified in in 6.0.04 --
|
2699 |
+
|
2700 |
+
if(current_user_can('wplc_ma_agent') || current_user_can('manage_options')){
|
2701 |
+
*/
|
2702 |
+
do_action("wplc_hook_admin_menu_layout_display_top");
|
2703 |
+
|
2704 |
+
wplc_stats("chat_dashboard");
|
2705 |
+
|
2706 |
+
global $wplc_basic_plugin_url;
|
2707 |
+
if (!isset($_GET['action'])) {
|
2708 |
+
?>
|
2709 |
+
<style>
|
2710 |
+
#wplc-support-tabs a.wplc-support-link {
|
2711 |
+
background: url('<?php echo $wplc_basic_plugin_url; ?>/images/support.png');
|
2712 |
+
right: 0px;
|
2713 |
+
top: 250px;
|
2714 |
+
height: 108px;
|
2715 |
+
width: 45px;
|
2716 |
+
margin: 0;
|
2717 |
+
padding: 0;
|
2718 |
+
position: fixed;
|
2719 |
+
z-index: 9999;
|
2720 |
+
display:block;
|
2721 |
+
}
|
2722 |
+
</style>
|
2723 |
+
<div class='wplc_network_issue' style='display:none;'>
|
2724 |
+
|
2725 |
+
</div>
|
2726 |
+
|
2727 |
+
<div id="wplc-support-tabs">
|
2728 |
+
<a class="wplc-support-link wplc-rotate" href="?page=wplivechat-menu-support-page"></a>
|
2729 |
+
</div>
|
2730 |
+
<div class='wplc_page_title'>
|
2731 |
+
<img src='<?php echo WPLC_BASIC_PLUGIN_URL; ?>images/wplc-logo.png' class='wplc-logo' />
|
2732 |
+
<?php wplc_first_time_tutorial(); ?>
|
2733 |
+
<?php do_action("wplc_hook_chat_dashboard_above"); ?>
|
2734 |
+
|
2735 |
+
<p><?php _e("Please note: This window must be open in order to receive new chat notifications.", "wplivechat"); ?></p>
|
2736 |
+
</div>
|
2737 |
+
|
2738 |
+
<?php
|
2739 |
+
$continue = apply_filters( "wplc_version_check_continue", true );
|
2740 |
+
if ($continue !== true) {
|
2741 |
+
|
2742 |
+
echo "<hr />";
|
2743 |
+
echo "<center>";
|
2744 |
+
echo "<h1>".$continue."</h1>";
|
2745 |
+
echo "<p>".sprintf( __( 'Need help? <a href="%s" target="_BLANK">contact us</a>.', 'wplivechat'),'https://wp-livechat.com/contact-us/')."</p>";
|
2746 |
+
echo "</center>";
|
2747 |
+
|
2748 |
+
|
2749 |
+
} else {
|
2750 |
+
|
2751 |
+
?>
|
2752 |
+
|
2753 |
+
|
2754 |
+
<div id="wplc_sound"></div>
|
2755 |
+
|
2756 |
+
<div id="wplc_admin_chat_holder">
|
2757 |
+
<div id='wplc_admin_chat_info_new'>
|
2758 |
+
<div class='wplc_chat_vis_count_box'>
|
2759 |
+
<?php do_action("wplc_hook_chat_dahsboard_visitors_online_top"); ?>
|
2760 |
+
<span class='wplc_vis_online'>0</span>
|
2761 |
+
<span style='text-transform:uppercase;'>
|
2762 |
+
<?php _e("Visitors online","wplivechat"); ?>
|
2763 |
+
</span>
|
2764 |
+
<?php echo apply_filters("wplc_filter_chat_dahsboard_visitors_online_bottom",""); ?>
|
2765 |
+
|
2766 |
+
|
2767 |
+
</div>
|
2768 |
+
|
2769 |
+
<?php do_action("wplc_after_chat_visitor_count_hook"); ?>
|
2770 |
+
|
2771 |
+
</div>
|
2772 |
+
|
2773 |
+
<div id="wplc_admin_chat_area_new">
|
2774 |
+
<div style="display:block;padding:10px;">
|
2775 |
+
<ul class='wplc_chat_ul_header'>
|
2776 |
+
<li><span class='wplc_header_vh wplc_headerspan_v'><?php _e("Visitor","wplivechat"); ?></span></li>
|
2777 |
+
<li><span class='wplc_header_vh wplc_headerspan_t'><?php _e("Time","wplivechat"); ?></span></li>
|
2778 |
+
<li><span class='wplc_header_vh wplc_headerspan_nr'><?php _e("Type","wplivechat"); ?></span></li>
|
2779 |
+
<li><span class='wplc_header_vh wplc_headerspan_dev'><?php _e("Device","wplivechat"); ?></span></li>
|
2780 |
+
<li><span class='wplc_header_vh wplc_headerspan_d'><?php _e("Data","wplivechat"); ?></span></li>
|
2781 |
+
<li><span class='wplc_header_vh wplc_headerspan_s'><?php _e("Status","wplivechat"); ?></span></li>
|
2782 |
+
<li><span class='wplc_header_vh wplc_headerspan_a'><?php _e("Action","wplivechat"); ?></span></li>
|
2783 |
+
</ul>
|
2784 |
+
<ul id='wplc_chat_ul'>
|
2785 |
+
</ul>
|
2786 |
+
<br />
|
2787 |
+
<hr />
|
2788 |
+
<?php do_action("wplc_hook_chat_dashboard_bottom"); ?>
|
2789 |
+
|
2790 |
+
</div>
|
2791 |
+
|
2792 |
+
</div>
|
2793 |
+
</div>
|
2794 |
+
<?php } ?>
|
2795 |
+
|
2796 |
+
|
2797 |
+
|
2798 |
+
|
2799 |
+
<?php
|
2800 |
+
} else {
|
2801 |
+
if (isset($_GET['aid'])) { $aid = $_GET['aid']; } else { $aid = null; }
|
2802 |
+
do_action("wplc_hook_admin_menu_layout_display_1",$_GET['action'],$_GET['cid'],$aid);
|
2803 |
+
|
2804 |
+
if (!is_null($aid)) {
|
2805 |
+
do_action("wplc_hook_update_agent_id",$_GET['cid'],$aid);
|
2806 |
+
}
|
2807 |
+
|
2808 |
+
do_action("wplc_hook_admin_menu_layout_display_1",$_GET['action'],$_GET['cid'],$aid);
|
2809 |
+
|
2810 |
+
if ($_GET['action'] == 'ac') {
|
2811 |
+
do_action('wplc_hook_accept_chat',$_GET,$aid);
|
2812 |
+
}
|
2813 |
+
do_action("wplc_hook_admin_menu_layout_display",$_GET['action'],$_GET['cid'],$aid);
|
2814 |
+
}
|
2815 |
+
} else {
|
2816 |
+
?>
|
2817 |
+
|
2818 |
+
<h1><?php _e("Chat Dashboard","wplivechat"); ?></h1>
|
2819 |
+
<div id="welcome-panel" class="welcome-panel">
|
2820 |
+
<div class="welcome-panel-content">
|
2821 |
+
<h2><?php _e("Oh no!","wplivechat"); ?></h2>
|
2822 |
+
<p class="about-description">
|
2823 |
+
<?php _e(
|
2824 |
+
"You do not have access to this page as <strong>you are not a chat agent</strong>.",
|
2825 |
+
"wplivechat"
|
2826 |
+
); ?>
|
2827 |
+
</p>
|
2828 |
+
<p>Users with access to this page are as follows:</p>
|
2829 |
+
<p>
|
2830 |
+
<?php
|
2831 |
+
$user_array = get_users(array(
|
2832 |
+
'meta_key' => 'wplc_ma_agent',
|
2833 |
+
));
|
2834 |
+
echo "<ol>";
|
2835 |
+
if ($user_array) {
|
2836 |
+
foreach ($user_array as $user) {
|
2837 |
+
echo "<li> ".$user->display_name . " (ID: ".$user->ID.")</li>";
|
2838 |
+
}
|
2839 |
+
}
|
2840 |
+
echo "</ol>";
|
2841 |
+
?>
|
2842 |
+
</p>
|
2843 |
+
</div>
|
2844 |
+
</div>
|
2845 |
+
<?php
|
2846 |
+
}
|
2847 |
+
}
|
2848 |
+
|
2849 |
+
add_action("wplc_hook_change_status_on_answer","wplc_hook_control_change_status_on_answer",10,2);
|
2850 |
+
function wplc_hook_control_change_status_on_answer($get_data, $chat_data = false) {
|
2851 |
+
|
2852 |
+
$user_ID = get_current_user_id();
|
2853 |
+
wplc_change_chat_status(sanitize_text_field($get_data['cid']), 3,$user_ID );
|
2854 |
+
wplc_record_chat_notification("joined",$get_data['cid'],array("aid"=>$user_ID));
|
2855 |
+
}
|
2856 |
+
|
2857 |
+
|
2858 |
+
add_action('wplc_hook_accept_chat','wplc_hook_control_accept_chat',10,2);
|
2859 |
+
function wplc_hook_control_accept_chat($get_data,$aid) {
|
2860 |
+
|
2861 |
+
global $admin_chat_data;
|
2862 |
+
|
2863 |
+
if (!$admin_chat_data) {
|
2864 |
+
$chat_data = wplc_get_chat_data($get_data['cid'], __LINE__);
|
2865 |
+
} else {
|
2866 |
+
if (isset($admin_chat_data->id) && intval($admin_chat_data->id) === intval($get_data['cid'])) {
|
2867 |
+
$chat_data = $admin_chat_data;
|
2868 |
+
} else {
|
2869 |
+
/* chat ID's dont match, get the data for the correct chat ID */
|
2870 |
+
$chat_data = wplc_get_chat_data($get_data['cid'], __LINE__);
|
2871 |
+
}
|
2872 |
+
}
|
2873 |
+
|
2874 |
+
|
2875 |
+
|
2876 |
+
|
2877 |
+
|
2878 |
+
do_action("wplc_hook_accept_chat_url",$get_data, $chat_data);
|
2879 |
+
|
2880 |
+
do_action("wplc_hook_change_status_on_answer",$get_data, $chat_data);
|
2881 |
+
|
2882 |
+
|
2883 |
+
if (function_exists("wplc_register_pro_version")) {
|
2884 |
+
/* backwards compatibility */
|
2885 |
+
wplc_pro_draw_chat_area(sanitize_text_field($get_data['cid']));
|
2886 |
+
} else {
|
2887 |
+
do_action("wplc_hook_draw_chat_area",$get_data, $chat_data);
|
2888 |
+
|
2889 |
+
}
|
2890 |
+
|
2891 |
+
|
2892 |
+
}
|
2893 |
+
|
2894 |
+
/**
|
2895 |
+
* Hook to accept chat
|
2896 |
+
*
|
2897 |
+
* @since 7.1.00
|
2898 |
+
* @param
|
2899 |
+
* @return void
|
2900 |
+
* @author Nick Duncan (nick@codecabin.co.za)
|
2901 |
+
*
|
2902 |
+
*/
|
2903 |
+
add_action( 'wplc_hook_accept_chat_url' , 'wplc_b_hook_control_accept_chat_url', 5, 2);
|
2904 |
+
remove_action( 'wplc_hook_accept_chat_url' , 'wplc_ma_hook_control_accept_chat_url', 10, 2); /* remove the older Pro hook as this was moved now to the basic version in 7.1.00 */
|
2905 |
+
function wplc_b_hook_control_accept_chat_url($get_data, $chat_data = false) {
|
2906 |
+
if (!isset($get_data['agent_id'])) {
|
2907 |
+
/* free version */
|
2908 |
+
wplc_b_update_agent_id(sanitize_text_field($get_data['cid']), get_current_user_id());
|
2909 |
+
} else {
|
2910 |
+
wplc_b_update_agent_id(sanitize_text_field($get_data['cid']), sanitize_text_field($get_data['agent_id']));
|
2911 |
+
}
|
2912 |
+
|
2913 |
+
}
|
2914 |
+
|
2915 |
+
/**
|
2916 |
+
* Assign the chat to the agent
|
2917 |
+
*
|
2918 |
+
* Replaces the same function of a different name in the older pro version
|
2919 |
+
*
|
2920 |
+
* @since 7.1.00
|
2921 |
+
* @param
|
2922 |
+
* @return void
|
2923 |
+
* @author Nick Duncan (nick@codecabin.co.za)
|
2924 |
+
*
|
2925 |
+
*/
|
2926 |
+
function wplc_b_update_agent_id($cid, $aid){
|
2927 |
+
global $wpdb;
|
2928 |
+
global $wplc_tblname_chats;
|
2929 |
+
$sql = "SELECT * FROM `$wplc_tblname_chats` WHERE `id` = '$cid' LIMIT 1";
|
2930 |
+
$result = $wpdb->get_row($sql);
|
2931 |
+
if ($result) {
|
2932 |
+
if(intval($result->status) != 3){
|
2933 |
+
$update = "UPDATE `$wplc_tblname_chats` SET `agent_id` = '$aid' WHERE `id` = '$cid' LIMIT 1";
|
2934 |
+
$wpdb->query($update);
|
2935 |
+
}
|
2936 |
+
}
|
2937 |
+
}
|
2938 |
+
|
2939 |
+
|
2940 |
+
|
2941 |
+
add_action("wplc_hook_chat_dashboard_bottom","wplc_hook_control_app_chat_dashboard_bottom",10);
|
2942 |
+
function wplc_hook_control_app_chat_dashboard_bottom() {
|
2943 |
+
//echo "<p>Tired of logging in to accept chats? Use our <a href='https://wp-livechat.com/extensions/mobile-desktop-app-extension/?utm_source=plugin&utm_medium=plugin&utm_campaign=main_app' target='_BLANK'>Android app</a> or <a href='https://wp-livechat.com/extensions/mobile-desktop-app-extension/?utm_source=plugin&utm_medium=plugin&utm_campaign=main_desktop' target='_BLANK'>desktop app</a> to monitor visitors, accept and initiate chats.</p>";
|
2944 |
+
}
|
2945 |
+
|
2946 |
+
add_action("wplc_hook_draw_chat_area","wplc_hook_control_draw_chat_area",10,2);
|
2947 |
+
function wplc_hook_control_draw_chat_area($get_data, $chat_data = false) {
|
2948 |
+
|
2949 |
+
wplc_draw_chat_area(sanitize_text_field($get_data['cid']), $chat_data);
|
2950 |
+
}
|
2951 |
+
|
2952 |
+
function wplc_draw_chat_area($cid, $chat_data = false) {
|
2953 |
+
|
2954 |
+
global $wpdb;
|
2955 |
+
global $wplc_tblname_chats;
|
2956 |
+
|
2957 |
+
$results = $wpdb->get_results(
|
2958 |
+
"
|
2959 |
+
SELECT *
|
2960 |
+
FROM $wplc_tblname_chats
|
2961 |
+
WHERE `id` = '$cid'
|
2962 |
+
LIMIT 1
|
2963 |
+
"
|
2964 |
+
);
|
2965 |
+
if ($results) { } else { $results[0] = null; } /* if chat ID doesnt exist, create the variable anyway to avoid an error. Hopefully the Chat ID exists on the server..! */
|
2966 |
+
|
2967 |
+
|
2968 |
+
$result = apply_filters("wplc_filter_chat_area_data", $results[0], $cid);
|
2969 |
+
|
2970 |
+
|
2971 |
+
?>
|
2972 |
+
<style>
|
2973 |
+
|
2974 |
+
.wplc-clear-float-message{
|
2975 |
+
clear: both;
|
2976 |
+
}
|
2977 |
+
|
2978 |
+
.rating{
|
2979 |
+
background-color: lightgray;
|
2980 |
+
width: 80px;
|
2981 |
+
padding: 2px;
|
2982 |
+
border-radius: 4px;
|
2983 |
+
text-align: center;
|
2984 |
+
color: white;
|
2985 |
+
display: inline-block;
|
2986 |
+
float: right;
|
2987 |
+
}
|
2988 |
+
|
2989 |
+
.rating-bad {
|
2990 |
+
background-color: #AF0B0B !important;
|
2991 |
+
}
|
2992 |
+
|
2993 |
+
.rating-good {
|
2994 |
+
background-color: #368437 !important;
|
2995 |
+
}
|
2996 |
+
|
2997 |
+
|
2998 |
+
</style>
|
2999 |
+
<?php
|
3000 |
+
|
3001 |
+
$user_data = maybe_unserialize($result->ip);
|
3002 |
+
$user_ip = isset($user_data['ip']) ? $user_data['ip'] : 'Unknown';
|
3003 |
+
$browser = isset($user_data['user_agent']) ? wplc_return_browser_string($user_data['user_agent']) : "Unknown";
|
3004 |
+
$browser_image = wplc_return_browser_image($browser, "16");
|
3005 |
+
|
3006 |
+
|
3007 |
+
global $wplc_basic_plugin_url;
|
3008 |
+
if ($result->status == 1) {
|
3009 |
+
$status = __("Previous", "wplivechat");
|
3010 |
+
} else {
|
3011 |
+
$status = __("Active", "wplivechat");
|
3012 |
+
}
|
3013 |
+
|
3014 |
+
if($user_ip == ""){
|
3015 |
+
$user_ip = __('IP Address not recorded', 'wplivechat');
|
3016 |
+
} else {
|
3017 |
+
$user_ip = "<a href='http://www.ip-adress.com/ip_tracer/" . $user_ip . "' title='".__('Whois for' ,'wplivechat')." ".$user_ip."' target='_BLANK'>".$user_ip."</a>";
|
3018 |
+
}
|
3019 |
+
|
3020 |
+
echo "<h2>$status " . __( 'Chat with', 'wplivechat' ) . " " . sanitize_text_field($result->name) . "</h2>";
|
3021 |
+
if ( isset( $_GET['action'] ) && 'history' === $_GET['action'] ) {
|
3022 |
+
echo "<span class='wplc-history__date'><strong>" . __( 'Starting Time:', 'wplivechat' ) . "</strong>" . date( 'Y-m-d H:i:s', current_time( strtotime( $result->timestamp ) ) ) . "</span>";
|
3023 |
+
echo "<span class='wplc-history__date wplc-history__date-end'><strong>" . __( 'Ending Time:', 'wplivechat' ) . "</strong>" . date( 'Y-m-d H:i:s', current_time( strtotime( $result->last_active_timestamp ) ) ) . "</span>";
|
3024 |
+
}
|
3025 |
+
echo "<style>#adminmenuwrap { display:none; } #adminmenuback { display:none; } #wpadminbar { display:none; } #wpfooter { display:none; } .update-nag { display:none; }</style>";
|
3026 |
+
|
3027 |
+
echo "<div class=\"end_chat_div\">";
|
3028 |
+
|
3029 |
+
do_action("wplc_admin_chat_area_before_end_chat_button", $result);
|
3030 |
+
|
3031 |
+
echo "<a href=\"javascript:void(0);\" class=\"wplc_admin_close_chat button\" id=\"wplc_admin_close_chat\">" . __("End chat", "wplivechat") . "</a>";
|
3032 |
+
|
3033 |
+
do_action("wplc_admin_chat_area_after_end_chat_button", $result);
|
3034 |
+
|
3035 |
+
echo "</div>";
|
3036 |
+
|
3037 |
+
do_action("wplc_add_js_admin_chat_area", $cid, $chat_data);
|
3038 |
+
|
3039 |
+
echo "<div id='admin_chat_box'>";
|
3040 |
+
|
3041 |
+
$result->continue = true;
|
3042 |
+
|
3043 |
+
do_action("wplc_hook_wplc_draw_chat_area",$result);
|
3044 |
+
|
3045 |
+
if (!$result->continue) { return; }
|
3046 |
+
|
3047 |
+
echo"<div class='admin_chat_box'><div class='admin_chat_box_inner' id='admin_chat_box_area_" . $result->id . "'>".apply_filters( "wplc_chat_box_draw_chat_box_inner", "", $cid)."</div><div class='admin_chat_box_inner_bottom'>" . wplc_return_chat_response_box($cid, $result) . "</div>";
|
3048 |
+
|
3049 |
+
|
3050 |
+
echo "</div>";
|
3051 |
+
echo "<div class='admin_visitor_info'>";
|
3052 |
+
do_action("wplc_hook_admin_visitor_info_display_before",$cid);
|
3053 |
+
|
3054 |
+
|
3055 |
+
echo " <div style='float:left; width:100px;'><img src=\"//www.gravatar.com/avatar/" . md5($result->email) . "\" class=\"admin_chat_img\" /></div>";
|
3056 |
+
echo " <div style='float:left;'>";
|
3057 |
+
|
3058 |
+
echo " <div class='admin_visitor_info_box1'>";
|
3059 |
+
echo " <span class='admin_chat_name'>" . sanitize_text_field($result->name) . "</span>";
|
3060 |
+
echo " <span class='admin_chat_email'>" . sanitize_text_field($result->email) . "</span>";
|
3061 |
+
echo " </div>";
|
3062 |
+
echo " </div>";
|
3063 |
+
|
3064 |
+
echo " <div class='admin_visitor_advanced_info'>";
|
3065 |
+
echo " <strong>" . __("Site Info", "wplivechat") . "</strong>";
|
3066 |
+
echo " <hr />";
|
3067 |
+
echo " <span class='part1'>" . __("Chat initiated on:", "wplivechat") . "</span> <span class='part2'>" . esc_url($result->url) . "</span>";
|
3068 |
+
echo " </div>";
|
3069 |
+
|
3070 |
+
echo " <div class='admin_visitor_advanced_info'>";
|
3071 |
+
echo " <strong>" . __("Advanced Info", "wplivechat") . "</strong>";
|
3072 |
+
echo " <hr />";
|
3073 |
+
echo " <span class='part1'>" . __("Browser:", "wplivechat") . "</span><span class='part2'> $browser <img src='" . $wplc_basic_plugin_url . "/images/$browser_image' alt='$browser' title='$browser' /><br />";
|
3074 |
+
echo " <span class='part1'>" . __("IP Address:", "wplivechat") . "</span><span class='part2'> ".sanitize_text_field($user_ip);
|
3075 |
+
echo " </div>";
|
3076 |
+
echo "<hr />";
|
3077 |
+
|
3078 |
+
echo (apply_filters("wplc_filter_advanced_info","", sanitize_text_field($result->id), sanitize_text_field($result->name), $result));
|
3079 |
+
|
3080 |
+
echo " <div id=\"wplc_sound_update\"></div>";
|
3081 |
+
|
3082 |
+
echo "<div class='wplc_bottom_chat_info_container'>";
|
3083 |
+
echo "<h3>".__("Add-ons","wplivechat")."</h3>";
|
3084 |
+
do_action("wplc_hook_admin_visitor_info_display_after",$cid);
|
3085 |
+
echo "<a href='".admin_url('admin.php?page=wplivechat-menu-extensions-page')."' class='button button-primary' target='_BLANK'>".__("Get more add-ons","wplivechat")."</a>";
|
3086 |
+
echo "</div>";
|
3087 |
+
|
3088 |
+
echo "</div>";
|
3089 |
+
|
3090 |
+
if ($result->status != 1) {
|
3091 |
+
|
3092 |
+
do_action("wplc_hook_admin_below_chat_box",$result);
|
3093 |
+
}
|
3094 |
+
|
3095 |
+
}
|
3096 |
+
|
3097 |
+
|
3098 |
+
add_action("wplc_hook_admin_below_chat_box","wplc_hook_control_admin_below_chat_box",10);
|
3099 |
+
function wplc_hook_control_admin_below_chat_box() {
|
3100 |
+
echo "<div class='admin_chat_quick_controls'>";
|
3101 |
+
echo " <p style=\"text-align:left; font-size:11px;\">" . __('Press ENTER to send your message', 'wplivechat') . "</p>";
|
3102 |
+
echo " " . __("Assign Quick Response", "wplivechat") . " <select name='wplc_macros_select' class='wplc_macros_select' disabled><option>" . __('Select', 'wplivechat') . "</option></select> <a href='https://wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=quick_resposnes' title='" . __('Add Quick Responses to your Live Chat', 'wplivechat') . "' target='_BLANK'>" . __("Pro version only", "wplivechat") . "</a>";
|
3103 |
+
echo " </div>";
|
3104 |
+
echo "</div>";
|
3105 |
+
|
3106 |
+
}
|
3107 |
+
|
3108 |
+
function wplc_return_chat_response_box($cid, $chat_data = false) {
|
3109 |
+
|
3110 |
+
$ret = "<div class=\"chat_response_box\">";
|
3111 |
+
$ret .= apply_filters("wplc_filter_typing_control_div","");
|
3112 |
+
$ret .= "<input type='text' name='wplc_admin_chatmsg' id='wplc_admin_chatmsg' value='' placeholder='" . __("type here...", "wplivechat") . "' />";
|
3113 |
+
|
3114 |
+
$ret .= apply_filters("wplc_filter_chat_upload","");
|
3115 |
+
$ret .= (!function_exists("nifty_text_edit_div") ? apply_filters("wplc_filter_chat_text_editor_upsell","") : apply_filters("wplc_filter_chat_text_editor",""));
|
3116 |
+
|
3117 |
+
$ret .= "<input id='wplc_admin_cid' type='hidden' value='$cid' />";
|
3118 |
+
$ret .= "<input id='wplc_admin_send_msg' type='button' value='" . __("Send", "wplivechat") . "' style=\"display:none;\" />";
|
3119 |
+
$ret .= "</div>";
|
3120 |
+
return $ret;
|
3121 |
+
}
|
3122 |
+
|
3123 |
+
function wplc_return_admin_chat_javascript($cid) {
|
3124 |
+
$ajax_nonce = wp_create_nonce("wplc");
|
3125 |
+
global $wplc_version;
|
3126 |
+
|
3127 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
3128 |
+
|
3129 |
+
wp_register_script('wplc-admin-chat-server', plugins_url('js/wplc_server.js', __FILE__), false, $wplc_version, false);
|
3130 |
+
wp_enqueue_script('wplc-admin-chat-server');
|
3131 |
+
|
3132 |
+
wp_localize_script( 'wplc-admin-chat-server', 'wplc_datetime_format', array(
|
3133 |
+
'date_format' => get_option( 'date_format' ),
|
3134 |
+
'time_format' => get_option( 'time_format' ),
|
3135 |
+
) );
|
3136 |
+
|
3137 |
+
global $admin_chat_data;
|
3138 |
+
if (!$admin_chat_data) {
|
3139 |
+
$cdata = wplc_get_chat_data($cid, __LINE__);
|
3140 |
+
} else {
|
3141 |
+
/* copy the stored admin chat data variable - more efficient */
|
3142 |
+
$cdata = $admin_chat_data;
|
3143 |
+
}
|
3144 |
+
|
3145 |
+
$other = maybe_unserialize($cdata->other);
|
3146 |
+
|
3147 |
+
if(isset($wplc_settings['wplc_use_node_server']) && $wplc_settings['wplc_use_node_server'] == 1){
|
3148 |
+
if (isset($other['socket']) && ($other['socket'] == true || $other['socket'] == "true")) {
|
3149 |
+
if ( isset( $_GET['action'] ) && $_GET['action'] === 'history') {
|
3150 |
+
wp_localize_script('wplc-admin-chat-server', 'wplc_use_node_server', "false");
|
3151 |
+
} else {
|
3152 |
+
wp_localize_script('wplc-admin-chat-server', 'wplc_use_node_server', "true");
|
3153 |
+
wp_localize_script('wplc-admin-chat-server', 'wplc_localized_string_is_typing_single', __(" is typing...","wplivechat"));
|
3154 |
+
}
|
3155 |
+
|
3156 |
+
$wplc_node_token = get_option("wplc_node_server_secret_token");
|
3157 |
+
if(!$wplc_node_token){
|
3158 |
+
if(function_exists("wplc_node_server_token_regenerate")){
|
3159 |
+
wplc_node_server_token_regenerate();
|
3160 |
+
$wplc_node_token = get_option("wplc_node_server_secret_token");
|
3161 |
+
}
|
3162 |
+
}
|
3163 |
+
wp_localize_script('wplc-admin-chat-server', 'bleeper_api_key', $wplc_node_token);
|
3164 |
+
}
|
3165 |
+
}
|
3166 |
+
|
3167 |
+
/**
|
3168 |
+
* Create a JS object for all Agent ID's and Gravatar MD5's
|
3169 |
+
*/
|
3170 |
+
$user_array = get_users(array(
|
3171 |
+
'meta_key' => 'wplc_ma_agent',
|
3172 |
+
));
|
3173 |
+
|
3174 |
+
$a_array = array();
|
3175 |
+
if ($user_array) {
|
3176 |
+
foreach ($user_array as $user) {
|
3177 |
+
$a_array[$user->ID] = array();
|
3178 |
+
$a_array[$user->ID]['name'] = $user->display_name;
|
3179 |
+
$a_array[$user->ID]['md5'] = md5( $user->user_email );
|
3180 |
+
}
|
3181 |
+
}
|
3182 |
+
wp_localize_script('wplc-admin-chat-server', 'wplc_agent_data', $a_array);
|
3183 |
+
|
3184 |
+
/**
|
3185 |
+
* Get the CURRENT agent's data
|
3186 |
+
*/
|
3187 |
+
if(isset($_GET['aid'])){
|
3188 |
+
$agent_data = get_user_by('ID', intval($_GET['aid']));
|
3189 |
+
wp_localize_script('wplc-admin-chat-server', 'wplc_admin_agent_name', $agent_data->display_name);
|
3190 |
+
wp_localize_script('wplc-admin-chat-server', 'wplc_admin_agent_email', md5($agent_data->user_email));
|
3191 |
+
} else {
|
3192 |
+
$agent_data = get_user_by('ID', intval(get_current_user_id()));
|
3193 |
+
wp_localize_script('wplc-admin-chat-server', 'wplc_admin_agent_name', $agent_data->display_name);
|
3194 |
+
wp_localize_script('wplc-admin-chat-server', 'wplc_admin_agent_email', md5($agent_data->user_email));
|
3195 |
+
}
|
3196 |
+
|
3197 |
+
|
3198 |
+
wp_register_script('wplc-admin-chat-js', plugins_url('js/wplc_u_admin_chat.js', __FILE__), array('wplc-admin-chat-server'), $wplc_version, false);
|
3199 |
+
wp_enqueue_script('wplc-admin-chat-js');
|
3200 |
+
|
3201 |
+
|
3202 |
+
global $wplc_pro_version;
|
3203 |
+
$wplc_ver = str_replace('.', '', $wplc_pro_version);
|
3204 |
+
$checker = intval($wplc_ver);
|
3205 |
+
if (isset($wplc_settings['wplc_theme'])) { $wplc_theme = $wplc_settings['wplc_theme']; } else { $wplc_theme = "theme-default"; }
|
3206 |
+
|
3207 |
+
if ( (isset($wplc_theme) && $checker >= 6000 ) || (! function_exists("wplc_pro_version_control") ) ) {
|
3208 |
+
if($wplc_theme == 'theme-default') {
|
3209 |
+
wp_register_style('wplc-theme-palette-default', plugins_url('/css/themes/theme-default.css', __FILE__), array(), $wplc_version);
|
3210 |
+
wp_enqueue_style('wplc-theme-palette-default');
|
3211 |
+
|
3212 |
+
}
|
3213 |
+
else if($wplc_theme == 'theme-1') {
|
3214 |
+
wp_register_style('wplc-theme-palette-1', plugins_url('/css/themes/theme-1.css', __FILE__), array(), $wplc_version);
|
3215 |
+
wp_enqueue_style('wplc-theme-palette-1');
|
3216 |
+
|
3217 |
+
}
|
3218 |
+
else if($wplc_theme == 'theme-2') {
|
3219 |
+
wp_register_style('wplc-theme-palette-2', plugins_url('/css/themes/theme-2.css', __FILE__), array(), $wplc_version);
|
3220 |
+
wp_enqueue_style('wplc-theme-palette-2');
|
3221 |
+
|
3222 |
+
}
|
3223 |
+
else if($wplc_theme == 'theme-3') {
|
3224 |
+
wp_register_style('wplc-theme-palette-3', plugins_url('/css/themes/theme-3.css', __FILE__), array(), $wplc_version);
|
3225 |
+
wp_enqueue_style('wplc-theme-palette-3');
|
3226 |
+
|
3227 |
+
}
|
3228 |
+
else if($wplc_theme == 'theme-4') {
|
3229 |
+
wp_register_style('wplc-theme-palette-4', plugins_url('/css/themes/theme-4.css', __FILE__), array(), $wplc_version);
|
3230 |
+
wp_enqueue_style('wplc-theme-palette-4');
|
3231 |
+
|
3232 |
+
}
|
3233 |
+
else if($wplc_theme == 'theme-5') {
|
3234 |
+
wp_register_style('wplc-theme-palette-5', plugins_url('/css/themes/theme-5.css', __FILE__), array(), $wplc_version);
|
3235 |
+
wp_enqueue_style('wplc-theme-palette-5');
|
3236 |
+
|
3237 |
+
}
|
3238 |
+
else if($wplc_theme == 'theme-6') {
|
3239 |
+
/* custom */
|
3240 |
+
/* handled elsewhere */
|
3241 |
+
|
3242 |
+
|
3243 |
+
|
3244 |
+
}
|
3245 |
+
}
|
3246 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
3247 |
+
$wplc_user_data = get_user_by( 'id', get_current_user_id() );
|
3248 |
+
|
3249 |
+
if (isset($cdata->agent_id)) {
|
3250 |
+
$wplc_agent_data = get_user_by( 'id', intval( $cdata->agent_id ) );
|
3251 |
+
}
|
3252 |
+
|
3253 |
+
|
3254 |
+
if( isset($wplc_settings['wplc_show_name']) && $wplc_settings['wplc_show_name'] == '1' ){ $wplc_show_name = true; } else { $wplc_show_name = false; }
|
3255 |
+
if( isset($wplc_settings['wplc_show_avatar']) && $wplc_settings['wplc_show_avatar'] ){ $wplc_show_avatar = true; } else { $wplc_show_avatar = false; }
|
3256 |
+
if( isset($wplc_settings['wplc_show_date']) && $wplc_settings['wplc_show_date'] == '1' ){ $wplc_show_date = true; } else { $wplc_show_date = false; }
|
3257 |
+
if( isset($wplc_settings['wplc_show_time']) && $wplc_settings['wplc_show_time'] == '1' ){ $wplc_show_time = true; } else { $wplc_show_time = false; }
|
3258 |
+
|
3259 |
+
$wplc_chat_detail = array( 'name' => $wplc_show_name, 'avatar' => $wplc_show_avatar, 'date' => $wplc_show_date, 'time' => $wplc_show_time );
|
3260 |
+
|
3261 |
+
|
3262 |
+
wp_enqueue_script('wplc-admin-chat-js');
|
3263 |
+
wp_localize_script( 'wplc-admin-chat-js', 'wplc_show_chat_detail', $wplc_chat_detail );
|
3264 |
+
|
3265 |
+
|
3266 |
+
|
3267 |
+
if (!empty( $wplc_agent_data ) ) {
|
3268 |
+
wp_localize_script( 'wplc-admin-chat-js', 'wplc_agent_name', $wplc_agent_data->display_name );
|
3269 |
+
wp_localize_script( 'wplc-admin-chat-js', 'wplc_agent_email', md5( $wplc_agent_data->user_email ) );
|
3270 |
+
} else {
|
3271 |
+
wp_localize_script( 'wplc-admin-chat-js', 'wplc_agent_name', ' ' );
|
3272 |
+
wp_localize_script( 'wplc-admin-chat-js', 'wplc_agent_email', ' ' );
|
3273 |
+
}
|
3274 |
+
|
3275 |
+
wp_localize_script('wplc-admin-chat-js', 'wplc_chat_name', $cdata->name);
|
3276 |
+
wp_localize_script('wplc-admin-chat-js', 'wplc_chat_email', md5($cdata->email));
|
3277 |
+
|
3278 |
+
if(class_exists("WP_REST_Request")) {
|
3279 |
+
wp_localize_script('wplc-admin-chat-js', 'wplc_restapi_enabled', '1');
|
3280 |
+
wp_localize_script('wplc-admin-chat-js', 'wplc_restapi_token', get_option('wplc_api_secret_token'));
|
3281 |
+
wp_localize_script('wplc-admin-chat-js', 'wplc_restapi_endpoint', rest_url('wp_live_chat_support/v1'));
|
3282 |
+
} else {
|
3283 |
+
wp_localize_script('wplc-admin-chat-js', 'wplc_restapi_enabled', '0');
|
3284 |
+
}
|
3285 |
+
|
3286 |
+
|
3287 |
+
if (function_exists("wplc_pro_get_admin_picture")) {
|
3288 |
+
$src = wplc_pro_get_admin_picture();
|
3289 |
+
if ($src) {
|
3290 |
+
$image = "<img src=" . $src . " width='20px' id='wp-live-chat-2-img'/>";
|
3291 |
+
} else {
|
3292 |
+
$image = " ";
|
3293 |
+
}
|
3294 |
+
} else {
|
3295 |
+
$image = " ";
|
3296 |
+
}
|
3297 |
+
$admin_pic = $image;
|
3298 |
+
wp_localize_script('wplc-admin-chat-js', 'wplc_localized_string_is_typing', __("is typing...","wplivechat"));
|
3299 |
+
wp_localize_script('wplc-user-script', 'wplc_localized_string_admin_name', apply_filters( 'wplc_filter_admin_name', 'Admin' ) );
|
3300 |
+
wp_localize_script('wplc-admin-chat-js', 'wplc_ajax_nonce', $ajax_nonce);
|
3301 |
+
wp_localize_script('wplc-admin-chat-js', 'admin_pic', $admin_pic);
|
3302 |
+
|
3303 |
+
$wplc_ding_file = plugins_url('/ding.mp3', __FILE__);
|
3304 |
+
$wplc_ding_file = apply_filters( 'wplc_filter_message_sound', $wplc_ding_file );
|
3305 |
+
wp_localize_script('wplc-admin-chat-js', 'wplc_ding_file', $wplc_ding_file);
|
3306 |
+
|
3307 |
+
$extra_data = apply_filters("wplc_filter_admin_javascript",array());
|
3308 |
+
wp_localize_script('wplc-admin-chat-js', 'wplc_extra_data', $extra_data);
|
3309 |
+
|
3310 |
+
if (isset($wplc_settings['wplc_display_name']) && $wplc_settings['wplc_display_name'] == 1) {
|
3311 |
+
$display_name = 'display';
|
3312 |
+
} else {
|
3313 |
+
$display_name = 'hide';
|
3314 |
+
}
|
3315 |
+
if (isset($wplc_settings['wplc_enable_msg_sound']) && intval($wplc_settings['wplc_enable_msg_sound']) == 1) {
|
3316 |
+
$enable_ding = '1';
|
3317 |
+
} else {
|
3318 |
+
$enable_ding = '0';
|
3319 |
+
}
|
3320 |
+
if (isset($_COOKIE['wplc_email']) && $_COOKIE['wplc_email'] != "") {
|
3321 |
+
$wplc_user_email_address = sanitize_text_field($_COOKIE['wplc_email']);
|
3322 |
+
} else {
|
3323 |
+
$wplc_user_email_address = " ";
|
3324 |
+
}
|
3325 |
+
|
3326 |
+
wp_localize_script('wplc-admin-chat-js', 'wplc_name', $display_name);
|
3327 |
+
wp_localize_script('wplc-admin-chat-js', 'wplc_enable_ding', $enable_ding);
|
3328 |
+
|
3329 |
+
$ajax_url = admin_url('admin-ajax.php');
|
3330 |
+
$home_ajax_url = $ajax_url;
|
3331 |
+
|
3332 |
+
$wplc_ajax_url = apply_filters("wplc_filter_ajax_url",$ajax_url);
|
3333 |
+
wp_localize_script('wplc-admin-chat-js', 'wplc_ajaxurl', $wplc_ajax_url);
|
3334 |
+
wp_localize_script('wplc-admin-chat-js', 'wplc_home_ajaxurl', $home_ajax_url);
|
3335 |
+
|
3336 |
+
|
3337 |
+
|
3338 |
+
$wplc_url = admin_url('admin.php?page=wplivechat-menu&action=ac&cid=' . $cid);
|
3339 |
+
wp_localize_script('wplc-admin-chat-js', 'wplc_url', $wplc_url);
|
3340 |
+
|
3341 |
+
|
3342 |
+
$wplc_string1 = __("User has opened the chat window", "wplivechat");
|
3343 |
+
$wplc_string2 = __("User has minimized the chat window", "wplivechat");
|
3344 |
+
$wplc_string3 = __("User has maximized the chat window", "wplivechat");
|
3345 |
+
$wplc_string4 = __("The chat has been ended", "wplivechat");
|
3346 |
+
wp_localize_script('wplc-admin-chat-js', 'wplc_string1', $wplc_string1);
|
3347 |
+
wp_localize_script('wplc-admin-chat-js', 'wplc_string2', $wplc_string2);
|
3348 |
+
wp_localize_script('wplc-admin-chat-js', 'wplc_string3', $wplc_string3);
|
3349 |
+
wp_localize_script('wplc-admin-chat-js', 'wplc_string4', $wplc_string4);
|
3350 |
+
wp_localize_script('wplc-admin-chat-js', 'wplc_cid', $cid);
|
3351 |
+
|
3352 |
+
|
3353 |
+
do_action("wplc_hook_admin_chatbox_javascript");
|
3354 |
+
|
3355 |
+
}
|
3356 |
+
|
3357 |
+
function wplc_activate() {
|
3358 |
+
wplc_handle_db();
|
3359 |
+
if (!get_option("WPLC_SETTINGS")) {
|
3360 |
+
$wplc_alt_text = __("Please click \'Start Chat\' to initiate a chat with an agent", "wplivechat");
|
3361 |
+
$wplc_default_visitor_name = __( "Guest", "wplivechat" );
|
3362 |
+
$wplc_admin_email = get_option('admin_email');
|
3363 |
+
|
3364 |
+
$wplc_default_settings_array = array(
|
3365 |
+
"wplc_settings_align" => "2",
|
3366 |
+
"wplc_settings_enabled" => "1",
|
3367 |
+
"wplc_powered_by_link" => "0",
|
3368 |
+
"wplc_settings_fill" => "ed832f",
|
3369 |
+
"wplc_settings_font" => "FFFFFF",
|
3370 |
+
"wplc_settings_color1" => "ED832F",
|
3371 |
+
"wplc_settings_color2" => "FFFFFF",
|
3372 |
+
"wplc_settings_color3" => "EEEEEE",
|
3373 |
+
"wplc_settings_color4" => "666666",
|
3374 |
+
"wplc_theme" => "theme-default",
|
3375 |
+
"wplc_newtheme" => "theme-2",
|
3376 |
+
"wplc_require_user_info" => '1',
|
3377 |
+
"wplc_loggedin_user_info" => '1',
|
3378 |
+
"wplc_user_alternative_text" => $wplc_alt_text,
|
3379 |
+
"wplc_user_default_visitor_name" => $wplc_default_visitor_name,
|
3380 |
+
"wplc_enabled_on_mobile" => '1',
|
3381 |
+
"wplc_display_name" => '1',
|
3382 |
+
"wplc_record_ip_address" => '0',
|
3383 |
+
"wplc_pro_chat_email_address" => $wplc_admin_email,
|
3384 |
+
"wplc_pro_fst1" => __("Questions?", "wplivechat"),
|
3385 |
+
"wplc_pro_fst2" => __("Chat with us", "wplivechat"),
|
3386 |
+
"wplc_pro_fst3" => __("Start live chat", "wplivechat"),
|
3387 |
+
"wplc_pro_sst1" => __("Start Chat", "wplivechat"),
|
3388 |
+
"wplc_pro_sst1_survey" => __("Or chat to an agent now", "wplivechat"),
|
3389 |
+
"wplc_pro_sst1e_survey" => __("Chat ended", "wplivechat"),
|
3390 |
+
"wplc_pro_sst2" => __("Connecting. Please be patient...", "wplivechat"),
|
3391 |
+
"wplc_pro_tst1" => __("Reactivating your previous chat...", "wplivechat"),
|
3392 |
+
"wplc_pro_na" => __("Chat offline. Leave a message", "wplivechat"),
|
3393 |
+
"wplc_pro_intro" => __("Hello. Please input your details so that I may help you.", "wplivechat"),
|
3394 |
+
"wplc_pro_offline1" => __("We are currently offline. Please leave a message and we'll get back to you shortly.", "wplivechat"),
|
3395 |
+
"wplc_pro_offline2" => __("Sending message...", "wplivechat"),
|
3396 |
+
"wplc_pro_offline3" => __("Thank you for your message. We will be in contact soon.", "wplivechat"),
|
3397 |
+
"wplc_pro_offline_btn" => __("Leave a message", "wplivechat"),
|
3398 |
+
"wplc_pro_offline_btn_send" => __("Send message", "wplivechat"),
|
3399 |
+
"wplc_user_enter" => __("Press ENTER to send your message", "wplivechat"),
|
3400 |
+
"wplc_text_chat_ended" => __("The chat has been ended by the operator.", "wplivechat"),
|
3401 |
+
"wplc_close_btn_text" => __("close", "wplivechat"),
|
3402 |
+
"wplc_user_welcome_chat" => __("Welcome. How may I help you?", "wplivechat"),
|
3403 |
+
'wplc_welcome_msg' => __("Please standby for an agent. While you wait for the agent you may type your message.","wplivechat")
|
3404 |
+
|
3405 |
+
);
|
3406 |
+
|
3407 |
+
//Added V8: Default Settings array filter
|
3408 |
+
$wplc_default_settings_array = apply_filters("wplc_activate_default_settings_array", $wplc_default_settings_array);
|
3409 |
+
|
3410 |
+
add_option('WPLC_SETTINGS', $wplc_default_settings_array);
|
3411 |
+
}
|
3412 |
+
|
3413 |
+
|
3414 |
+
|
3415 |
+
|
3416 |
+
|
3417 |
+
|
3418 |
+
$admins = get_role('administrator');
|
3419 |
+
if( $admins !== null ) { $admins->add_cap('wplc_ma_agent'); }
|
3420 |
+
|
3421 |
+
|
3422 |
+
$uid = get_current_user_id();
|
3423 |
+
update_user_meta($uid, 'wplc_ma_agent', 1);
|
3424 |
+
update_user_meta($uid, "wplc_chat_agent_online", time());
|
3425 |
+
|
3426 |
+
add_option("WPLC_HIDE_CHAT", "true");
|
3427 |
+
|
3428 |
+
|
3429 |
+
do_action("wplc_activate_hook");
|
3430 |
+
}
|
3431 |
+
|
3432 |
+
|
3433 |
+
|
3434 |
+
function wplc_handle_db() {
|
3435 |
+
global $wpdb;
|
3436 |
+
global $wplc_version;
|
3437 |
+
global $wplc_tblname_chats;
|
3438 |
+
global $wplc_tblname_msgs;
|
3439 |
+
global $wplc_tblname_offline_msgs;
|
3440 |
+
|
3441 |
+
$sql = "
|
3442 |
+
CREATE TABLE " . $wplc_tblname_chats . " (
|
3443 |
+
id int(11) NOT NULL AUTO_INCREMENT,
|
3444 |
+
timestamp datetime NOT NULL,
|
3445 |
+
name varchar(700) NOT NULL,
|
3446 |
+
email varchar(700) NOT NULL,
|
3447 |
+
ip varchar(700) NOT NULL,
|
3448 |
+
status int(11) NOT NULL,
|
3449 |
+
session varchar(100) NOT NULL,
|
3450 |
+
url varchar(700) NOT NULL,
|
3451 |
+
last_active_timestamp datetime NOT NULL,
|
3452 |
+
agent_id INT(11) NOT NULL,
|
3453 |
+
other LONGTEXT NOT NULL,
|
3454 |
+
rel varchar(40) NOT NULL,
|
3455 |
+
PRIMARY KEY (id)
|
3456 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
3457 |
+
";
|
3458 |
+
|
3459 |
+
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
3460 |
+
dbDelta($sql);
|
3461 |
+
|
3462 |
+
|
3463 |
+
|
3464 |
+
|
3465 |
+
$sql = '
|
3466 |
+
CREATE TABLE ' . $wplc_tblname_msgs . ' (
|
3467 |
+
id int(11) NOT NULL AUTO_INCREMENT,
|
3468 |
+
chat_sess_id int(11) NOT NULL,
|
3469 |
+
msgfrom varchar(150) CHARACTER SET utf8 NOT NULL,
|
3470 |
+
msg LONGTEXT CHARACTER SET utf8 NOT NULL,
|
3471 |
+
timestamp datetime NOT NULL,
|
3472 |
+
status INT(3) NOT NULL,
|
3473 |
+
originates INT(3) NOT NULL,
|
3474 |
+
other LONGTEXT NOT NULL,
|
3475 |
+
rel varchar(40) NOT NULL,
|
3476 |
+
afrom INT(10) NOT NULL,
|
3477 |
+
ato INT(10) NOT NULL,
|
3478 |
+
PRIMARY KEY (id)
|
3479 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
3480 |
+
';
|
3481 |
+
|
3482 |
+
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
3483 |
+
@dbDelta($sql);
|
3484 |
+
|
3485 |
+
/* check for previous versions containing 'from' instead of 'msgfrom' */
|
3486 |
+
$results = $wpdb->get_results("DESC $wplc_tblname_msgs");
|
3487 |
+
$founded = 0;
|
3488 |
+
foreach ($results as $row ) {
|
3489 |
+
if ($row->Field == "from") {
|
3490 |
+
$founded++;
|
3491 |
+
}
|
3492 |
+
}
|
3493 |
+
|
3494 |
+
if ($founded>0) { $wpdb->query("ALTER TABLE ".$wplc_tblname_msgs." CHANGE `from` `msgfrom` varchar(150)"); }
|
3495 |
+
|
3496 |
+
|
3497 |
+
$sql2 = "
|
3498 |
+
CREATE TABLE " . $wplc_tblname_offline_msgs . " (
|
3499 |
+
id int(11) NOT NULL AUTO_INCREMENT,
|
3500 |
+
timestamp datetime NOT NULL,
|
3501 |
+
name varchar(700) NOT NULL,
|
3502 |
+
email varchar(700) NOT NULL,
|
3503 |
+
message varchar(700) NOT NULL,
|
3504 |
+
ip varchar(700) NOT NULL,
|
3505 |
+
user_agent varchar(700) NOT NULL,
|
3506 |
+
PRIMARY KEY (id)
|
3507 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
3508 |
+
";
|
3509 |
+
|
3510 |
+
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
3511 |
+
@dbDelta($sql2);
|
3512 |
+
|
3513 |
+
add_option("wplc_db_version", $wplc_version);
|
3514 |
+
update_option("wplc_db_version", $wplc_version);
|
3515 |
+
}
|
3516 |
+
|
3517 |
+
function wplc_add_user_stylesheet() {
|
3518 |
+
global $wplc_version;
|
3519 |
+
if(function_exists('wplc_display_chat_contents')){
|
3520 |
+
$show_chat_contents = wplc_display_chat_contents();
|
3521 |
+
} else {
|
3522 |
+
$show_chat_contents = 1;
|
3523 |
+
}
|
3524 |
+
if($show_chat_contents >= 1){
|
3525 |
+
$wplc_settings = get_option( 'WPLC_SETTINGS' );
|
3526 |
+
if ( isset( $wplc_settings ) && isset( $wplc_settings['wplc_enable_font_awesome'] ) && '1' === $wplc_settings['wplc_enable_font_awesome'] ) {
|
3527 |
+
wp_register_style( 'wplc-font-awesome', plugins_url( '/css/font-awesome.min.css', __FILE__ ) );
|
3528 |
+
|
3529 |
+
wp_enqueue_style( 'wplc-font-awesome' );
|
3530 |
+
}
|
3531 |
+
wp_register_style('wplc-style', plugins_url('/css/wplcstyle.css', __FILE__), array(), $wplc_version);
|
3532 |
+
wp_enqueue_style('wplc-style');
|
3533 |
+
|
3534 |
+
if( isset( $wplc_settings['wplc_elem_trigger_id'] ) && trim( $wplc_settings['wplc_elem_trigger_id'] ) !== "" ) {
|
3535 |
+
if( isset( $wplc_settings['wplc_elem_trigger_type'] ) ){
|
3536 |
+
if ( $wplc_settings['wplc_elem_trigger_type'] === "0" ) {
|
3537 |
+
/* class */
|
3538 |
+
$wplc_elem_style_prefix = ".";
|
3539 |
+
} else {
|
3540 |
+
/* ID */
|
3541 |
+
$wplc_elem_style_prefix = "#";
|
3542 |
+
}
|
3543 |
+
}
|
3544 |
+
|
3545 |
+
$wplc_elem_inline_style = $wplc_elem_style_prefix.stripslashes( $wplc_settings['wplc_elem_trigger_id'] ).":hover { cursor:pointer; }";
|
3546 |
+
wp_add_inline_style( 'wplc-style', stripslashes( $wplc_elem_inline_style ) );
|
3547 |
+
}
|
3548 |
+
|
3549 |
+
// Serve the icon up over HTTPS if needs be
|
3550 |
+
//$icon = plugins_url('images/chaticon.png', __FILE__);
|
3551 |
+
$icon = plugins_url('images/iconRetina.png', __FILE__);
|
3552 |
+
$close_icon = plugins_url('images/iconCloseRetina.png', __FILE__);
|
3553 |
+
|
3554 |
+
|
3555 |
+
if ( isset( $wplc_settings['wplc_settings_bg'] ) ) {
|
3556 |
+
if ( $wplc_settings['wplc_settings_bg'] == "0" ) { $bg = false; } else { $bg = esc_attr( $wplc_settings['wplc_settings_bg'] ); }
|
3557 |
+
} else { $bg = "cloudy.jpg"; }
|
3558 |
+
if ($bg) {
|
3559 |
+
$bg = plugins_url('images/bg/'.$bg, __FILE__);
|
3560 |
+
$bg_string = "#wp-live-chat-4 { background:url('$bg') repeat; background-size: cover; }";
|
3561 |
+
} else { $bg_string = "#wp-live-chat-4 { background-color: #fff; }"; }
|
3562 |
+
|
3563 |
+
if( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] ){ $icon = preg_replace('/^http:\/\//', 'https:\/\/', $icon); }
|
3564 |
+
if( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] ){ $close_icon = preg_replace('/^http:\/\//', 'https:\/\/', $close_icon); }
|
3565 |
+
$icon = apply_filters("wplc_filter_chaticon",$icon);
|
3566 |
+
|
3567 |
+
$close_icon = apply_filters("wplc_filter_chaticon_close",$close_icon);
|
3568 |
+
|
3569 |
+
$wplc_elem_inline_style = "#wp-live-chat-header { background:url('$icon') no-repeat; background-size: cover; } #wp-live-chat-header.active { background:url('$close_icon') no-repeat; background-size: cover; } $bg_string";
|
3570 |
+
wp_add_inline_style( 'wplc-style', stripslashes( $wplc_elem_inline_style ) );
|
3571 |
+
|
3572 |
+
|
3573 |
+
|
3574 |
+
global $wplc_pro_version;
|
3575 |
+
$wplc_ver = str_replace('.', '', $wplc_pro_version);
|
3576 |
+
$checker = intval($wplc_ver);
|
3577 |
+
|
3578 |
+
if (function_exists("wplc_pro_version_control") && $checker < 6000) {
|
3579 |
+
/* old pro version backwards compatibility */
|
3580 |
+
wp_register_style('wplc-style-pro', plugins_url('/css/wplcstyle_old.css', __FILE__));
|
3581 |
+
wp_enqueue_style('wplc-style-pro');
|
3582 |
+
|
3583 |
+
|
3584 |
+
}
|
3585 |
+
|
3586 |
+
|
3587 |
+
|
3588 |
+
$wplc_settings = get_option('WPLC_SETTINGS');
|
3589 |
+
if (isset($wplc_settings['wplc_theme'])) { $wplc_theme = $wplc_settings['wplc_theme']; } else { $wplc_theme = "theme-default"; }
|
3590 |
+
|
3591 |
+
if ( (isset($wplc_theme) && $checker >= 6000 ) || (! function_exists("wplc_pro_version_control") ) ) {
|
3592 |
+
if($wplc_theme == 'theme-default') {
|
3593 |
+
wp_register_style('wplc-theme-palette-default', plugins_url('/css/themes/theme-default.css', __FILE__), array(), $wplc_version);
|
3594 |
+
wp_enqueue_style('wplc-theme-palette-default');
|
3595 |
+
|
3596 |
+
}
|
3597 |
+
else if($wplc_theme == 'theme-1') {
|
3598 |
+
wp_register_style('wplc-theme-palette-1', plugins_url('/css/themes/theme-1.css', __FILE__), array(), $wplc_version);
|
3599 |
+
wp_enqueue_style('wplc-theme-palette-1');
|
3600 |
+
|
3601 |
+
}
|
3602 |
+
else if($wplc_theme == 'theme-2') {
|
3603 |
+
wp_register_style('wplc-theme-palette-2', plugins_url('/css/themes/theme-2.css', __FILE__), array(), $wplc_version);
|
3604 |
+
wp_enqueue_style('wplc-theme-palette-2');
|
3605 |
+
|
3606 |
+
}
|
3607 |
+
else if($wplc_theme == 'theme-3') {
|
3608 |
+
wp_register_style('wplc-theme-palette-3', plugins_url('/css/themes/theme-3.css', __FILE__), array(), $wplc_version);
|
3609 |
+
wp_enqueue_style('wplc-theme-palette-3');
|
3610 |
+
|
3611 |
+
}
|
3612 |
+
else if($wplc_theme == 'theme-4') {
|
3613 |
+
wp_register_style('wplc-theme-palette-4', plugins_url('/css/themes/theme-4.css', __FILE__), array(), $wplc_version);
|
3614 |
+
wp_enqueue_style('wplc-theme-palette-4');
|
3615 |
+
|
3616 |
+
}
|
3617 |
+
else if($wplc_theme == 'theme-5') {
|
3618 |
+
wp_register_style('wplc-theme-palette-5', plugins_url('/css/themes/theme-5.css', __FILE__), array(), $wplc_version);
|
3619 |
+
wp_enqueue_style('wplc-theme-palette-5');
|
3620 |
+
|
3621 |
+
}
|
3622 |
+
else if($wplc_theme == 'theme-6') {
|
3623 |
+
/* custom */
|
3624 |
+
/* handled elsewhere */
|
3625 |
+
|
3626 |
+
|
3627 |
+
|
3628 |
+
}
|
3629 |
+
|
3630 |
+
|
3631 |
+
|
3632 |
+
|
3633 |
+
|
3634 |
+
if (isset($wplc_settings['wplc_newtheme'])) { $wplc_newtheme = $wplc_settings['wplc_newtheme']; } else { $wplc_newtheme = "theme-2"; }
|
3635 |
+
if (isset($wplc_newtheme)) {
|
3636 |
+
if($wplc_newtheme == 'theme-1') {
|
3637 |
+
wp_register_style('wplc-theme-classic', plugins_url('/css/themes/classic.css', __FILE__), array(), $wplc_version);
|
3638 |
+
wp_enqueue_style('wplc-theme-classic');
|
3639 |
+
|
3640 |
+
}
|
3641 |
+
else if($wplc_newtheme == 'theme-2') {
|
3642 |
+
wp_register_style('wplc-theme-modern', plugins_url('/css/themes/modern.css', __FILE__), array(), $wplc_version);
|
3643 |
+
wp_enqueue_style('wplc-theme-modern');
|
3644 |
+
|
3645 |
+
}
|
3646 |
+
}
|
3647 |
+
|
3648 |
+
if ($wplc_settings["wplc_settings_align"] == 1) {
|
3649 |
+
wp_register_style('wplc-theme-position', plugins_url('/css/themes/position-bottom-left.css', __FILE__), array(), $wplc_version);
|
3650 |
+
wp_enqueue_style('wplc-theme-position');
|
3651 |
+
} else if ($wplc_settings["wplc_settings_align"] == 2) {
|
3652 |
+
wp_register_style('wplc-theme-position', plugins_url('/css/themes/position-bottom-right.css', __FILE__), array(), $wplc_version);
|
3653 |
+
wp_enqueue_style('wplc-theme-position');
|
3654 |
+
} else if ($wplc_settings["wplc_settings_align"] == 3) {
|
3655 |
+
wp_register_style('wplc-theme-position', plugins_url('/css/themes/position-left.css', __FILE__), array(), $wplc_version);
|
3656 |
+
wp_enqueue_style('wplc-theme-position');
|
3657 |
+
} else if ($wplc_settings["wplc_settings_align"] == 4) {
|
3658 |
+
wp_register_style('wplc-theme-position', plugins_url('/css/themes/position-right.css', __FILE__), array(), $wplc_version);
|
3659 |
+
wp_enqueue_style('wplc-theme-position');
|
3660 |
+
} else {
|
3661 |
+
wp_register_style('wplc-theme-position', plugins_url('/css/themes/position-bottom-right.css', __FILE__), array(), $wplc_version);
|
3662 |
+
wp_enqueue_style('wplc-theme-position');
|
3663 |
+
}
|
3664 |
+
|
3665 |
+
}
|
3666 |
+
|
3667 |
+
// Gutenberg template styles - user
|
3668 |
+
wp_register_style( 'wplc-gutenberg-template-styles-user', plugins_url( '/includes/blocks/wplc-chat-box/wplc_gutenberg_template_styles.css', __FILE__ ) );
|
3669 |
+
wp_enqueue_style( 'wplc-gutenberg-template-styles-user' );
|
3670 |
+
|
3671 |
+
// GIF integration styles - user
|
3672 |
+
wp_register_style( 'wplc-gif-integration-user', plugins_url( '/css/wplc_gif_integration.css', __FILE__ ) );
|
3673 |
+
wp_enqueue_style( 'wplc-gif-integration-user' );
|
3674 |
+
}
|
3675 |
+
if(function_exists('wplc_ce_activate')){
|
3676 |
+
if(function_exists('wplc_ce_load_user_styles')){
|
3677 |
+
wplc_ce_load_user_styles();
|
3678 |
+
}
|
3679 |
+
}
|
3680 |
+
}
|
3681 |
+
|
3682 |
+
|
3683 |
+
add_action( 'init', 'wplc_online_check_script', 10 );
|
3684 |
+
/**
|
3685 |
+
* Load the JS that allows us to integrate into the WP Heartbeat
|
3686 |
+
* @return void
|
3687 |
+
*/
|
3688 |
+
function wplc_online_check_script() {
|
3689 |
+
global $wplc_version;
|
3690 |
+
if (esc_attr( get_the_author_meta( 'wplc_ma_agent', get_current_user_id() ) ) == "1"){
|
3691 |
+
$ajax_nonce = wp_create_nonce("wplc");
|
3692 |
+
wp_register_script( 'wplc-heartbeat', plugins_url( 'js/wplc_heartbeat.js', __FILE__ ), array( 'jquery' ), $wplc_version, true );
|
3693 |
+
wp_enqueue_script( 'wplc-heartbeat' );
|
3694 |
+
wp_localize_script( 'wplc-heartbeat', 'wplc_transient_nonce', $ajax_nonce );
|
3695 |
+
|
3696 |
+
$wplc_ajax_url = apply_filters("wplc_filter_ajax_url", admin_url('admin-ajax.php'));
|
3697 |
+
wp_localize_script('wplc-heartbeat', 'wplc_ajaxurl', $wplc_ajax_url);
|
3698 |
+
}
|
3699 |
+
}
|
3700 |
+
|
3701 |
+
/**
|
3702 |
+
* Heartbeat integrations
|
3703 |
+
*
|
3704 |
+
*/
|
3705 |
+
add_filter( 'heartbeat_received', 'wplc_heartbeat_receive', 10, 2 );
|
3706 |
+
add_filter( 'heartbeat_nopriv_received', 'wplc_heartbeat_receive', 10, 2 );
|
3707 |
+
function wplc_heartbeat_receive( $response, $data ) {
|
3708 |
+
if ( $data['client'] == 'wplc_heartbeat' ) {
|
3709 |
+
if (esc_attr( get_the_author_meta( 'wplc_ma_agent', get_current_user_id() ) ) == "1"){
|
3710 |
+
update_user_meta(get_current_user_id(), "wplc_chat_agent_online", time());
|
3711 |
+
wplc_hook_control_set_transient();
|
3712 |
+
}
|
3713 |
+
}
|
3714 |
+
return $response;
|
3715 |
+
}
|
3716 |
+
|
3717 |
+
|
3718 |
+
|
3719 |
+
/**
|
3720 |
+
* Loads the admin stylesheets for the chat dashboard and settings pages
|
3721 |
+
* @return void
|
3722 |
+
*/
|
3723 |
+
function wplc_add_admin_stylesheet() {
|
3724 |
+
global $wplc_version;
|
3725 |
+
|
3726 |
+
wp_register_style( 'wplc-ace-styles', plugins_url( '/css/ace.css', __FILE__ ) );
|
3727 |
+
wp_enqueue_style( 'wplc-ace-styles' );
|
3728 |
+
|
3729 |
+
wp_register_style( 'wplc-fontawesome-iconpicker', plugins_url( '/css/fontawesome-iconpicker.css', __FILE__ ) );
|
3730 |
+
wp_enqueue_style( 'wplc-fontawesome-iconpicker' );
|
3731 |
+
|
3732 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
3733 |
+
if(isset($wplc_settings['wplc_use_node_server']) && $wplc_settings['wplc_use_node_server'] == 1 && (!isset($_GET['action']) || $_GET['action'] !== "history") ){
|
3734 |
+
//if(isset($_GET['page']) && $_GET['page'] == 'wplivechat-menu'){
|
3735 |
+
//Using node, remote styles please
|
3736 |
+
//Using node, remote scripts please
|
3737 |
+
if ( isset( $wplc_settings['wplc_enable_all_admin_pages'] ) && $wplc_settings['wplc_enable_all_admin_pages'] === '1' ) {
|
3738 |
+
/* Run admin JS on all admin pages */
|
3739 |
+
wplc_admin_remote_dashboard_styles();
|
3740 |
+
} else {
|
3741 |
+
/* Only run admin JS on the chat dashboard page */
|
3742 |
+
if ( isset( $_GET['page'] ) && $_GET['page'] === 'wplivechat-menu' && !isset( $_GET['action'] ) ) {
|
3743 |
+
wplc_admin_remote_dashboard_styles();
|
3744 |
+
}
|
3745 |
+
}
|
3746 |
+
|
3747 |
+
wp_register_style( 'wplc-admin-remote-addition-styles', plugins_url( '/css/remote_dash_styles.css', __FILE__ ), array(), $wplc_version );
|
3748 |
+
wp_enqueue_style( 'wplc-admin-remote-addition-styles' );
|
3749 |
+
|
3750 |
+
//}
|
3751 |
+
}
|
3752 |
+
//Special new check to see if we need to add the node history styling
|
3753 |
+
if(isset($wplc_settings['wplc_use_node_server']) && $wplc_settings['wplc_use_node_server'] == 1 && isset($_GET['action']) && $_GET['action'] == 'history'){
|
3754 |
+
wp_register_style( 'wplc-admin-node-history-styles', plugins_url( '/css/node_history_styles.css', __FILE__ ) );
|
3755 |
+
wp_enqueue_style( 'wplc-admin-node-history-styles' );
|
3756 |
+
}
|
3757 |
+
|
3758 |
+
if (isset($_GET['page']) && $_GET['page'] == 'wplivechat-menu' && isset($_GET['action']) && ($_GET['action'] == "ac" || $_GET['action'] == "history" ) ) {
|
3759 |
+
wp_register_style('wplc-admin-chat-box-style', plugins_url('/css/admin-chat-box-style.css', __FILE__ ), false, $wplc_version );
|
3760 |
+
wp_enqueue_style('wplc-admin-chat-box-style');
|
3761 |
+
}
|
3762 |
+
|
3763 |
+
wp_register_style( 'wplc-font-awesome', plugins_url('css/font-awesome.min.css', __FILE__ ), false, $wplc_version );
|
3764 |
+
wp_enqueue_style( 'wplc-font-awesome' );
|
3765 |
+
|
3766 |
+
if (isset($_GET['page']) && ($_GET['page'] == 'wplivechat-menu' || $_GET['page'] == 'wplivechat-menu-api-keys-page' || $_GET['page'] == 'wplivechat-menu-extensions-page' || $_GET['page'] == 'wplivechat-menu-settings' || $_GET['page'] == 'wplivechat-menu-offline-messages' || $_GET['page'] == 'wplivechat-menu-history' || $_GET['page'] == 'wplivechat-menu-missed-chats' || $_GET['page'] == 'wplivechat-menu-dashboard')) {
|
3767 |
+
wp_register_style( 'wplc-jquery-ui', plugins_url( '/css/jquery-ui.css', __FILE__ ), false, $wplc_version );
|
3768 |
+
wp_enqueue_style( 'wplc-jquery-ui' );
|
3769 |
+
|
3770 |
+
wp_enqueue_script( 'jquery-ui-core' );
|
3771 |
+
wp_enqueue_script( 'jquery-effects-core' );
|
3772 |
+
|
3773 |
+
// Gutenberg template styles - admin
|
3774 |
+
wp_register_style( 'wplc-gutenberg-template-styles', plugins_url( '/includes/blocks/wplc-chat-box/wplc_gutenberg_template_styles.css', __FILE__ ) );
|
3775 |
+
wp_enqueue_style( 'wplc-gutenberg-template-styles' );
|
3776 |
+
|
3777 |
+
wp_register_style( 'wplc-admin-styles', plugins_url( '/css/admin_styles.css', __FILE__ ), false, $wplc_version );
|
3778 |
+
wp_enqueue_style( 'wplc-admin-styles' );
|
3779 |
+
|
3780 |
+
// Old admin chat style
|
3781 |
+
if ((!isset($wplc_settings['wplc_use_node_server'])) || ($wplc_settings['wplc_use_node_server'] != 1)) {
|
3782 |
+
wp_register_style( 'wplc-chat-style', plugins_url( '/css/chat-style.css', __FILE__ ), false, $wplc_version );
|
3783 |
+
wp_enqueue_style( 'wplc-chat-style' );
|
3784 |
+
|
3785 |
+
// New admin chat style
|
3786 |
+
} else if (isset($wplc_settings['wplc_use_node_server']) && ($wplc_settings['wplc_use_node_server'] == 1)) {
|
3787 |
+
wp_register_style( 'wplc-admin-chat-style', plugins_url( '/css/admin-chat-style.css', __FILE__ ), false, $wplc_version );
|
3788 |
+
wp_enqueue_style( 'wplc-admin-chat-style' );
|
3789 |
+
}
|
3790 |
+
}
|
3791 |
+
|
3792 |
+
// Gif Integration styles - admin
|
3793 |
+
wp_register_style( 'wplc-gif-integration', plugins_url( '/css/wplc_gif_integration.css', __FILE__ ) );
|
3794 |
+
wp_enqueue_style( 'wplc-gif-integration' );
|
3795 |
+
|
3796 |
+
// This loads the chat styling on all admin pages as we are using the popout dashboard
|
3797 |
+
if ( isset( $wplc_settings['wplc_use_node_server'] ) && ( $wplc_settings['wplc_use_node_server'] == 1 ) && ( isset( $wplc_settings['wplc_enable_all_admin_pages'] ) && $wplc_settings['wplc_enable_all_admin_pages'] === '1') ) {
|
3798 |
+
|
3799 |
+
wp_register_style( 'wplc-admin-chat-style', plugins_url( '/css/admin-chat-style.css', __FILE__ ), false, $wplc_version );
|
3800 |
+
wp_enqueue_style( 'wplc-admin-chat-style' );
|
3801 |
+
}
|
3802 |
+
|
3803 |
+
if (isset($_GET['page']) && $_GET['page'] == "wplivechat-menu-support-page") {
|
3804 |
+
wp_register_style('fontawesome', plugins_url('css/font-awesome.min.css', __FILE__ ), false, $wplc_version );
|
3805 |
+
wp_enqueue_style('fontawesome');
|
3806 |
+
wp_register_style('wplc-support-page-css', plugins_url('css/support-css.css', __FILE__ ), false, $wplc_version );
|
3807 |
+
wp_enqueue_style('wplc-support-page-css');
|
3808 |
+
}
|
3809 |
+
|
3810 |
+
if(isset($_GET['immersive_mode'])){
|
3811 |
+
wp_add_inline_style( 'wplc-admin-style', "#wpcontent { margin-left: 0px !important;} #wpadminbar, #wpfooter, #adminmenumain {display: none !important;}" );
|
3812 |
+
}
|
3813 |
+
}
|
3814 |
+
|
3815 |
+
if (isset($_GET['page']) && $_GET['page'] == 'wplivechat-menu-settings') {
|
3816 |
+
add_action('admin_print_scripts', 'wplc_admin_scripts_basic');
|
3817 |
+
}
|
3818 |
+
|
3819 |
+
/**
|
3820 |
+
* Loads the admin scripts for the chat dashboard and settings pages
|
3821 |
+
* @return void
|
3822 |
+
*/
|
3823 |
+
function wplc_admin_scripts_basic() {
|
3824 |
+
|
3825 |
+
$gutenberg_default_html = '<!-- Default HTML -->
|
3826 |
+
<div class="wplc_block">
|
3827 |
+
<span class="wplc_block_logo">{wplc_logo}</span>
|
3828 |
+
<span class="wplc_block_text">{wplc_text}</span>
|
3829 |
+
<span class="wplc_block_icon">{wplc_icon}</span>
|
3830 |
+
</div>';
|
3831 |
+
|
3832 |
+
if (isset($_GET['page']) && $_GET['page'] == "wplivechat-menu-settings") {
|
3833 |
+
wp_enqueue_script('jquery');
|
3834 |
+
wp_enqueue_script('jquery-ui-core');
|
3835 |
+
wp_enqueue_script('jquery-ui-tooltip');
|
3836 |
+
wp_register_script('my-wplc-color', plugins_url('js/jscolor.js', __FILE__), false, '1.4.1', false);
|
3837 |
+
wp_enqueue_script('my-wplc-color');
|
3838 |
+
wp_enqueue_script('jquery-ui-tabs');
|
3839 |
+
wp_register_script('my-wplc-tabs', plugins_url('js/wplc_tabs.js', __FILE__), array('jquery-ui-core'), '', true);
|
3840 |
+
wp_enqueue_script('my-wplc-tabs');
|
3841 |
+
wp_enqueue_media();
|
3842 |
+
wp_register_script('wplc-fontawesome-iconpicker', plugins_url('js/fontawesome-iconpicker.js', __FILE__), array('jquery'), '', true);
|
3843 |
+
wp_enqueue_script('wplc-fontawesome-iconpicker');
|
3844 |
+
wp_register_script('wplc-gutenberg', plugins_url('js/wplc_gutenberg.js', __FILE__), array('jquery'), '', true);
|
3845 |
+
wp_enqueue_script('wplc-gutenberg');
|
3846 |
+
wp_localize_script( 'wplc-gutenberg', 'default_html', $gutenberg_default_html );
|
3847 |
+
}
|
3848 |
+
}
|
3849 |
+
|
3850 |
+
/**
|
3851 |
+
* Loads basic version's settings page
|
3852 |
+
* @return void
|
3853 |
+
*/
|
3854 |
+
function wplc_admin_settings_layout() {
|
3855 |
+
wplc_settings_page_basic();
|
3856 |
+
}
|
3857 |
+
|
3858 |
+
/**
|
3859 |
+
* Loads the dashboard page
|
3860 |
+
* @return void
|
3861 |
+
*/
|
3862 |
+
function wplc_admin_dashboard_layout() {
|
3863 |
+
include 'includes/dashboard_page.php';
|
3864 |
+
}
|
3865 |
+
|
3866 |
+
add_action("wplc_hook_history_draw_area","wplc_hook_control_history_draw_area",10,1);
|
3867 |
+
/**
|
3868 |
+
* Display normal history page
|
3869 |
+
* @param int $cid Chat ID
|
3870 |
+
* @return void
|
3871 |
+
* @since 6.1.00
|
3872 |
+
* @author Nick Duncan <nick@codecabin.co.za>
|
3873 |
+
*/
|
3874 |
+
function wplc_hook_control_history_draw_area($cid) {
|
3875 |
+
wplc_draw_chat_area($cid);
|
3876 |
+
}
|
3877 |
+
|
3878 |
+
/**
|
3879 |
+
* What to display for the chat history
|
3880 |
+
* @param int $cid Chat ID
|
3881 |
+
* @return void
|
3882 |
+
* @since 6.1.00
|
3883 |
+
* @author Nick Duncan <nick@codecabin.co.za>
|
3884 |
+
*/
|
3885 |
+
function wplc_admin_view_chat_history($cid) {
|
3886 |
+
do_action("wplc_hook_history_draw_area",$cid);
|
3887 |
+
}
|
3888 |
+
|
3889 |
+
|
3890 |
+
add_action( 'wplc_hook_admin_menu_layout_display' , 'wplc_hook_control_history_get_control', 1, 3);
|
3891 |
+
/**
|
3892 |
+
* Control history GET calls
|
3893 |
+
* @param string $action The GET action
|
3894 |
+
* @param int $cid The chat id
|
3895 |
+
* @param int $aid AID
|
3896 |
+
* @return void
|
3897 |
+
* @since 6.1.00
|
3898 |
+
* @author Nick Duncan <nick@codecabin.co.za>
|
3899 |
+
*/
|
3900 |
+
function wplc_hook_control_history_get_control($action,$cid,$aid) {
|
3901 |
+
|
3902 |
+
if ($action == 'history') {
|
3903 |
+
wplc_admin_view_chat_history(sanitize_text_field($cid));
|
3904 |
+
} else if ($action == 'download_history'){
|
3905 |
+
|
3906 |
+
//Moved into the init hook as of version 6.0.01 due to different functionality
|
3907 |
+
|
3908 |
+
//wplc_admin_download_history(sanitize_text_field($_GET['type']), sanitize_text_field($cid));
|
3909 |
+
}
|
3910 |
+
|
3911 |
+
|
3912 |
+
}
|
3913 |
+
|
3914 |
+
|
3915 |
+
add_action("wplc_hook_chat_history","wplc_hook_control_chat_history");
|
3916 |
+
/**
|
3917 |
+
* Renders the chat history content
|
3918 |
+
* @return string
|
3919 |
+
*/
|
3920 |
+
function wplc_hook_control_chat_history() {
|
3921 |
+
|
3922 |
+
if (is_admin()) {
|
3923 |
+
|
3924 |
+
global $wpdb;
|
3925 |
+
global $wplc_tblname_chats;
|
3926 |
+
global $wplc_tblname_msgs;
|
3927 |
+
|
3928 |
+
if(isset($_GET['wplc_action']) && $_GET['wplc_action'] == 'remove_cid'){
|
3929 |
+
if(isset($_GET['cid'])){
|
3930 |
+
if(isset($_GET['wplc_confirm'])){
|
3931 |
+
//Confirmed - delete
|
3932 |
+
$delete_sql = "
|
3933 |
+
DELETE FROM $wplc_tblname_chats
|
3934 |
+
WHERE `id` = '".intval($_GET['cid'])."'
|
3935 |
+
";
|
3936 |
+
$delete_messages = "
|
3937 |
+
DELETE FROM $wplc_tblname_msgs
|
3938 |
+
WHERE `chat_sess_id` = '".intval($_GET['cid'])."'
|
3939 |
+
";
|
3940 |
+
|
3941 |
+
$wplc_was_error = false;
|
3942 |
+
|
3943 |
+
$wpdb->query($delete_sql);
|
3944 |
+
if ($wpdb->last_error) { $wplc_was_error = true; }
|
3945 |
+
$wpdb->query($delete_messages);
|
3946 |
+
if ($wpdb->last_error) { $wplc_was_error = true; }
|
3947 |
+
|
3948 |
+
if ($wplc_was_error) {
|
3949 |
+
echo "<div class='update-nag' style='margin-top: 0px;margin-bottom: 5px;'>
|
3950 |
+
".__("Error: Could not delete chat", "wplivechat")."<br>
|
3951 |
+
</div>";
|
3952 |
+
} else {
|
3953 |
+
echo "<div class='update-nag' style='margin-top: 0px;margin-bottom: 5px;border-color:#67d552;'>
|
3954 |
+
".__("Chat Deleted", "wplivechat")."<br>
|
3955 |
+
</div>";
|
3956 |
+
}
|
3957 |
+
|
3958 |
+
} else {
|
3959 |
+
//Prompt
|
3960 |
+
echo "<div class='update-nag' style='margin-top: 0px;margin-bottom: 5px;'>
|
3961 |
+
".__("Are you sure you would like to delete this chat?", "wplivechat")."<br>
|
3962 |
+
<a class='button' href='?page=wplivechat-menu-history&wplc_action=remove_cid&cid=".sanitize_text_field( $_GET['cid'] )."&wplc_confirm=1''>".__("Yes", "wplivechat")."</a> <a class='button' href='?page=wplivechat-menu-history'>".__("No", "wplivechat")."</a>
|
3963 |
+
</div>";
|
3964 |
+
}
|
3965 |
+
}
|
3966 |
+
}
|
3967 |
+
|
3968 |
+
$pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 1;
|
3969 |
+
$limit = 20; // number of rows in page
|
3970 |
+
$offset = ( $pagenum - 1 ) * $limit;
|
3971 |
+
$total = $wpdb->get_var( "SELECT COUNT(`id`) FROM $wplc_tblname_chats" );
|
3972 |
+
$num_of_pages = ceil( $total / $limit );
|
3973 |
+
|
3974 |
+
$results = $wpdb->get_results(
|
3975 |
+
"
|
3976 |
+
SELECT *
|
3977 |
+
FROM $wplc_tblname_chats
|
3978 |
+
WHERE `name` NOT LIKE 'agent-to-agent chat'
|
3979 |
+
ORDER BY `timestamp` DESC
|
3980 |
+
LIMIT $limit OFFSET $offset
|
3981 |
+
"
|
3982 |
+
);
|
3983 |
+
echo "
|
3984 |
+
<form method=\"post\" >
|
3985 |
+
<input type=\"submit\" value=\"".__('Delete History', 'wplivechat')."\" class='button' name=\"wplc-delete-chat-history\" /><br /><br />
|
3986 |
+
</form>
|
3987 |
+
|
3988 |
+
<table class=\"wp-list-table wplc_list_table widefat fixed \" cellspacing=\"0\">
|
3989 |
+
<thead>
|
3990 |
+
<tr>
|
3991 |
+
<th scope='col' id='wplc_id_colum' class='manage-column column-id sortable desc' style=''><span>" . __("Date", "wplivechat") . "</span></th>
|
3992 |
+
<th scope='col' id='wplc_name_colum' class='manage-column column-name_title sortable desc' style=''><span>" . __("Name", "wplivechat") . "</span></th>
|
3993 |
+
<th scope='col' id='wplc_email_colum' class='manage-column column-email' style=\"\">" . __("Email", "wplivechat") . "</th>
|
3994 |
+
<th scope='col' id='wplc_url_colum' class='manage-column column-url' style=\"\">" . __("URL", "wplivechat") . "</th>
|
3995 |
+
<th scope='col' id='wplc_status_colum' class='manage-column column-status' style=\"\">" . __("Status", "wplivechat") . "</th>
|
3996 |
+
<th scope='col' id='wplc_action_colum' class='manage-column column-action sortable desc' style=\"\"><span>" . __("Action", "wplivechat") . "</span></th>
|
3997 |
+
</tr>
|
3998 |
+
</thead>
|
3999 |
+
<tbody id=\"the-list\" class='list:wp_list_text_link'>
|
4000 |
+
";
|
4001 |
+
if (!$results) {
|
4002 |
+
echo "<tr><td></td><td>" . __("No chats available at the moment", "wplivechat") . "</td></tr>";
|
4003 |
+
} else {
|
4004 |
+
foreach ($results as $result) {
|
4005 |
+
unset($trstyle);
|
4006 |
+
unset($actions);
|
4007 |
+
|
4008 |
+
$tcid = sanitize_text_field( $result->id );
|
4009 |
+
|
4010 |
+
|
4011 |
+
$url = admin_url('admin.php?page=wplivechat-menu&action=history&cid=' . $tcid);
|
4012 |
+
$url2 = admin_url('admin.php?page=wplivechat-menu&action=download_history&type=csv&cid=' . $tcid);
|
4013 |
+
$url3 = "?page=wplivechat-menu-history&wplc_action=remove_cid&cid=" . $tcid;
|
4014 |
+
$actions = "
|
4015 |
+
<a href='$url' class='button' title='".__('View Chat History', 'wplivechat')."' target='_BLANK' id=''><i class='fa fa-eye'></i></a> <a href='$url2' class='button' title='".__('Download Chat History', 'wplivechat')."' target='_BLANK' id=''><i class='fa fa-download'></i></a> <a href='$url3' class='button'><i class='fa fa-trash-o'></i></a>
|
4016 |
+
";
|
4017 |
+
$trstyle = "style='height:30px;'";
|
4018 |
+
|
4019 |
+
echo "<tr id=\"record_" . $tcid . "\" $trstyle>";
|
4020 |
+
echo "<td class='chat_id column-chat_d'>" . date("Y-m-d H:i:s", current_time( strtotime( $result->timestamp ) ) ) . "</td>";
|
4021 |
+
echo "<td class='chat_name column_chat_name' id='chat_name_" . $tcid . "'><img src=\"//www.gravatar.com/avatar/" . md5($result->email) . "?s=40\" /> " . sanitize_text_field($result->name) . "</td>";
|
4022 |
+
echo "<td class='chat_email column_chat_email' id='chat_email_" . $tcid . "'><a href='mailto:" . sanitize_text_field($result->email) . "' title='Email " . ".$result->email." . "'>" . sanitize_text_field ($result->email) . "</a></td>";
|
4023 |
+
echo "<td class='chat_name column_chat_url' id='chat_url_" . $tcid . "'>" . esc_url($result->url) . "</td>";
|
4024 |
+
echo "<td class='chat_status column_chat_status' id='chat_status_" . $tcid . "'><strong>" . wplc_return_status($result->status) . "</strong></td>";
|
4025 |
+
echo "<td class='chat_action column-chat_action' id='chat_action_" . $tcid . "'>$actions</td>";
|
4026 |
+
echo "</tr>";
|
4027 |
+
}
|
4028 |
+
}
|
4029 |
+
echo "</table>";
|
4030 |
+
|
4031 |
+
$page_links = paginate_links( array(
|
4032 |
+
'base' => add_query_arg( 'pagenum', '%#%' ),
|
4033 |
+
'format' => '',
|
4034 |
+
'prev_text' => __( '«', 'wplivechat' ),
|
4035 |
+
'next_text' => __( '»', 'wplivechat' ),
|
4036 |
+
'total' => $num_of_pages,
|
4037 |
+
'current' => $pagenum
|
4038 |
+
) );
|
4039 |
+
|
4040 |
+
if ( $page_links ) {
|
4041 |
+
echo '<div class="tablenav"><div class="tablenav-pages" style="margin: 1em 0;float:none;text-align:center;">' . $page_links . '</div></div>';
|
4042 |
+
}
|
4043 |
+
}
|
4044 |
+
|
4045 |
+
|
4046 |
+
}
|
4047 |
+
|
4048 |
+
/**
|
4049 |
+
* Loads the chat history layout to accommodate basic/pro versions
|
4050 |
+
* @return string
|
4051 |
+
*/
|
4052 |
+
function wplc_admin_history_layout() {
|
4053 |
+
wplc_stats("history");
|
4054 |
+
echo"<div class=\"wrap wplc_wrap\"><div id=\"icon-edit\" class=\"icon32 icon32-posts-post\"><br></div><h2>" . __("WP Live Chat History", "wplivechat") . "</h2>";
|
4055 |
+
|
4056 |
+
do_action("wplc_before_history_table_hook");
|
4057 |
+
|
4058 |
+
if(function_exists("wplc_ce_activate")){
|
4059 |
+
wplc_ce_admin_display_history();
|
4060 |
+
} else if (function_exists("wplc_register_pro_version")) {
|
4061 |
+
wplc_pro_admin_display_history();
|
4062 |
+
} else {
|
4063 |
+
do_action("wplc_hook_chat_history");
|
4064 |
+
}
|
4065 |
+
}
|
4066 |
+
|
4067 |
+
|
4068 |
+
add_action("wplc_hook_chat_missed","wplc_hook_control_missed_chats",10);
|
4069 |
+
/**
|
4070 |
+
* Loads missed chats contents
|
4071 |
+
* @return string
|
4072 |
+
*/
|
4073 |
+
function wplc_hook_control_missed_chats() {
|
4074 |
+
if (function_exists('wplc_admin_display_missed_chats')) { wplc_admin_display_missed_chats(); }
|
4075 |
+
}
|
4076 |
+
|
4077 |
+
/**
|
4078 |
+
* Loads the missed chats page wrapper
|
4079 |
+
* @return string
|
4080 |
+
*/
|
4081 |
+
function wplc_admin_missed_chats() {
|
4082 |
+
wplc_stats("missed");
|
4083 |
+
echo "<div class=\"wrap wplc_wrap\"><div id=\"icon-edit\" class=\"icon32 icon32-posts-post\"><br></div><h2>" . __("WP Live Chat Missed Chats", "wplivechat") . "</h2>";
|
4084 |
+
do_action("wplc_hook_chat_missed");
|
4085 |
+
}
|
4086 |
+
|
4087 |
+
add_action("wplc_hook_offline_messages_display","wplc_hook_control_offline_messages_display",10);
|
4088 |
+
/**
|
4089 |
+
* Loads the offline messages page contents
|
4090 |
+
* @return string
|
4091 |
+
*/
|
4092 |
+
function wplc_hook_control_offline_messages_display() {
|
4093 |
+
if (function_exists("wplc_admin_display_offline_messages_new")) { wplc_admin_display_offline_messages_new(); } else {
|
4094 |
+
if (function_exists("wplc_register_pro_version")) {
|
4095 |
+
if (function_exists('wplc_pro_admin_display_offline_messages')) {
|
4096 |
+
wplc_pro_admin_display_offline_messages();
|
4097 |
+
} else {
|
4098 |
+
echo "<div class='updated'><p>" . __('Please update to the latest version of WP Live Chat Support Pro to start recording any offline messages.', 'wplivechat') . "</p></div>";
|
4099 |
+
}
|
4100 |
+
} else {
|
4101 |
+
echo "<br /><br >" . _('This option is only available in the ', 'wplivechat') . "<a href=\"http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=history1\" title=\"" . __("Pro Add-on", "wplivechat") . "\" target=\"_BLANK\">" . __('Pro Add-on', 'wplivechat') . "</a> of WP Live Chat. <a href=\"http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=missed_chats2\" title=\"" . __("Pro Add-on", "wplivechat") . "\" target=\"_BLANK\"></a>";
|
4102 |
+
}
|
4103 |
+
}
|
4104 |
+
|
4105 |
+
}
|
4106 |
+
|
4107 |
+
/**
|
4108 |
+
* Control who should see the offline messages
|
4109 |
+
* @return void
|
4110 |
+
*/
|
4111 |
+
function wplc_admin_offline_messages() {
|
4112 |
+
wplc_stats("offline_messages");
|
4113 |
+
echo"<div class=\"wrap wplc_wrap\"><div id=\"icon-edit\" class=\"icon32 icon32-posts-post\"><br></div><h2>" . __("WP Live Chat Offline Messages", "wplivechat") . "</h2>";
|
4114 |
+
do_action("wplc_hook_offline_messages_display");
|
4115 |
+
}
|
4116 |
+
|
4117 |
+
/**
|
4118 |
+
* Output the offline messages in an HTML table
|
4119 |
+
* @return void
|
4120 |
+
*/
|
4121 |
+
function wplc_admin_display_offline_messages_new() {
|
4122 |
+
|
4123 |
+
global $wpdb;
|
4124 |
+
global $wplc_tblname_offline_msgs;
|
4125 |
+
|
4126 |
+
echo "
|
4127 |
+
<table class=\"wp-list-table wplc_list_table widefat \" cellspacing=\"0\">
|
4128 |
+
<thead>
|
4129 |
+
<tr>
|
4130 |
+
<th class='manage-column column-id'><span>" . __("Date", "wplivechat") . "</span></th>
|
4131 |
+
<th scope='col' id='wplc_name_colum' class='manage-column column-id'><span>" . __("Name", "wplivechat") . "</span></th>
|
4132 |
+
<th scope='col' id='wplc_email_colum' class='manage-column column-id'>" . __("Email", "wplivechat") . "</th>
|
4133 |
+
<th scope='col' id='wplc_message_colum' class='manage-column column-id'>" . __("Message", "wplivechat") . "</th>
|
4134 |
+
<th scope='col' id='wplc_message_colum' class='manage-column column-id'>" . __("Actions", "wplivechat") . "</th>
|
4135 |
+
</tr>
|
4136 |
+
</thead>
|
4137 |
+
<tbody id=\"the-list\" class='list:wp_list_text_link'>";
|
4138 |
+
|
4139 |
+
$pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 1;
|
4140 |
+
$limit = 20; // number of rows in page
|
4141 |
+
$offset = ( $pagenum - 1 ) * $limit;
|
4142 |
+
$total = $wpdb->get_var( "SELECT COUNT(`id`) FROM $wplc_tblname_offline_msgs" );
|
4143 |
+
$num_of_pages = ceil( $total / $limit );
|
4144 |
+
|
4145 |
+
$sql = "SELECT * FROM $wplc_tblname_offline_msgs ORDER BY `timestamp` DESC LIMIT $limit OFFSET $offset";
|
4146 |
+
|
4147 |
+
$results = $wpdb->get_results($sql);
|
4148 |
+
|
4149 |
+
if (!$results) {
|
4150 |
+
echo "<tr><td></td><td>" . __("You have not received any offline messages.", "wplivechat") . "</td></tr>";
|
4151 |
+
} else {
|
4152 |
+
foreach ($results as $result) {
|
4153 |
+
echo "<tr id=\"record_" . $result->id . "\">";
|
4154 |
+
echo "<td class='chat_id column-chat_d'>" . $result->timestamp . "</td>";
|
4155 |
+
echo "<td class='chat_name column_chat_name' id='chat_name_" . $result->id . "'><img src=\"//www.gravatar.com/avatar/" . md5($result->email) . "?s=30\" /> " . $result->name . "</td>";
|
4156 |
+
echo "<td class='chat_email column_chat_email' id='chat_email_" . $result->id . "'><a href='mailto:" . $result->email . "' title='Email " . ".$result->email." . "'>" . $result->email . "</a></td>";
|
4157 |
+
echo "<td class='chat_name column_chat_url' id='chat_url_" . $result->id . "'>" . nl2br($result->message) . "</td>";
|
4158 |
+
echo "<td class='chat_name column_chat_delete'><button class='button wplc_delete_message' title='".__('Delete Message', 'wplivechat')."' class='wplc_delete_message' mid='".$result->id."'><i class='fa fa-times'></i></button></td>";
|
4159 |
+
echo "</tr>";
|
4160 |
+
}
|
4161 |
+
}
|
4162 |
+
|
4163 |
+
echo "
|
4164 |
+
</tbody>
|
4165 |
+
</table>";
|
4166 |
+
|
4167 |
+
$page_links = paginate_links( array(
|
4168 |
+
'base' => add_query_arg( 'pagenum', '%#%' ),
|
4169 |
+
'format' => '',
|
4170 |
+
'prev_text' => __( '«', 'wplivechat' ),
|
4171 |
+
'next_text' => __( '»', 'wplivechat' ),
|
4172 |
+
'total' => $num_of_pages,
|
4173 |
+
'current' => $pagenum
|
4174 |
+
) );
|
4175 |
+
|
4176 |
+
if ( $page_links ) {
|
4177 |
+
echo '<div class="tablenav"><div class="tablenav-pages" style="margin: 1em 0;float:none;text-align:center;">' . $page_links . '</div></div>';
|
4178 |
+
}
|
4179 |
+
}
|
4180 |
+
|
4181 |
+
/**
|
4182 |
+
* Loads the basic/pro version's settings pages
|
4183 |
+
* @return string
|
4184 |
+
*/
|
4185 |
+
function wplc_settings_page_basic() {
|
4186 |
+
if (function_exists("wplc_register_pro_version")) {
|
4187 |
+
wplc_settings_page_pro();
|
4188 |
+
} else {
|
4189 |
+
include 'includes/settings_page.php';
|
4190 |
+
}
|
4191 |
+
}
|
4192 |
+
|
4193 |
+
/**
|
4194 |
+
* Updates chat statistics
|
4195 |
+
* @param string $sec Specify which array key of the stats you'd like access to
|
4196 |
+
* @return void
|
4197 |
+
*/
|
4198 |
+
function wplc_stats($sec) {
|
4199 |
+
$wplc_stats = get_option("wplc_stats");
|
4200 |
+
if ($wplc_stats) {
|
4201 |
+
if (isset($wplc_stats[$sec]["views"])) {
|
4202 |
+
$wplc_stats[$sec]["views"] = $wplc_stats[$sec]["views"] + 1;
|
4203 |
+
$wplc_stats[$sec]["last_accessed"] = date("Y-m-d H:i:s");
|
4204 |
+
} else {
|
4205 |
+
$wplc_stats[$sec]["views"] = 1;
|
4206 |
+
$wplc_stats[$sec]["last_accessed"] = date("Y-m-d H:i:s");
|
4207 |
+
$wplc_stats[$sec]["first_accessed"] = date("Y-m-d H:i:s");
|
4208 |
+
}
|
4209 |
+
|
4210 |
+
|
4211 |
+
} else {
|
4212 |
+
|
4213 |
+
$wplc_stats[$sec]["views"] = 1;
|
4214 |
+
$wplc_stats[$sec]["last_accessed"] = date("Y-m-d H:i:s");
|
4215 |
+
$wplc_stats[$sec]["first_accessed"] = date("Y-m-d H:i:s");
|
4216 |
+
|
4217 |
+
|
4218 |
+
}
|
4219 |
+
update_option("wplc_stats",$wplc_stats);
|
4220 |
+
|
4221 |
+
}
|
4222 |
+
|
4223 |
+
|
4224 |
+
add_action("wplc_hook_head","wplc_hook_control_head");
|
4225 |
+
/**
|
4226 |
+
* Deletes the chat history on submission of POST
|
4227 |
+
* @return bool
|
4228 |
+
*/
|
4229 |
+
function wplc_hook_control_head() {
|
4230 |
+
if (isset($_POST['wplc-delete-chat-history'])) {
|
4231 |
+
wplc_del_history();
|
4232 |
+
}
|
4233 |
+
}
|
4234 |
+
|
4235 |
+
/**
|
4236 |
+
* Deletes all chat history
|
4237 |
+
* @return bool
|
4238 |
+
*/
|
4239 |
+
function wplc_del_history(){
|
4240 |
+
global $wpdb;
|
4241 |
+
global $wplc_tblname_chats;
|
4242 |
+
global $wplc_tblname_msgs;
|
4243 |
+
$wpdb->query("TRUNCATE TABLE $wplc_tblname_chats");
|
4244 |
+
$wpdb->query("TRUNCATE TABLE $wplc_tblname_msgs");
|
4245 |
+
}
|
4246 |
+
|
4247 |
+
add_filter("wplc_filter_chat_header_extra_attr","wplc_filter_control_chat_header_extra_attr",10,1);
|
4248 |
+
/**
|
4249 |
+
* Controls if the chat window should popup or not
|
4250 |
+
* @param array $wplc_extra_attr Extra chat data passed
|
4251 |
+
* @return string
|
4252 |
+
*/
|
4253 |
+
function wplc_filter_control_chat_header_extra_attr($wplc_extra_attr) {
|
4254 |
+
$wplc_acbc_data = get_option("WPLC_SETTINGS");
|
4255 |
+
if (isset($wplc_acbc_data['wplc_auto_pop_up'])) { $extr_string = $wplc_acbc_data['wplc_auto_pop_up']; $wplc_extra_attr .= " wplc-auto-pop-up=\"".$extr_string."\""; }
|
4256 |
+
|
4257 |
+
return $wplc_extra_attr;
|
4258 |
+
}
|
4259 |
+
|
4260 |
+
/**
|
4261 |
+
* Admin side headers used to save settings
|
4262 |
+
* @return string
|
4263 |
+
*/
|
4264 |
+
function wplc_head_basic() {
|
4265 |
+
global $wpdb;
|
4266 |
+
|
4267 |
+
do_action("wplc_hook_head");
|
4268 |
+
|
4269 |
+
|
4270 |
+
if (isset($_POST['wplc_save_settings'])) {
|
4271 |
+
|
4272 |
+
do_action("wplc_hook_admin_settings_save");
|
4273 |
+
if (isset($_POST['wplc_settings_align'])) { $wplc_data['wplc_settings_align'] = esc_attr($_POST['wplc_settings_align']); }
|
4274 |
+
if (isset($_POST['wplc_settings_bg'])) { $wplc_data['wplc_settings_bg'] = esc_attr($_POST['wplc_settings_bg']); }
|
4275 |
+
if (isset($_POST['wplc_environment'])) { $wplc_data['wplc_environment'] = esc_attr($_POST['wplc_environment']); }
|
4276 |
+
if (isset($_POST['wplc_settings_fill'])) { $wplc_data['wplc_settings_fill'] = esc_attr($_POST['wplc_settings_fill']); }
|
4277 |
+
if (isset($_POST['wplc_settings_font'])) { $wplc_data['wplc_settings_font'] = esc_attr($_POST['wplc_settings_font']); }
|
4278 |
+
|
4279 |
+
if (isset($_POST['wplc_settings_color1'])) { $wplc_data['wplc_settings_color1'] = esc_attr($_POST['wplc_settings_color1']); /* backwards compatibility for pro */ $wplc_data['wplc_settings_fill'] = esc_attr($_POST['wplc_settings_color1']); }
|
4280 |
+
if (isset($_POST['wplc_settings_color2'])) { $wplc_data['wplc_settings_color2'] = esc_attr($_POST['wplc_settings_color2']); /* backwards compatibility for pro */ $wplc_data['wplc_settings_font'] = esc_attr($_POST['wplc_settings_color2']); }
|
4281 |
+
if (isset($_POST['wplc_settings_color3'])) { $wplc_data['wplc_settings_color3'] = esc_attr($_POST['wplc_settings_color3']); }
|
4282 |
+
if (isset($_POST['wplc_settings_color4'])) { $wplc_data['wplc_settings_color4'] = esc_attr($_POST['wplc_settings_color4']); }
|
4283 |
+
|
4284 |
+
if (isset($_POST['wplc_settings_enabled'])) { $wplc_data['wplc_settings_enabled'] = esc_attr($_POST['wplc_settings_enabled']); }
|
4285 |
+
if (isset($_POST['wplc_powered_by_link'])) { $wplc_data['wplc_powered_by_link'] = esc_attr($_POST['wplc_powered_by_link']); }
|
4286 |
+
if (isset($_POST['wplc_auto_pop_up'])) { $wplc_data['wplc_auto_pop_up'] = esc_attr($_POST['wplc_auto_pop_up']); }
|
4287 |
+
if (isset($_POST['wplc_require_user_info'])) { $wplc_data['wplc_require_user_info'] = esc_attr($_POST['wplc_require_user_info']); } else { $wplc_data['wplc_require_user_info'] = "0"; }
|
4288 |
+
if (isset($_POST['wplc_user_default_visitor_name']) && $_POST['wplc_user_default_visitor_name'] != '') { $wplc_data['wplc_user_default_visitor_name'] = esc_attr($_POST['wplc_user_default_visitor_name']); } else { $wplc_data['wplc_user_default_visitor_name'] = __("Guest", "wplivechat"); }
|
4289 |
+
if (isset($_POST['wplc_loggedin_user_info'])) { $wplc_data['wplc_loggedin_user_info'] = esc_attr($_POST['wplc_loggedin_user_info']); } else { $wplc_data['wplc_loggedin_user_info'] = "0"; }
|
4290 |
+
if (isset($_POST['wplc_user_alternative_text']) && $_POST['wplc_user_alternative_text'] != '') { $wplc_data['wplc_user_alternative_text'] = esc_attr($_POST['wplc_user_alternative_text']); } else { $wplc_data['wplc_user_alternative_text'] = __("Please click 'Start Chat' to initiate a chat with an agent", "wplivechat"); }
|
4291 |
+
if (isset($_POST['wplc_enabled_on_mobile'])) { $wplc_data['wplc_enabled_on_mobile'] = esc_attr($_POST['wplc_enabled_on_mobile']); } else { $wplc_data['wplc_enabled_on_mobile'] = "0"; }
|
4292 |
+
if (isset($_POST['wplc_display_name'])) { $wplc_data['wplc_display_name'] = esc_attr($_POST['wplc_display_name']); }
|
4293 |
+
if (isset($_POST['wplc_display_to_loggedin_only'])) { $wplc_data['wplc_display_to_loggedin_only'] = esc_attr($_POST['wplc_display_to_loggedin_only']); }
|
4294 |
+
|
4295 |
+
if (isset($_POST['wplc_redirect_to_thank_you_page'])) { $wplc_data['wplc_redirect_to_thank_you_page'] = esc_attr($_POST['wplc_redirect_to_thank_you_page']); }
|
4296 |
+
if (isset($_POST['wplc_redirect_thank_you_url'])) { $wplc_data['wplc_redirect_thank_you_url'] = urlencode(str_replace("https:", "", str_replace("http:", "", $_POST['wplc_redirect_thank_you_url']) ) ); }
|
4297 |
+
|
4298 |
+
if (isset($_POST['wplc_is_gif_integration_enabled'] )){ $wplc_data['wplc_is_gif_integration_enabled'] = esc_attr($_POST['wplc_is_gif_integration_enabled']); }
|
4299 |
+
if (isset($_POST['wplc_preferred_gif_provider'])) { $wplc_data['wplc_preferred_gif_provider'] = esc_attr($_POST['wplc_preferred_gif_provider']); }
|
4300 |
+
if (isset($_POST['wplc_giphy_api_key'])) { $wplc_data['wplc_giphy_api_key'] = esc_attr($_POST['wplc_giphy_api_key']); }
|
4301 |
+
if (isset($_POST['wplc_tenor_api_key'])) { $wplc_data['wplc_tenor_api_key'] = esc_attr($_POST['wplc_tenor_api_key']); }
|
4302 |
+
|
4303 |
+
$wplc_data['wplc_disable_emojis'] = !empty($_POST['wplc_disable_emojis']);
|
4304 |
+
|
4305 |
+
/** DEPRECATED BY GDPR */
|
4306 |
+
/*if(isset($_POST['wplc_record_ip_address'])){ $wplc_data['wplc_record_ip_address'] = esc_attr($_POST['wplc_record_ip_address']); } else { $wplc_data['wplc_record_ip_address'] = "0"; }*/
|
4307 |
+
|
4308 |
+
$wplc_data['wplc_record_ip_address'] = "0";
|
4309 |
+
|
4310 |
+
if(isset($_POST['wplc_enable_msg_sound'])){ $wplc_data['wplc_enable_msg_sound'] = esc_attr($_POST['wplc_enable_msg_sound']); } else { $wplc_data['wplc_enable_msg_sound'] = "0"; }
|
4311 |
+
|
4312 |
+
if(isset($_POST['wplc_enable_visitor_sound'])){ $wplc_data['wplc_enable_visitor_sound'] = esc_attr($_POST['wplc_enable_visitor_sound']); } else { $wplc_data['wplc_enable_visitor_sound'] = "0"; }
|
4313 |
+
|
4314 |
+
|
4315 |
+
if(isset($_POST['wplc_enable_font_awesome'])){ $wplc_data['wplc_enable_font_awesome'] = esc_attr($_POST['wplc_enable_font_awesome']); } else { $wplc_data['wplc_enable_font_awesome'] = "0"; }
|
4316 |
+
if(isset($_POST['wplc_enable_all_admin_pages'])){ $wplc_data['wplc_enable_all_admin_pages'] = esc_attr($_POST['wplc_enable_all_admin_pages']); } else { $wplc_data['wplc_enable_all_admin_pages'] = "0"; }
|
4317 |
+
|
4318 |
+
if (isset($_POST['wplc_pro_na'])) { $wplc_data['wplc_pro_na'] = esc_attr($_POST['wplc_pro_na']); }
|
4319 |
+
if (isset($_POST['wplc_hide_when_offline'])) { $wplc_data['wplc_hide_when_offline'] = esc_attr($_POST['wplc_hide_when_offline']); }
|
4320 |
+
if (isset($_POST['wplc_pro_chat_email_address'])) { $wplc_data['wplc_pro_chat_email_address'] = esc_attr($_POST['wplc_pro_chat_email_address']); }
|
4321 |
+
|
4322 |
+
if (isset($_POST['wplc_pro_chat_email_offline_subject'])) { $wplc_data['wplc_pro_chat_email_offline_subject'] = esc_attr($_POST['wplc_pro_chat_email_offline_subject']); }
|
4323 |
+
|
4324 |
+
if (isset($_POST['wplc_pro_offline1'])) { $wplc_data['wplc_pro_offline1'] = esc_attr($_POST['wplc_pro_offline1']); }
|
4325 |
+
if (isset($_POST['wplc_pro_offline2'])) { $wplc_data['wplc_pro_offline2'] = esc_attr($_POST['wplc_pro_offline2']); }
|
4326 |
+
if (isset($_POST['wplc_pro_offline3'])) { $wplc_data['wplc_pro_offline3'] = esc_attr($_POST['wplc_pro_offline3']); }
|
4327 |
+
if (isset($_POST['wplc_pro_offline_btn'])) { $wplc_data['wplc_pro_offline_btn'] = esc_attr($_POST['wplc_pro_offline_btn']); }
|
4328 |
+
if (isset($_POST['wplc_pro_offline_btn_send'])) { $wplc_data['wplc_pro_offline_btn_send'] = esc_attr($_POST['wplc_pro_offline_btn_send']); }
|
4329 |
+
if (isset($_POST['wplc_using_localization_plugin'])){ $wplc_data['wplc_using_localization_plugin'] = esc_attr($_POST['wplc_using_localization_plugin']); }
|
4330 |
+
|
4331 |
+
|
4332 |
+
if (isset($_POST['wplc_pro_fst1'])) { $wplc_data['wplc_pro_fst1'] = esc_attr($_POST['wplc_pro_fst1']); }
|
4333 |
+
if (isset($_POST['wplc_pro_fst2'])) { $wplc_data['wplc_pro_fst2'] = esc_attr($_POST['wplc_pro_fst2']); }
|
4334 |
+
if (isset($_POST['wplc_pro_fst3'])) { $wplc_data['wplc_pro_fst3'] = esc_attr($_POST['wplc_pro_fst3']); }
|
4335 |
+
if (isset($_POST['wplc_pro_sst1'])) { $wplc_data['wplc_pro_sst1'] = esc_attr($_POST['wplc_pro_sst1']); }
|
4336 |
+
if (isset($_POST['wplc_pro_sst1_survey'])) { $wplc_data['wplc_pro_sst1_survey'] = esc_attr($_POST['wplc_pro_sst1_survey']); }
|
4337 |
+
if (isset($_POST['wplc_pro_sst1e_survey'])) { $wplc_data['wplc_pro_sst1e_survey'] = esc_attr($_POST['wplc_pro_sst1e_survey']); }
|
4338 |
+
if (isset($_POST['wplc_pro_sst2'])) { $wplc_data['wplc_pro_sst2'] = esc_attr($_POST['wplc_pro_sst2']); }
|
4339 |
+
if (isset($_POST['wplc_pro_tst1'])) { $wplc_data['wplc_pro_tst1'] = esc_attr($_POST['wplc_pro_tst1']); }
|
4340 |
+
if (isset($_POST['wplc_pro_intro'])) { $wplc_data['wplc_pro_intro'] = esc_attr($_POST['wplc_pro_intro']); }
|
4341 |
+
if (isset($_POST['wplc_user_enter'])) { $wplc_data['wplc_user_enter'] = esc_attr($_POST['wplc_user_enter']); }
|
4342 |
+
if (isset($_POST['wplc_text_chat_ended'])) { $wplc_data['wplc_text_chat_ended'] = esc_attr($_POST['wplc_text_chat_ended']); }
|
4343 |
+
if (isset($_POST['wplc_close_btn_text'])) { $wplc_data['wplc_close_btn_text'] = esc_attr($_POST['wplc_close_btn_text']); }
|
4344 |
+
if (isset($_POST['wplc_user_welcome_chat'])) { $wplc_data['wplc_user_welcome_chat'] = esc_attr($_POST['wplc_user_welcome_chat']); }
|
4345 |
+
if (isset($_POST['wplc_welcome_msg'])) { $wplc_data['wplc_welcome_msg'] = esc_attr($_POST['wplc_welcome_msg']); }
|
4346 |
+
|
4347 |
+
|
4348 |
+
if(isset($_POST['wplc_animation'])){ $wplc_data['wplc_animation'] = esc_attr($_POST['wplc_animation']); }
|
4349 |
+
if(isset($_POST['wplc_theme'])){ $wplc_data['wplc_theme'] = esc_attr($_POST['wplc_theme']); }
|
4350 |
+
if(isset($_POST['wplc_newtheme'])){ $wplc_data['wplc_newtheme'] = esc_attr($_POST['wplc_newtheme']); }
|
4351 |
+
|
4352 |
+
if(isset($_POST['wplc_elem_trigger_action'])){ $wplc_data['wplc_elem_trigger_action'] = esc_attr($_POST['wplc_elem_trigger_action']); } else{ $wplc_data['wplc_elem_trigger_action'] = "0"; }
|
4353 |
+
if(isset($_POST['wplc_elem_trigger_type'])){ $wplc_data['wplc_elem_trigger_type'] = esc_attr($_POST['wplc_elem_trigger_type']); } else { $wplc_data['wplc_elem_trigger_type'] = "0";}
|
4354 |
+
if(isset($_POST['wplc_elem_trigger_id'])){ $wplc_data['wplc_elem_trigger_id'] = esc_attr($_POST['wplc_elem_trigger_id']); } else { $wplc_data['wplc_elem_trigger_id'] = ""; }
|
4355 |
+
|
4356 |
+
if(isset($_POST['wplc_agent_select']) && $_POST['wplc_agent_select'] != "") {
|
4357 |
+
$user_array = get_users(array(
|
4358 |
+
'meta_key' => 'wplc_ma_agent',
|
4359 |
+
));
|
4360 |
+
if ($user_array) {
|
4361 |
+
foreach ($user_array as $user) {
|
4362 |
+
$uid = $user->ID;
|
4363 |
+
$wplc_ma_user = new WP_User( $uid );
|
4364 |
+
$wplc_ma_user->remove_cap( 'wplc_ma_agent' );
|
4365 |
+
delete_user_meta($uid, "wplc_ma_agent");
|
4366 |
+
delete_user_meta($uid, "wplc_chat_agent_online");
|
4367 |
+
}
|
4368 |
+
}
|
4369 |
+
|
4370 |
+
|
4371 |
+
$uid = intval($_POST['wplc_agent_select']);
|
4372 |
+
$wplc_ma_user = new WP_User( $uid );
|
4373 |
+
$wplc_ma_user->add_cap( 'wplc_ma_agent' );
|
4374 |
+
update_user_meta($uid, "wplc_ma_agent", 1);
|
4375 |
+
update_user_meta($uid, "wplc_chat_agent_online", time());
|
4376 |
+
|
4377 |
+
}
|
4378 |
+
|
4379 |
+
|
4380 |
+
if(isset($_POST['wplc_ban_users_ip'])){
|
4381 |
+
$wplc_banned_ip_addresses = explode('<br />', nl2br(sanitize_text_field($_POST['wplc_ban_users_ip'])));
|
4382 |
+
foreach($wplc_banned_ip_addresses as $key => $value) {
|
4383 |
+
$data[$key] = trim($value);
|
4384 |
+
}
|
4385 |
+
$wplc_banned_ip_addresses = maybe_serialize($data);
|
4386 |
+
|
4387 |
+
update_option('WPLC_BANNED_IP_ADDRESSES', $wplc_banned_ip_addresses);
|
4388 |
+
}
|
4389 |
+
|
4390 |
+
if( isset( $_POST['wplc_show_date'] ) ){ $wplc_data['wplc_show_date'] = '1'; } else { $wplc_data['wplc_show_date'] = '0'; }
|
4391 |
+
if( isset( $_POST['wplc_show_time'] ) ){ $wplc_data['wplc_show_time'] = '1'; } else { $wplc_data['wplc_show_time'] = '0'; }
|
4392 |
+
|
4393 |
+
if( isset( $_POST['wplc_show_name'] ) ){ $wplc_data['wplc_show_name'] = '1'; } else { $wplc_data['wplc_show_name'] = '0'; }
|
4394 |
+
if( isset( $_POST['wplc_show_avatar'] ) ){ $wplc_data['wplc_show_avatar'] = '1'; } else { $wplc_data['wplc_show_avatar'] = '0'; }
|
4395 |
+
$wplc_data = apply_filters("wplc_settings_save_filter_hook", $wplc_data);
|
4396 |
+
|
4397 |
+
if (isset($_POST['wplc_user_no_answer'])) { $wplc_data["wplc_user_no_answer"] = esc_attr($_POST['wplc_user_no_answer']); } else { $wplc_data["wplc_user_no_answer"] = __("There is No Answer. Please Try Again Later.", "wplivechat"); }
|
4398 |
+
|
4399 |
+
update_option('WPLC_SETTINGS', $wplc_data);
|
4400 |
+
if (isset($_POST['wplc_hide_chat'])) {
|
4401 |
+
update_option("WPLC_HIDE_CHAT", true);
|
4402 |
+
} else {
|
4403 |
+
update_option("WPLC_HIDE_CHAT", false);
|
4404 |
+
}
|
4405 |
+
|
4406 |
+
|
4407 |
+
$wplc_advanced_settings = array();
|
4408 |
+
if (isset($_POST['wplc_iterations'])) { $wplc_advanced_settings['wplc_iterations'] = esc_attr($_POST['wplc_iterations']); }
|
4409 |
+
if (isset($_POST['wplc_delay_between_loops'])) { $wplc_advanced_settings['wplc_delay_between_loops'] = esc_attr($_POST['wplc_delay_between_loops']); }
|
4410 |
+
update_option("wplc_advanced_settings",$wplc_advanced_settings);
|
4411 |
+
|
4412 |
+
|
4413 |
+
update_option('wplc_mail_type', $_POST['wplc_mail_type']);
|
4414 |
+
update_option('wplc_mail_host', $_POST['wplc_mail_host']);
|
4415 |
+
update_option('wplc_mail_port', $_POST['wplc_mail_port']);
|
4416 |
+
update_option('wplc_mail_username', $_POST['wplc_mail_username']);
|
4417 |
+
update_option('wplc_mail_password', $_POST['wplc_mail_password']);
|
4418 |
+
|
4419 |
+
|
4420 |
+
add_action( 'admin_notices', 'wplc_save_settings_action' );
|
4421 |
+
}
|
4422 |
+
if (isset($_POST['action']) && $_POST['action'] == "wplc_submit_find_us") {
|
4423 |
+
if (function_exists('curl_version')) {
|
4424 |
+
$request_url = "http://www.wp-livechat.com/apif/rec.php";
|
4425 |
+
$ch = curl_init();
|
4426 |
+
curl_setopt($ch, CURLOPT_URL, $request_url);
|
4427 |
+
curl_setopt($ch, CURLOPT_POST, 1);
|
4428 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST);
|
4429 |
+
curl_setopt($ch, CURLOPT_REFERER, $_SERVER['HTTP_HOST']);
|
4430 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
4431 |
+
$output = curl_exec($ch);
|
4432 |
+
curl_close($ch);
|
4433 |
+
}
|
4434 |
+
echo "<div class=\"updated\"><p>" . __("Thank You for your feedback!", "wplivechat") . "</p></div>";
|
4435 |
+
@wp_redirect( admin_url("/admin.php?page=wplivechat-menu&override=1") );
|
4436 |
+
}
|
4437 |
+
if( isset( $_GET['override'] ) && $_GET['override'] == '1' ){
|
4438 |
+
update_option( "WPLC_V8_FIRST_TIME", false);
|
4439 |
+
}
|
4440 |
+
}
|
4441 |
+
|
4442 |
+
function wplc_save_settings_action() { ?>
|
4443 |
+
<div class='notice notice-success updated wplc_settings_save_notice'>
|
4444 |
+
<?php _e("Your settings have been saved.", "wplivechat"); ?>
|
4445 |
+
</div>
|
4446 |
+
<?php }
|
4447 |
+
|
4448 |
+
add_action('wp_logout', 'wplc_logout');
|
4449 |
+
/**
|
4450 |
+
* Deletes the chat transient when a user logs out
|
4451 |
+
* @return bool
|
4452 |
+
*/
|
4453 |
+
function wplc_logout() {
|
4454 |
+
delete_transient('wplc_is_admin_logged_in');
|
4455 |
+
}
|
4456 |
+
|
4457 |
+
/**
|
4458 |
+
* Returns the home page of the user's side
|
4459 |
+
* @return string
|
4460 |
+
*/
|
4461 |
+
function wplc_get_home_path() {
|
4462 |
+
$home = get_option('home');
|
4463 |
+
$siteurl = site_url();
|
4464 |
+
if (!empty($home) && 0 !== strcasecmp($home, $siteurl)) {
|
4465 |
+
$wp_path_rel_to_home = str_ireplace($home, '', $siteurl); /* $siteurl - $home */
|
4466 |
+
$pos = strripos(str_replace('\\', '/', $_SERVER['SCRIPT_FILENAME']), trailingslashit($wp_path_rel_to_home));
|
4467 |
+
$home_path = substr($_SERVER['SCRIPT_FILENAME'], 0, $pos);
|
4468 |
+
$home_path = trailingslashit($home_path);
|
4469 |
+
} else {
|
4470 |
+
$home_path = ABSPATH;
|
4471 |
+
}
|
4472 |
+
return str_replace('\\', '/', $home_path);
|
4473 |
+
}
|
4474 |
+
|
4475 |
+
/**
|
4476 |
+
* Error checks used to ensure the user's resources meet the plugin's requirements
|
4477 |
+
*/
|
4478 |
+
if(isset($_GET['page']) && $_GET['page'] == 'wplivechat-menu-settings'){
|
4479 |
+
if(is_admin()){
|
4480 |
+
|
4481 |
+
// Only show these warning messages to Legacy users as they will be affected, not Node users.
|
4482 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
4483 |
+
if (isset( $wplc_settings['wplc_use_node_server'] ) && intval( $wplc_settings['wplc_use_node_server'] ) == 1 ) { } else {
|
4484 |
+
|
4485 |
+
$wplc_error_count = 0;
|
4486 |
+
$wplc_admin_warnings = "<div class='error'>";
|
4487 |
+
if(!function_exists('set_time_limit')){
|
4488 |
+
$wplc_admin_warnings .= "
|
4489 |
+
<p>".__("WPLC: set_time_limit() is not enabled on this server. You may experience issues while using WP Live Chat Support as a result of this. Please get in contact your host to get this function enabled.", "wplivechat")."</p>
|
4490 |
+
";
|
4491 |
+
$wplc_error_count++;
|
4492 |
+
}
|
4493 |
+
if(ini_get('safe_mode')){
|
4494 |
+
$wplc_admin_warnings .= "
|
4495 |
+
<p>".__("WPLC: Safe mode is enabled on this server. You may experience issues while using WP Live Chat Support as a result of this. Please contact your host to get safe mode disabled.", "wplivechat")."</p>
|
4496 |
+
";
|
4497 |
+
$wplc_error_count++;
|
4498 |
+
}
|
4499 |
+
$wplc_admin_warnings .= "</div>";
|
4500 |
+
if($wplc_error_count > 0){
|
4501 |
+
echo $wplc_admin_warnings;
|
4502 |
+
}
|
4503 |
+
}
|
4504 |
+
}
|
4505 |
+
}
|
4506 |
+
|
4507 |
+
/**
|
4508 |
+
* Loads the contents of the extensions menu item
|
4509 |
+
* @return string
|
4510 |
+
*/
|
4511 |
+
function wplc_extensions_menu() {
|
4512 |
+
|
4513 |
+
if (isset($_GET['type']) && $_GET['type'] == "additional") {
|
4514 |
+
$additional = "nav-tab-active";
|
4515 |
+
$normal = "";
|
4516 |
+
} else {
|
4517 |
+
$normal = "nav-tab-active";
|
4518 |
+
$additional = "";
|
4519 |
+
}
|
4520 |
+
|
4521 |
+
?>
|
4522 |
+
<h2 class="nav-tab-wrapper">
|
4523 |
+
<a href="admin.php?page=wplivechat-menu-extensions-page" title="<?php _e("Add-ons","wplivechat"); ?>" class="nav-tab <?php echo $normal; ?>"><?php _e("Add-ons","wplivechat"); ?></a><a href="admin.php?page=wplivechat-menu-extensions-page&type=additional" title="<?php _e("Suggested Plugins","wplivechat"); ?>" class="nav-tab <?php echo $additional; ?>"><?php _e("Suggested Plugins","wplivechat"); ?></a>
|
4524 |
+
<span style='float: right; bottom:-5px; position: relative;'><img src='<?php echo plugins_url('/images/codecabin.png', __FILE__); ?>' style="height:15px;" /></span>
|
4525 |
+
</h2>
|
4526 |
+
<div id="tab_container">
|
4527 |
+
|
4528 |
+
|
4529 |
+
<?php
|
4530 |
+
if (isset($_GET['type']) && $_GET['type'] == "additional") {
|
4531 |
+
?>
|
4532 |
+
|
4533 |
+
<div class="wplc-extension wplc-plugin">
|
4534 |
+
<h3 class="wplc-extension-title"><?php _e("Sola Support Tickets","wplivechat"); ?></h3>
|
4535 |
+
<a href="https://wordpress.org/plugins/sola-support-tickets/" title="<?php _e("Sola Support Tickets","wplivechat"); ?>" target="_BLANK">
|
4536 |
+
<img width="320" src="<?php echo plugins_url('/images/plugin2.jpg', __FILE__); ?>" class="attachment-showcase wp-post-image" alt="<?php _e("Sola Support Tickets","wplivechat"); ?>" title="<?php _e("Sola Support Tickets","wplivechat"); ?>">
|
4537 |
+
</a>
|
4538 |
+
<p></p>
|
4539 |
+
<p><?php _e("The easiest to use Help Desk & Support Ticket plugin. Create a support help desk quickly and easily with Sola Support Tickets.","wplivechat"); ?></p>
|
4540 |
+
<p></p>
|
4541 |
+
<a href="https://wordpress.org/plugins/sola-support-tickets/" title="<?php _e("Sola Support Tickets","wplivechat"); ?>" class="button-secondary" target="_BLANK"><?php _e("Get this Plugin","wplivechat"); ?></a>
|
4542 |
+
</div>
|
4543 |
+
|
4544 |
+
<div class="wplc-extension wplc-plugin">
|
4545 |
+
<h3 class="wplc-extension-title"><?php _e("Nifty Newsletters","wplivechat"); ?></h3>
|
4546 |
+
<a href="https://wordpress.org/plugins/sola-newsletters/" title="<?php _e("Nifty Newsletters","wplivechat"); ?>" target="_BLANK">
|
4547 |
+
<img width="320" src="<?php echo plugins_url('/images/plugin1.jpg', __FILE__); ?>" class="attachment-showcase wp-post-image" alt="<?php _e("Nifty Newsletters","wplivechat"); ?>" title="<?php _e("Nifty Newsletters","wplivechat"); ?>">
|
4548 |
+
</a>
|
4549 |
+
<p></p>
|
4550 |
+
<p><?php _e("Create and send newsletters, automatic post notifications and autoresponders that are modern and beautiful with Nifty Newsletters.","wplivechat"); ?></p>
|
4551 |
+
<p></p>
|
4552 |
+
<a href="https://wordpress.org/plugins/sola-newsletters/" title="<?php _e("Nifty Newsletters","wplivechat"); ?>" class="button-secondary" target="_BLANK"><?php _e("Get this Plugin","wplivechat"); ?></a>
|
4553 |
+
</div>
|
4554 |
+
|
4555 |
+
|
4556 |
+
<?php } else {
|
4557 |
+
$filter1 = "all";
|
4558 |
+
$filter2 = "all";
|
4559 |
+
|
4560 |
+
if (isset($_GET['filter1'])) { $filter1 = $_GET['filter1']; }
|
4561 |
+
if (isset($_GET['filter2'])) { $filter2 = $_GET['filter2']; }
|
4562 |
+
|
4563 |
+
$style_strong = 'style="font-weight:bold;"';
|
4564 |
+
$style_normal = 'style="font-weight:normal;"';
|
4565 |
+
|
4566 |
+
$filter1_all_style = $style_normal;
|
4567 |
+
$filter1_free_style = $style_normal;
|
4568 |
+
$filter1_paid_style = $style_normal;
|
4569 |
+
$filter2_both_style = $style_normal;
|
4570 |
+
$filter2_free_style = $style_normal;
|
4571 |
+
$filter2_pro_style = $style_normal;
|
4572 |
+
|
4573 |
+
if ($filter1 == "all") { $filter1_all_style = $style_strong; }
|
4574 |
+
else if ($filter1 == "free") { $filter1_free_style = $style_strong; }
|
4575 |
+
else if ($filter1 == "paid") { $filter1_paid_style = $style_strong; }
|
4576 |
+
else { $filter1_all_style = $style_strong; }
|
4577 |
+
if ($filter2 == "all") { $filter2_both_style = $style_strong; }
|
4578 |
+
else if ($filter2 == "free") { $filter2_free_style = $style_strong; }
|
4579 |
+
else if ($filter2 == "pro") { $filter2_pro_style = $style_strong; }
|
4580 |
+
else { $filter2_both_style = $style_strong; }
|
4581 |
+
|
4582 |
+
|
4583 |
+
echo "<p><div style='display:block; overflow:auto; clear:both;'>";
|
4584 |
+
echo "<strong>".__("Price:","wplivechat")."</strong> ";
|
4585 |
+
echo "<a href='admin.php?page=wplivechat-menu-extensions-page&filter1=all&filter2=".$filter2."' $filter1_all_style>".__("All","wplivechat")."</a> |";
|
4586 |
+
echo "<a href='admin.php?page=wplivechat-menu-extensions-page&filter1=free&filter2=".$filter2."' $filter1_free_style>".__("Free","wplivechat")."</a> |";
|
4587 |
+
echo "<a href='admin.php?page=wplivechat-menu-extensions-page&filter1=paid&filter2=".$filter2."' $filter1_paid_style>".__("Paid","wplivechat")."</a>";
|
4588 |
+
echo "</div></p>";
|
4589 |
+
echo "<p><div style='display:block; overflow:auto; clear:both;'>";
|
4590 |
+
echo "<strong>".__("For:","wplivechat")."</strong> ";
|
4591 |
+
echo "<a href='admin.php?page=wplivechat-menu-extensions-page&filter2=all&filter1=".$filter1."' $filter2_both_style>".__("Both","wplivechat")."</a> |";
|
4592 |
+
echo "<a href='admin.php?page=wplivechat-menu-extensions-page&filter2=free&filter1=".$filter1."' $filter2_free_style>".__("Free version","wplivechat")."</a> |";
|
4593 |
+
echo "<a href='admin.php?page=wplivechat-menu-extensions-page&filter2=pro&filter1=".$filter1."' $filter2_pro_style>".__("Pro version","wplivechat")."</a>";
|
4594 |
+
echo "</div></p>";
|
4595 |
+
|
4596 |
+
|
4597 |
+
$response = wp_remote_post( "https://ccplugins.co/api-wplc-extensions", array(
|
4598 |
+
'method' => 'POST',
|
4599 |
+
'body' => array(
|
4600 |
+
'action' => 'extensions',
|
4601 |
+
'filter1' => $filter1,
|
4602 |
+
'filter2' => $filter2
|
4603 |
+
)
|
4604 |
+
)
|
4605 |
+
);
|
4606 |
+
if(is_array($response) && isset($response['body'])){
|
4607 |
+
$data = json_decode($response['body']);
|
4608 |
+
global $wplc_version;
|
4609 |
+
$wplc_version = str_replace(",","",$wplc_version);
|
4610 |
+
if ($data) {
|
4611 |
+
$output = "";
|
4612 |
+
foreach ($data as $extension) {
|
4613 |
+
if (!isset($extension->fromversion)) { $extension->fromversion = 0; }
|
4614 |
+
if (intval($wplc_version) >= intval($extension->fromversion)) {
|
4615 |
+
$output .= '<div class="wplc-extension">';
|
4616 |
+
$output .= '<h3 class="wplc-extension-title">'.$extension->title.'</h3>';
|
4617 |
+
$output .= '<a href="'.$extension->link.'" title="'.$extension->title.'" target="_BLANK">';
|
4618 |
+
$output .= '<img width="320" height="200" src="'.$extension->image.'" class="attachment-showcase wp-post-image" alt="'.$extension->title.'" title="'.$extension->title.'">';
|
4619 |
+
$output .= '</a>';
|
4620 |
+
$output .= '<p></p>';
|
4621 |
+
$output .= '<p><div class="wplc-extension-label-box">';
|
4622 |
+
$output .= '</div></p>';
|
4623 |
+
$output .= '<p>'.$extension->description.'</p>';
|
4624 |
+
if ($extension->slug != false && is_plugin_active($extension->slug."/".$extension->slug.".php")) {
|
4625 |
+
$button = '<a href="javascriot:void(0);" title="" disabled class="button-secondary">'.__("Already installed","wplivechat").'</a>';
|
4626 |
+
} else {
|
4627 |
+
$button = '<a href="'.$extension->link.'" title="'.$extension->title.'" class="button-secondary" target="_BLANK">'.$extension->button_text.'</a>';
|
4628 |
+
}
|
4629 |
+
$output .= $button;
|
4630 |
+
$output .= '</div>';
|
4631 |
+
}
|
4632 |
+
}
|
4633 |
+
echo $output;
|
4634 |
+
}
|
4635 |
+
|
4636 |
+
}
|
4637 |
+
?>
|
4638 |
+
|
4639 |
+
|
4640 |
+
|
4641 |
+
<?php } ?>
|
4642 |
+
|
4643 |
+
</div>
|
4644 |
+
<?php
|
4645 |
+
}
|
4646 |
+
|
4647 |
+
/**
|
4648 |
+
* Loads the contents of the support menu item
|
4649 |
+
* @return string
|
4650 |
+
*/
|
4651 |
+
function wplc_support_menu() {
|
4652 |
+
wplc_stats("support");
|
4653 |
+
?>
|
4654 |
+
<h1><?php _e("WP Live Chat Support","wplivechat"); ?></h1>
|
4655 |
+
<div class="wplc_row">
|
4656 |
+
<div class='wplc_row_col' style='background-color:#FFF;'>
|
4657 |
+
<h2><i class="fa fa-book fa-2x"></i> <?php _e("Documentation","wplivechat"); ?></h2>
|
4658 |
+
<hr />
|
4659 |
+
<p><?php _e("Getting started? Read through some of these articles to help you along your way.","wplivechat"); ?></p>
|
4660 |
+
<p><strong><?php _e("Documentation:","wplivechat"); ?></strong></p>
|
4661 |
+
<ul>
|
4662 |
+
<li><a href='https://wp-livechat.com/documentation/minimum-system-requirements/' target='_BLANK' title='<?php _e("Minimum System Requirements","wplivechat"); ?>'><?php _e("Minimum System Requirements","wplivechat"); ?></a></li>
|
4663 |
+
<li><a href='https://wp-livechat.com/documentation/do-i-have-to-be-logged-into-the-dashboard-to-chat-with-visitors/' target='_BLANK' title='<?php _e("Do I have to be logged into the dashboard to chat with visitors?","wplivechat"); ?>'><?php _e("Do I have to be logged into the dashboard to chat with visitors?","wplivechat"); ?></a></li>
|
4664 |
+
<li><a href='https://wp-livechat.com/documentation/what-are-quick-responses/' target='_BLANK' title='<?php _e("What are Quick Responses?","wplivechat"); ?>'><?php _e("What are Quick Responses?","wplivechat"); ?></a></li>
|
4665 |
+
<li><a href='https://wp-livechat.com/documentation/troubleshooting/is-this-plugin-multi-site-friendly/' target='_BLANK' title='<?php _e("Can I use this plugin on my multi-site?","wplivechat"); ?>'><?php _e("Can I use this plugin on my multi-site?","wplivechat"); ?></a></li>
|
4666 |
+
<li><a href='https://wp-livechat.com/documentation/how-do-i-disable-apc-object-cache/' target='_BLANK' title='<?php _e("How do I disable APC Object Cache?","wplivechat"); ?>'><?php _e("How do I disable APC Object Cache?","wplivechat"); ?></a></li>
|
4667 |
+
<li><a href='https://wp-livechat.com/documentation/do-you-have-a-mobile-app/' target='_BLANK' title='<?php _e("Do you have a mobile app?","wplivechat"); ?>'><?php _e("Do you have a mobile app?","wplivechat"); ?></a></li>
|
4668 |
+
<li><a href='https://wp-livechat.com/documentation/how-do-i-check-for-javascript-errors-on-my-site/' target='_BLANK' title='<?php _e("How do I check for JavaScript errors on my site?","wplivechat"); ?>'><?php _e("How do I check for JavaScript errors on my site?","wplivechat"); ?></a></li>
|
4669 |
+
</ul>
|
4670 |
+
</div>
|
4671 |
+
<div class='wplc_row_col' style='background-color:#FFF;'>
|
4672 |
+
<h2><i class="fa fa-exclamation-circle fa-2x"></i> <?php _e("Troubleshooting","wplivechat"); ?></h2>
|
4673 |
+
<hr />
|
4674 |
+
<p><?php _e("WP Live Chat Support has a diverse and wide range of features which may, from time to time, run into conflicts with the thousands of themes and other plugins on the market.", "wplivechat"); ?></p>
|
4675 |
+
<p><strong><?php _e("Common issues:","wplivechat"); ?></strong></p>
|
4676 |
+
<ul>
|
4677 |
+
<li><a href='https://wp-livechat.com/documentation/troubleshooting/the-chat-box-doesnt-show-up/' target='_BLANK' title='<?php _e("The chat box doesnt show up","wplivechat"); ?>'><?php _e("The chat box doesnt show up","wplivechat"); ?></a></li>
|
4678 |
+
<li><a href='https://wp-livechat.com/documentation/the-chat-window-disappears-when-i-logout-or-go-offline/' target='_BLANK' title='<?php _e("The chat window disappears when I logout or go offline","wplivechat"); ?>'><?php _e("The chat window disappears when I logout or go offline","wplivechat"); ?></a></li>
|
4679 |
+
<li><a href='https://wp-livechat.com/this-chat-has-already-been-answered-please-close-the-chat-window/' target='_BLANK' title='<?php _e("This chat has already been answered. Please close the chat window","wplivechat"); ?>'><?php _e("This chat has already been answered. Please close the chat window","wplivechat"); ?></a></li>
|
4680 |
+
<li><a href='https://wp-livechat.com/messages-only-show-when-i-refresh-the-chat-window/' target='_BLANK' title='<?php _e("Messages only show when I refresh the chat window","wplivechat"); ?>'><?php _e("Messages only show when I refresh the chat window","wplivechat"); ?></a></li>
|
4681 |
+
<li><a href='https://wp-livechat.com/documentation/im-not-getting-any-notifications-of-a-new-chat/' target='_BLANK' title='<?php _e("I'm not getting any notifications of a new chat","wplivechat"); ?>'><?php _e("I'm not getting any notifications of a new chat","wplivechat"); ?></a></li>
|
4682 |
+
<li><a href='https://wp-livechat.com/the-chat-window-never-goes-offline/' target='_BLANK' title='<?php _e("The chat window never goes offline","wplivechat"); ?>'><?php _e("The chat window never goes offline","wplivechat"); ?></a></li>
|
4683 |
+
</ul>
|
4684 |
+
</div>
|
4685 |
+
<div class='wplc_row_col' style='background-color:#FFF;'>
|
4686 |
+
<h2><i class="fa fa-bullhorn fa-2x"></i> <?php _e("Support","wplivechat"); ?></h2>
|
4687 |
+
<hr />
|
4688 |
+
<p><?php _e("Still need help? Use one of these links below.","wplivechat"); ?></p>
|
4689 |
+
<ul>
|
4690 |
+
<li><a href='https://wp-livechat.com/support/' target='_BLANK' title='<?php _e("Support desk","wplivechat"); ?>'><?php _e("Support desk","wplivechat"); ?></a></li>
|
4691 |
+
<li><a href='https://wp-livechat.com/contact-us/' target='_BLANK' title='<?php _e("Contact us","wplivechat"); ?>'><?php _e("Contact us","wplivechat"); ?></a></li>
|
4692 |
+
</ul>
|
4693 |
+
</div>
|
4694 |
+
</div>
|
4695 |
+
<?php
|
4696 |
+
}
|
4697 |
+
if (!function_exists("wplc_ic_initiate_chat_button")) {
|
4698 |
+
add_action('admin_enqueue_scripts', 'wp_button_pointers_load_scripts');
|
4699 |
+
}
|
4700 |
+
/**
|
4701 |
+
* Displays the pointers on teh live chat dashboard for the initiate chat functionality
|
4702 |
+
* @param string $hook returns the page name we're on
|
4703 |
+
* @return string contents ofthe pointers and their scripts
|
4704 |
+
*/
|
4705 |
+
function wp_button_pointers_load_scripts($hook) {
|
4706 |
+
$wplcrun = false;
|
4707 |
+
global $wplc_version;
|
4708 |
+
|
4709 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
4710 |
+
if ( isset( $wplc_settings['wplc_enable_all_admin_pages'] ) && $wplc_settings['wplc_enable_all_admin_pages'] === '1' ) {
|
4711 |
+
/* Run admin JS on all admin pages */
|
4712 |
+
$wplcrun = true;
|
4713 |
+
|
4714 |
+
|
4715 |
+
} else {
|
4716 |
+
|
4717 |
+
if( $hook === 'toplevel_page_wplivechat-menu') { $wplcrun = true; } // stop if we are not on the right page
|
4718 |
+
}
|
4719 |
+
|
4720 |
+
|
4721 |
+
if ( $wplcrun ) {
|
4722 |
+
|
4723 |
+
|
4724 |
+
|
4725 |
+
|
4726 |
+
$pointer_localize_strings = array(
|
4727 |
+
"initiate" => "<h3>".__("Initiate Chats","wplivechat")."</h3><p>".__("With the Pro add-on of WP Live Chat Support, you can", "wplivechat")." <a href='http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=initiate1_pointer' title='".__("see who's online and initiate chats", "wplivechat")."' target=\"_BLANK\">".__("initiate chats", "wplivechat")."</a> ".__("with your online visitors with the click of a button.", "wplivechat")." <br /><br /><a href='http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=initiate2_pointer' title='".__("Buy the Pro add-on now (once off payment).", "wplivechat")."' target=\"_BLANK\"><strong>".__("Buy the Pro add-on now (once off payment).", "wplivechat")."</strong></a></p>",
|
4728 |
+
"chats" => "<h3>".__("Multiple Chats","wplivechat")."</h3><p>".__("With the Pro add-on of WP Live Chat Support, you can", "wplivechat")." <a href='http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=morechats1_pointer' title='".__("accept and handle multiple chats.", "wplivechat")."' target=\"_BLANK\">".__("accept and handle multiple chats.", "wplivechat")."</a><br /><br /><a href='http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=morechats2_pointer' title='".__("Buy the Pro add-on now (once off payment).", "wplivechat")."' target=\"_BLANK\"><strong>".__("Buy the Pro add-on now (once off payment).", "wplivechat")."</strong></a></p>",
|
4729 |
+
"agent_info" => "<h3>".__("Add unlimited agents","wplivechat")."</h3><p><a href='http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=unlimited_agents1_pointer' title='".__("Add unlimited agents", "wplivechat")."' target=\"_BLANK\">".__("Add unlimited agents", "wplivechat")."</a> ".__(" with the Pro add-on of WP Live Chat Support","wplivechat")." "."<a href='http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=unlimited_agents2_pointer' target='_BLANK'>".__("(once off payment).","wplivechat")."</a></p>",
|
4730 |
+
"transfer" => "<h3>".__("Transfer Chats","wplivechat")."</h3><p><a href='http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=transfer1_pointer' title='".__("Transfer Chats", "wplivechat")."' target=\"_BLANK\">".__("Transfer Chats", "wplivechat")."</a> ".__(" with the Pro add-on of WP Live Chat Support","wplivechat")." "."<a href='http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=transfer2_pointer' target='_BLANK'>".__("(once off payment).","wplivechat")."</a></p>",
|
4731 |
+
"direct_to_page" => "<h3>".__("Direct User To Page","wplivechat")."</h3><p><a href='http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=direct_to_page_1' title='".__("Transfer Chats", "wplivechat")."' target=\"_BLANK\">".__("Direct User To Page", "wplivechat")."</a> ".__(" with the Pro add-on of WP Live Chat Support","wplivechat")." "."<a href='http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=direct_to_page_2' target='_BLANK'>".__("(once off payment).","wplivechat")."</a></p>"
|
4732 |
+
);
|
4733 |
+
|
4734 |
+
|
4735 |
+
wp_enqueue_style( 'wp-pointer' );
|
4736 |
+
wp_enqueue_script( 'wp-pointer' );
|
4737 |
+
wp_register_script('wplc-user-admin-pointer', plugins_url('/js/wplc-admin-pointers.js', __FILE__), array('wp-pointer'), $wplc_version);
|
4738 |
+
wp_enqueue_script('wplc-user-admin-pointer');
|
4739 |
+
wp_localize_script('wplc-user-admin-pointer', 'pointer_localize_strings', $pointer_localize_strings);
|
4740 |
+
}
|
4741 |
+
|
4742 |
+
}
|
4743 |
+
|
4744 |
+
add_filter( 'admin_footer_text', 'wplc_footer_mod' );
|
4745 |
+
/**
|
4746 |
+
* Adds the WP Live Chat Support & CODECABIN_ footer contents to the relevant pages
|
4747 |
+
* @param string $footer_text current footer text available to us
|
4748 |
+
* @return string footer contents with our branding in it
|
4749 |
+
*/
|
4750 |
+
function wplc_footer_mod( $footer_text ) {
|
4751 |
+
if (isset($_GET['page']) && ($_GET['page'] == 'wplivechat-menu' || $_GET['page'] == 'wplivechat-menu-extensions-page' || $_GET['page'] == 'wplivechat-menu-settings' || $_GET['page'] == 'wplivechat-menu-offline-messages' || $_GET['page'] == 'wplivechat-menu-history')) {
|
4752 |
+
$footer_text_mod = sprintf( __( 'Thank you for using <a href="%1$s" target="_blank">WP Live Chat Support</a>! Please <a href="%2$s" target="_blank">rate us</a> on <a href="%2$s" target="_blank">WordPress.org</a>', 'wplivechat' ),
|
4753 |
+
'https://wp-livechat.com/?utm_source=plugin&utm_medium=link&utm_campaign=footer',
|
4754 |
+
'https://wordpress.org/support/view/plugin-reviews/wp-live-chat-support?filter=5#postform'
|
4755 |
+
);
|
4756 |
+
|
4757 |
+
return str_replace( '</span>', '', $footer_text ) . ' | ' . $footer_text_mod . ' | ' . __('WP Live Chat Support is a product of','wplivechat') . ' <a target="_BLANK" href="http://codecabin.co.za/?utm_source=livechat&utm_medium=link&utm_campaign=footer" border="0"><img src="'.plugins_url('/images/codecabin.png', __FILE__).'" style="height:10px;"/></span></a>';
|
4758 |
+
} else {
|
4759 |
+
return $footer_text;
|
4760 |
+
}
|
4761 |
+
|
4762 |
+
}
|
4763 |
+
|
4764 |
+
add_filter("wplc_filter_admin_long_poll_chat_loop_iteration","wplc_filter_control_wplc_admin_long_poll_chat_iteration", 1, 3);
|
4765 |
+
/**
|
4766 |
+
* Alters the admin's long poll chat iteration
|
4767 |
+
* @param array $array current chat data available to us
|
4768 |
+
* @param array $post_data current post data available to us
|
4769 |
+
* @param int $i count for each chat available
|
4770 |
+
* @return array additional contents added to the chat data
|
4771 |
+
*/
|
4772 |
+
function wplc_filter_control_wplc_admin_long_poll_chat_iteration($array,$post_data,$i) {
|
4773 |
+
if(isset($post_data['action_2']) && $post_data['action_2'] == "wplc_long_poll_check_user_opened_chat"){
|
4774 |
+
$chat_status = wplc_return_chat_status(sanitize_text_field($post_data['cid']));
|
4775 |
+
if(intval($chat_status) == 3){
|
4776 |
+
$array['action'] = "wplc_user_open_chat";
|
4777 |
+
}
|
4778 |
+
} else {
|
4779 |
+
|
4780 |
+
if ($post_data['first_run'] === "true") {
|
4781 |
+
/* get the chat messages for the first run */
|
4782 |
+
$array['chat_history'] = wplc_return_chat_messages($post_data['cid'], false, true, false, false, 'array', false);
|
4783 |
+
$array['action'] = "wplc_chat_history";
|
4784 |
+
|
4785 |
+
} else {
|
4786 |
+
|
4787 |
+
$new_chat_status = wplc_return_chat_status(sanitize_text_field($post_data['cid']));
|
4788 |
+
if($new_chat_status != $post_data['chat_status']){
|
4789 |
+
$array['chat_status'] = $new_chat_status;
|
4790 |
+
$array['action'] = "wplc_update_chat_status";
|
4791 |
+
}
|
4792 |
+
$new_chat_message = wplc_return_admin_chat_messages(sanitize_text_field($post_data['cid']));
|
4793 |
+
|
4794 |
+
if($new_chat_message){
|
4795 |
+
|
4796 |
+
$array['chat_message'] = $new_chat_message;
|
4797 |
+
$array['action'] = "wplc_new_chat_message";
|
4798 |
+
}
|
4799 |
+
}
|
4800 |
+
}
|
4801 |
+
|
4802 |
+
return $array;
|
4803 |
+
}
|
4804 |
+
|
4805 |
+
|
4806 |
+
add_action("wplc_hook_agents_settings","wplc_hook_control_agents_settings", 10);
|
4807 |
+
/**
|
4808 |
+
* Loads the contents of the chat agents in the settings page
|
4809 |
+
* @return string
|
4810 |
+
*/
|
4811 |
+
function wplc_hook_control_agents_settings() {
|
4812 |
+
$user_array = get_users(array(
|
4813 |
+
'meta_key' => 'wplc_ma_agent',
|
4814 |
+
));
|
4815 |
+
|
4816 |
+
echo "<h3>".__('Current Users that are Chat Agents', 'wplivechat')."</h3>";
|
4817 |
+
$wplc_agents = "<div class='wplc_agent_container'><ul>";
|
4818 |
+
|
4819 |
+
if ($user_array) {
|
4820 |
+
foreach ($user_array as $user) {
|
4821 |
+
|
4822 |
+
$wplc_agents .= "<li id=\"wplc_agent_li_".$user->ID."\">";
|
4823 |
+
$wplc_agents .= "<p><img src=\"//www.gravatar.com/avatar/" . md5($user->user_email) . "?s=80&d=mm\" /></p>";
|
4824 |
+
$check = get_user_meta($user->ID,"wplc_chat_agent_online");
|
4825 |
+
if ($check) {
|
4826 |
+
$wplc_agents .= "<span class='wplc_status_box wplc_type_returning'>".__("Online","wplivechat")."</span>";
|
4827 |
+
}
|
4828 |
+
$default_agent_id = $user->ID;
|
4829 |
+
$default_agent_user = $user->display_name;
|
4830 |
+
$wplc_agents .= "<h3>" . $user->display_name . "</h3>";
|
4831 |
+
|
4832 |
+
$wplc_agents .= "<small>" . $user->user_email . "</small>";
|
4833 |
+
|
4834 |
+
|
4835 |
+
|
4836 |
+
|
4837 |
+
$wplc_agents .= "</li>";
|
4838 |
+
}
|
4839 |
+
}
|
4840 |
+
echo $wplc_agents;
|
4841 |
+
$temp_line = "<select name='wplc_agent_select' id='wplc_agent_select'><option value=''>".__("Select","wplivechat")."</option>";
|
4842 |
+
|
4843 |
+
$blogusers = get_users( array( 'role' => 'administrator', 'fields' => array( 'display_name','id','user_email' ) ) );
|
4844 |
+
if ($blogusers) {
|
4845 |
+
foreach ( $blogusers as $user ) {
|
4846 |
+
$is_agent = get_user_meta(esc_html( $user->id ), 'wplc_ma_agent', true);
|
4847 |
+
$temp_line2 = '<option id="wplc_selected_agent_'. esc_html( $user->id ) .'" value="' . esc_html( $user->id ) . '">' . esc_html( $user->display_name ) . ' ('.__('Administrator','wplivechat').')</option>';
|
4848 |
+
if(!$is_agent){ $temp_line .= $temp_line2; }
|
4849 |
+
}
|
4850 |
+
}
|
4851 |
+
|
4852 |
+
$blogusers = get_users( array( 'role' => 'editor', 'fields' => array( 'display_name','id','user_email' ) ) );
|
4853 |
+
if ($blogusers) {
|
4854 |
+
foreach ( $blogusers as $user ) {
|
4855 |
+
$is_agent = get_user_meta(esc_html( $user->id ), 'wplc_ma_agent', true);
|
4856 |
+
$temp_line2 = '<option id="wplc_selected_agent_'. esc_html( $user->id ) .'" value="' . esc_html( $user->id ) . '">' . esc_html( $user->display_name ) . ' ('.__('Editor','wplivechat').')</option>';
|
4857 |
+
if(!$is_agent){ $temp_line .= $temp_line2; }
|
4858 |
+
}
|
4859 |
+
}
|
4860 |
+
|
4861 |
+
$blogusers = get_users( array( 'role' => 'author', 'fields' => array( 'display_name','id','user_email' ) ) );
|
4862 |
+
if ($blogusers) {
|
4863 |
+
foreach ( $blogusers as $user ) {
|
4864 |
+
$is_agent = get_user_meta(esc_html( $user->id ), 'wplc_ma_agent', true);
|
4865 |
+
$temp_line2 = '<option id="wplc_selected_agent_'. esc_html( $user->id ) .'" value="' . esc_html( $user->id ) . '">' . esc_html( $user->display_name ) . ' ('.__('Author','wplivechat').')</option>';
|
4866 |
+
if(!$is_agent){ $temp_line .= $temp_line2; }
|
4867 |
+
}
|
4868 |
+
}
|
4869 |
+
|
4870 |
+
$temp_line .= "</select> ";
|
4871 |
+
?>
|
4872 |
+
|
4873 |
+
|
4874 |
+
<li style='width:150px;' id='wplc_add_new_agent_box'>
|
4875 |
+
<p><i class='fa fa-plus-circle fa-4x' style='color:#ccc;' ></i></p>
|
4876 |
+
<h3><?php _e("Add New Agent","wplivechat"); ?></h3>
|
4877 |
+
<p><button class='button button-secondary' id='wplc_add_agent' disabled style=><?php _e("Add Agent","wplivechat"); ?></button></p>
|
4878 |
+
<p style='font-size:0.8em'><?php _e("Add as many agents as you need with the ","wplivechat") ?> <a href="https://wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=multipleAgents" target="_BLANK"><?php _e("Pro version.", "wplivechat") ?></a></p>
|
4879 |
+
</li>
|
4880 |
+
</ul>
|
4881 |
+
<?php
|
4882 |
+
$agent_text = sprintf( __( 'Change the default chat agent from <strong>%1$s</strong> to ', 'wplivechat' ),
|
4883 |
+
$default_agent_user
|
4884 |
+
|
4885 |
+
);
|
4886 |
+
echo $agent_text.$temp_line;
|
4887 |
+
?>
|
4888 |
+
|
4889 |
+
</div>
|
4890 |
+
|
4891 |
+
<hr/>
|
4892 |
+
<?php
|
4893 |
+
}
|
4894 |
+
|
4895 |
+
/**
|
4896 |
+
* Returns chat data specific to a chat ID
|
4897 |
+
* @param int $cid Chat ID
|
4898 |
+
* @param string $line Line number the function is called on
|
4899 |
+
* @return array Contents of the chat based on the ID provided
|
4900 |
+
*/
|
4901 |
+
function wplc_get_chat_data($cid,$line = false) {
|
4902 |
+
$result = apply_filters("wplc_filter_get_chat_data",null,$cid);
|
4903 |
+
return $result;
|
4904 |
+
}
|
4905 |
+
|
4906 |
+
add_filter( "wplc_filter_get_chat_data", "wplc_get_local_chat_data", 10, 2 );
|
4907 |
+
function wplc_get_local_chat_data($result, $cid) {
|
4908 |
+
global $wpdb;
|
4909 |
+
global $wplc_tblname_chats;
|
4910 |
+
|
4911 |
+
$sql = "SELECT * FROM $wplc_tblname_chats WHERE `id` = '".intval($cid)."' LIMIT 1";
|
4912 |
+
$results = $wpdb->get_results($sql);
|
4913 |
+
if (isset($results[0])) { $result = $results[0]; } else { $result = null; }
|
4914 |
+
|
4915 |
+
return $result;
|
4916 |
+
|
4917 |
+
}
|
4918 |
+
|
4919 |
+
/**
|
4920 |
+
* Returns chat messages specific to a chat ID
|
4921 |
+
* @param int $cid Chat ID
|
4922 |
+
* @return array Chat messages based on the ID provided
|
4923 |
+
*/
|
4924 |
+
function wplc_get_chat_messages($cid, $only_read_messages = false, $wplc_settings = false) {
|
4925 |
+
global $wpdb;
|
4926 |
+
global $wplc_tblname_msgs;
|
4927 |
+
|
4928 |
+
if (!$wplc_settings) {
|
4929 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
4930 |
+
}
|
4931 |
+
|
4932 |
+
/**
|
4933 |
+
* Identify if the user is using the node server and if they are, display all messages. Otherwise display read only messages (non-node users)
|
4934 |
+
*/
|
4935 |
+
if (isset($wplc_settings['wplc_use_node_server']) && $wplc_settings['wplc_use_node_server'] == '1') {
|
4936 |
+
|
4937 |
+
$sql = "
|
4938 |
+
SELECT * FROM (
|
4939 |
+
SELECT *
|
4940 |
+
FROM $wplc_tblname_msgs
|
4941 |
+
WHERE `chat_sess_id` = '$cid'
|
4942 |
+
ORDER BY `timestamp` DESC LIMIT 100
|
4943 |
+
) sub
|
4944 |
+
ORDER BY `timestamp` ASC
|
4945 |
+
";
|
4946 |
+
} else {
|
4947 |
+
if ($only_read_messages) {
|
4948 |
+
// only show read messages
|
4949 |
+
$sql =
|
4950 |
+
"
|
4951 |
+
SELECT * FROM (
|
4952 |
+
SELECT *
|
4953 |
+
FROM $wplc_tblname_msgs
|
4954 |
+
WHERE `chat_sess_id` = '$cid' AND `status` = 1
|
4955 |
+
ORDER BY `timestamp` DESC LIMIT 100
|
4956 |
+
) sub
|
4957 |
+
ORDER BY `timestamp` ASC
|
4958 |
+
";
|
4959 |
+
} else {
|
4960 |
+
$sql =
|
4961 |
+
"
|
4962 |
+
SELECT * FROM (
|
4963 |
+
SELECT *
|
4964 |
+
FROM $wplc_tblname_msgs
|
4965 |
+
WHERE `chat_sess_id` = '$cid'
|
4966 |
+
ORDER BY `timestamp` DESC LIMIT 100
|
4967 |
+
) sub
|
4968 |
+
ORDER BY `timestamp` ASC
|
4969 |
+
";
|
4970 |
+
}
|
4971 |
+
|
4972 |
+
}
|
4973 |
+
$results = $wpdb->get_results($sql);
|
4974 |
+
|
4975 |
+
if (isset($results[0])) { } else { $results = null; }
|
4976 |
+
$results = apply_filters("wplc_filter_get_chat_messages",$results,$cid);
|
4977 |
+
|
4978 |
+
if ($results == "null") {
|
4979 |
+
return false;
|
4980 |
+
} else {
|
4981 |
+
return $results;
|
4982 |
+
}
|
4983 |
+
}
|
4984 |
+
|
4985 |
+
/**
|
4986 |
+
* Validates extension API keys
|
4987 |
+
* @param string $page_content Current page contents in the extensions page
|
4988 |
+
* @param array $data Extension data such as name and slug
|
4989 |
+
* @return string Updated extensions page contents
|
4990 |
+
*/
|
4991 |
+
function wplc_build_api_check($page_content, $data) {
|
4992 |
+
$link = "#";
|
4993 |
+
$image = "https://ccplugins.co/api-wplc-extensions/images/add-on0.jpg";
|
4994 |
+
if ($data['string'] == "Multiple Agents") {
|
4995 |
+
$link = "";
|
4996 |
+
$image = "https://ccplugins.co/api-wplc-extensions/images/Agents-Small.jpg";
|
4997 |
+
}
|
4998 |
+
if ($data['string'] == "Cloud Server") {
|
4999 |
+
$link = "";
|
5000 |
+
$image = "https://ccplugins.co/api-wplc-extensions/images/Cloud-Small.jpg";
|
5001 |
+
}
|
5002 |
+
if ($data['string'] == "Advanced Chat Box Control") {
|
5003 |
+
$link = "https://wp-livechat.com/extensions/advanced-chat-control/";
|
5004 |
+
$image = "https://ccplugins.co/api-wplc-extensions/images/AdvancedChatBox-Small.jpg";
|
5005 |
+
}
|
5006 |
+
if ($data['string'] == "Choose When Online") {
|
5007 |
+
$link = "";
|
5008 |
+
$image = "https://ccplugins.co/api-wplc-extensions/images/ChooseOnline-Small.jpg";
|
5009 |
+
}
|
5010 |
+
if ($data['string'] == "Encryption") {
|
5011 |
+
$link = "";
|
5012 |
+
$image = "https://ccplugins.co/api-wplc-extensions/images/Encryption-Small.jpg";
|
5013 |
+
}
|
5014 |
+
if ($data['string'] == "Mobile and Desktop App") {
|
5015 |
+
$link = "";
|
5016 |
+
$image = "https://ccplugins.co/api-wplc-extensions/images/MobileDesktop-Small.jpg";
|
5017 |
+
}
|
5018 |
+
if ($data['string'] == "Initiate Chats") {
|
5019 |
+
$link = "";
|
5020 |
+
$image = "https://ccplugins.co/api-wplc-extensions/images/InitiateChat-Small.jpg";
|
5021 |
+
}
|
5022 |
+
if ($data['string'] == "Include Exclude Pages") {
|
5023 |
+
$link = "";
|
5024 |
+
$image = "https://ccplugins.co/api-wplc-extensions/images/IncludeAndExclude-Small.jpg";
|
5025 |
+
}
|
5026 |
+
|
5027 |
+
|
5028 |
+
if ($data['string'] == "WP Live Chat Support Pro") {
|
5029 |
+
$link = "";
|
5030 |
+
$image = "https://ccplugins.co/api-wplc-extensions/images/add-on0.jpg";
|
5031 |
+
}
|
5032 |
+
|
5033 |
+
|
5034 |
+
$page_content .= '<div class="wplc-extension" style="height:480px;">';
|
5035 |
+
$page_content .= '<a href="'.$link.'" title="'.$data['string'].'" target="_BLANK" style=" text-decoration:none;"><h3 class="wplc-extension-title" style="text-decoration:none;">'.$data['string'].'</h3></a>';
|
5036 |
+
$page_content .= '<img width="320" height="200" src="'.$image.'" alt="'.$data['string'].'" title="'.$data['string'].'">';
|
5037 |
+
$page_content .= '<p>'.__('API Key','wplivechat').'<br />';
|
5038 |
+
$page_content .= " <form name='".$data['form_name']."' action='' method='POST'>";
|
5039 |
+
$page_content .= " <input type='text' name='".$data['option_name']."' id='".$data['option_name']."' value='".get_option($data['option_name'])."' style='width: 250px;'/>";
|
5040 |
+
$page_content .= " <input type='submit' name='".$data['button']."' id='".$data['button']."' value='".__("Verify","wplivechat")."' />";
|
5041 |
+
$page_content .= " </form>";
|
5042 |
+
$page_content .= '</p>';
|
5043 |
+
$page_content .= '<p>'.__('Status: ','wplivechat');
|
5044 |
+
if (isset($data['data']['status']) && $data['data']['status'] == "OK") {
|
5045 |
+
update_option($data['is_valid'], 1);
|
5046 |
+
$page_content .= "<span style='color: white; font-weight: bold; background-color: green; border-radius: 5px; padding: 3px;'>". __('Valid', 'wplivechat') . '</span>';
|
5047 |
+
$page_content .= '<a href="https://wp-livechat.com/my-account/" title="'.__('Manage this extension','wplivechat').'" class="button-secondary" target="_BLANK">'.__('Manage this extension','wplivechat').'</a>';
|
5048 |
+
} else {
|
5049 |
+
update_option($data['is_valid'], 0);
|
5050 |
+
$page_content .= "<span style='color: white; font-weight: bold; background-color: red; border-radius: 5px; padding: 3px;'>" . __('Invalid', 'wplivechat') . '</span>';
|
5051 |
+
$page_content .= '<a href="https://wp-livechat.com/my-account/" title="'.__('Manage this extension','wplivechat').'" class="button-secondary" target="_BLANK">'.__('Manage this extension','wplivechat').'</a>';
|
5052 |
+
}
|
5053 |
+
$page_content .= '</p>';
|
5054 |
+
$page_content .= '<div style="dispaly:block; width:100%; height:100px; overflow:auto;">';
|
5055 |
+
if (isset($data['data']['domains']) && !empty($data['data']['domains'])) {
|
5056 |
+
$page_content .= '<span><strong>'.__("Linked Domains","wplivechat").'</strong></span><ol>';
|
5057 |
+
foreach ($data['data']['domains'] as $domain) {
|
5058 |
+
$page_content .= '<li>'.$domain.'</li>';
|
5059 |
+
}
|
5060 |
+
$page_content .= '</ol>';
|
5061 |
+
} else {
|
5062 |
+
$page_content .= ' <span>'.$data['data']['message'].'</span>';
|
5063 |
+
|
5064 |
+
}
|
5065 |
+
$page_content .= '</div>';
|
5066 |
+
|
5067 |
+
$page_content .= '</div>';
|
5068 |
+
|
5069 |
+
|
5070 |
+
|
5071 |
+
|
5072 |
+
return $page_content;
|
5073 |
+
}
|
5074 |
+
|
5075 |
+
|
5076 |
+
|
5077 |
+
add_filter("wplc_filter_relevant_extensions_main","wplc_filter_control_relevant_extensions_main_proe");
|
5078 |
+
/**
|
5079 |
+
* Loads additional extension data for the Pro version
|
5080 |
+
* @param string $text Current extensions page content
|
5081 |
+
* @return string Extensions page content with Pro version extension data
|
5082 |
+
*/
|
5083 |
+
function wplc_filter_control_relevant_extensions_main_proe($text) {
|
5084 |
+
if (function_exists("wplc_hook_control_intiate_check")) { return $text; }
|
5085 |
+
|
5086 |
+
$rel_name = __("Pro Add-on","wplivechat");
|
5087 |
+
$rel_image = "https://ccplugins.co/api-wplc-extensions/images/add-on0.jpg";
|
5088 |
+
$rel_link = "http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=relevant_pro";
|
5089 |
+
$text .= '<div class="wplc-extension relevant_extension">';
|
5090 |
+
$text .= '<a href="'.$rel_link.'" title="'.$rel_name.'" target="_BLANK" style="float:left;">';
|
5091 |
+
$text .= '<img src="'.$rel_image.'" class="attachment-showcase wp-post-image" alt="'.$rel_name.'" title="'.$rel_name.'" >';
|
5092 |
+
$text .= '</a>';
|
5093 |
+
$text .= '<div class="float:left; padding-left:10px;">';
|
5094 |
+
$text .= '<h3 class="wplc-extension-title">'.$rel_name.'</h3>';
|
5095 |
+
$text .= '<p>'.__("Get unlimited agents, initiate chats, advanced chat box control, encryption and more with the Pro add-on.","wplivechat").'</p>';
|
5096 |
+
$text .= '</div>';
|
5097 |
+
$text .= '<a href="'.$rel_link.'" title="'.$rel_name.'" class="button-secondary" target="_BLANK">'.__("Get this extension","wplivechat").'</a>';
|
5098 |
+
$text .= '</div>';
|
5099 |
+
|
5100 |
+
return $text;
|
5101 |
+
}
|
5102 |
+
|
5103 |
+
|
5104 |
+
add_filter("wplc_filter_relevant_extensions_main","wplc_filter_control_relevant_extensions_main_mobile");
|
5105 |
+
/**
|
5106 |
+
* Loads additional extension data for the Mobile & Desktop App Extension
|
5107 |
+
* @param string $text Current extensions page content
|
5108 |
+
* @return string Extensions page content with Mobile & Desktop App extension data
|
5109 |
+
*/
|
5110 |
+
function wplc_filter_control_relevant_extensions_main_mobile($text) {
|
5111 |
+
if (function_exists("wplc_mobile_check_if_logged_in")) { return $text; }
|
5112 |
+
|
5113 |
+
$rel_name = __("Mobile & Desktop App","wplivechat");
|
5114 |
+
$rel_image = "https://ccplugins.co/api-wplc-extensions/images/MobileDesktop-Icon.jpg";
|
5115 |
+
$rel_link = "https://wp-livechat.com/extensions/mobile-desktop-app-extension/?utm_source=plugin&utm_medium=link&utm_campaign=relevant_mobile";
|
5116 |
+
$text .= '<div class="wplc-extension relevant_extension">';
|
5117 |
+
$text .= '<a href="'.$rel_link.'" title="'.$rel_name.'" target="_BLANK" style="float:left;">';
|
5118 |
+
$text .= '<img src="'.$rel_image.'" class="attachment-showcase wp-post-image" alt="'.$rel_name.'" title="'.$rel_name.'" >';
|
5119 |
+
$text .= '</a>';
|
5120 |
+
$text .= '<div class="float:left; padding-left:10px;">';
|
5121 |
+
$text .= '<h3 class="wplc-extension-title">'.$rel_name.'</h3>';
|
5122 |
+
$text .= '<p>'.__("Answer chats directly from your mobile phone or desktop with our mobile app and desktop client","wplivechat").'</p>';
|
5123 |
+
$text .= '</div>';
|
5124 |
+
$text .= '<a href="'.$rel_link.'" title="'.$rel_name.'" class="button-secondary" target="_BLANK">'.__("Get this extension","wplivechat").'</a>';
|
5125 |
+
$text .= '</div>';
|
5126 |
+
|
5127 |
+
return $text;
|
5128 |
+
}
|
5129 |
+
|
5130 |
+
|
5131 |
+
add_filter("wplc_filter_relevant_extensions_chatbox","wplc_filter_control_relevant_extensions_chatbox_proe");
|
5132 |
+
/**
|
5133 |
+
* Loads additional extension data for the Pro version - alternative option
|
5134 |
+
* @param string $text Current extensions page content
|
5135 |
+
* @return string Extensions page content with Pro version extension data
|
5136 |
+
*/
|
5137 |
+
function wplc_filter_control_relevant_extensions_chatbox_proe($text) {
|
5138 |
+
if (function_exists("wplc_hook_control_intiate_check")) { return $text; }
|
5139 |
+
|
5140 |
+
$rel_name = __("Pro Add-on","wplivechat");
|
5141 |
+
$rel_image = "https://ccplugins.co/api-wplc-extensions/images/add-on0.jpg";
|
5142 |
+
$rel_link = "http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=relevant_pro_chatbox";
|
5143 |
+
$text .= '<div class="wplc-extension relevant_extension">';
|
5144 |
+
$text .= '<a href="'.$rel_link.'" title="'.$rel_name.'" target="_BLANK" style="float:left;">';
|
5145 |
+
$text .= '<img src="'.$rel_image.'" class="attachment-showcase wp-post-image" alt="'.$rel_name.'" title="'.$rel_name.'" >';
|
5146 |
+
$text .= '</a>';
|
5147 |
+
$text .= '<div class="float:left; padding-left:10px;">';
|
5148 |
+
$text .= '<h3 class="wplc-extension-title">'.$rel_name.'</h3>';
|
5149 |
+
$text .= '<p>'.__("Get unlimited agents, initiate chats, advanced chat box control, encryption and more with the Pro add-on.","wplivechat").'</p>';
|
5150 |
+
$text .= '</div>';
|
5151 |
+
$text .= '<a href="'.$rel_link.'" title="'.$rel_name.'" class="button-secondary" target="_BLANK">'.__("Get this extension","wplivechat").'</a>';
|
5152 |
+
$text .= '</div>';
|
5153 |
+
|
5154 |
+
return $text;
|
5155 |
+
}
|
5156 |
+
|
5157 |
+
/**
|
5158 |
+
* Add to the chat box settings page
|
5159 |
+
* @return void
|
5160 |
+
* @since 1.0.00
|
5161 |
+
* @author Nick Duncan <nick@codecabin.co.za>
|
5162 |
+
*/
|
5163 |
+
add_action('wplc_hook_admin_settings_chat_box_settings_after','wplc_hook_control_settings_page_relevant_extensions_acbc',9);
|
5164 |
+
function wplc_hook_control_settings_page_relevant_extensions_acbc() {
|
5165 |
+
$check = apply_filters("wplc_filter_relevant_extensions_chatbox","");
|
5166 |
+
if ($check != "") {
|
5167 |
+
echo "<hr />";
|
5168 |
+
echo "<div style='padding:1%; width:98%; display:block; overflow:auto;'>";
|
5169 |
+
echo "<div class='display:block; font-weight:bold;'><strong>".__("Relevant Extensions",'wplivechat')."</strong><br /><br /></div>";
|
5170 |
+
echo "";
|
5171 |
+
echo $check;
|
5172 |
+
echo "";
|
5173 |
+
echo "";
|
5174 |
+
echo "</div>";
|
5175 |
+
}
|
5176 |
+
}
|
5177 |
+
|
5178 |
+
/**
|
5179 |
+
* Add to the chat box settings page
|
5180 |
+
* @return void
|
5181 |
+
* @since 1.0.00
|
5182 |
+
* @author Nick Duncan <nick@codecabin.co.za>
|
5183 |
+
*/
|
5184 |
+
add_action('wplc_hook_admin_settings_main_settings_after','wplc_hook_control_settings_page_relevant_extensions_main',9);
|
5185 |
+
function wplc_hook_control_settings_page_relevant_extensions_main() {
|
5186 |
+
$check = apply_filters("wplc_filter_relevant_extensions_main","");
|
5187 |
+
if ($check != "") {
|
5188 |
+
echo "<hr />";
|
5189 |
+
echo "<div style='padding:1%; width:98%; display:block; overflow:auto;'>";
|
5190 |
+
echo "<div class='display:block; font-weight:bold;'><strong>".__("Relevant Extensions",'wplivechat')."</strong><br /><br /></div>";
|
5191 |
+
echo "";
|
5192 |
+
echo $check;
|
5193 |
+
echo "";
|
5194 |
+
echo "";
|
5195 |
+
echo "</div>";
|
5196 |
+
}
|
5197 |
+
}
|
5198 |
+
|
5199 |
+
|
5200 |
+
|
5201 |
+
add_filter("wplc_filter_hovercard_bottom_before","wplc_filter_control_hovercard_bottom_before_pro",5,1);
|
5202 |
+
/**
|
5203 |
+
* Adds a powered by link to the hovercard
|
5204 |
+
* @param string $content current chat content of the hover card
|
5205 |
+
* @return string chat content with the powered by link
|
5206 |
+
* @deprecated 7.0.0 rebuilt unknowingly
|
5207 |
+
*/
|
5208 |
+
function wplc_filter_control_hovercard_bottom_before_pro($content) {
|
5209 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
5210 |
+
if(isset($wplc_settings["wplc_powered_by_link"]) && $wplc_settings["wplc_powered_by_link"] == 0){
|
5211 |
+
|
5212 |
+
} else if(!isset($wplc_settings["wplc_powered_by_link"])) {
|
5213 |
+
|
5214 |
+
} else{
|
5215 |
+
$content .= "<a title='".__("Powered By WP Live Chat Support", "wplivechat")."' target='_blank' rel='nofollow' href='https://wp-livechat.com/?utm_source=poweredby&utm_medium=click&utm_campaign=".esc_html(site_url())."' class='wplc_powered_by_link'>".__("Powered By WP Live Chat Support", "wplivechat")."</a>";
|
5216 |
+
}
|
5217 |
+
return $content;
|
5218 |
+
}
|
5219 |
+
|
5220 |
+
|
5221 |
+
|
5222 |
+
add_action('admin_init', 'wplc_admin_download_new_chat_history');
|
5223 |
+
/**
|
5224 |
+
* Downloads the chat history and adds it to a CSV file
|
5225 |
+
* @return file
|
5226 |
+
*/
|
5227 |
+
function wplc_admin_download_new_chat_history(){
|
5228 |
+
if(!is_user_logged_in() || !get_user_meta(get_current_user_id(), 'wplc_ma_agent', true) ){
|
5229 |
+
return;
|
5230 |
+
}
|
5231 |
+
|
5232 |
+
if (isset($_GET['action']) && $_GET['action'] == "download_history") {
|
5233 |
+
|
5234 |
+
global $wpdb;
|
5235 |
+
|
5236 |
+
$chat_id = sanitize_text_field( $_GET['cid'] );
|
5237 |
+
$fileName = 'live_chat_history_'.$chat_id.'.csv';
|
5238 |
+
|
5239 |
+
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
|
5240 |
+
header('Content-Description: File Transfer');
|
5241 |
+
header("Content-type: text/csv");
|
5242 |
+
header("Content-Disposition: attachment; filename={$fileName}");
|
5243 |
+
header("Expires: 0");
|
5244 |
+
header("Pragma: public");
|
5245 |
+
|
5246 |
+
$fh = @fopen( 'php://output', 'w' );
|
5247 |
+
|
5248 |
+
global $wpdb;
|
5249 |
+
global $wplc_tblname_msgs;
|
5250 |
+
|
5251 |
+
$results = $wpdb->get_results(
|
5252 |
+
"
|
5253 |
+
SELECT *
|
5254 |
+
FROM $wplc_tblname_msgs
|
5255 |
+
WHERE `chat_sess_id` = '$chat_id'
|
5256 |
+
ORDER BY `timestamp` ASC
|
5257 |
+
LIMIT 0, 100
|
5258 |
+
"
|
5259 |
+
);
|
5260 |
+
|
5261 |
+
$fields[] = array(
|
5262 |
+
'id' => __('Chat ID', 'wplivechat'),
|
5263 |
+
'msgfrom' => __('From', 'wplivechat'),
|
5264 |
+
'msg' => __('Message', 'wplivechat'),
|
5265 |
+
'time' => __('Timestamp', 'wplivechat'),
|
5266 |
+
'orig' => __('Origin', 'wplivechat'),
|
5267 |
+
);
|
5268 |
+
|
5269 |
+
foreach ($results as $result => $key) {
|
5270 |
+
if($key->originates == 2){
|
5271 |
+
$user = __('user', 'wplivechat');
|
5272 |
+
} else {
|
5273 |
+
$user = __('agent', 'wplivechat');
|
5274 |
+
}
|
5275 |
+
|
5276 |
+
$fields[] = array(
|
5277 |
+
'id' => $key->chat_sess_id,
|
5278 |
+
'msgfrom' => $key->msgfrom,
|
5279 |
+
'msg' => apply_filters("wplc_filter_message_control_out",$key->msg),
|
5280 |
+
'time' => $key->timestamp,
|
5281 |
+
'orig' => $user,
|
5282 |
+
);
|
5283 |
+
}
|
5284 |
+
|
5285 |
+
foreach($fields as $field){
|
5286 |
+
fputcsv($fh, $field, ",", '"');
|
5287 |
+
}
|
5288 |
+
// Close the file
|
5289 |
+
fclose($fh);
|
5290 |
+
// Make sure nothing else is sent, our file is done
|
5291 |
+
exit;
|
5292 |
+
|
5293 |
+
}
|
5294 |
+
}
|
5295 |
+
/**
|
5296 |
+
* Retrieves the data to start downloadling the chat history
|
5297 |
+
* @param string $type Chat history output type
|
5298 |
+
* @param string $cid Chat ID
|
5299 |
+
* @return void
|
5300 |
+
*/
|
5301 |
+
function wplc_admin_download_history($type, $cid){
|
5302 |
+
if(!is_user_logged_in() || !get_user_meta(get_current_user_id(), 'wplc_ma_agent', true) ){
|
5303 |
+
return;
|
5304 |
+
}
|
5305 |
+
|
5306 |
+
global $wpdb;
|
5307 |
+
global $wplc_tblname_msgs;
|
5308 |
+
|
5309 |
+
$results = $wpdb->get_results(
|
5310 |
+
"
|
5311 |
+
SELECT *
|
5312 |
+
FROM $wplc_tblname_msgs
|
5313 |
+
WHERE `chat_sess_id` = '$cid'
|
5314 |
+
ORDER BY `timestamp` ASC
|
5315 |
+
LIMIT 0, 100
|
5316 |
+
"
|
5317 |
+
);
|
5318 |
+
|
5319 |
+
$fields[] = array(
|
5320 |
+
'id' => __('Chat ID', 'wplivechat'),
|
5321 |
+
'msgfrom' => __('From', 'wplivechat'),
|
5322 |
+
'msg' => __('Message', 'wplivechat'),
|
5323 |
+
'time' => __('Timestamp', 'wplivechat'),
|
5324 |
+
'orig' => __('Origin', 'wplivechat'),
|
5325 |
+
);
|
5326 |
+
|
5327 |
+
foreach ($results as $result => $key) {
|
5328 |
+
if($key->originates == 2){
|
5329 |
+
$user = __('user', 'wplivechat');
|
5330 |
+
} else {
|
5331 |
+
$user = __('agent', 'wplivechat');
|
5332 |
+
}
|
5333 |
+
|
5334 |
+
$fields[] = array(
|
5335 |
+
'id' => $key->chat_sess_id,
|
5336 |
+
'msgfrom' => $key->msgfrom,
|
5337 |
+
'msg' => apply_filters("wplc_filter_message_control_out",$key->msg),
|
5338 |
+
'time' => $key->timestamp,
|
5339 |
+
'orig' => $user,
|
5340 |
+
);
|
5341 |
+
}
|
5342 |
+
|
5343 |
+
ob_end_clean();
|
5344 |
+
|
5345 |
+
wplc_convert_to_csv_new($fields, 'live_chat_history_'.$cid.'.csv', ',');
|
5346 |
+
|
5347 |
+
exit();
|
5348 |
+
}
|
5349 |
+
|
5350 |
+
/**
|
5351 |
+
* Converts contents into a CSV file
|
5352 |
+
* @param string $in Contents of file
|
5353 |
+
* @param string $out Output of file
|
5354 |
+
* @param string $del Delimiter for content
|
5355 |
+
* @return void
|
5356 |
+
*/
|
5357 |
+
function wplc_convert_to_csv_new($in, $out, $del){
|
5358 |
+
|
5359 |
+
$f = fopen('php://memory', 'w');
|
5360 |
+
|
5361 |
+
foreach ($in as $line) {
|
5362 |
+
wplc_fputcsv_eol_new($f, $line, $del, "\r\n");
|
5363 |
+
}
|
5364 |
+
|
5365 |
+
fseek($f, 0);
|
5366 |
+
|
5367 |
+
header('Content-Type: application/csv');
|
5368 |
+
|
5369 |
+
header('Content-Disposition: attachement; filename="' . $out . '";');
|
5370 |
+
|
5371 |
+
fpassthru($f);
|
5372 |
+
}
|
5373 |
+
/**
|
5374 |
+
* Parses content to add to a CSV file
|
5375 |
+
* @param string $fp The open file
|
5376 |
+
* @param string $array The content to be added to the file
|
5377 |
+
* @param string $del Delimiter to use in the file
|
5378 |
+
* @param string $eol Content to be written to the file
|
5379 |
+
* @return void
|
5380 |
+
*/
|
5381 |
+
function wplc_fputcsv_eol_new($fp, $array, $del, $eol) {
|
5382 |
+
fputcsv($fp, $array,$del);
|
5383 |
+
if("\n\r" != $eol && 0 === fseek($fp, -1, SEEK_CUR)) {
|
5384 |
+
fwrite($fp, $eol);
|
5385 |
+
}
|
5386 |
+
}
|
5387 |
+
|
5388 |
+
/**
|
5389 |
+
* Adds an API key notice in the plugin's page
|
5390 |
+
* @return string
|
5391 |
+
*/
|
5392 |
+
function wplc_plugin_row_invalid_api() {
|
5393 |
+
echo '<tr class="active"><td> </td><td colspan="2" style="color:red;">
|
5394 |
+
'.__('Your API Key is Invalid. You are not eligible for future updates. Please enter your API key <a href="admin.php?page=wplivechat-menu-api-keys-page">here</a>.','wplivechat').'
|
5395 |
+
</td></tr>';
|
5396 |
+
}
|
5397 |
+
|
5398 |
+
/**
|
5399 |
+
* Hides the chat when offline
|
5400 |
+
* @return int Incremented number if any agents have logged in
|
5401 |
+
*/
|
5402 |
+
function wplc_basic_hide_chat_when_offline(){
|
5403 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
5404 |
+
|
5405 |
+
$hide_chat = 0;
|
5406 |
+
if (isset($wplc_settings['wplc_hide_when_offline']) && $wplc_settings['wplc_hide_when_offline'] == 1) {
|
5407 |
+
/* Hide the window when its offline */
|
5408 |
+
$logged_in = apply_filters("wplc_loggedin_filter",false);
|
5409 |
+
if (!$logged_in) {
|
5410 |
+
$hide_chat++;
|
5411 |
+
}
|
5412 |
+
} else {
|
5413 |
+
$hide_chat = 0;
|
5414 |
+
}
|
5415 |
+
return $hide_chat;
|
5416 |
+
}
|
5417 |
+
|
5418 |
+
/**
|
5419 |
+
* Checks all strings that are added to the chat window
|
5420 |
+
* @return void
|
5421 |
+
*/
|
5422 |
+
function wplc_string_check() {
|
5423 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
5424 |
+
|
5425 |
+
if (!isset($wplc_settings['wplc_pro_na'])) { $wplc_settings["wplc_pro_na"] = __("Chat offline. Leave a message", "wplivechat"); }
|
5426 |
+
if (!isset($wplc_settings['wplc_pro_intro'])) { $wplc_settings["wplc_pro_intro"] = __("Hello. Please input your details so that I may help you.", "wplivechat"); }
|
5427 |
+
if (!isset($wplc_settings['wplc_pro_offline1'])) { $wplc_settings["wplc_pro_offline1"] = __("We are currently offline. Please leave a message and we'll get back to you shortly.", "wplivechat"); }
|
5428 |
+
if (!isset($wplc_settings['wplc_pro_offline2'])) { $wplc_settings["wplc_pro_offline2"] = __("Sending message...", "wplivechat"); }
|
5429 |
+
if (!isset($wplc_settings['wplc_pro_offline3'])) { $wplc_settings["wplc_pro_offline3"] = __("Thank you for your message. We will be in contact soon.", "wplivechat"); }
|
5430 |
+
if (!isset($wplc_settings['wplc_pro_offline_btn']) || (isset($wplc_settings['wplc_pro_offline_btn']) && $wplc_settings['wplc_pro_offline_btn'] == "")) { $wplc_settings["wplc_pro_offline_btn"] = __("Leave a message", "wplivechat"); }
|
5431 |
+
if (!isset($wplc_settings['wplc_pro_offline_btn_send']) || (isset($wplc_settings['wplc_pro_offline_btn_send']) && $wplc_settings['wplc_pro_offline_btn_send'] == "")) { $wplc_settings["wplc_pro_offline_btn_send"] = __("Send message", "wplivechat"); }
|
5432 |
+
if (!isset($wplc_settings['wplc_pro_fst1'])) { $wplc_settings["wplc_pro_fst1"] = __("Questions?", "wplivechat"); }
|
5433 |
+
if (!isset($wplc_settings['wplc_pro_fst2'])) { $wplc_settings["wplc_pro_fst2"] = __("Chat with us", "wplivechat"); }
|
5434 |
+
if (!isset($wplc_settings['wplc_pro_fst3'])) { $wplc_settings["wplc_pro_fst3"] = __("Start live chat", "wplivechat"); }
|
5435 |
+
if (!isset($wplc_settings['wplc_pro_sst1'])) { $wplc_settings["wplc_pro_sst1"] = __("Start Chat", "wplivechat"); }
|
5436 |
+
if (!isset($wplc_settings['wplc_pro_sst1_survey'])) { $wplc_settings["wplc_pro_sst1_survey"] = __("Or chat to an agent now", "wplivechat"); }
|
5437 |
+
if (!isset($wplc_settings['wplc_pro_sst1e_survey'])) { $wplc_settings["wplc_pro_sst1e_survey"] = __("Chat ended", "wplivechat"); }
|
5438 |
+
if (!isset($wplc_settings['wplc_pro_sst2'])) { $wplc_settings["wplc_pro_sst2"] = __("Connecting. Please be patient...", "wplivechat"); }
|
5439 |
+
if (!isset($wplc_settings['wplc_pro_tst1'])) { $wplc_settings["wplc_pro_tst1"] = __("Reactivating your previous chat...", "wplivechat"); }
|
5440 |
+
if (!isset($wplc_settings['wplc_user_welcome_chat'])) { $wplc_settings["wplc_user_welcome_chat"] = __("Welcome. How may I help you?", "wplivechat"); }
|
5441 |
+
if (!isset($wplc_settings['wplc_welcome_msg'])) { $wplc_settings['wplc_welcome_msg'] = __("Please standby for an agent. While you wait for the agent you may type your message.","wplivechat"); }
|
5442 |
+
if (!isset($wplc_settings['wplc_user_enter'])) { $wplc_settings["wplc_user_enter"] = __("Press ENTER to send your message", "wplivechat"); }
|
5443 |
+
if (!isset($wplc_settings['wplc_close_btn_text'])) { $wplc_settings["wplc_close_btn_text"] = __("close", "wplivechat"); }
|
5444 |
+
|
5445 |
+
update_option("WPLC_SETTINGS",$wplc_settings);
|
5446 |
+
|
5447 |
+
}
|
5448 |
+
|
5449 |
+
add_filter("wplc_filter_chat_text_editor_upsell","nifty_text_edit_upsell",1,1);
|
5450 |
+
/**
|
5451 |
+
* Used to upsell the advanced text editor in the chat
|
5452 |
+
* @param string $msg Current text in the chat window
|
5453 |
+
* @return string Additional content added for upselling purposes
|
5454 |
+
*/
|
5455 |
+
function nifty_text_edit_upsell($msg){
|
5456 |
+
if(!function_exists("nifty_text_edit_div") && !function_exists("wplc_pro_activate")){
|
5457 |
+
//Only show this if in admin area and is not PRO
|
5458 |
+
$msg .= "<div id='nifty_text_editor_holder' class='wplc_faded_upsell'>";
|
5459 |
+
$msg .= "<i class='nifty_tedit_icon fa fa-bold' id='nifty_tedit_b'></i>";
|
5460 |
+
$msg .= "<i class='nifty_tedit_icon fa fa-italic' id='nifty_tedit_i'></i>";
|
5461 |
+
$msg .= "<i class='nifty_tedit_icon fa fa-underline' id='nifty_tedit_u'></i>";
|
5462 |
+
$msg .= "<i class='nifty_tedit_icon fa fa-strikethrough' id='nifty_tedit_strike'></i>";
|
5463 |
+
$msg .= "<i class='nifty_tedit_icon fa fa-square' id='nifty_tedit_mark'></i>";
|
5464 |
+
$msg .= "<i class='nifty_tedit_icon fa fa-subscript' id='nifty_tedit_sub'></i>";
|
5465 |
+
$msg .= "<i class='nifty_tedit_icon fa fa-superscript' id='nifty_tedit_sup'></i>";
|
5466 |
+
$msg .= "<i class='nifty_tedit_icon fa fa-link' id='nifty_tedit_link'></i>";
|
5467 |
+
$msg .= "<i class='nifty_tedit_icon'><a target='_BLANK' href='https://wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=text_editor'>Pro version only</a></i>";
|
5468 |
+
$msg .= "</div>";
|
5469 |
+
}
|
5470 |
+
return $msg;
|
5471 |
+
}
|
5472 |
+
|
5473 |
+
add_filter("wplc_filter_advanced_info","nifty_rating_advanced_info_upsell",1,4);
|
5474 |
+
/**
|
5475 |
+
* Chat experience ratings upselling page
|
5476 |
+
* @param string $msg current chat window contents
|
5477 |
+
* @param int $cid chat ID
|
5478 |
+
* @param string $name User's name
|
5479 |
+
* @return string current chat window contents with the experience rating content appended
|
5480 |
+
*/
|
5481 |
+
function nifty_rating_advanced_info_upsell($msg, $cid, $name, $chat_data){
|
5482 |
+
if(!function_exists("nifty_rating_advanced_info_control") && is_admin() && !function_exists("wplc_pro_activate")){
|
5483 |
+
$msg .= "<div class='admin_visitor_advanced_info admin_agent_rating wplc_faded_upsell'>
|
5484 |
+
<strong>" . __("Experience Rating", "wplivechat") . "</strong>
|
5485 |
+
<div class='rating'><a target='_BLANK' href='https://wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=experience_ratings'>Pro only</a></div>
|
5486 |
+
</div>";
|
5487 |
+
}
|
5488 |
+
return $msg;
|
5489 |
+
}
|
5490 |
+
|
5491 |
+
add_filter("wplc_filter_typing_control_div","wplc_basic_filter_control_return_chat_response_box_before",2,1);
|
5492 |
+
function wplc_basic_filter_control_return_chat_response_box_before($string) {
|
5493 |
+
remove_filter("wplc_filter_typing_control_div","wplc_pro_filter_control_return_chat_response_box_before");
|
5494 |
+
$string = $string. "<div class='typing_indicator wplc-color-2 wplc-color-bg-1'></div>";
|
5495 |
+
|
5496 |
+
return $string;
|
5497 |
+
}
|
5498 |
+
add_filter("wplc_filter_typing_control_div_theme_2","wplc_basic_filter_control_return_chat_response_box_before_theme2",2,1);
|
5499 |
+
function wplc_basic_filter_control_return_chat_response_box_before_theme2($string) {
|
5500 |
+
remove_filter("wplc_filter_typing_control_div_theme_2","wplc_pro_filter_control_return_chat_response_box_before_theme2");
|
5501 |
+
$string = $string. "<div class='typing_indicator wplc-color-2 wplc-color-bg-1'></div>";
|
5502 |
+
|
5503 |
+
return $string;
|
5504 |
+
}
|
5505 |
+
|
5506 |
+
|
5507 |
+
add_action("wplc_hook_admin_settings_main_settings_after","wplc_hook_control_admin_settings_chat_box_settings_after",2);
|
5508 |
+
/**
|
5509 |
+
* Adds the settings to allow the user to change their server environment variables
|
5510 |
+
* @return sring */
|
5511 |
+
function wplc_hook_control_admin_settings_chat_box_settings_after() {
|
5512 |
+
|
5513 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
5514 |
+
if (isset($wplc_settings["wplc_environment"])) { $wplc_environment[intval($wplc_settings["wplc_environment"])] = "SELECTED"; }
|
5515 |
+
|
5516 |
+
?>
|
5517 |
+
<h4><?php _e("Advanced settings", "wplivechat") ?></h4>
|
5518 |
+
<table class='wp-list-table wplc_list_table widefat fixed striped pages' width='700'>
|
5519 |
+
|
5520 |
+
<?php do_action("wplc_advanced_settings_above_performance", $wplc_settings); ?>
|
5521 |
+
</table>
|
5522 |
+
<p> </p>
|
5523 |
+
<table class='wp-list-table wplc_list_table widefat fixed striped pages' width='700'>
|
5524 |
+
|
5525 |
+
<tr>
|
5526 |
+
<td colspan='2'>
|
5527 |
+
<p><em><small><?php _e("Only change these settings if you are experiencing performance issues.","wplivechat"); ?></small></em></p>
|
5528 |
+
</td>
|
5529 |
+
</tr>
|
5530 |
+
</tr>
|
5531 |
+
<?php do_action("wplc_advanced_settings_settings"); ?>
|
5532 |
+
<tr>
|
5533 |
+
<td valign='top'>
|
5534 |
+
<?php _e("What type of environment are you on?","wplivechat"); ?>
|
5535 |
+
</td>
|
5536 |
+
<td valign='top'>
|
5537 |
+
<select name='wplc_environment' id='wplc_environment'>
|
5538 |
+
<option value='1' <?php if (isset($wplc_environment[1])) { echo $wplc_environment[1]; } ?>><?php _e("Shared hosting - low level plan","wplivechat"); ?></option>
|
5539 |
+
<option value='2' <?php if (isset($wplc_environment[2])) { echo $wplc_environment[2]; } ?>><?php _e("Shared hosting - normal plan","wplivechat"); ?></option>
|
5540 |
+
<option value='3' <?php if (isset($wplc_environment[3])) { echo $wplc_environment[3]; } ?>><?php _e("VPS","wplivechat"); ?></option>
|
5541 |
+
<option value='4' <?php if (isset($wplc_environment[4])) { echo $wplc_environment[4]; } ?>><?php _e("Dedicated server","wplivechat"); ?></option>
|
5542 |
+
</select>
|
5543 |
+
</td>
|
5544 |
+
</tr>
|
5545 |
+
<tr>
|
5546 |
+
<td valign='top'>
|
5547 |
+
<?php _e("Long poll setup","wplivechat"); ?>: <i class="fa fa-question-circle wplc_light_grey wplc_settings_tooltip" title="<?php _e("Only change these if you are an experienced developer or if you have received these figures from the Code Cabin Support team.", "wplivechat") ?>"></i>
|
5548 |
+
</td>
|
5549 |
+
<td valign='top'>
|
5550 |
+
<?php
|
5551 |
+
$wplc_advanced_settings = get_option("wplc_advanced_settings");
|
5552 |
+
?>
|
5553 |
+
<table>
|
5554 |
+
<tr>
|
5555 |
+
<td><?php _e("Iterations","wplivechat"); ?></td>
|
5556 |
+
<td><input id="wplc_iterations" name="wplc_iterations" type="number" max='200' min='10' value="<?php if (isset($wplc_advanced_settings['wplc_iterations'])) { echo $wplc_advanced_settings['wplc_iterations']; } else { echo '55'; } ?>" /></td>
|
5557 |
+
</tr>
|
5558 |
+
<tr>
|
5559 |
+
<td><?php _e("Sleep between iterations","wplivechat"); ?></td>
|
5560 |
+
<td>
|
5561 |
+
<input id="wplc_delay_between_loops" name="wplc_delay_between_loops" type="number" max='1000000' min='25000' value="<?php if (isset($wplc_advanced_settings['wplc_delay_between_loops'])) { echo $wplc_advanced_settings['wplc_delay_between_loops']; } else { echo '500000'; } ?>" />
|
5562 |
+
<small><em><?php _e("microseconds","wplivechat"); ?></em></small>
|
5563 |
+
</td>
|
5564 |
+
</tr>
|
5565 |
+
</table>
|
5566 |
+
|
5567 |
+
</td>
|
5568 |
+
</tr>
|
5569 |
+
|
5570 |
+
</table>
|
5571 |
+
<?php
|
5572 |
+
}
|
5573 |
+
/**
|
5574 |
+
* Basic version's reporting page
|
5575 |
+
* @return string
|
5576 |
+
*/
|
5577 |
+
function wplc_basic_reporting_page(){
|
5578 |
+
|
5579 |
+
$content = "<div class='wrap wplc_wrap'>";
|
5580 |
+
$content .= "<h2>".__('WP Live Chat Support Reporting', 'wp-livechat')." (beta) </h2>";
|
5581 |
+
$content .= "<table class=\"wp-list-table wplc_list_table widefat fixed form-table\" cellspacing=\"0\" style='width:98%'>";
|
5582 |
+
$content .= "<tr>";
|
5583 |
+
$content .= "<td style='width:35%; vertical-align:top;'>";
|
5584 |
+
$content .= "<img class='reporting_img_main' style='width:99%; height:auto; padding:2px; border:1px lightgray solid;box-shadow: 3px 3px 2px -2px #999;-webkit-box-shadow: 3px 3px 2px -2px #999;-moz-box-shadow: 3px 3px 2px -2px #999;-o-box-shadow: 3px 3px 2px -2px #999;' src='".plugins_url('/images/reporting_sample.jpg', __FILE__)."'>";
|
5585 |
+
$content .= "</td>";
|
5586 |
+
$content .= "<td style='vertical-align:top;'>";
|
5587 |
+
$content .= "<h3>".__('WP Live Chat Support Reporting', 'wp-livechat')."</h3>";
|
5588 |
+
$content .= "<p>".__('View comprehensive reports regarding your chat and agent activity.', 'wp-livechat')."</p>";
|
5589 |
+
|
5590 |
+
|
5591 |
+
$content .= "<br><p><strong>".__('Reports', 'wp-livechat').":</strong></p>";
|
5592 |
+
$content .= "<ul style='list-style: inherit;margin-left: 22px;'>";
|
5593 |
+
$content .= "<li>".__('Chat statistics', 'wp-livechat')."</li>";
|
5594 |
+
$content .= "<li>".__('Popular pages', 'wp-livechat')."</li>";
|
5595 |
+
$content .= "<li>".__('ROI reporting and tracking (identify which agents produce the most sales)', 'wp-livechat')."</li>";
|
5596 |
+
$content .= "<li>".__('User experience ratings (identify which agents produce the happiest customers)', 'wp-livechat')."</li>";
|
5597 |
+
$content .= "</ul>";
|
5598 |
+
|
5599 |
+
if (function_exists("wplc_pro_activate")) {
|
5600 |
+
global $wplc_pro_version;
|
5601 |
+
if (intval(str_replace(".","",$wplc_pro_version)) < 6300) {
|
5602 |
+
$content .= "<p>In order to use reporting, please ensure you are using the latest Pro version (version 6.3.00 or newer).</p>";
|
5603 |
+
$content .= "<br><a title='Update Now' href='./update-core.php' style='width: 200px;height: 58px;text-align: center;line-height: 56px;font-size: 18px;' class='button button-primary'>".__("Update now" ,"wplivechat")."</a>";
|
5604 |
+
}
|
5605 |
+
} else {
|
5606 |
+
$content .= "<p>".__('Get all this and more in the ', 'wp-livechat')."<a href='https://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=reporting' target='_BLANK'>".__("Pro add-on", "wplivechat")."</a></p>";
|
5607 |
+
$content .= "<br><a title='Upgrade Now' href='https://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=reporting' style='width: 200px;height: 58px;text-align: center;line-height: 56px;font-size: 18px;' class='button button-primary' target='_BLANK'>".__("Upgrade Now" ,"wplivechat")."</a>";
|
5608 |
+
}
|
5609 |
+
$content .= "</td>";
|
5610 |
+
$content .= "</tr>";
|
5611 |
+
$content .= "</table>";
|
5612 |
+
$content .= "</div>";
|
5613 |
+
echo $content;
|
5614 |
+
|
5615 |
+
}
|
5616 |
+
/**
|
5617 |
+
* Basic version's triggers page - used to upsell the feature
|
5618 |
+
* @return string
|
5619 |
+
*/
|
5620 |
+
function wplc_basic_triggers_page(){
|
5621 |
+
$content = "<div class='wrap wplc_wrap'>";
|
5622 |
+
$content .= "<h2>".__('WP Live Chat Support Triggers', 'wp-livechat')." (beta) </h2>";
|
5623 |
+
$content .= "<script>
|
5624 |
+
var isOn = true;
|
5625 |
+
jQuery(function(){
|
5626 |
+
jQuery(function(){
|
5627 |
+
setInterval(function(){
|
5628 |
+
if(isOn){
|
5629 |
+
jQuery('.trigger_img_main').fadeOut('fast', function(){
|
5630 |
+
jQuery('.trigger_img_sec').fadeIn('slow');
|
5631 |
+
jQuery('.trigger_img_sec').fadeIn('slow');
|
5632 |
+
});
|
5633 |
+
} else {
|
5634 |
+
jQuery('.trigger_img_sec').fadeOut('fast');
|
5635 |
+
jQuery('.trigger_img_sec').fadeOut('fast', function(){
|
5636 |
+
jQuery('.trigger_img_main').fadeIn('slow');
|
5637 |
+
});
|
5638 |
+
}
|
5639 |
+
isOn = !isOn;
|
5640 |
+
}, 5000);
|
5641 |
+
});
|
5642 |
+
});
|
5643 |
+
</script>";
|
5644 |
+
|
5645 |
+
$content .= "<table class=\"wp-list-table wplc_list_table widefat fixed form-table\" cellspacing=\"0\" style='width:98%'>";
|
5646 |
+
$content .= "<tr>";
|
5647 |
+
$content .= "<td style='width:35%; vertical-align:top;'>";
|
5648 |
+
$content .= "<img class='trigger_img_main' style='width:99%; height:auto; padding:2px; border:1px lightgray solid;box-shadow: 3px 3px 2px -2px #999;-webkit-box-shadow: 3px 3px 2px -2px #999;-moz-box-shadow: 3px 3px 2px -2px #999;-o-box-shadow: 3px 3px 2px -2px #999;' src='".plugins_url('/images/trigger_sample.jpg', __FILE__)."'>";
|
5649 |
+
$content .= "<img class='trigger_img_sec'style='display: none; width:49%; height:auto; border:1px lightgray solid;box-shadow: 3px 3px 2px -2px #999;-webkit-box-shadow: 3px 3px 2px -2px #999;-moz-box-shadow: 3px 3px 2px -2px #999;-o-box-shadow: 3px 3px 2px -2px #999;' src='".plugins_url('/images/trigger_sample_front.jpg', __FILE__)."'>";
|
5650 |
+
$content .= "</td>";
|
5651 |
+
$content .= "<td style='vertical-align:top;'>";
|
5652 |
+
$content .= "<h3>".__('WP Live Chat Support Triggers', 'wp-livechat')."</h3>";
|
5653 |
+
$content .= "<p>".__('Create custom data triggers when users view a certain page, spend a certain amount of time on a page, scroll past a certain point or when their mouse leaves the window.', 'wp-livechat')."</p>";
|
5654 |
+
|
5655 |
+
|
5656 |
+
$content .= "<br><p><strong>".__('Trigger Types', 'wp-livechat').":</strong></p>";
|
5657 |
+
$content .= "<ul style='list-style: inherit;margin-left: 22px;'>";
|
5658 |
+
$content .= "<li>".__('Page Trigger', 'wp-livechat')."</li>";
|
5659 |
+
$content .= "<li>".__('Time Trigger', 'wp-livechat')."</li>";
|
5660 |
+
$content .= "<li>".__('Scroll Trigger', 'wp-livechat')."</li>";
|
5661 |
+
$content .= "<li>".__('Page Leave Trigger', 'wp-livechat')."</li>";
|
5662 |
+
$content .= "</ul>";
|
5663 |
+
|
5664 |
+
if (function_exists("wplc_pro_activate")) {
|
5665 |
+
global $wplc_pro_version;
|
5666 |
+
if (intval(str_replace(".","",$wplc_pro_version)) < 6200) {
|
5667 |
+
$content .= "<p>In order to use data triggers, please ensure you are using the latest Pro version (version 6.2.00 or newer).</p>";
|
5668 |
+
$content .= "<br><a title='Update Now' href='./update-core.php' style='width: 200px;height: 58px;text-align: center;line-height: 56px;font-size: 18px;' class='button button-primary'>".__("Update now" ,"wplivechat")."</a>";
|
5669 |
+
}
|
5670 |
+
} else {
|
5671 |
+
$content .= "<p>".__('Get all this and more in the ', 'wp-livechat')."<a href='https://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=data_triggers' target='_BLANK'>".__("Pro add-on", "wplivechat")."</a></p>";
|
5672 |
+
$content .= "<br><a title='Upgrade Now' href='https://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=data_triggers' style='width: 200px;height: 58px;text-align: center;line-height: 56px;font-size: 18px;' class='button button-primary' target='_BLANK'>".__("Upgrade Now" ,"wplivechat")."</a>";
|
5673 |
+
}
|
5674 |
+
$content .= "</td>";
|
5675 |
+
$content .= "</tr>";
|
5676 |
+
$content .= "</table>";
|
5677 |
+
$content .= "</div>";
|
5678 |
+
echo $content;
|
5679 |
+
|
5680 |
+
}
|
5681 |
+
/**
|
5682 |
+
* Basic version's custom fields page - used to upsell the feature
|
5683 |
+
* @return string
|
5684 |
+
*/
|
5685 |
+
function wplc_basic_custom_fields_page(){
|
5686 |
+
$content = "<div class='wrap wplc_wrap'>";
|
5687 |
+
$content .= "<h2>".__('WP Live Chat Support Custom Fields', 'wplivechat')."</h2>";
|
5688 |
+
$content .= "<table class=\"wp-list-table wplc_list_table widefat fixed form-table\" cellspacing=\"0\" style='width:98%'>";
|
5689 |
+
$content .= "<tr>";
|
5690 |
+
$content .= "<td style='width:35%; vertical-align:top;'>";
|
5691 |
+
$content .= "<img class='trigger_img_main' style='width:99%; height:auto; padding:2px; border:1px lightgray solid;box-shadow: 3px 3px 2px -2px #999;-webkit-box-shadow: 3px 3px 2px -2px #999;-moz-box-shadow: 3px 3px 2px -2px #999;-o-box-shadow: 3px 3px 2px -2px #999;' src='".plugins_url('/images/trigger_sample.jpg', __FILE__)."'>";
|
5692 |
+
$content .= "</td>";
|
5693 |
+
$content .= "<td style='vertical-align:top;'>";
|
5694 |
+
$content .= "<h3>".__('WP Live Chat Support Custom Fields', 'wp-livechat')."</h3>";
|
5695 |
+
$content .= "<p>".__('Create custom fields, allowing your visitors to enter the data you need before starting a chat.', 'wp-livechat')."</p>";
|
5696 |
+
$content .= "<br><p><strong>".__('Custom Field Types', 'wp-livechat').":</strong></p>";
|
5697 |
+
$content .= "<ul style='list-style: inherit;margin-left: 22px;'>";
|
5698 |
+
$content .= "<li>".__('Text Fields', 'wp-livechat')."</li>";
|
5699 |
+
$content .= "<li>".__('Dropdown Fields', 'wp-livechat')."</li>";
|
5700 |
+
$content .= "</ul>";
|
5701 |
+
|
5702 |
+
if (function_exists("wplc_pro_activate")) {
|
5703 |
+
global $wplc_pro_version;
|
5704 |
+
if (intval(str_replace(".","",$wplc_pro_version)) < 7000) {
|
5705 |
+
$content .= "<p>In order to use custom fields, please ensure you are using the latest Pro version (version 7.0.0 or newer).</p>";
|
5706 |
+
$content .= "<br><a title='Update Now' href='./update-core.php' style='width: 200px;height: 58px;text-align: center;line-height: 56px;font-size: 18px;' class='button button-primary'>".__("Update now" ,"wplivechat")."</a>";
|
5707 |
+
}
|
5708 |
+
} else {
|
5709 |
+
$content .= "<p>".__('Get all this and more in the ', 'wp-livechat')."<a href='https://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=custom_fields' target='_BLANK'>".__("Pro add-on", "wplivechat")."</a></p>";
|
5710 |
+
$content .= "<br><a title='Upgrade Now' href='https://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=custom_fields' style='width: 200px;height: 58px;text-align: center;line-height: 56px;font-size: 18px;' class='button button-primary' target='_BLANK'>".__("Upgrade Now" ,"wplivechat")."</a>";
|
5711 |
+
}
|
5712 |
+
$content .= "</td>";
|
5713 |
+
$content .= "</tr>";
|
5714 |
+
$content .= "</table>";
|
5715 |
+
$content .= "</div>";
|
5716 |
+
echo $content;
|
5717 |
+
}
|
5718 |
+
|
5719 |
+
add_action('wplc_hook_admin_settings_main_settings_after','wplc_powered_by_link_settings_page',2);
|
5720 |
+
/**
|
5721 |
+
* Adds the necessary checkbox to enable/disable the 'Powered by' link
|
5722 |
+
* @return string
|
5723 |
+
*/
|
5724 |
+
function wplc_powered_by_link_settings_page() {
|
5725 |
+
$wplc_powered_by = get_option("WPLC_POWERED_BY");
|
5726 |
+
?>
|
5727 |
+
<table class='form-table wp-list-table wplc_list_table widefat fixed striped pages' width='700'>
|
5728 |
+
<tr>
|
5729 |
+
<td width='350' valign='top'>
|
5730 |
+
<?php _e("Display a 'Powered by' link in the chat box", "wplivechat") ?>: <i class="fa fa-question-circle wplc_light_grey wplc_settings_tooltip" title="<?php _e("Checking this will display a 'Powered by WP Live Chat Support' caption at the bottom of your chatbox.", 'wplivechat'); ?>"></i>
|
5731 |
+
</td>
|
5732 |
+
<td>
|
5733 |
+
<input type="checkbox" value="1" name="wplc_powered_by" <?php if ( $wplc_powered_by && $wplc_powered_by == 1 ) { echo "checked"; } ?> />
|
5734 |
+
</td>
|
5735 |
+
</tr>
|
5736 |
+
</table>
|
5737 |
+
<hr>
|
5738 |
+
<?php
|
5739 |
+
}
|
5740 |
+
|
5741 |
+
add_action( "wplc_hook_head", "wplc_powered_by_link_save_settings" );
|
5742 |
+
/**
|
5743 |
+
* Saves the 'Powered by' link settings
|
5744 |
+
* @return void
|
5745 |
+
*/
|
5746 |
+
function wplc_powered_by_link_save_settings(){
|
5747 |
+
|
5748 |
+
if( isset( $_POST['wplc_save_settings'] ) ){
|
5749 |
+
|
5750 |
+
if( isset( $_POST['wplc_powered_by'] ) && $_POST['wplc_powered_by'] == '1' ){
|
5751 |
+
update_option( "WPLC_POWERED_BY", 1 );
|
5752 |
+
} else {
|
5753 |
+
update_option( "WPLC_POWERED_BY", 0 );
|
5754 |
+
}
|
5755 |
+
|
5756 |
+
}
|
5757 |
+
|
5758 |
+
}
|
5759 |
+
|
5760 |
+
add_filter( "wplc_start_chat_user_form_after_filter", "wplc_powered_by_link_in_chat", 12, 2 );
|
5761 |
+
/**
|
5762 |
+
* Appends the 'Powered by' link to the chat window
|
5763 |
+
* @param string $string the current contents of the chat box
|
5764 |
+
* @param int $cid the current chat ID
|
5765 |
+
* @return string the chat contents, with the 'Powered by' link appended to it
|
5766 |
+
*/
|
5767 |
+
function wplc_powered_by_link_in_chat( $string ){
|
5768 |
+
|
5769 |
+
$show_powered_by = get_option( "WPLC_POWERED_BY" );
|
5770 |
+
|
5771 |
+
if( $show_powered_by == 1){
|
5772 |
+
$ret = "<i style='text-align: center; display: block; padding: 5px 0; font-size: 10px;'><a href='https://wp-livechat.com/?utm_source=poweredby&utm_medium=click&utm_campaign=".esc_html(site_url())."'' target='_BLANK' rel='nofollow'>".__("Powered by WP Live Chat Support", "wplivechat")."</a></i>";
|
5773 |
+
|
5774 |
+
} else {
|
5775 |
+
|
5776 |
+
$ret = "";
|
5777 |
+
|
5778 |
+
}
|
5779 |
+
|
5780 |
+
return $string . $ret;
|
5781 |
+
|
5782 |
+
}
|
5783 |
+
|
5784 |
+
add_action( "admin_enqueue_scripts", "wplc_custom_scripts_scripts" );
|
5785 |
+
/**
|
5786 |
+
* Loads the Ace.js editor for the custom scripts
|
5787 |
+
* @return void
|
5788 |
+
*/
|
5789 |
+
function wplc_custom_scripts_scripts(){
|
5790 |
+
|
5791 |
+
if ( isset( $_GET['page'] ) ) {
|
5792 |
+
if ( $_GET['page'] == 'wplivechat-menu-settings' ) {
|
5793 |
+
wp_enqueue_script( "wplc-custom-script-tab-ace",'//cdnjs.cloudflare.com/ajax/libs/ace/1.2.9/ace.js', array('jquery') );
|
5794 |
+
} else if ( $_GET['page'] == 'wplivechat-menu-dashboard' ) {
|
5795 |
+
wp_enqueue_script( 'wplc-custom-script-dashboard', plugins_url( '/js/wplc_dashboard.js', __FILE__ ), array('jquery'), null, true );
|
5796 |
+
}
|
5797 |
+
|
5798 |
+
}
|
5799 |
+
|
5800 |
+
}
|
5801 |
+
|
5802 |
+
add_filter( "wplc_filter_setting_tabs", "wplc_custom_scripts_tab" );
|
5803 |
+
/**
|
5804 |
+
* Adds a tab for the custom scripts
|
5805 |
+
* @param array $array current array that is made available to us
|
5806 |
+
* @return array our tabs array has been added to the array
|
5807 |
+
*/
|
5808 |
+
function wplc_custom_scripts_tab( $array ){
|
5809 |
+
|
5810 |
+
$array['custom-scripts'] = array(
|
5811 |
+
'href' => '#wplc-custom-scripts',
|
5812 |
+
'icon' => 'fa fa-pencil',
|
5813 |
+
'label' => __("Custom Scripts", "wplivechat")
|
5814 |
+
);
|
5815 |
+
|
5816 |
+
return $array;
|
5817 |
+
}
|
5818 |
+
|
5819 |
+
add_action( "wplc_hook_settings_page_more_tabs", "wplc_custom_scripts_content" );
|
5820 |
+
/**
|
5821 |
+
* Adds the tab content to the settings page to allow the user to add custom CSS & JS
|
5822 |
+
* @return string
|
5823 |
+
*/
|
5824 |
+
function wplc_custom_scripts_content(){
|
5825 |
+
|
5826 |
+
$wplc_custom_css = get_option( "WPLC_CUSTOM_CSS" );
|
5827 |
+
$wplc_custom_js = get_option( "WPLC_CUSTOM_JS" );
|
5828 |
+
|
5829 |
+
$content = "";
|
5830 |
+
|
5831 |
+
$content .= "<div id='wplc-custom-scripts'>";
|
5832 |
+
|
5833 |
+
$content .= "<h2>".__("Custom Scripts", "wplivechat")."</h2>";
|
5834 |
+
$content .= "<table class='form-table'>";
|
5835 |
+
|
5836 |
+
$content .= "<tr>";
|
5837 |
+
$content .= "<td width='300'>".__("Custom CSS", "wplivechat")."</td>";
|
5838 |
+
$content .= "<td><div id='wplc_custom_css_editor'></div><textarea name='wplc_custom_css' id='wplc_custom_css' style='display: none;' data-editor='css' rows='12'>".strip_tags( stripslashes( $wplc_custom_css ) )."</textarea></td>";
|
5839 |
+
$content .= "</tr>";
|
5840 |
+
|
5841 |
+
$content .= "<tr>";
|
5842 |
+
$content .= "<td width='300'>".__("Custom JS", "wplivechat")."</td>";
|
5843 |
+
$content .= "<td valign='middle'><div id='wplc_custom_js_editor'></div><textarea name='wplc_custom_js' id='wplc_custom_js' style='display: none;' data-editor='javascript' rows='12'>".strip_tags( stripslashes( $wplc_custom_js ) )."</textarea></td>";
|
5844 |
+
$content .= "</tr>";
|
5845 |
+
|
5846 |
+
$content .= "</table>";
|
5847 |
+
|
5848 |
+
$content .= "</div>";
|
5849 |
+
|
5850 |
+
echo $content;
|
5851 |
+
|
5852 |
+
}
|
5853 |
+
|
5854 |
+
add_action( "wplc_hook_head", "wplc_custom_scripts_save" );
|
5855 |
+
/**
|
5856 |
+
* Saves the custom scripts into the options table
|
5857 |
+
* @return void
|
5858 |
+
*/
|
5859 |
+
function wplc_custom_scripts_save(){
|
5860 |
+
|
5861 |
+
if( isset( $_POST['wplc_save_settings'] ) ){
|
5862 |
+
|
5863 |
+
if( isset( $_POST['wplc_custom_css'] ) ){
|
5864 |
+
update_option( "WPLC_CUSTOM_CSS", nl2br( $_POST['wplc_custom_css'] ) );
|
5865 |
+
}
|
5866 |
+
|
5867 |
+
if( isset( $_POST['wplc_custom_js'] ) ){
|
5868 |
+
update_option( "WPLC_CUSTOM_JS", nl2br( $_POST['wplc_custom_js'] ) );
|
5869 |
+
}
|
5870 |
+
|
5871 |
+
}
|
5872 |
+
|
5873 |
+
}
|
5874 |
+
|
5875 |
+
add_action( "wp_head", "wplc_custom_scripts_frontend" );
|
5876 |
+
/**
|
5877 |
+
* Display the custom scripts on the front end of the site
|
5878 |
+
* @return string
|
5879 |
+
*/
|
5880 |
+
function wplc_custom_scripts_frontend(){
|
5881 |
+
|
5882 |
+
$wplc_custom_css = get_option( "WPLC_CUSTOM_CSS" );
|
5883 |
+
$wplc_custom_js = get_option( "WPLC_CUSTOM_JS" );
|
5884 |
+
|
5885 |
+
if( $wplc_custom_css ){
|
5886 |
+
echo "<!-- WPLC Custom CSS -->";
|
5887 |
+
echo "<style>";
|
5888 |
+
echo strip_tags( stripslashes( $wplc_custom_css ) );
|
5889 |
+
echo "</style>";
|
5890 |
+
}
|
5891 |
+
|
5892 |
+
if( $wplc_custom_js ){
|
5893 |
+
echo "<!-- WPLC Custom JS -->";
|
5894 |
+
echo "<script>";
|
5895 |
+
echo strip_tags( stripslashes( $wplc_custom_js ) );
|
5896 |
+
echo "</script>";
|
5897 |
+
}
|
5898 |
+
|
5899 |
+
}
|
5900 |
+
|
5901 |
+
add_filter( "wplc_offline_message_subject_filter", "wplc_change_offline_message", 10, 1 );
|
5902 |
+
/**
|
5903 |
+
* Adds a filter to change the email address to the user's preference
|
5904 |
+
* @param string $subject The default subject
|
5905 |
+
* @return string
|
5906 |
+
*/
|
5907 |
+
function wplc_change_offline_message( $subject ){
|
5908 |
+
|
5909 |
+
$wplc_settings = get_option( "WPLC_SETTINGS");
|
5910 |
+
|
5911 |
+
if( isset( $wplc_settings['wplc_pro_chat_email_offline_subject'] ) ){
|
5912 |
+
$subject = stripslashes( $wplc_settings['wplc_pro_chat_email_offline_subject'] );
|
5913 |
+
}
|
5914 |
+
|
5915 |
+
return $subject;
|
5916 |
+
|
5917 |
+
}
|
5918 |
+
|
5919 |
+
function wplc_basic_version_departments(){
|
5920 |
+
echo "<div class='wrap wplc_wrap'>";
|
5921 |
+
echo sprintf( "<div class='error'><p>".__("WP Live Chat Support requires WP Live Chat Support Pro Version 7.0.0 or greater in order for departments to function as expected. Please update WP Live Chat Support %s", "wplivechat")."</p></div>", "<a href='".admin_url('update-core.php')."'>".__("here", "wplivechat")."</a>" );
|
5922 |
+
echo "</div>";
|
5923 |
+
|
5924 |
+
$content = "";
|
5925 |
+
|
5926 |
+
$content .= "<table class=\"wp-list-table wplc_list_table widefat fixed \" cellspacing=\"0\" style='width:98%'>";
|
5927 |
+
$content .= "<thead>";
|
5928 |
+
$content .= "<tr>";
|
5929 |
+
$content .= "<th scope='col'><span>" . __("ID", "wplivechat") . "</span></th>";
|
5930 |
+
$content .= "<th scope='col'><span>" . __("Name", "wplivechat") . "</span></th>";
|
5931 |
+
$content .= "<th scope='col'><span>" . __("Action", "wplivechat") . "</span></th>";
|
5932 |
+
$content .= "</tr>";
|
5933 |
+
$content .= "</thead>";
|
5934 |
+
|
5935 |
+
$content .= "<tr><td>".__("Please update your Pro version to create a department", "wp-livechat")."</td><td></td><td></td></tr>";
|
5936 |
+
|
5937 |
+
$content .= "</table>";
|
5938 |
+
|
5939 |
+
echo $content;
|
5940 |
+
}
|
5941 |
+
|
5942 |
+
add_filter( 'wplc_filter_active_chat_box_notification', 'wplc_active_chat_box_notice' );
|
5943 |
+
|
5944 |
+
if ( ! function_exists( "wplc_active_chat_box_notices" ) ) {
|
5945 |
+
add_action( "wplc_hook_chat_dashboard_above", "wplc_active_chat_box_notices" );
|
5946 |
+
function wplc_active_chat_box_notices() {
|
5947 |
+
$wplc_settings = get_option( "WPLC_SETTINGS" );
|
5948 |
+
if ( $wplc_settings["wplc_settings_enabled"] == 2 ) { ?>
|
5949 |
+
<div class="wplc-chat-box-notification wplc-chat-box-notification--disabled">
|
5950 |
+
<p><?php echo sprintf( __( 'The Live Chat box is currently disabled on your website due to : <a href="%s">General Settings</a>', 'wp-livechat' ), admin_url( 'admin.php?page=wplivechat-menu-settings#tabs-1' ) ) ?></p>
|
5951 |
+
</div>
|
5952 |
+
<?php
|
5953 |
+
} else {
|
5954 |
+
//$notice = '<div class="wplc-chat-box-notification">';
|
5955 |
+
//$notice .= '<p>' . __( 'The Live Chat box is currently active', 'wp-livechat' ) . '</p>';
|
5956 |
+
//$notice .= '</div>';
|
5957 |
+
$notice = '';
|
5958 |
+
$notice = apply_filters( 'wplc_filter_active_chat_box_notice', $notice );
|
5959 |
+
echo $notice;
|
5960 |
+
}
|
5961 |
+
|
5962 |
+
}
|
5963 |
+
}
|
5964 |
+
|
5965 |
+
|
5966 |
+
add_filter("wplc_filter_chat_4th_layer_below_input","nifty_chat_ratings_div_backwards_compat",2,2);
|
5967 |
+
/**
|
5968 |
+
* This adds backwards compatibility to the new look and feel of the modern chat box
|
5969 |
+
*
|
5970 |
+
* The ' | ' is removed from the rating icons to fit the new look and feel
|
5971 |
+
*
|
5972 |
+
*/
|
5973 |
+
function nifty_chat_ratings_div_backwards_compat($msg, $wplc_setting){
|
5974 |
+
$msg = str_replace(" | ","", $msg);
|
5975 |
+
return $msg;
|
5976 |
+
|
5977 |
+
}
|
5978 |
+
|
5979 |
+
/**
|
5980 |
+
* Identifies if the chat box should show, scripts should run and the dashboard should display correctly all based on certain versions.
|
5981 |
+
*
|
5982 |
+
* i.e. This is the part where we force users to upgrade their extensions to make sure everything works correctly.
|
5983 |
+
*
|
5984 |
+
* Use with caution and always try add backwards compatibility where necessary
|
5985 |
+
*
|
5986 |
+
* @param bool $continue
|
5987 |
+
* @return bool
|
5988 |
+
* @since 7.1.00
|
5989 |
+
* @author Nick Duncan
|
5990 |
+
*/
|
5991 |
+
add_filter( "wplc_version_check_continue", "wplc_filter_control_version_check_continue", 10, 1 );
|
5992 |
+
function wplc_filter_control_version_check_continue( $continue ) {
|
5993 |
+
|
5994 |
+
/**
|
5995 |
+
* Check to see that we are on the cloud server 1.3.00 or newer
|
5996 |
+
*/
|
5997 |
+
if ( function_exists("wplc_cloud_load_updates") ) {
|
5998 |
+
global $wplc_cloud_version;
|
5999 |
+
$float_version = intval( str_replace(".", "", $wplc_cloud_version ) );
|
6000 |
+
if ($float_version < 2000) {
|
6001 |
+
return sprintf( "Your chat has been disabled due to a version conflict. Please <a href='%s'>update your cloud extension</a> to 1.3.00 or higher.", admin_url('update-core.php') )."<br />";
|
6002 |
+
|
6003 |
+
}
|
6004 |
+
}
|
6005 |
+
|
6006 |
+
return $continue;
|
6007 |
+
|
6008 |
+
}
|
6009 |
+
|
6010 |
+
/*
|
6011 |
+
* Returns the WDT emoji selector
|
6012 |
+
*/
|
6013 |
+
function wplc_emoji_selector_div(){
|
6014 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
6015 |
+
|
6016 |
+
// NB: This causes Failed to initVars ReferenceError: wplc_show_date is not defined when uncommented and enabled
|
6017 |
+
if(!empty($wplc_settings['wplc_disable_emojis']))
|
6018 |
+
return;
|
6019 |
+
|
6020 |
+
$emoji_container = "";
|
6021 |
+
if(isset($wplc_settings['wplc_use_node_server']) && $wplc_settings['wplc_use_node_server'] == 1){
|
6022 |
+
$emoji_container = '<div class="wdt-emoji-popup">
|
6023 |
+
<a href="#" class="wdt-emoji-popup-mobile-closer"> × </a>
|
6024 |
+
<div class="wdt-emoji-menu-content">
|
6025 |
+
<div id="wdt-emoji-menu-header">
|
6026 |
+
<a class="wdt-emoji-tab" data-group-name="People"></a>
|
6027 |
+
<a class="wdt-emoji-tab" data-group-name="Nature"></a>
|
6028 |
+
<a class="wdt-emoji-tab" data-group-name="Foods"></a>
|
6029 |
+
<a class="wdt-emoji-tab" data-group-name="Activity"></a>
|
6030 |
+
<a class="wdt-emoji-tab" data-group-name="Places"></a>
|
6031 |
+
<a class="wdt-emoji-tab" data-group-name="Objects"></a>
|
6032 |
+
<a class="wdt-emoji-tab" data-group-name="Symbols"></a>
|
6033 |
+
<a class="wdt-emoji-tab" data-group-name="Flags"></a>
|
6034 |
+
</div>
|
6035 |
+
<div class="wdt-emoji-scroll-wrapper">
|
6036 |
+
<div id="wdt-emoji-menu-items">
|
6037 |
+
<input id="wdt-emoji-search" type="text" placeholder="Search">
|
6038 |
+
<h3 id="wdt-emoji-search-result-title">Search Results</h3>
|
6039 |
+
<div class="wdt-emoji-sections"></div>
|
6040 |
+
<div id="wdt-emoji-no-result">No emoji found</div>
|
6041 |
+
</div>
|
6042 |
+
</div>
|
6043 |
+
<div id="wdt-emoji-footer">
|
6044 |
+
<div id="wdt-emoji-preview">
|
6045 |
+
<span id="wdt-emoji-preview-img"></span>
|
6046 |
+
<div id="wdt-emoji-preview-text">
|
6047 |
+
<span id="wdt-emoji-preview-name"></span><br>
|
6048 |
+
<span id="wdt-emoji-preview-aliases"></span>
|
6049 |
+
</div>
|
6050 |
+
</div>
|
6051 |
+
<div id="wdt-emoji-preview-bundle">
|
6052 |
+
<span></span>
|
6053 |
+
</div>
|
6054 |
+
<span class="wdt-credit">WDT Emoji Bundle</span>
|
6055 |
+
</div>
|
6056 |
+
</div>
|
6057 |
+
</div>';
|
6058 |
+
}
|
6059 |
+
|
6060 |
+
return $emoji_container;
|
6061 |
+
|
6062 |
+
}
|
6063 |
+
|
6064 |
+
add_action("wplc_hook_chat_missed","wplc_missed_chats_deprecation_notice",5);
|
6065 |
+
/**
|
6066 |
+
* Displays a notice to the user that Missed Chats is being deprecated
|
6067 |
+
*/
|
6068 |
+
function wplc_missed_chats_deprecation_notice() {
|
6069 |
+
$output = "<div class='update-nag' style='margin-top: 0px;margin-bottom: 5px;'>";
|
6070 |
+
$output .= "<strong>" . __("Deprecation Notice", "wplivechat") . "</strong><br>";
|
6071 |
+
$output .= "<p>" . __("Please note, missed chat functionality is being deprecated as we will be moving to a customer oriented system in the near future. ", "wplivechat") . "</p>";
|
6072 |
+
$output .= "<p>" . __("The new system will offer more insight into your user base while enhancing your experience when retrieving statistics and information. ", "wplivechat") . "</p>";
|
6073 |
+
$output .= "<p>" . __("This area will remain active for the time being, however it is recommended that you prepare for this change in the near future. ", "wplivechat") . "</p>";
|
6074 |
+
$output .= "</div>";
|
6075 |
+
|
6076 |
+
echo $output;
|
6077 |
+
}
|
6078 |
+
|
6079 |
+
add_action( 'admin_notices', 'wplc_browser_notifications_admin_warning' );
|
6080 |
+
/**
|
6081 |
+
* Displays browser notifications warning.
|
6082 |
+
*
|
6083 |
+
* Only displays if site is insecure (no SSL).
|
6084 |
+
*/
|
6085 |
+
function wplc_browser_notifications_admin_warning() {
|
6086 |
+
|
6087 |
+
if ( ! is_ssl() && isset( $_GET['page'] ) && $_GET['page'] === 'wplivechat-menu-settings' ) {
|
6088 |
+
|
6089 |
+
if ( isset( $_GET['wplc_dismiss_notice_bn'] ) && 'true' === $_GET['wplc_dismiss_notice_bn'] ) {
|
6090 |
+
|
6091 |
+
update_option( 'wplc_dismiss_notice_bn', 'true' );
|
6092 |
+
|
6093 |
+
}
|
6094 |
+
|
6095 |
+
if ( get_option( 'wplc_dismiss_notice_bn') !== 'true' ) {
|
6096 |
+
|
6097 |
+
?>
|
6098 |
+
<div class="notice notice-warning is-dismissible">
|
6099 |
+
<p><img src="<?php echo esc_attr( plugins_url( 'images/wplc-logo.png', __FILE__ ) ); ?>" style="width:260px;height:auto;max-width:100%;"></p>
|
6100 |
+
<p><strong><?php esc_html_e( 'Browser notifications will no longer function on insecure (non-SSL) sites.', 'wplivechat' ); ?></strong></p>
|
6101 |
+
<p><?php esc_html_e( 'Please add an SSL certificate to your site to continue receiving chat notifications in your browser.', 'wplivechat' ); ?></p>
|
6102 |
+
<p><a href="?page=<?php echo esc_attr( $_GET['page'] ); ?>&wplc_dismiss_notice_bn=true" id="wplc_dismiss_notice_bn" class="button"><?php esc_html_e( "Don't Show This Again", 'wplivechat' ); ?></a></p>
|
6103 |
+
</div>
|
6104 |
+
<?php
|
6105 |
+
|
6106 |
+
}
|
6107 |
+
}
|
6108 |
+
}
|
6109 |
+
|
6110 |
+
if ( function_exists( 'wplc_et_first_run_check' ) ) {
|
6111 |
+
add_action( 'admin_notices', 'wplc_transcript_admin_notice' );
|
6112 |
+
}
|
6113 |
+
function wplc_transcript_admin_notice() {
|
6114 |
+
printf( '<div class="notice notice-info">%1$s</div>', __( 'Please deactivate WP Live Chat Suport - Email Transcript plugin. Since WP Live Chat Support 8.0.05 there is build in support for Email Transcript.', 'wplivechat' ) );
|
6115 |
+
}
|
6116 |
+
|
6117 |
+
add_action( 'init', 'wplc_transcript_first_run_check' );
|
6118 |
+
function wplc_transcript_first_run_check() {
|
6119 |
+
if ( ! get_option( "WPLC_ET_FIRST_RUN" ) ) {
|
6120 |
+
/* set the default settings */
|
6121 |
+
$wplc_et_data['wplc_enable_transcripts'] = 1;
|
6122 |
+
$wplc_et_data['wplc_send_transcripts_to'] = 'user';
|
6123 |
+
$wplc_et_data['wplc_send_transcripts_when_chat_ends'] = 0;
|
6124 |
+
$wplc_et_data['wplc_et_email_body'] = wplc_transcript_return_default_email_body();
|
6125 |
+
$wplc_et_data['wplc_et_email_header'] = '<a title="' . get_bloginfo( 'name' ) . '" href="' . get_bloginfo( 'url' ) . '" style="font-family: Arial, Helvetica, sans-serif; font-size: 13px; color: #FFF; font-weight: bold; text-decoration: underline;">' . get_bloginfo( 'name' ) . '</a>';
|
6126 |
+
|
6127 |
+
$default_footer_text = sprintf( __( 'Thank you for chatting with us. If you have any questions, please <a href="%1$s" target="_blank" style="font-family: Arial, Helvetica, sans-serif; font-size: 13px; color: #FFF; font-weight: bold; text-decoration: underline;">contact us</a>', 'wplivechat' ),
|
6128 |
+
'mailto:' . get_bloginfo( 'admin_email' )
|
6129 |
+
);
|
6130 |
+
|
6131 |
+
$wplc_et_data['wplc_et_email_footer'] = "<span style='font-family: Arial, Helvetica, sans-serif; font-size: 13px; color: #FFF; font-weight: normal;'>" . $default_footer_text . "</span>";
|
6132 |
+
|
6133 |
+
|
6134 |
+
update_option( 'WPLC_ET_SETTINGS', $wplc_et_data );
|
6135 |
+
update_option( "WPLC_ET_FIRST_RUN", true );
|
6136 |
+
}
|
6137 |
+
}
|
6138 |
+
|
6139 |
+
add_action( 'wplc_hook_admin_visitor_info_display_after', 'wplc_transcript_add_admin_button' );
|
6140 |
+
function wplc_transcript_add_admin_button( $cid ) {
|
6141 |
+
$wplc_et_settings = get_option( "WPLC_ET_SETTINGS" );
|
6142 |
+
$wplc_enable_transcripts = $wplc_et_settings['wplc_enable_transcripts'];
|
6143 |
+
if ( isset( $wplc_enable_transcripts ) && $wplc_enable_transcripts == 1 ) {
|
6144 |
+
echo "<p><a href=\"javascript:void(0);\" cid='" . sanitize_text_field( $cid ) . "' class=\"wplc_admin_email_transcript button button-secondary\" id=\"wplc_admin_email_transcript\">" . __( "Email transcript to user", "wplivechat" ) . "</a></p>";
|
6145 |
+
}
|
6146 |
+
}
|
6147 |
+
|
6148 |
+
add_action( 'wplc_hook_admin_javascript_chat', 'wplc_transcript_admin_javascript' );
|
6149 |
+
function wplc_transcript_admin_javascript() {
|
6150 |
+
$wplc_et_ajax_nonce = wp_create_nonce( "wplc_et_nonce" );
|
6151 |
+
wp_register_script( 'wplc_transcript_admin', plugins_url( '/js/wplc_transcript.js', __FILE__ ), null, '', true );
|
6152 |
+
$wplc_transcript_localizations = array(
|
6153 |
+
'ajax_nonce' => $wplc_et_ajax_nonce,
|
6154 |
+
'string_loading' => __( "Sending transcript...", "wplivechat" ),
|
6155 |
+
'string_title' => __( "Sending Transcript", "wplivechat" ),
|
6156 |
+
'string_close' => __( "Close", "wplivechat" ),
|
6157 |
+
'string_chat_emailed' => __( "The chat transcript has been emailed.", "wplivechat" ),
|
6158 |
+
'string_error1' => sprintf( __( "There was a problem emailing the chat. Please <a target='_BLANK' href='%s'>contact support</a>.", "wplivechat" ), "http://wp-livechat.com/contact-us/?utm_source=plugin&utm_medium=link&utm_campaign=error_emailing_chat" )
|
6159 |
+
);
|
6160 |
+
wp_localize_script( 'wplc_transcript_admin', 'wplc_transcript_nonce', $wplc_transcript_localizations );
|
6161 |
+
wp_enqueue_script( 'wplc_transcript_admin' );
|
6162 |
+
}
|
6163 |
+
|
6164 |
+
add_action( 'wp_ajax_wplc_et_admin_email_transcript', 'wplc_transcript_callback' );
|
6165 |
+
function wplc_transcript_callback() {
|
6166 |
+
$check = check_ajax_referer( 'wplc_et_nonce', 'security' );
|
6167 |
+
if ( $check == 1 ) {
|
6168 |
+
|
6169 |
+
if ( isset( $_POST['el'] ) && $_POST['el'] === 'endChat' ) {
|
6170 |
+
$wplc_et_settings = get_option( "WPLC_ET_SETTINGS" );
|
6171 |
+
$transcript_chat_ends = $wplc_et_settings['wplc_send_transcripts_when_chat_ends'];
|
6172 |
+
if ( $transcript_chat_ends === 0 ) {
|
6173 |
+
wp_die();
|
6174 |
+
}
|
6175 |
+
}
|
6176 |
+
|
6177 |
+
if ( $_POST['action'] == "wplc_et_admin_email_transcript" ) {
|
6178 |
+
if ( isset( $_POST['cid'] ) ) {
|
6179 |
+
$cid = wplc_return_chat_id_by_rel( $_POST['cid'] );
|
6180 |
+
echo json_encode( wplc_send_transcript( sanitize_text_field( $cid ) ) );
|
6181 |
+
} else {
|
6182 |
+
echo json_encode( array( "error" => "no CID" ) );
|
6183 |
+
}
|
6184 |
+
wp_die();
|
6185 |
+
}
|
6186 |
+
|
6187 |
+
wp_die();
|
6188 |
+
}
|
6189 |
+
wp_die();
|
6190 |
+
}
|
6191 |
+
|
6192 |
+
function wplc_send_transcript( $cid ) {
|
6193 |
+
if ( ! $cid ) {
|
6194 |
+
return array( "error" => "no CID", "cid" => $cid );
|
6195 |
+
}
|
6196 |
+
|
6197 |
+
if( ! filter_var($cid, FILTER_VALIDATE_INT) ) {
|
6198 |
+
/* We need to identify if this CID is a node CID, and if so, return the WP CID */
|
6199 |
+
$cid = wplc_return_chat_id_by_rel($cid);
|
6200 |
+
}
|
6201 |
+
|
6202 |
+
$email = false;
|
6203 |
+
$wplc_et_settings = get_option( "WPLC_ET_SETTINGS" );
|
6204 |
+
|
6205 |
+
$wplc_enable_transcripts = $wplc_et_settings['wplc_enable_transcripts'];
|
6206 |
+
if ( isset( $wplc_enable_transcripts ) && $wplc_enable_transcripts == 1 ) {
|
6207 |
+
|
6208 |
+
if ( function_exists( "wplc_get_chat_data" ) ) {
|
6209 |
+
$cdata = wplc_get_chat_data( $cid );
|
6210 |
+
if ( $cdata ) {
|
6211 |
+
if ( $wplc_et_settings['wplc_send_transcripts_to'] === 'admin' ) {
|
6212 |
+
$user = wp_get_current_user();
|
6213 |
+
$email = $user->user_email;
|
6214 |
+
} else {
|
6215 |
+
$email = $cdata->email;
|
6216 |
+
}
|
6217 |
+
if ( ! $email ) {
|
6218 |
+
return array( "error" => "no email" );
|
6219 |
+
}
|
6220 |
+
} else {
|
6221 |
+
return array( "error" => "no chat data" );
|
6222 |
+
}
|
6223 |
+
} else {
|
6224 |
+
return array( "error" => "basic funtion missing" );
|
6225 |
+
}
|
6226 |
+
|
6227 |
+
$headers = array( 'Content-Type: text/html; charset=UTF-8' );
|
6228 |
+
$subject = sprintf( __( 'Your chat transcript from %1$s', 'wplivechat' ),
|
6229 |
+
get_bloginfo( 'url' )
|
6230 |
+
);
|
6231 |
+
wp_mail( $email, $subject, wplc_transcript_return_chat_messages( $cid ), $headers );
|
6232 |
+
|
6233 |
+
}
|
6234 |
+
|
6235 |
+
return array( "success" => 1 );
|
6236 |
+
|
6237 |
+
}
|
6238 |
+
add_action('wplc_send_transcript_hook', 'wplc_send_transcript', 10, 1);
|
6239 |
+
|
6240 |
+
function wplc_transcript_return_chat_messages( $cid ) {
|
6241 |
+
global $current_chat_id;
|
6242 |
+
$current_chat_id = $cid;
|
6243 |
+
$wplc_et_settings = get_option( "WPLC_ET_SETTINGS" );
|
6244 |
+
$body = html_entity_decode( stripslashes( $wplc_et_settings['wplc_et_email_body'] ) );
|
6245 |
+
|
6246 |
+
if ( ! $body ) {
|
6247 |
+
$body = do_shortcode( wplc_transcript_return_default_email_body() );
|
6248 |
+
} else {
|
6249 |
+
$body = do_shortcode( $body );
|
6250 |
+
}
|
6251 |
+
|
6252 |
+
return $body;
|
6253 |
+
}
|
6254 |
+
|
6255 |
+
function wplc_transcript_return_default_email_body() {
|
6256 |
+
$body = '
|
6257 |
+
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">
|
6258 |
+
<html>
|
6259 |
+
|
6260 |
+
<body>
|
6261 |
+
|
6262 |
+
|
6263 |
+
|
6264 |
+
<table id="" border="0" cellpadding="0" cellspacing="0" width="100%" style="background-color: #ec822c;">
|
6265 |
+
<tbody>
|
6266 |
+
<tr>
|
6267 |
+
<td width="100%" style="padding: 30px 20px 100px 20px;">
|
6268 |
+
<table align="center" cellpadding="0" cellspacing="0" class="" width="100%" style="border-collapse: separate; max-width:600px;">
|
6269 |
+
<tbody>
|
6270 |
+
<tr>
|
6271 |
+
<td style="text-align: center; padding-bottom: 20px;">
|
6272 |
+
|
6273 |
+
<p>[wplc_et_transcript_header_text]</p>
|
6274 |
+
</td>
|
6275 |
+
</tr>
|
6276 |
+
</tbody>
|
6277 |
+
</table>
|
6278 |
+
|
6279 |
+
<table id="" align="center" cellpadding="0" cellspacing="0" class="" width="100%" style="border-collapse: separate; max-width: 600px; font-family: Georgia, serif; font-size: 12px; color: rgb(51, 62, 72); border: 0px solid rgb(255, 255, 255); border-radius: 10px; background-color: rgb(255, 255, 255);">
|
6280 |
+
<tbody>
|
6281 |
+
<tr>
|
6282 |
+
<td class="sortable-list ui-sortable" style="padding:20px;">
|
6283 |
+
[wplc_et_transcript]
|
6284 |
+
</td>
|
6285 |
+
</tr>
|
6286 |
+
</tbody>
|
6287 |
+
</table>
|
6288 |
+
|
6289 |
+
<table align="center" cellpadding="0" cellspacing="0" class="" width="100%" style="border-collapse: separate; max-width:100%;">
|
6290 |
+
<tbody>
|
6291 |
+
<tr>
|
6292 |
+
<td style="padding:20px;">
|
6293 |
+
<table border="0" cellpadding="0" cellspacing="0" class="" width="100%">
|
6294 |
+
<tbody>
|
6295 |
+
<tr>
|
6296 |
+
<td id="" align="center">
|
6297 |
+
<p>[wplc_et_transcript_footer_text]</p>
|
6298 |
+
</td>
|
6299 |
+
</tr>
|
6300 |
+
</tbody>
|
6301 |
+
</table>
|
6302 |
+
</td>
|
6303 |
+
</tr>
|
6304 |
+
</tbody>
|
6305 |
+
</table>
|
6306 |
+
</td>
|
6307 |
+
</tr>
|
6308 |
+
</tbody>
|
6309 |
+
</table>
|
6310 |
+
|
6311 |
+
|
6312 |
+
|
6313 |
+
</div>
|
6314 |
+
</body>
|
6315 |
+
</html>
|
6316 |
+
';
|
6317 |
+
|
6318 |
+
return $body;
|
6319 |
+
}
|
6320 |
+
|
6321 |
+
add_action( 'wplc_hook_admin_settings_save', 'wplc_transcript_save_settings' );
|
6322 |
+
function wplc_transcript_save_settings() {
|
6323 |
+
if ( isset( $_POST['wplc_save_settings'] ) ) {
|
6324 |
+
if ( isset( $_POST['wplc_enable_transcripts'] ) ) {
|
6325 |
+
$wplc_et_data['wplc_enable_transcripts'] = esc_attr( $_POST['wplc_enable_transcripts'] );
|
6326 |
+
} else {
|
6327 |
+
$wplc_et_data['wplc_enable_transcripts'] = 0;
|
6328 |
+
}
|
6329 |
+
if ( isset( $_POST['wplc_send_transcripts_to'] ) ) {
|
6330 |
+
$wplc_et_data['wplc_send_transcripts_to'] = esc_attr( $_POST['wplc_send_transcripts_to'] );
|
6331 |
+
} else {
|
6332 |
+
$wplc_et_data['wplc_send_transcripts_to'] = 'user';
|
6333 |
+
}
|
6334 |
+
if ( isset( $_POST['wplc_send_transcripts_when_chat_ends'] ) ) {
|
6335 |
+
$wplc_et_data['wplc_send_transcripts_when_chat_ends'] = esc_attr( $_POST['wplc_send_transcripts_when_chat_ends'] );
|
6336 |
+
} else {
|
6337 |
+
$wplc_et_data['wplc_send_transcripts_when_chat_ends'] = 0;
|
6338 |
+
}
|
6339 |
+
if ( isset( $_POST['wplc_et_email_header'] ) ) {
|
6340 |
+
$wplc_et_data['wplc_et_email_header'] = esc_attr( $_POST['wplc_et_email_header'] );
|
6341 |
+
}
|
6342 |
+
if ( isset( $_POST['wplc_et_email_footer'] ) ) {
|
6343 |
+
$wplc_et_data['wplc_et_email_footer'] = esc_attr( $_POST['wplc_et_email_footer'] );
|
6344 |
+
}
|
6345 |
+
if ( isset( $_POST['wplc_et_email_body'] ) ) {
|
6346 |
+
$wplc_et_data['wplc_et_email_body'] = esc_html( $_POST['wplc_et_email_body'] );
|
6347 |
+
}
|
6348 |
+
update_option( 'WPLC_ET_SETTINGS', $wplc_et_data );
|
6349 |
+
|
6350 |
+
}
|
6351 |
+
}
|
6352 |
+
|
6353 |
+
add_action( 'wplc_hook_admin_settings_main_settings_after', 'wplc_hook_admin_transcript_settings' );
|
6354 |
+
function wplc_hook_admin_transcript_settings() {
|
6355 |
+
$wplc_et_settings = get_option( "WPLC_ET_SETTINGS" );
|
6356 |
+
echo "<hr />";
|
6357 |
+
echo "<h3>" . __( "Chat Transcript Settings", 'wplivechat' ) . "</h3>";
|
6358 |
+
echo "<table class='form-table wp-list-table widefat fixed striped pages' width='700'>";
|
6359 |
+
echo " <tr>";
|
6360 |
+
echo " <td width='400' valign='top'>" . __( "Enable chat transcripts:", "wplivechat" ) . "</td>";
|
6361 |
+
echo " <td>";
|
6362 |
+
echo " <input type=\"checkbox\" value=\"1\" name=\"wplc_enable_transcripts\" ";
|
6363 |
+
if ( isset( $wplc_et_settings['wplc_enable_transcripts'] ) && $wplc_et_settings['wplc_enable_transcripts'] == 1 ) {
|
6364 |
+
echo "checked";
|
6365 |
+
}
|
6366 |
+
echo " />";
|
6367 |
+
echo " </td>";
|
6368 |
+
echo " </tr>";
|
6369 |
+
|
6370 |
+
echo " <tr>";
|
6371 |
+
echo " <td width='400' valign='top'>" . __( "Send transcripts to:", "wplivechat" ) . "</td>";
|
6372 |
+
echo " <td>";
|
6373 |
+
echo " <select name=\"wplc_send_transcripts_to\">";
|
6374 |
+
echo " <option value=\"user\" ";
|
6375 |
+
if ( isset( $wplc_et_settings['wplc_send_transcripts_to'] ) && $wplc_et_settings['wplc_send_transcripts_to'] == 'user' ) {
|
6376 |
+
echo "selected";
|
6377 |
+
}
|
6378 |
+
echo ">" . __( "User", "wplivechat" ) . "</option>";
|
6379 |
+
echo " <option value=\"admin\" ";
|
6380 |
+
if ( isset( $wplc_et_settings['wplc_send_transcripts_to'] ) && $wplc_et_settings['wplc_send_transcripts_to'] == 'admin' ) {
|
6381 |
+
echo "selected";
|
6382 |
+
}
|
6383 |
+
echo ">" . __( "Admin", "wplivechat" ) . "</option>";
|
6384 |
+
echo " </select>";
|
6385 |
+
echo " </td>";
|
6386 |
+
echo " </tr>";
|
6387 |
+
|
6388 |
+
echo " <tr>";
|
6389 |
+
echo " <td width='400' valign='top'>" . __( "Send transcripts when chat ends:", "wplivechat" ) . "</td>";
|
6390 |
+
echo " <td>";
|
6391 |
+
echo " <input type=\"checkbox\" value=\"1\" name=\"wplc_send_transcripts_when_chat_ends\" ";
|
6392 |
+
if ( isset( $wplc_et_settings['wplc_send_transcripts_when_chat_ends'] ) && $wplc_et_settings['wplc_send_transcripts_when_chat_ends'] == 1 ) {
|
6393 |
+
echo "checked";
|
6394 |
+
}
|
6395 |
+
echo " />";
|
6396 |
+
echo " </td>";
|
6397 |
+
echo " </tr>";
|
6398 |
+
|
6399 |
+
echo " <tr>";
|
6400 |
+
echo " <td width='400' valign='top'>" . __( "Email body", "wplivechat" ) . "</td>";
|
6401 |
+
echo " <td>";
|
6402 |
+
echo " <textarea cols='85' rows='15' name=\"wplc_et_email_body\">";
|
6403 |
+
if ( isset( $wplc_et_settings['wplc_et_email_body'] ) ) {
|
6404 |
+
echo html_entity_decode( stripslashes( $wplc_et_settings['wplc_et_email_body'] ) );
|
6405 |
+
}
|
6406 |
+
echo " </textarea>";
|
6407 |
+
echo " </td>";
|
6408 |
+
echo " </tr>";
|
6409 |
+
|
6410 |
+
|
6411 |
+
echo " <tr>";
|
6412 |
+
echo " <td width='400' valign='top'>" . __( "Email header", "wplivechat" ) . "</td>";
|
6413 |
+
echo " <td>";
|
6414 |
+
echo " <textarea cols='85' rows='5' name=\"wplc_et_email_header\">";
|
6415 |
+
if ( isset( $wplc_et_settings['wplc_et_email_header'] ) ) {
|
6416 |
+
echo stripslashes( $wplc_et_settings['wplc_et_email_header'] );
|
6417 |
+
}
|
6418 |
+
echo " </textarea>";
|
6419 |
+
echo " </td>";
|
6420 |
+
echo " </tr>";
|
6421 |
+
|
6422 |
+
echo " <tr>";
|
6423 |
+
echo " <td width='400' valign='top'>" . __( "Email footer", "wplivechat" ) . "</td>";
|
6424 |
+
echo " <td>";
|
6425 |
+
echo " <textarea cols='85' rows='5' name=\"wplc_et_email_footer\">";
|
6426 |
+
if ( isset( $wplc_et_settings['wplc_et_email_footer'] ) ) {
|
6427 |
+
echo stripslashes( $wplc_et_settings['wplc_et_email_footer'] );
|
6428 |
+
}
|
6429 |
+
echo " </textarea>";
|
6430 |
+
echo " </td>";
|
6431 |
+
echo " </tr>";
|
6432 |
+
|
6433 |
+
|
6434 |
+
echo "</table>";
|
6435 |
+
}
|
6436 |
+
|
6437 |
+
add_shortcode('wplc_et_transcript', 'wplc_transcript_get_transcript');
|
6438 |
+
function wplc_transcript_get_transcript() {
|
6439 |
+
global $current_chat_id;
|
6440 |
+
$cid = $current_chat_id;
|
6441 |
+
|
6442 |
+
if ( intval( $cid ) > 0 ) {
|
6443 |
+
return wplc_return_chat_messages( intval( $cid ), true );
|
6444 |
+
} else {
|
6445 |
+
return "0";
|
6446 |
+
}
|
6447 |
+
}
|
6448 |
+
|
6449 |
+
add_shortcode( 'wplc_et_transcript_footer_text', 'wplc_transcript_get_footer_text' );
|
6450 |
+
function wplc_transcript_get_footer_text() {
|
6451 |
+
$wplc_et_settings = get_option( "WPLC_ET_SETTINGS" );
|
6452 |
+
$wplc_et_footer = html_entity_decode( stripslashes( $wplc_et_settings['wplc_et_email_footer'] ) );
|
6453 |
+
if ( $wplc_et_footer ) {
|
6454 |
+
return $wplc_et_footer;
|
6455 |
+
} else {
|
6456 |
+
return "";
|
6457 |
+
}
|
6458 |
+
}
|
6459 |
+
|
6460 |
+
add_shortcode( 'wplc_et_transcript_header_text', 'wplc_transcript_get_header_text' );
|
6461 |
+
function wplc_transcript_get_header_text() {
|
6462 |
+
$wplc_et_settings = get_option( "WPLC_ET_SETTINGS" );
|
6463 |
+
|
6464 |
+
global $current_chat_id;
|
6465 |
+
$cid = $current_chat_id;
|
6466 |
+
|
6467 |
+
$from_email = "Unknown@unknown.com";
|
6468 |
+
$from_name = "User";
|
6469 |
+
if ( intval( $cid ) > 0 ) {
|
6470 |
+
$chat_data = wplc_get_chat_data( $cid );
|
6471 |
+
if ( isset( $chat_data->email ) ) {
|
6472 |
+
$from_email = $chat_data->email;
|
6473 |
+
}
|
6474 |
+
if ( isset( $chat_data->name ) ) {
|
6475 |
+
$from_name = $chat_data->name;
|
6476 |
+
}
|
6477 |
+
}
|
6478 |
+
|
6479 |
+
$wplc_et_header = "<h3>".$from_name." (".$from_email.")"."</h3>".html_entity_decode( stripslashes( $wplc_et_settings['wplc_et_email_header'] ) );
|
6480 |
+
if ( $wplc_et_header ) {
|
6481 |
+
return $wplc_et_header;
|
6482 |
+
} else {
|
6483 |
+
return "";
|
6484 |
+
}
|
6485 |
}
|