WP Live Chat Support - Version 8.0.05

Version Description

  • 2018-03-09 - Medium priority =
  • Chat minimize is now respected
  • GIF integration support (Giphy, Tenor)
  • Fixed get correct rest api endpoint urls
  • Fixed chat box header not respecting Use WordPress name instead option
  • Fixes CSS issue in dashboard with the action column
  • Fixes chat history styling
  • Mac style fix (front end)
  • Email transcript integrated
Download this release

Release Info

Developer WP-LiveChat
Plugin Icon 128x128 WP Live Chat Support
Version 8.0.05
Comparing to
See all releases

Code changes from version 8.0.04 to 8.0.05

css/admin-chat-style.css CHANGED
@@ -430,3 +430,14 @@ span.bleeper-edit-message {
430
  border-radius: 2px;
431
  box-shadow: 0px 0px 10px 1px rgba(0,0,0,0.1);
432
  }
 
 
 
 
 
 
 
 
 
 
 
430
  border-radius: 2px;
431
  box-shadow: 0px 0px 10px 1px rgba(0,0,0,0.1);
432
  }
433
+
434
+ #chatTranscriptTitle {
435
+ display: block !important;
436
+ }
437
+
438
+ #chatTranscriptTitle.is-disabled {
439
+ color: currentColor;
440
+ cursor: not-allowed;
441
+ opacity: .5;
442
+ text-decoration: none;
443
+ }
css/admin_styles.css CHANGED
@@ -304,3 +304,12 @@
304
  }
305
  .wplc_agent_container small { word-wrap: break-word; display:block; height:50px; }
306
  .wplc_agent_container select { width: 120px; }
 
 
 
 
 
 
 
 
 
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
+ }
css/node_history_styles.css CHANGED
@@ -72,4 +72,24 @@
72
 
73
  .wplc_bottom_chat_info_container h3{
74
  margin-top: 0 !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  }
72
 
73
  .wplc_bottom_chat_info_container h3{
74
  margin-top: 0 !important;
75
+ }
76
+
77
+ .wplc-user-message, .wplc-admin-message {
78
+ display: block;
79
+ max-width: 80%;
80
+ margin: 5px;
81
+ padding: 5px;
82
+ border-radius: 3px;
83
+ }
84
+
85
+ .wplc-user-message-avatar, .wplc-admin-message-avatar {
86
+ display: inline-block;
87
+ border-radius: 20px;
88
+ }
89
+
90
+ .wplc-msg-content{
91
+
92
+ display: inline-block;
93
+ padding-left:10px
94
+
95
  }
css/remote_dash_styles.css CHANGED
@@ -118,8 +118,8 @@ div#choose_online {
118
  .wplc_remote_dash_below_contianer {
119
  border-radius: 4px;
120
  overflow: hidden;
121
- box-shadow: 0 0 40px 1px rgba(0,0,0,.07);
122
- background:#fff;
123
  margin-top:10px;
124
  margin-right: 20px;
125
  padding: 10px;
@@ -419,7 +419,7 @@ span.bleeper-edit-message {
419
  }
420
  #nifty_wrapper .visitorListBoxHeader .vcol.visActionCol,
421
  #nifty_wrapper .visitorListBox .visitorList .vcol.visActionCol {
422
- width: 20%;
423
  }
424
 
425
  /* List header */
118
  .wplc_remote_dash_below_contianer {
119
  border-radius: 4px;
120
  overflow: hidden;
121
+ /*box-shadow: 0 0 40px 1px rgba(0,0,0,.07);
122
+ background:#fff;*/
123
  margin-top:10px;
124
  margin-right: 20px;
125
  padding: 10px;
419
  }
420
  #nifty_wrapper .visitorListBoxHeader .vcol.visActionCol,
421
  #nifty_wrapper .visitorListBox .visitorList .vcol.visActionCol {
422
+ width: 10%;
423
  }
424
 
425
  /* List header */
css/themes/classic.css CHANGED
File without changes
css/themes/modern.css CHANGED
@@ -74,8 +74,8 @@
74
  z-index: 99998;
75
  position: absolute;
76
  overflow-y: auto;
77
- padding:10px;
78
- width:100%;
79
  overflow-y: scroll;
80
  }
81
  #wp-live-chat-inner-container {
@@ -1176,4 +1176,48 @@ div#bleeper_chat_ended {
1176
  top: -35px;
1177
  opacity: .8;
1178
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1179
  }
74
  z-index: 99998;
75
  position: absolute;
76
  overflow-y: auto;
77
+ padding: 5%;
78
+
79
  overflow-y: scroll;
80
  }
81
  #wp-live-chat-inner-container {
1176
  top: -35px;
1177
  opacity: .8;
1178
  }
1179
+ }
1180
+ /* iPhone fix */
1181
+ @media screen and (max-height: 675px){
1182
+ #wp-live-chat-2 {
1183
+ bottom: 70px;
1184
+ }
1185
+
1186
+ }
1187
+
1188
+ div#bleeper_bell {
1189
+ animation: shake 0.82s cubic-bezier(.36,.07,.19,.97) both;
1190
+ transform: translate3d(0, 0, 0);
1191
+ backface-visibility: hidden;
1192
+ perspective: 1000px;
1193
+ z-index: 99;
1194
+ position: absolute;
1195
+ color: #fff;
1196
+ right: 0;
1197
+ width: 22px;
1198
+ background-color: #d6abab;
1199
+ height: 22px;
1200
+ text-align: center;
1201
+ /* padding-top: 2px; */
1202
+ font-size: 11px;
1203
+ border-radius: 20px;
1204
+ border: 2px solid #fff;
1205
+
1206
+ }
1207
+ @keyframes shake {
1208
+ 10%, 90% {
1209
+ transform: translate3d(-1px, 0, 0);
1210
+ }
1211
+
1212
+ 20%, 80% {
1213
+ transform: translate3d(2px, 0, 0);
1214
+ }
1215
+
1216
+ 30%, 50%, 70% {
1217
+ transform: translate3d(-2px, 0, 0);
1218
+ }
1219
+
1220
+ 40%, 60% {
1221
+ transform: translate3d(2px, 0, 0);
1222
+ }
1223
  }
css/wplc_gif_integration.css ADDED
@@ -0,0 +1,364 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * GIF image style within a message
3
+ */
4
+ .messageBody .gif-img {
5
+ max-width: 100%;
6
+ margin-bottom: -5px;
7
+ }
8
+
9
+ /**
10
+ * GIF Search box
11
+ */
12
+ /* Loader */
13
+ .wplc-gif-integration-search-box .gif-sb-loader {
14
+ display:block;
15
+ position: absolute;
16
+ left:0px;
17
+ top:0px;
18
+ width: 100%;
19
+ height: 100%;
20
+ z-index: 1;
21
+ background-color:#ffffff;
22
+ }
23
+ .wplc-gif-integration-search-box .gif-sb-loader.hidden {
24
+ display: none;
25
+ z-index: 0;
26
+ }
27
+ .wplc-gif-integration-search-box .gif-sb-loader img {
28
+ display: block;
29
+ position: relative;
30
+ top: calc(50% - 25px);
31
+ width: 50px;
32
+ height: auto;
33
+ margin: auto;
34
+ }
35
+
36
+ /* Outter container */
37
+ .wplc-gif-integration-search-box.show,
38
+ .wplc-gif-integration-search-box {
39
+ display: block;
40
+ position: absolute;
41
+ bottom: 66px;
42
+ width: 70%;
43
+ margin-left:15%;
44
+ height: 300px;
45
+ background: #fafafa;
46
+ z-index: 100000000;
47
+ box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
48
+ transition: all 0.3s cubic-bezier(.25,.8,.25,1);
49
+ }
50
+ .wplc-gif-integration-search-box.show {
51
+ animation-name: present-gif-search-box;
52
+ animation-duration: 500ms;
53
+ animation-timing-function: ease-in-out;
54
+ animation-fill-mode: forwards;
55
+
56
+ -webkit-animation-name: present-gif-search-box;
57
+ -webkit-animation-duration: 500ms;
58
+ -webkit-animation-timing-function: ease-in-out;
59
+ -webkit-animation-fill-mode: forwards;
60
+
61
+ -moz-animation-name: present-gif-search-box;
62
+ -moz-animation-duration: 500ms;
63
+ -moz-animation-timing-function: ease-in-out;
64
+ -moz-animation-fill-mode: forwards;
65
+
66
+ -ms-animation-name: present-gif-search-box;
67
+ -ms-animation-duration: 500ms;
68
+ -ms-animation-timing-function: ease-in-out;
69
+ -ms-animation-fill-mode: forwards;
70
+ }
71
+ .wplc-gif-integration-search-box {
72
+ animation-name: dismiss-gif-search-box;
73
+ animation-duration: 500ms;
74
+ animation-timing-function: ease-in-out;
75
+ animation-fill-mode: forwards;
76
+
77
+ -webkit-animation-name: dismiss-gif-search-box;
78
+ -webkit-animation-duration: 500ms;
79
+ -webkit-animation-timing-function: ease-in-out;
80
+ -webkit-animation-fill-mode: forwards;
81
+
82
+ -moz-animation-name: dismiss-gif-search-box;
83
+ -moz-animation-duration: 500ms;
84
+ -moz-animation-timing-function: ease-in-out;
85
+ -moz-animation-fill-mode: forwards;
86
+
87
+ -ms-animation-name: dismiss-gif-search-box;
88
+ -ms-animation-duration: 500ms;
89
+ -ms-animation-timing-function: ease-in-out;
90
+ -ms-animation-fill-mode: forwards;
91
+ }
92
+ .wplc-gif-integration-search-box.hidden {
93
+ display: none;
94
+ }
95
+
96
+ /**
97
+ * Present full screen msg
98
+ */
99
+ @keyframes present-gif-search-box {
100
+ 0% {
101
+ left: 5000px;
102
+ }
103
+ 100% {
104
+ left: 0px;
105
+ }
106
+ }
107
+ @-moz-keyframes present-gif-search-box {
108
+ 0% {
109
+ left: 5000px;
110
+ }
111
+ 100% {
112
+ left: 0px;
113
+ }
114
+ }
115
+ @-webkit-keyframes present-gif-search-box {
116
+ 0% {
117
+ left: 5000px;
118
+ }
119
+ 100% {
120
+ left: 0px;
121
+ }
122
+ }
123
+
124
+ /**
125
+ * Dismiss full screen msg
126
+ */
127
+ @keyframes dismiss-gif-search-box {
128
+ 0% {
129
+ left: 0px;
130
+ }
131
+ 100% {
132
+ left: 5000px;
133
+ }
134
+ }
135
+ @-moz-keyframes dismiss-gif-search-box {
136
+ 0% {
137
+ left: 0px;
138
+ }
139
+ 100% {
140
+ left: 5000px;
141
+ }
142
+ }
143
+ @-webkit-keyframes dismiss-gif-search-box {
144
+ 0% {
145
+ left: 0px;
146
+ }
147
+ 100% {
148
+ left: 5000px;
149
+ }
150
+ }
151
+
152
+ @media(max-width:767px) {
153
+
154
+ .wplc-gif-integration-search-box.show,
155
+ .wplc-gif-integration-search-box {
156
+ bottom: 75px;
157
+ }
158
+
159
+ }
160
+
161
+ /* Header, Body and Footer */
162
+ .wplc-gif-integration-search-box .gif-sb-header,
163
+ .wplc-gif-integration-search-box .gif-sb-body,
164
+ .wplc-gif-integration-search-box .gif-sb-footer {
165
+ display: block;
166
+ position: relative;
167
+ left: 0px;
168
+ top: 0px;
169
+ width: 100%;
170
+ height: auto;
171
+ padding: 10px;
172
+ padding-top: 5px;
173
+ padding-bottom: 5px;
174
+ }
175
+
176
+ /* Header */
177
+ .wplc-gif-integration-search-box .gif-sb-header {
178
+ min-height: 10%;
179
+ background-color:#ffffff;
180
+ border: 1px solid #e6e6e6;
181
+ }
182
+ .wplc-gif-integration-search-box .gif-sb-header .gif-sb-search-term,
183
+ .wplc-gif-integration-search-box .gif-sb-header .gif-sb-confirm-search, {
184
+ display: inline-block;
185
+ position: relative;
186
+ left: 0px;
187
+ margin: 0px;
188
+ border-bottom: 1px solid #f0f0f0 !important;
189
+ background-color: transparent !important;
190
+ border-right: none;
191
+ }
192
+ .wplc-gif-integration-search-box .gif-sb-header .gif-sb-confirm-search i,
193
+ .wplc-gif-integration-search-box .gif-sb-header .gif-sb-close i,
194
+ .wplc-gif-integration-search-box .gif-sb-header .gif-sb-confirm-search:hover i,
195
+ .wplc-gif-integration-search-box .gif-sb-header .gif-sb-close:hover i {
196
+ display: block;
197
+ position: relative;
198
+ left: 0px;
199
+ font-style: initial;
200
+ color:#ccc;
201
+ }
202
+
203
+ .wplc-gif-integration-search-box .gif-sb-header .gif-sb-close {
204
+ position: absolute;
205
+ top: 3px;
206
+ right: 4px;
207
+
208
+ border: none !important;
209
+ }
210
+
211
+ .wplc-gif-integration-search-box .gif-sb-header .gif-sb-confirm-search,
212
+ .wplc-gif-integration-search-box .gif-sb-header .gif-sb-close,
213
+ .wplc-gif-integration-search-box .gif-sb-header .gif-sb-confirm-search:hover,
214
+ .wplc-gif-integration-search-box .gif-sb-header .gif-sb-close:hover {
215
+ text-decoration: none !important;
216
+ }
217
+
218
+ .wplc-gif-integration-search-box .gif-sb-header .gif-sb-search-term {
219
+ top: -1px;
220
+ width: 95%;
221
+ height: 38px;
222
+ margin-bottom: 0px !important;
223
+ padding-left: 10px !important;
224
+ padding-right: 10px !important;
225
+ background-color:transparent !important;
226
+ border-bottom:1px solid #eee !important;
227
+ border-top: none;
228
+ border-left: none;
229
+ border-right: none;
230
+ }
231
+
232
+ .wplc-gif-integration-search-box .gif-sb-header .gif-sb-confirm-search,
233
+ .wplc-gif-integration-search-box .gif-sb-header .gif-sb-confirm-search:hover {
234
+ top: 0px;
235
+ left: 1px;
236
+ width: 10%;
237
+ height: 40px;
238
+ text-align: center;
239
+ padding-top: 10px;
240
+ border-radius: 3px;
241
+
242
+ }
243
+
244
+
245
+ .wplc-gif-integration-search-box .gif-sb-header .gif-sb-confirm-search i,
246
+ .wplc-gif-integration-search-box .gif-sb-header .gif-sb-confirm-search:hover i {
247
+ top:0px;
248
+ left:-1px;
249
+ font-weight: 600;
250
+ }
251
+
252
+ .wplc-gif-integration-search-box .gif-sb-header .gif-sb-close {
253
+ color: #999999 !important;
254
+ cursor: pointer;
255
+ }
256
+ .wplc-gif-integration-search-box .gif-sb-header .gif-sb-close:hover {
257
+ background-color: #ffffff;
258
+ color: #333333 !important;
259
+ }
260
+ .wplc-gif-integration-search-box .gif-sb-header .gif-sb-close i,
261
+ .wplc-gif-integration-search-box .gif-sb-header .gif-sb-close:hover i {
262
+ top: -3px;
263
+ font-weight: 500;
264
+ }
265
+
266
+ /* Body */
267
+ .wplc-gif-integration-search-box .gif-sb-body {
268
+ min-height: 65%;
269
+ max-height: 195px;
270
+ background-color: #f0f0f0;
271
+ border: 1px solid #eaeaea;
272
+ overflow: auto;
273
+ }
274
+ .wplc-gif-integration-search-box .gif-sb-body .gif-img,
275
+ .wplc-gif-integration-search-box .gif-sb-body .gif-img:hover,
276
+ .wplc-gif-integration-search-box .gif-sb-body .gif-img.selected-gif {
277
+ display:inline-block;
278
+ position:relative;
279
+ left:0px;
280
+ top:0px;
281
+ min-height:70px;
282
+ min-height:70px;
283
+ width: auto;
284
+ max-width: 100px;
285
+ margin-left: 2px;
286
+ margin-right: 2px;
287
+ margin-bottom: 1px;
288
+ }
289
+ .wplc-gif-integration-search-box .gif-sb-body .gif-img {
290
+ opacity:0.7;
291
+ }
292
+ .wplc-gif-integration-search-box .gif-sb-body .gif-img:hover {
293
+ opacity:1;
294
+ }
295
+ .wplc-gif-integration-search-box .gif-sb-body .gif-img.selected-gif {
296
+ min-height:100px;
297
+ opacity:1;
298
+ }
299
+
300
+ @media(max-width:767px) {
301
+ .wplc-gif-integration-search-box .gif-sb-body .gif-img {
302
+ width:50%;
303
+ }
304
+ }
305
+
306
+ @media(max-width:900px) {
307
+ .wplc-gif-integration-search-box .gif-sb-body .gif-img {
308
+ width:33%;
309
+ }
310
+ }
311
+
312
+ @media(max-width:1200px) {
313
+ .wplc-gif-integration-search-box .gif-sb-body .gif-img {
314
+ width:20%;
315
+ }
316
+ }
317
+
318
+ /* Footer */
319
+ .wplc-gif-integration-search-box .gif-sb-footer {
320
+ min-height: 10%;
321
+ background-color: #fafafa;
322
+ border: 1px solid #eaeaea;
323
+ font-size: 0.9em;
324
+ color: #777777;
325
+ }
326
+
327
+ /**
328
+ * Adjustments of the base style made for the admin chat
329
+ */
330
+ /**
331
+ * GIF image style within a message
332
+ */
333
+ #chat_area .messageBody .gif-img {
334
+ max-width: 100%;
335
+ margin-bottom: 0px;
336
+ }
337
+
338
+ /* Header */
339
+ #chat_area .wplc-gif-integration-search-box .gif-sb-header .gif-sb-search-term {
340
+ top:1px;
341
+ }
342
+ #chat_area .wplc-gif-integration-search-box .gif-sb-header .gif-sb-confirm-search,
343
+ #chat_area .wplc-gif-integration-search-box .gif-sb-header .gif-sb-confirm-search:hover {
344
+
345
+ padding-top: 9px;
346
+ }
347
+ #chat_area .wplc-gif-integration-search-box .gif-sb-header .gif-sb-close,
348
+ #chat_area .wplc-gif-integration-search-box .gif-sb-header .gif-sb-close:hover {
349
+ top: 2px;
350
+ height: 38px;
351
+ }
352
+ #chat_area .wplc-gif-integration-search-box .gif-sb-header .gif-sb-close i,
353
+ #chat_area .wplc-gif-integration-search-box .gif-sb-header .gif-sb-close:hover i {
354
+ top: 0px;
355
+ }
356
+ #chat_area .wplc-gif-integration-search-box .gif-sb-header .gif-sb-confirm-search i,
357
+ #chat_area .wplc-gif-integration-search-box .gif-sb-header .gif-sb-confirm-search:hover i {
358
+ top: 1px;
359
+ }
360
+
361
+ /* Body */
362
+ #chat_area .wplc-gif-integration-search-box .gif-sb-body {
363
+ min-height: 73%;
364
+ }
functions.php CHANGED
@@ -980,16 +980,20 @@ function wplc_return_chat_messages($cid, $transcript = false, $html = true, $wpl
980
  $nice_time = date("d M Y H:i:s",$timestamp);
981
 
982
 
983
-
984
 
985
  $image = "";
986
  if($result->originates == 1){
987
 
 
 
988
  } else if ($result->originates == 2){
989
 
990
 
991
  } else if ($result->originates == 0 || $result->originates == 3) {
992
 
 
 
993
  $system_notification = true;
994
  $cuid = get_current_user_id();
995
  $is_agent = get_user_meta(esc_html( $cuid ), 'wplc_ma_agent', true);
@@ -1031,11 +1035,40 @@ function wplc_return_chat_messages($cid, $transcript = false, $html = true, $wpl
1031
  $msg = stripslashes($msg);
1032
  }
1033
 
1034
- if ( isset( $result->afrom ) && intval( $result->afrom ) > 0 ) { $msg_array[$id]['afrom'] = intval( $result->afrom ); $other_data['aid'] = intval( $result->afrom ); }
 
 
 
1035
  if ( isset( $result->ato ) && intval( $result->ato ) > 0 ) { $msg_array[$id]['ato'] = intval( $result->ato ); }
1036
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1037
  $msg_array[$id]['msg'] = $msg;
1038
- $msg_hist .= $msg;
 
 
 
 
 
 
 
1039
  $msg_array[$id]['originates'] = $result->originates;
1040
  $msg_array[$id]['other'] = $other_data;
1041
 
980
  $nice_time = date("d M Y H:i:s",$timestamp);
981
 
982
 
983
+ $agent_from = false;
984
 
985
  $image = "";
986
  if($result->originates == 1){
987
 
988
+ $agent_from = 'Agent';
989
+
990
  } else if ($result->originates == 2){
991
 
992
 
993
  } else if ($result->originates == 0 || $result->originates == 3) {
994
 
995
+
996
+
997
  $system_notification = true;
998
  $cuid = get_current_user_id();
999
  $is_agent = get_user_meta(esc_html( $cuid ), 'wplc_ma_agent', true);
1035
  $msg = stripslashes($msg);
1036
  }
1037
 
1038
+ if ( isset( $result->afrom ) && intval( $result->afrom ) > 0 ) {
1039
+ $msg_array[$id]['afrom'] = intval( $result->afrom ); $other_data['aid'] = intval( $result->afrom );
1040
+
1041
+ }
1042
  if ( isset( $result->ato ) && intval( $result->ato ) > 0 ) { $msg_array[$id]['ato'] = intval( $result->ato ); }
1043
 
1044
+
1045
+ /* use the new "other" array to get the AID and agent name */
1046
+ if ( $result->originates == '1' && isset( $result->other ) ){
1047
+ $other_data = maybe_unserialize( $result->other );
1048
+ if ( isset( $other_data['aid'] ) ) {
1049
+ $user_info = get_userdata( intval( $other_data['aid'] ) );
1050
+ $agent_from = $user_info->display_name;
1051
+ }
1052
+
1053
+ }
1054
+
1055
+ /* get the name of the USER if there is one */
1056
+ if ( $result->originates == '2' && isset( $result->msgfrom ) ) {
1057
+ $user_from = $result->msgfrom;
1058
+ } else {
1059
+ $user_from = 'User';
1060
+ }
1061
+
1062
+
1063
  $msg_array[$id]['msg'] = $msg;
1064
+
1065
+ if ($agent_from !== false) {
1066
+ $msg_hist .= $agent_from . ": " . $msg . "<br />";
1067
+ } else {
1068
+ $msg_hist .= $user_from . ": " . $msg . "<br />";
1069
+ }
1070
+
1071
+
1072
  $msg_array[$id]['originates'] = $result->originates;
1073
  $msg_array[$id]['other'] = $other_data;
1074
 
images/gif_f.png ADDED
Binary file
includes/settings_page.php CHANGED
@@ -77,7 +77,8 @@ if (get_option("WPLC_HIDE_CHAT") == true) {
77
  if (isset($wplc_settings["wplc_settings_color3"])) { $wplc_settings_color3 = $wplc_settings["wplc_settings_color3"]; } else { $wplc_settings_color3 = "EEEEEE"; }
78
  if (isset($wplc_settings["wplc_settings_color4"])) { $wplc_settings_color4 = $wplc_settings["wplc_settings_color4"]; } else { $wplc_settings_color4 = "666666"; }
79
  if (isset($wplc_settings["wplc_environment"])) { $wplc_environment[intval($wplc_settings["wplc_environment"])] = "SELECTED"; }
80
-
 
81
  if(get_option("WPLC_HIDE_CHAT") == true) { $wplc_hide_chat = "checked"; } else { $wplc_hide_chat = ""; };
82
 
83
  ?>
@@ -223,6 +224,17 @@ if (get_option("WPLC_HIDE_CHAT") == true) {
223
  <input type="checkbox" value="1" name="wplc_record_ip_address" <?php if(isset($wplc_settings['wplc_record_ip_address']) && $wplc_settings['wplc_record_ip_address'] == 1 ) { echo "checked"; } ?> />
224
  </td>
225
  </tr>
 
 
 
 
 
 
 
 
 
 
 
226
  <tr>
227
  <td width='300' valign='top'>
228
  <?php _e("Play a sound when a new message is received","wplivechat"); ?>: <i class="fa fa-question-circle wplc_light_grey wplc_settings_tooltip" title="<?php _e("Disable this to mute the sound that is played when a new chat message is received", "wplivechat") ?>"></i>
@@ -231,6 +243,7 @@ if (get_option("WPLC_HIDE_CHAT") == true) {
231
  <input type="checkbox" value="1" name="wplc_enable_msg_sound" <?php if(isset($wplc_settings['wplc_enable_msg_sound']) && $wplc_settings['wplc_enable_msg_sound'] == 1 ) { echo "checked"; } ?> />
232
  </td>
233
  </tr>
 
234
  <tr>
235
  <td width='300' valign='top'>
236
  <?php _e("Enable Font Awesome set","wplivechat"); ?>: <i class="fa fa-question-circle wplc_light_grey wplc_settings_tooltip" title="<?php _e("Disable this if you have Font Awesome set included with your theme", "wplivechat") ?>"></i>
@@ -556,6 +569,8 @@ if (get_option("WPLC_HIDE_CHAT") == true) {
556
  </table>
557
  <?php } ?>
558
 
 
 
559
  <?php do_action('wplc_hook_admin_settings_chat_box_settings_after'); ?>
560
 
561
  </div>
77
  if (isset($wplc_settings["wplc_settings_color3"])) { $wplc_settings_color3 = $wplc_settings["wplc_settings_color3"]; } else { $wplc_settings_color3 = "EEEEEE"; }
78
  if (isset($wplc_settings["wplc_settings_color4"])) { $wplc_settings_color4 = $wplc_settings["wplc_settings_color4"]; } else { $wplc_settings_color4 = "666666"; }
79
  if (isset($wplc_settings["wplc_environment"])) { $wplc_environment[intval($wplc_settings["wplc_environment"])] = "SELECTED"; }
80
+
81
+
82
  if(get_option("WPLC_HIDE_CHAT") == true) { $wplc_hide_chat = "checked"; } else { $wplc_hide_chat = ""; };
83
 
84
  ?>
224
  <input type="checkbox" value="1" name="wplc_record_ip_address" <?php if(isset($wplc_settings['wplc_record_ip_address']) && $wplc_settings['wplc_record_ip_address'] == 1 ) { echo "checked"; } ?> />
225
  </td>
226
  </tr>
227
+
228
+ <?php if( isset( $wplc_settings['wplc_use_node_server'] ) && intval( $wplc_settings['wplc_use_node_server'] ) == 1 ){ ?>
229
+ <tr>
230
+ <td width='300' valign='top'>
231
+ <?php _e("Play a sound when there is a new visitor","wplivechat"); ?>: <i class="fa fa-question-circle wplc_light_grey wplc_settings_tooltip" title="<?php _e("Disable this to mute the sound that is played when a new visitor arrives", "wplivechat") ?>"></i>
232
+ </td>
233
+ <td valign='top'>
234
+ <input type="checkbox" value="1" name="wplc_enable_visitor_sound" <?php if(isset($wplc_settings['wplc_enable_visitor_sound']) && $wplc_settings['wplc_enable_visitor_sound'] == 1 ) { echo "checked"; } ?> />
235
+ </td>
236
+ </tr>
237
+ <?php } ?>
238
  <tr>
239
  <td width='300' valign='top'>
240
  <?php _e("Play a sound when a new message is received","wplivechat"); ?>: <i class="fa fa-question-circle wplc_light_grey wplc_settings_tooltip" title="<?php _e("Disable this to mute the sound that is played when a new chat message is received", "wplivechat") ?>"></i>
243
  <input type="checkbox" value="1" name="wplc_enable_msg_sound" <?php if(isset($wplc_settings['wplc_enable_msg_sound']) && $wplc_settings['wplc_enable_msg_sound'] == 1 ) { echo "checked"; } ?> />
244
  </td>
245
  </tr>
246
+
247
  <tr>
248
  <td width='300' valign='top'>
249
  <?php _e("Enable Font Awesome set","wplivechat"); ?>: <i class="fa fa-question-circle wplc_light_grey wplc_settings_tooltip" title="<?php _e("Disable this if you have Font Awesome set included with your theme", "wplivechat") ?>"></i>
569
  </table>
570
  <?php } ?>
571
 
572
+
573
+
574
  <?php do_action('wplc_hook_admin_settings_chat_box_settings_after'); ?>
575
 
576
  </div>
includes/welcome_page.php CHANGED
@@ -43,7 +43,7 @@
43
  <p style='text-align: center;'><?php _e("Handle all your chats in one area, on any admin page.","wplivechat"); ?></p>
44
  </div>
45
  <div class="col">
46
- <div style='text-align: center;' ><i class="fa-4x fa fa-smile-o" aria-hidden="true"></i><br/><h4><?php _e("Emojis!","wplivechat"); ?></h4></div>
47
  <p style='text-align: center;'><?php _e("Add a touch of your own personality with emojis!","wplivechat"); ?></p>
48
  </div>
49
  </div>
43
  <p style='text-align: center;'><?php _e("Handle all your chats in one area, on any admin page.","wplivechat"); ?></p>
44
  </div>
45
  <div class="col">
46
+ <div style='text-align: center;' ><i class="fa-4x far fa-smile" aria-hidden="true"></i><br/><h4><?php _e("Emojis!","wplivechat"); ?></h4></div>
47
  <p style='text-align: center;'><?php _e("Add a touch of your own personality with emojis!","wplivechat"); ?></p>
48
  </div>
49
  </div>
js/themes/classic.js CHANGED
@@ -147,12 +147,16 @@ jQuery(document).ready(function() {
147
  if (jQuery(this).hasClass('active')) {
148
  jQuery(this).removeClass('active');
149
  jQuery.event.trigger({type: "wplc_minimize_chat"});
 
 
150
 
151
  } else {
152
  //jQuery(this).addClass('active');
153
  jQuery.event.trigger({type: "wplc_open_chat"});
154
  jQuery("#wp-live-chat-minimize").show();
155
 
 
 
156
  }
157
 
158
 
147
  if (jQuery(this).hasClass('active')) {
148
  jQuery(this).removeClass('active');
149
  jQuery.event.trigger({type: "wplc_minimize_chat"});
150
+
151
+ Cookies.set('wplc_minimize', "yes", { expires: 1, path: '/' });
152
 
153
  } else {
154
  //jQuery(this).addClass('active');
155
  jQuery.event.trigger({type: "wplc_open_chat"});
156
  jQuery("#wp-live-chat-minimize").show();
157
 
158
+ Cookies.set('wplc_minimize', "", { expires: 1, path: '/' });
159
+
160
  }
161
 
162
 
js/themes/modern.js CHANGED
@@ -245,37 +245,44 @@ jQuery(document).on("wplc_animation_done", function(e) {
245
 
246
  });
247
  jQuery(document).on( "wplc_open_chat_2", function( e ) {
248
- jQuery("#wp-live-chat-1").hide();
249
- jQuery("#wp-live-chat-2-inner").hide();
 
250
 
251
- jQuery("#wp-live-chat-2").show();
252
 
253
- if(!jQuery("#wp-live-chat-header").hasClass("active")){
254
- jQuery("#wplc_chatmsg").focus();
255
- }
256
 
257
- jQuery("#wp-live-chat-header").addClass("active");
258
- jQuery("#wp-live-chat").addClass("mobile-active");
259
-
260
 
261
- wplc_chat_status = Cookies.get('wplc_chat_status');
262
- if (typeof e.wplc_online !== "undefined" && e.wplc_online === true) {
263
- jQuery("#wp-live-chat-4").show();
264
- jQuery("#wplc_social_holder").show();
265
- jQuery("#nifty_ratings_holder").show();
266
- jQuery.event.trigger({type: "wplc_animation_done"});
267
-
268
-
269
- }
270
- setTimeout(function() {
271
- wplc_scroll_to_bottom();
272
- },1000);
273
 
274
- jQuery("#wp-live-chat-3").hide();
275
- jQuery("#wplc_chatmsg").focus();
276
- jQuery("#wp-live-chat-minimize").css("right","23px");
277
- Cookies.set('wplc_minimize', "", { expires: 1, path: '/' });
278
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
279
 
280
 
281
  });
@@ -343,6 +350,8 @@ jQuery(document).ready(function() {
343
  jQuery("#wp-live-chat-2").fadeOut("fast");
344
  jQuery(this).removeClass('active');
345
  jQuery.event.trigger({type: "wplc_minimize_chat"});
 
 
346
 
347
  } else {
348
  jQuery("#wplc_hovercard").fadeIn('fast');
@@ -351,9 +360,14 @@ jQuery(document).ready(function() {
351
  wplc_chat_status = Cookies.get('wplc_chat_status');
352
  nc_status = Cookies.get('nc_status');
353
  if (parseInt(wplc_chat_status) == 3 || parseInt(wplc_chat_status) == 2 || parseInt(wplc_chat_status) == 0 || parseInt(wplc_chat_status) == 12 || parseInt(wplc_chat_status) == 10 || nc_status === 'active') {
 
 
 
354
  jQuery("#speeching_button").click();
355
  }
356
 
 
 
357
  }
358
 
359
 
245
 
246
  });
247
  jQuery(document).on( "wplc_open_chat_2", function( e ) {
248
+
249
+ wplc_chat_status = Cookies.get('wplc_chat_status');
250
+
251
 
252
+ if (Cookies.get('wplc_minimize') === 'yes') { } else {
253
 
254
+ jQuery("#wp-live-chat-1").hide();
255
+ jQuery("#wp-live-chat-2-inner").hide();
 
256
 
257
+ jQuery("#wp-live-chat-2").show();
 
 
258
 
259
+ if(!jQuery("#wp-live-chat-header").hasClass("active")){
260
+ jQuery("#wplc_chatmsg").focus();
261
+ }
 
 
 
 
 
 
 
 
 
262
 
263
+ jQuery("#wp-live-chat-header").addClass("active");
264
+ jQuery("#wp-live-chat").addClass("mobile-active");
265
+
 
266
 
267
+ wplc_chat_status = Cookies.get('wplc_chat_status');
268
+
269
+ if (typeof e.wplc_online !== "undefined" && e.wplc_online === true) {
270
+ jQuery("#wp-live-chat-4").show();
271
+ jQuery("#wplc_social_holder").show();
272
+ jQuery("#nifty_ratings_holder").show();
273
+ jQuery.event.trigger({type: "wplc_animation_done"});
274
+
275
+
276
+ }
277
+ setTimeout(function() {
278
+ wplc_scroll_to_bottom();
279
+ },1000);
280
+
281
+ jQuery("#wp-live-chat-3").hide();
282
+ jQuery("#wplc_chatmsg").focus();
283
+ jQuery("#wp-live-chat-minimize").css("right","23px");
284
+ Cookies.set('wplc_minimize', "", { expires: 1, path: '/' });
285
+ }
286
 
287
 
288
  });
350
  jQuery("#wp-live-chat-2").fadeOut("fast");
351
  jQuery(this).removeClass('active');
352
  jQuery.event.trigger({type: "wplc_minimize_chat"});
353
+
354
+ Cookies.set('wplc_minimize', "yes", { expires: 1, path: '/' });
355
 
356
  } else {
357
  jQuery("#wplc_hovercard").fadeIn('fast');
360
  wplc_chat_status = Cookies.get('wplc_chat_status');
361
  nc_status = Cookies.get('nc_status');
362
  if (parseInt(wplc_chat_status) == 3 || parseInt(wplc_chat_status) == 2 || parseInt(wplc_chat_status) == 0 || parseInt(wplc_chat_status) == 12 || parseInt(wplc_chat_status) == 10 || nc_status === 'active') {
363
+
364
+ jQuery("#bleeper_bell").hide();
365
+
366
  jQuery("#speeching_button").click();
367
  }
368
 
369
+ //Cookies.set('wplc_minimize', "", { expires: 1, path: '/' });
370
+
371
  }
372
 
373
 
js/wplc_server.js CHANGED
@@ -1,6 +1,8 @@
1
  /*
2
  * Hanldes Message transportation within WPLC
3
  */
 
 
4
  var wplc_server_method = null;
5
  var wplc_supress_server_logs = true; //We are now surpressing server logs
6
  var wplc_node_socket = null; //Will not be set unless
@@ -419,7 +421,12 @@ function wplc_rest_api(type, wplc_send_data, wplc_send_timeout, next) {
419
  //Send the data to the Async
420
  if(typeof wplc_restapi_enabled !== "undefined" && parseInt(wplc_restapi_enabled) === 1 && typeof wplc_restapi_endpoint !== "undefined"){
421
  //REST API is ready to rumble
422
- wplc_send_url = wplc_restapi_endpoint + "/" + type;
 
 
 
 
 
423
 
424
  var prepared_data = wplc_send_data;
425
 
@@ -670,6 +677,35 @@ function wplc_get_chat_person_name_msg_field(name) {
670
  }
671
  }
672
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
673
  /**
674
  * Pushes the message object to the chat box
675
  *
@@ -867,9 +903,16 @@ function wplc_push_message_to_chatbox(the_message, aoru, next) {
867
  message_content = niftyFormatParser(message_content);
868
  }
869
 
870
- concatenated_message += "<span class='messageBody' data-message='" + original_message + "'>"+message_content+"</span>"+ message_edit_string;
871
-
872
- // Close the person name and message wrapper, if it was added
 
 
 
 
 
 
 
873
  concatenated_message += "</div>";
874
 
875
  // Close the HTML of a message
1
  /*
2
  * Hanldes Message transportation within WPLC
3
  */
4
+ var gifExtensionPattern = new RegExp(/\.(gif)\b/);
5
+
6
  var wplc_server_method = null;
7
  var wplc_supress_server_logs = true; //We are now surpressing server logs
8
  var wplc_node_socket = null; //Will not be set unless
421
  //Send the data to the Async
422
  if(typeof wplc_restapi_enabled !== "undefined" && parseInt(wplc_restapi_enabled) === 1 && typeof wplc_restapi_endpoint !== "undefined"){
423
  //REST API is ready to rumble
424
+
425
+ let anti_cache = Date.now();
426
+
427
+ wplc_send_url = wplc_restapi_endpoint + "/" + type + "?nocache="+anti_cache;
428
+
429
+
430
 
431
  var prepared_data = wplc_send_data;
432
 
677
  }
678
  }
679
 
680
+ /**
681
+ * Removes undesired strings from a message which contains a GIF URL and returns only the gif url
682
+ * @param {*} message_content
683
+ */
684
+ function getCleanedGif(message_content) {
685
+ if (typeof(message_content) !== "undefined") {
686
+ var msgParts = message_content.split(" ");
687
+
688
+ if (typeof(msgParts) !== "undefined") {
689
+
690
+ for (var i = 0; i < msgParts.length; i++) {
691
+ var msgPart = msgParts[i];
692
+
693
+ if (typeof(msgPart) !== "undefined") {
694
+
695
+ if (gifExtensionPattern.test(msgPart)) {
696
+ var cleanedGifUrl = msgPart.replace("href=", "");
697
+ cleanedGifUrl = cleanedGifUrl.replace(/\"/g, "");
698
+
699
+ return cleanedGifUrl;
700
+ }
701
+ }
702
+ }
703
+ }
704
+ }
705
+
706
+ return "";
707
+ }
708
+
709
  /**
710
  * Pushes the message object to the chat box
711
  *
903
  message_content = niftyFormatParser(message_content);
904
  }
905
 
906
+ // If it is a GIF message
907
+ if (gifExtensionPattern.test(message_content)) {
908
+ cleanedGif = getCleanedGif(message_content);
909
+ concatenated_message += "<span class='messageBody' data-message='"+ cleanedGif +"'><img src='"+ cleanedGif + "' class='gif-img'/></span>"+ message_edit_string;
910
+ } else {
911
+ // If it is a regular message
912
+ concatenated_message += "<span class='messageBody' data-message='" + original_message + "'>"+message_content+"</span>"+ message_edit_string;
913
+ }
914
+
915
+ // Close the person name/message wrapper, if it was added
916
  concatenated_message += "</div>";
917
 
918
  // Close the HTML of a message
js/wplc_tabs.js CHANGED
@@ -7,7 +7,7 @@ jQuery("document").ready(function() {
7
 
8
  sessionStorage.setItem(
9
  "wplc-tabs-index",
10
- $(event.target).tabs("option", "active")
11
  );
12
  }
13
 
7
 
8
  sessionStorage.setItem(
9
  "wplc-tabs-index",
10
+ jQuery(event.target).tabs("option", "active")
11
  );
12
  }
13
 
js/wplc_transcript.js ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery('body').on('click', '#chatTranscriptTitle, #wplc_admin_email_transcript, .endChat', sendTranscript);
2
+
3
+ function sendTranscript(event) {
4
+ var data = {};
5
+ var isCloseChatClicked = false;
6
+ if (jQuery(event.target).hasClass('endChat')) {
7
+ isCloseChatClicked = true;
8
+ data.el = 'endChat';
9
+ }
10
+ if (jQuery('#chatTranscriptTitle').length) {
11
+ if (!isCloseChatClicked) {
12
+ jQuery("#chatTranscriptTitle").addClass('is-disabled');
13
+ }
14
+ var cur_id = jQuery('#chatCloseTitle').attr('cid');
15
+ data.action = 'wplc_et_admin_email_transcript';
16
+ data.security = wplc_transcript_nonce.ajax_nonce;
17
+ data.cid = cur_id;
18
+ jQuery.post(ajaxurl, data, function(response) {
19
+ if (typeof response === 'string' && response.length < 1) {
20
+ return;
21
+ }
22
+ returned_data = JSON.parse(response);
23
+ if (returned_data.constructor === Object) {
24
+ jQuery('.nifty_admin_chat_prompt, .nifty_admin_overlay').css('display', 'block');
25
+ jQuery('#nifty_admin_chat_prompt_confirm').css('display', 'none');
26
+ jQuery('.nifty_admin_chat_prompt_title').html(wplc_transcript_nonce.string_title);
27
+ jQuery('#nifty_admin_chat_prompt_cancel').html(wplc_transcript_nonce.string_close);
28
+ if (returned_data.errorstring) {
29
+ jQuery('.nifty_admin_chat_prompt_message').html(wplc_transcript_nonce.string_error1);
30
+ } else {
31
+ jQuery('.nifty_admin_chat_prompt_message').html(wplc_transcript_nonce.string_chat_emailed);
32
+ }
33
+ }
34
+ });
35
+ } else {
36
+ if (!isCloseChatClicked) {
37
+ jQuery(".wplc_admin_email_transcript").hide();
38
+ html = "<span class='wplc_et_loading'><em>" + wplc_transcript_nonce.string_loading + "</em></span>";
39
+ jQuery(".wplc_admin_email_transcript").after(html);
40
+ }
41
+ var cur_id = jQuery(this).attr("cid");
42
+ data.action = 'wplc_et_admin_email_transcript';
43
+ data.security = wplc_transcript_nonce.ajax_nonce;
44
+ data.cid = cur_id;
45
+ jQuery.post(ajaxurl, data, function (response) {
46
+ returned_data = JSON.parse(response);
47
+ if (returned_data.constructor === Object) {
48
+ if (returned_data.errorstring) {
49
+ jQuery(".wplc_admin_email_transcript").after("<p><strong>" + wplc_transcript_nonce.string_error1 + "</strong></p>");
50
+ } else {
51
+ jQuery(".wplc_et_loading").hide();
52
+
53
+ html = "<span class=''>" + wplc_transcript_nonce.string_chat_emailed + "</span>";
54
+ jQuery("#wplc_admin_email_transcript").after(html);
55
+ jQuery("#wplc_admin_email_transcript").hide();
56
+ }
57
+ }
58
+ });
59
+ }
60
+ }
js/wplc_u.js CHANGED
@@ -190,7 +190,9 @@ jQuery(document).ready(function() {
190
  nc.type = "text/javascript";
191
  nc.async = true;
192
  nc.src = "https://bleeper.io/app/assets/js/bleeper-dev.js";
193
- document.getElementsByTagName("head")[0].appendChild(nc);
 
 
194
 
195
  }
196
 
@@ -203,12 +205,14 @@ jQuery(document).ready(function() {
203
 
204
  wplc_call_to_server_chat(data,true,false);
205
  }
206
-
207
  if(wplc_cid !== null && wplc_init_chat_box_check == true && wplc_init_chat_box !== false){
 
208
  wplc_init_chat_box(wplc_cid,wplc_chat_status);
209
  } else {
210
  //Node and offline
211
  if(typeof wplc_use_node_server !== "undefined" && (wplc_use_node_server === "true" || wplc_use_node_server === true)){
 
212
  wplc_cbox_animation();
213
  }
214
  }
@@ -807,19 +811,24 @@ function wplc_cbox_animation() {
807
  break;
808
  }
809
 
810
- //jQuery("#wp-live-chat").css({ "display" : "block" });
811
  if(jQuery("#wp-live-chat").attr('wplc-auto-pop-up') === "1"){
812
 
813
- setTimeout(function(){
814
- open_chat(0);
815
- },1000);
816
- /**
817
- * Adding this fixes the bug that stops the chat window from opening when an agent initialises a chat with a user
818
- *
819
- * Reasoning: when running open_chat(), wplc_is_chat_open is set to TRUE at the end of the function, and stops any future request to open_chat();
820
- *
821
- */
822
- wplc_is_chat_open = false;
 
 
 
 
 
823
  }
824
 
825
  jQuery.event.trigger({type: "wplc_animation_done"});
190
  nc.type = "text/javascript";
191
  nc.async = true;
192
  nc.src = "https://bleeper.io/app/assets/js/bleeper-dev.js";
193
+ //nc.src = "http://127.0.0.1/nick-bleeper-dev.js";
194
+
195
+ document.getElementsByTagName("head")[0].appendChild(nc);
196
 
197
  }
198
 
205
 
206
  wplc_call_to_server_chat(data,true,false);
207
  }
208
+
209
  if(wplc_cid !== null && wplc_init_chat_box_check == true && wplc_init_chat_box !== false){
210
+
211
  wplc_init_chat_box(wplc_cid,wplc_chat_status);
212
  } else {
213
  //Node and offline
214
  if(typeof wplc_use_node_server !== "undefined" && (wplc_use_node_server === "true" || wplc_use_node_server === true)){
215
+
216
  wplc_cbox_animation();
217
  }
218
  }
811
  break;
812
  }
813
 
814
+ //jQuery("#wp-live-chat").css({ "display" : "block" });
815
  if(jQuery("#wp-live-chat").attr('wplc-auto-pop-up') === "1"){
816
 
817
+ var wplc_force_must_min = Cookies.get('wplc_minimize');
818
+ if(wplc_force_must_min === 'yes'){
819
+ /* User has actively chosen to minimize the chat, leave it alone */
820
+ } else {
821
+ setTimeout(function(){
822
+ open_chat(0);
823
+ },1000);
824
+ /**
825
+ * Adding this fixes the bug that stops the chat window from opening when an agent initialises a chat with a user
826
+ *
827
+ * Reasoning: when running open_chat(), wplc_is_chat_open is set to TRUE at the end of the function, and stops any future request to open_chat();
828
+ *
829
+ */
830
+ wplc_is_chat_open = false;
831
+ }
832
  }
833
 
834
  jQuery.event.trigger({type: "wplc_animation_done"});
js/wplc_u_admin_events.js CHANGED
@@ -183,6 +183,12 @@ jQuery(document).on("bleeper_dom_ready", function(e) {
183
  'aid': '',
184
  html: agent_to_agent_chat_upsell
185
  }).appendTo(".online_agent_list");
 
 
 
 
 
 
186
  }
187
 
188
  jQuery("#page-wrapper").css("height", (jQuery(window).height() - 100) + "px");
@@ -506,9 +512,14 @@ jQuery(document).on("bleeper_dom_ready", function(e) {
506
  * @return void
507
  */
508
  jQuery(document).on("bleeper_add_agent", function(e) {
509
-
 
 
 
 
 
510
  socket.emit('add agent', e.ndata);
511
- socket.emit('custom data',{action:'send_custom_header',chatid:e.ndata.chatid,agentid:e.ndata.agent,ndata:wplc_head_data});
512
 
513
 
514
  });
@@ -768,6 +779,18 @@ jQuery(document).on("bleeper_dom_ready", function(e) {
768
  });
769
 
770
 
 
 
 
 
 
 
 
 
 
 
 
 
771
 
772
  /**
773
  * Custom data trigger
183
  'aid': '',
184
  html: agent_to_agent_chat_upsell
185
  }).appendTo(".online_agent_list");
186
+
187
+
188
+ jQuery('<div/>', {
189
+ 'class': 'initiate_upsell',
190
+ html: initiate_chat_upsell
191
+ }).appendTo(".infoArea");
192
  }
193
 
194
  jQuery("#page-wrapper").css("height", (jQuery(window).height() - 100) + "px");
512
  * @return void
513
  */
514
  jQuery(document).on("bleeper_add_agent", function(e) {
515
+
516
+ var custom_header_data = wplc_head_data;
517
+ if (typeof bleeper_agent_name !== 'undefined'){
518
+ custom_header_data.name = bleeper_agent_name;
519
+ }
520
+
521
  socket.emit('add agent', e.ndata);
522
+ socket.emit('custom data',{action:'send_custom_header',chatid:e.ndata.chatid,agentid:e.ndata.agent,ndata:custom_header_data});
523
 
524
 
525
  });
779
  });
780
 
781
 
782
+ /**
783
+ * New visitor
784
+ *
785
+ * @return void
786
+ */
787
+ jQuery(document).on("bleeper_new_visitor", function(e) {
788
+ if (typeof bleeper_enable_visitor_sound !== "undefined" && bleeper_enable_visitor_sound === '1') {
789
+ bleeper_ping.play();
790
+ }
791
+
792
+ });
793
+
794
 
795
  /**
796
  * Custom data trigger
js/wplc_u_admin_gif_integration.js ADDED
@@ -0,0 +1,471 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * wplc_u_admin_gif_integration.js add events that let the user insert GIFs by typing a text command
3
+ * on the chatbox message input. For instance:
4
+ *
5
+ * - The user can add a random GIF via a forward slash command like we do on Slack "/gif happy"
6
+ */
7
+
8
+ var WPLC_GIF_I_DEBUG = false;
9
+
10
+ function WPLC_U_Admin_GIF_Integration() {
11
+ this._initialized = false;
12
+ }
13
+
14
+ WPLC_U_Admin_GIF_Integration.prototype = {
15
+
16
+ GIF_INTEGRATION_COMMAND_PATTERN: /\/gif/,
17
+ GIF_WORD_PATTERN: "/gif",
18
+ GIF_EXTENSION_PATTERN: /\.(gif)\b/,
19
+
20
+ SELECTORS : {
21
+ CHATBOX_EDIT_MSG_INPUT: "#wplc_chatmsg, #inputMessage",
22
+ GIF_SEARCH_BOX: "#wplc_gif_integration_search_box",
23
+ GIF_INSIDE_GIF_SEARCH_BOX: "#wplc_gif_integration_search_box .gif-sb-body .gifs-container .gif-img",
24
+ GIF_SEARCH_BOX_INPUT_SEARCH_TERMS: "#wplc_gif_integration_search_box > div.gif-sb-header > .gif-sb-search-term",
25
+ GIF_SEARCH_BOX_BTN_CONFIRM_SEARCH: "#wplc_gif_integration_search_box > div.gif-sb-header > .gif-sb-confirm-search",
26
+ GIF_SEARCH_BOX_BTN_CLOSE_SEARCH: "#wplc_gif_integration_search_box > div.gif-sb-header > .gif-sb-close",
27
+ GIF_SEARCH_BOX_BODY: ".gif-sb-body",
28
+ GIF_SEARCH_BOX_GIFS_CONTAINER: ".gif-sb-body .gifs-container",
29
+ GIF_SEARCH_BOX_BODY_GIFS: ".gif-sb-body .gifs-container .gif-img",
30
+ GIF_SEARCH_BOX_LOADER: "#wplc_gif_integration_search_box .gif-sb-loader"
31
+ },
32
+
33
+ CLASSES: {
34
+ GIF_SEARCH_BOX: "wplc-gif-integration-search-box",
35
+ HIDDEN: "hidden",
36
+ SHOW: "show",
37
+ SELECTED_GIF: "selected-gif",
38
+ GIF_IMG: "gif-img"
39
+ },
40
+
41
+ IDXS: {
42
+ GIPHY_API: "1",
43
+ TENOR_API: "2",
44
+ },
45
+
46
+ MSGS: {
47
+ INSTRUCTIONS_GIF_SEARCH: "To search for a GIF write '/gif your_search' or use the search bar for more results"
48
+ },
49
+
50
+ IMAGES: {
51
+ ICO_CONFIRM_SEARCH: "Search",
52
+ ICO_CLOSE_SEARCH: "X",
53
+ LOADING: "https://media.tenor.com/images/d6cd5151c04765d1992edfde14483068/tenor.gif"
54
+ },
55
+
56
+ gif_settings: undefined,
57
+ chosen_gif: undefined,
58
+ previous_search_term: "",
59
+ current_search_term: "",
60
+ canceled_search_request: false,
61
+
62
+ // Getters and Setters
63
+ getClassSelector: function(className) {
64
+ try {
65
+ return "." + className;
66
+ } catch(err) {
67
+ if (WPLC_GIF_I_DEBUG) {
68
+ console.log("Warning: Failed to getSelectorFromClass " + err);
69
+ }
70
+ }
71
+ },
72
+
73
+ getIdFromSelector: function(selector) {
74
+ try {
75
+ return selector.replace("#", "");
76
+ } catch(err) {
77
+ if (WPLC_GIF_I_DEBUG) {
78
+ console.log("Warning: Failed to getId " + err);
79
+ }
80
+ }
81
+ },
82
+
83
+ // Other methods
84
+ /**
85
+ * Add the selected GIF URL to the message that is going to be sent
86
+ */
87
+ applyChosenGifToNewMessage: function() {
88
+ try {
89
+
90
+ if (typeof(this.chosen_gif) !== "undefined") {
91
+ jQuery(this.SELECTORS.CHATBOX_EDIT_MSG_INPUT).val(this.chosen_gif);
92
+ }
93
+ } catch(err) {
94
+ if (WPLC_GIF_I_DEBUG) {
95
+ console.log("Warning: Failed to applyChosenGifToNewMessage " + err);
96
+ }
97
+ }
98
+ },
99
+
100
+ fetchGifResultsFromGiphy: function(topGifs) {
101
+ try {
102
+
103
+ if (typeof(topGifs) !== "undefined") {
104
+
105
+ for (var i = 0; i < topGifs.length; i++) {
106
+ var gifUrl = topGifs[i]["images"]["downsized_large"]["url"];
107
+
108
+ if (typeof(gifUrl) !== "undefined") {
109
+ var gifHtml = jQuery('<img/>');
110
+ gifHtml.attr('class', this.CLASSES.GIF_IMG);
111
+ gifHtml.attr('src', gifUrl);
112
+
113
+ jQuery(this.SELECTORS.GIF_SEARCH_BOX).find(this.SELECTORS.GIF_SEARCH_BOX_GIFS_CONTAINER).append(gifHtml);
114
+ }
115
+ }
116
+
117
+ if (this.chosen_gif === "") {
118
+ this.chosen_gif = topGifs[0]["images"]["downsized_large"]["url"];
119
+ }
120
+ }
121
+
122
+ } catch(err) {
123
+ if (WPLC_GIF_I_DEBUG) {
124
+ console.log("Warning: Failed to fetchGifResultsFromGiphy " + err);
125
+ }
126
+ }
127
+ },
128
+
129
+ fetchGifResultsFromTenor: function(topGifs) {
130
+ try {
131
+
132
+ if (typeof(topGifs) !== "undefined") {
133
+
134
+ for (var i = 0; i < topGifs.length; i++) {
135
+ var gifUrl = topGifs[i]["media"][0]["gif"]["url"];
136
+
137
+ if (typeof(gifUrl) !== "undefined") {
138
+ var gifHtml = jQuery('<img/>');
139
+ gifHtml.attr('class', this.CLASSES.GIF_IMG);
140
+ gifHtml.attr('src', gifUrl);
141
+
142
+ jQuery(this.SELECTORS.GIF_SEARCH_BOX).find(this.SELECTORS.GIF_SEARCH_BOX_GIFS_CONTAINER).append(gifHtml);
143
+ }
144
+
145
+ if (this.chosen_gif === "") {
146
+ this.chosen_gif = topGifs[0]["media"][0]["gif"]["url"];
147
+ }
148
+ }
149
+ }
150
+
151
+ } catch(err) {
152
+ if (WPLC_GIF_I_DEBUG) {
153
+ console.log("Warning: Failed to fetchGifResultsFromTenor " + err);
154
+ }
155
+ }
156
+ },
157
+
158
+ gifSearch: function(searchTerm) {
159
+ try {
160
+ this.canceled_search_request = false;
161
+
162
+ if (searchTerm.length > 1) {
163
+ var ctx = this;
164
+ ctx.chosen_gif = "";
165
+
166
+ if (searchTerm !== "") {
167
+ jQuery(ctx.SELECTORS.GIF_SEARCH_BOX_LOADER).removeClass(ctx.CLASSES.HIDDEN);
168
+
169
+ var data = {
170
+ 'action': 'wplc_search_gif',
171
+ 'security': wplc_nonce,
172
+ 'search_term': searchTerm
173
+ };
174
+
175
+ jQuery.post(wplc_ajaxurl, data, function(response) {
176
+ try {
177
+
178
+ if (!ctx.canceled_search_request && response !== "") {
179
+ var responseObjects = JSON.parse(response);
180
+
181
+ if (typeof(responseObjects) !== "undefined") {
182
+
183
+ switch(ctx.gif_settings.preferred_gif_provider) {
184
+
185
+ case ctx.IDXS.GIPHY_API: {
186
+ var topGifs = responseObjects["data"];
187
+ ctx.fetchGifResultsFromGiphy(topGifs);
188
+ break;
189
+ }
190
+
191
+ case ctx.IDXS.TENOR_API: {
192
+ var topGifs = responseObjects["results"];
193
+ ctx.fetchGifResultsFromTenor(topGifs);
194
+ break;
195
+ }
196
+ }
197
+ }
198
+
199
+ if (ctx.chosen_gif !== "") {
200
+ ctx.applyChosenGifToNewMessage();
201
+ } else {
202
+ jQuery(ctx.SELECTORS.CHATBOX_EDIT_MSG_INPUT).val("Please try again ...");
203
+ }
204
+ }
205
+
206
+ jQuery(ctx.SELECTORS.GIF_SEARCH_BOX_LOADER).addClass(ctx.CLASSES.HIDDEN);
207
+
208
+ } catch(err) {
209
+ if (WPLC_GIF_I_DEBUG) {
210
+ console.log("Warning: Failed to process GIF from provider " + err);
211
+ }
212
+ }
213
+ });
214
+ }
215
+ }
216
+
217
+ } catch(err) {
218
+ if (WPLC_GIF_I_DEBUG) {
219
+ console.log("Warning: Failed to gifSearch " + err);
220
+ }
221
+ }
222
+ },
223
+
224
+ cancelGifSearch: function() {
225
+ try {
226
+ this.canceled_search_request = true;
227
+
228
+ } catch(err) {
229
+ if (WPLC_GIF_I_DEBUG) {
230
+ console.log("Warning: Failed to cancelGifSearch " + err);
231
+ }
232
+ }
233
+ },
234
+
235
+ openGifSearchBox: function() {
236
+ try {
237
+ jQuery(this.SELECTORS.GIF_SEARCH_BOX).removeClass(this.CLASSES.HIDDEN);
238
+ jQuery(this.SELECTORS.GIF_SEARCH_BOX).addClass(this.CLASSES.SHOW);
239
+ jQuery(this.SELECTORS.GIF_SEARCH_BOX).find(this.SELECTORS.GIF_SEARCH_BOX_GIFS_CONTAINER).html("");
240
+
241
+ } catch(err) {
242
+ if (WPLC_GIF_I_DEBUG) {
243
+ console.log("Warning: Failed to openGifSearchBox " + err);
244
+ }
245
+ }
246
+ },
247
+
248
+ closeGifSearchBox: function() {
249
+ try {
250
+ jQuery(this.SELECTORS.GIF_SEARCH_BOX).removeClass(this.CLASSES.SHOW);
251
+ jQuery(ctx.SELECTORS.GIF_SEARCH_BOX_LOADER).addClass(ctx.CLASSES.HIDDEN);
252
+
253
+ } catch(err) {
254
+ if (WPLC_GIF_I_DEBUG) {
255
+ console.log("Warning: Failed to closeGifSearchBox " + err);
256
+ }
257
+ }
258
+ },
259
+
260
+ getSearchTermFromNewMsgInput: function() {
261
+ try {
262
+ var currentMsg = jQuery(this.SELECTORS.CHATBOX_EDIT_MSG_INPUT).val();
263
+ var gifCommandPattern = new RegExp(this.GIF_INTEGRATION_COMMAND_PATTERN);
264
+
265
+
266
+ if (gifCommandPattern.test(currentMsg)) {
267
+ this.openGifSearchBox();
268
+
269
+ // Ensure the user inserted a complete word before starting the search
270
+ var msgParts = currentMsg.split(" ");
271
+ var searchTerm = "";
272
+
273
+ for (var i = 0; i < msgParts.length; i++) {
274
+ var word = msgParts[i];
275
+
276
+ if (this.GIF_WORD_PATTERN === word) {
277
+
278
+ if (i + 1 < msgParts.length) {
279
+ searchTerm = msgParts[i + 1];
280
+
281
+ if (searchTerm.length > 0) {
282
+ return searchTerm;
283
+ }
284
+ }
285
+ }
286
+ }
287
+ } else {
288
+ this.closeGifSearchBox();
289
+ }
290
+ } catch(err) {
291
+ if (WPLC_GIF_I_DEBUG) {
292
+ console.log("Warning: Failed to getSearchTermFromNewMsgInput " + err);
293
+ }
294
+ }
295
+
296
+ return "";
297
+ },
298
+
299
+ identifyGifCommands: function() {
300
+ try {
301
+ this.current_search_term = this.getSearchTermFromNewMsgInput();
302
+
303
+ if (this.current_search_term !== "") {
304
+
305
+ // Lock the search until the search term is different from the previous one
306
+ if (this.previous_search_term !== this.current_search_term) {
307
+ this.previous_search_term = this.current_search_term;
308
+ this.gifSearch(this.current_search_term);
309
+ }
310
+ } else {
311
+ this.cancelGifSearch();
312
+ }
313
+
314
+ } catch(err) {
315
+ if (WPLC_GIF_I_DEBUG) {
316
+ console.log("Warning: Failed to identifyGifCommands " + err);
317
+ }
318
+ }
319
+ },
320
+
321
+ createGifSearchBox: function() {
322
+ try {
323
+ var searchBox = jQuery(this.SELECTORS.GIF_SEARCH_BOX);
324
+ var searchBoxContent = jQuery(searchBox).html();
325
+
326
+ if (typeof(searchBoxContent) === "undefined" || typeof(jQuery(searchBox).html()) === "") {
327
+ // Build the template of the Gif Search box
328
+ var searchBoxHtml = "<div id="+ this.getIdFromSelector(this.SELECTORS.GIF_SEARCH_BOX) +" class='" + this.CLASSES.GIF_SEARCH_BOX + " " + this.CLASSES.HIDDEN + "'>";
329
+ searchBoxHtml += "<div class='gif-sb-header'>";
330
+ searchBoxHtml += "<input class='gif-sb-search-term' placeholder='Search...'>";
331
+ //searchBoxHtml += "<a target='_blank' class='gif-sb-confirm-search'><i class='fa fa-search'></i></a>";
332
+ searchBoxHtml += "<a target='_blank' class='gif-sb-close'><i>"+ this.IMAGES.ICO_CLOSE_SEARCH +"</i></a>";
333
+ searchBoxHtml += "</div>";
334
+ searchBoxHtml += "<div class='gif-sb-body'>";
335
+ searchBoxHtml += "<div class='gifs-container'></div>";
336
+ searchBoxHtml += "<div class='gif-sb-loader hidden'><img src='"+ this.IMAGES.LOADING +"'></div>";
337
+ searchBoxHtml += "</div>";
338
+ searchBoxHtml += "<div class='gif-sb-footer'>";
339
+ searchBoxHtml += this.MSGS.INSTRUCTIONS_GIF_SEARCH;
340
+ searchBoxHtml += "</div>";
341
+ searchBoxHtml += "</div>";
342
+
343
+ // Inject the search box into the DOM
344
+ jQuery(this.SELECTORS.CHATBOX_EDIT_MSG_INPUT).parent().parent().prepend(searchBoxHtml);
345
+ }
346
+
347
+ } catch(err) {
348
+ if (WPLC_GIF_I_DEBUG) {
349
+ console.log("Warning: Failed to closeGifSearchBox " + err);
350
+ }
351
+ }
352
+ },
353
+
354
+ selectGif: function(gifObj) {
355
+ try {
356
+ var ctx = this;
357
+
358
+ jQuery(ctx.SELECTORS.GIF_SEARCH_BOX).find(ctx.SELECTORS.GIF_SEARCH_BOX_BODY_GIFS).removeClass(ctx.CLASSES.SELECTED_GIF);
359
+ jQuery(gifObj).addClass(ctx.CLASSES.SELECTED_GIF);
360
+
361
+ var selectedGifUrl = jQuery(gifObj).attr("src");
362
+ ctx.chosen_gif = selectedGifUrl;
363
+
364
+ ctx.applyChosenGifToNewMessage();
365
+
366
+ setTimeout(function() {
367
+ ctx.closeGifSearchBox();
368
+ }, 500);
369
+ } catch(err) {
370
+ if (WPLC_GIF_I_DEBUG) {
371
+ console.log("Warning: Failed to selectGif " + err);
372
+ }
373
+ }
374
+ },
375
+
376
+ refinedSearch: function() {
377
+ try {
378
+ this.previous_search_term = jQuery(this.SELECTORS.GIF_SEARCH_BOX_INPUT_SEARCH_TERMS).val();
379
+ this.current_search_term = this.previous_search_term;
380
+ this.gifSearch(this.current_search_term);
381
+
382
+ } catch(err) {
383
+ if (WPLC_GIF_I_DEBUG) {
384
+ console.log("Warning: Failed to refinedSearch " + err);
385
+ }
386
+ }
387
+ },
388
+
389
+ initEvents: function() {
390
+ try {
391
+ var ctx = this;
392
+
393
+ // Monitor the message being edited in order to detect a GIF integration command
394
+ jQuery(document).on("keydown", ctx.SELECTORS.CHATBOX_EDIT_MSG_INPUT, function() {
395
+ ctx.createGifSearchBox();
396
+ ctx.identifyGifCommands();
397
+ });
398
+
399
+ // Monitor for the ENTER key press on the search input
400
+ jQuery(document).on("keydown", ctx.SELECTORS.GIF_SEARCH_BOX_INPUT_SEARCH_TERMS, function(event) {
401
+ if (event.which === 13) {
402
+ event.preventDefault();
403
+ ctx.refinedSearch();
404
+ }
405
+
406
+ });
407
+
408
+ // Execute a refined search with a text input from the GIF search box
409
+ jQuery(document).on("click", ctx.SELECTORS.GIF_SEARCH_BOX_BTN_CONFIRM_SEARCH, function() {
410
+ ctx.refinedSearch();
411
+ });
412
+
413
+ // Select a GIF from the search results within the GIf search box
414
+ jQuery(document).on("click", ctx.SELECTORS.GIF_INSIDE_GIF_SEARCH_BOX, function() {
415
+ ctx.selectGif(this);
416
+ });
417
+
418
+ // Close the Gif Search Box
419
+ jQuery(document).on("click", ctx.SELECTORS.GIF_SEARCH_BOX_BTN_CLOSE_SEARCH, function() {
420
+ ctx.closeGifSearchBox();
421
+ });
422
+
423
+ } catch(err) {
424
+ if (WPLC_GIF_I_DEBUG) {
425
+ console.log("Warning: Failed to initEvents " + err);
426
+ }
427
+ }
428
+ },
429
+
430
+ initVars: function() {
431
+ try {
432
+
433
+ if (typeof(wplc_gif_integration_details) !== "undefined") {
434
+ this.gif_settings = wplc_gif_integration_details;
435
+ }
436
+ } catch(err) {
437
+ if (WPLC_GIF_I_DEBUG) {
438
+ console.log("Warning: Failed to initVars " + err);
439
+ }
440
+ }
441
+ },
442
+
443
+ init: function() {
444
+ try {
445
+ var ctx = this;
446
+
447
+ jQuery(document).ready(function() {
448
+
449
+ if (typeof(wplc_gif_integration_details) !== "undefined") {
450
+ ctx._initialized = true;
451
+ ctx.initVars();
452
+
453
+ if (typeof(ctx.gif_settings.is_gif_integration_enabled) !== "undefined") {
454
+
455
+ if (ctx.gif_settings.is_gif_integration_enabled) {
456
+ ctx.initEvents();
457
+ }
458
+ }
459
+ }
460
+ });
461
+ } catch(err) {
462
+ if (WPLC_GIF_I_DEBUG) {
463
+ console.log("Warning: Failed to init " + err);
464
+ }
465
+ }
466
+ }
467
+
468
+ }
469
+
470
+ var wplcGifIntegration = new WPLC_U_Admin_GIF_Integration();
471
+ wplcGifIntegration.init();
js/wplc_u_node_events.js CHANGED
@@ -36,6 +36,7 @@ jQuery(document).ready(function() {
36
  jQuery("#wp-live-chat-header").addClass("active");
37
  } else if (nc_status === "active") {
38
  /* go straight into chat */
 
39
  jQuery.event.trigger({type: "wplc_open_chat_2", wplc_online: wplc_online});
40
 
41
 
@@ -157,6 +158,10 @@ jQuery(document).ready(function() {
157
  wplc_push_message_to_chatbox(the_message,'u', function() {
158
  wplc_scroll_to_bottom();
159
  });
 
 
 
 
160
  }
161
  });
162
 
36
  jQuery("#wp-live-chat-header").addClass("active");
37
  } else if (nc_status === "active") {
38
  /* go straight into chat */
39
+ Cookies.set('wplc_minimize', "", { expires: 1, path: '/' });
40
  jQuery.event.trigger({type: "wplc_open_chat_2", wplc_online: wplc_online});
41
 
42
 
158
  wplc_push_message_to_chatbox(the_message,'u', function() {
159
  wplc_scroll_to_bottom();
160
  });
161
+
162
+ if (Cookies.get("wplc_minimize") === 'yes' && jQuery("#bleeper_bell").length > 0) {
163
+ jQuery("#bleeper_bell").show();
164
+ }
165
  }
166
  });
167
 
modules/module_gif.php ADDED
@@ -0,0 +1,188 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ add_action( 'wp_ajax_wplc_search_gif', 'wplc_search_gif' );
4
+ add_action( 'wp_ajax_nopriv_my_action', 'wplc_search_gif');
5
+
6
+
7
+
8
+
9
+ /* admin chat - legacy chatbox */
10
+ add_action('wplc_hook_admin_chatbox_javascript','wplc_gif_localize_data');
11
+ /*legacy dashboard */
12
+ add_action('wplc_hook_push_js_to_front','wplc_gif_localize_data');
13
+ /* default dashboard */
14
+ add_action('wplc_admin_remoter_dashboard_scripts_localizer','wplc_gif_localize_data');
15
+
16
+ /**
17
+ * Add localized data for Gif integration
18
+ *
19
+ */
20
+ function wplc_gif_localize_data() {
21
+ $wplc_settings = get_option("WPLC_SETTINGS");
22
+ global $wplc_version;
23
+
24
+ // Localize variables for the GIF Integration
25
+ if( isset($wplc_settings['wplc_is_gif_integration_enabled']) && $wplc_settings['wplc_is_gif_integration_enabled'] == '1' ) {
26
+ $wplc_is_gif_integration_enabled = true;
27
+ } else {
28
+ $wplc_is_gif_integration_enabled = false;
29
+ }
30
+
31
+ if ( $wplc_is_gif_integration_enabled ) {
32
+
33
+
34
+
35
+ wp_register_script('my-wplc-u-admin-gif-integration', plugins_url('../js/wplc_u_admin_gif_integration.js', __FILE__), array('jquery'), $wplc_version, true);
36
+ wp_enqueue_script('my-wplc-u-admin-gif-integration');
37
+
38
+
39
+
40
+ if( isset($wplc_settings['wplc_preferred_gif_provider']) ) {
41
+ $wplc_selected_gif_provider_idx = $wplc_settings['wplc_preferred_gif_provider'];
42
+ } else {
43
+ $wplc_selected_gif_provider_idx = '0';
44
+ }
45
+
46
+ $wplc_gif_integration_details = array(
47
+ 'is_gif_integration_enabled' => $wplc_is_gif_integration_enabled,
48
+ 'preferred_gif_provider' => $wplc_selected_gif_provider_idx,
49
+ 'available_gif_providers' => array(
50
+ "1" => "https://api.giphy.com",
51
+ "2" => "https://api.tenor.com"
52
+ )
53
+ );
54
+
55
+ wp_localize_script('my-wplc-u-admin-gif-integration', "wplc_gif_integration_details", $wplc_gif_integration_details);
56
+
57
+ }
58
+
59
+ }
60
+
61
+
62
+ /**
63
+ * Searches for a gif in the selected GIF provider
64
+ */
65
+ function wplc_search_gif() {
66
+ // Clean the input coming from the client side
67
+ $search_term = sanitize_text_field($_POST["search_term"]);
68
+
69
+ // Get the necessary parameters to build the url
70
+ $wplc_settings = get_option("WPLC_SETTINGS");
71
+
72
+ if (isset($wplc_settings['wplc_preferred_gif_provider'])) {
73
+ $wplc_selected_gif_provider_idx = $wplc_settings['wplc_preferred_gif_provider'];
74
+ } else {
75
+ $wplc_selected_gif_provider_idx = '1';
76
+ }
77
+
78
+
79
+
80
+
81
+ switch ($wplc_selected_gif_provider_idx) {
82
+
83
+ // Giphy
84
+ case '1':
85
+
86
+ if (isset($wplc_settings['wplc_giphy_api_key'])) {
87
+ $gif_provider_url = "https://api.giphy.com/v1/gifs/search";
88
+ $wplc_selected_gif_provider_key = $wplc_settings['wplc_giphy_api_key'];
89
+
90
+ $params = array(
91
+ 'api_key'=> $wplc_selected_gif_provider_key,
92
+ 'q' => $search_term,
93
+ 'limit' => 10,
94
+ 'offset' => 0,
95
+ 'rating' => 'G',
96
+ 'lan' => 'en'
97
+ );
98
+
99
+ $gif_provider_url = add_query_arg($params, esc_url_raw($gif_provider_url));
100
+ }
101
+
102
+ break;
103
+
104
+ // Tenor
105
+ case '2':
106
+
107
+ if (isset($wplc_settings['wplc_tenor_api_key'])) {
108
+ $gif_provider_url = "https://api.tenor.com/v1/search";
109
+ $wplc_selected_gif_provider_key = $wplc_settings['wplc_tenor_api_key'];
110
+
111
+ $params = array(
112
+ 'q' => $search_term,
113
+ 'key'=> $wplc_selected_gif_provider_key,
114
+ 'limit' => 10,
115
+ 'anon_id' => '3a76e56901d740da9e59ffb22b988242'
116
+ );
117
+
118
+ $gif_provider_url = add_query_arg($params, esc_url_raw($gif_provider_url));
119
+ }
120
+
121
+ break;
122
+ }
123
+
124
+ $response = wp_remote_get(esc_url_raw($gif_provider_url));
125
+ $response_code = wp_remote_retrieve_response_code($response);
126
+ $response_message = wp_remote_retrieve_response_message($response);
127
+
128
+ if (is_wp_error($response)) {
129
+ die($response_message);
130
+ exit;
131
+ } else {
132
+ $body = wp_remote_retrieve_body($response);
133
+ die($body);
134
+ exit;
135
+ }
136
+ }
137
+
138
+ add_action('wplc_hook_admin_settings_chat_box_settings_after','wplc_gif_settings_page', 1);
139
+ function wplc_gif_settings_page() {
140
+ $wplc_settings = get_option("WPLC_SETTINGS");
141
+ if (isset($wplc_settings["wplc_preferred_gif_provider"])) { $wplc_preferred_gif_provider[intval($wplc_settings["wplc_preferred_gif_provider"])] = "SELECTED"; }
142
+ ?>
143
+ <!-- GIF Integration -->
144
+ <h3><?php _e("GIF Integration", 'wplivechat') ?></h3>
145
+ <hr>
146
+ <table class='wp-list-table wplc_list_table widefat fixed striped pages'>
147
+ <tbody>
148
+ <tr>
149
+ <td width='300' valign='top'>
150
+ <?php _e("Enable GIF Integration", "wplivechat") ?>: <i class="fa fa-question-circle wplc_light_grey wplc_settings_tooltip" title="<?php _e("If you enable GIF Integration you're going to be able to send GIFs by typing commands such as '/gif happy' when writing a message.", "wplivechat") ?>"></i>
151
+ </td>
152
+ <td>
153
+ <input id="wplc_is_gif_integration_enabled" name="wplc_is_gif_integration_enabled" type="checkbox" value="1" <?php echo (isset($wplc_settings['wplc_is_gif_integration_enabled']) && $wplc_settings['wplc_is_gif_integration_enabled'] == 1 ? "checked" : "" ); ?> />
154
+ </td>
155
+ </tr>
156
+ <tr>
157
+ <td width='300' valign='top'>
158
+ <?php _e("Select a GIF provider", "wplivechat") ?>: <i class="fa fa-question-circle wplc_light_grey wplc_settings_tooltip" title="<?php _e("A GIF provider is the source of the GIFs that are going to show when you type a command like '/gif happy' on a message.", "wplivechat") ?>"></i>
159
+ </td>
160
+ <td>
161
+ <select id='wplc_preferred_gif_provider' name='wplc_preferred_gif_provider'>
162
+ <option value="1" <?php if (isset($wplc_preferred_gif_provider[1])) { echo $wplc_preferred_gif_provider[1]; } ?>><?php _e("Giphy","wplivechat"); ?></option>
163
+ <option value="2" <?php if (isset($wplc_preferred_gif_provider[2])) { echo $wplc_preferred_gif_provider[2]; } ?>><?php _e("Tenor","wplivechat"); ?></option>
164
+ </select>
165
+ </td>
166
+ </tr>
167
+ <tr>
168
+ <td width='300' valign='top'>
169
+ <?php _e("Giphy API key", "wplivechat") ?>: <i class="fa fa-question-circle wplc_light_grey wplc_settings_tooltip" title="<?php _e("The API key created for you when you register an app on Giphy", "wplivechat") ?>"></i>
170
+ </td>
171
+ <td>
172
+ <input id='wplc_giphy_api_key' name="wplc_giphy_api_key" type="text" value="<?php echo (isset($wplc_settings['wplc_giphy_api_key']) ? urldecode($wplc_settings['wplc_giphy_api_key']) : '' ); ?>" placeholder="<?php _e('Giphy API key', 'wplivechat'); ?>" />
173
+ </td>
174
+ </tr>
175
+ <tr>
176
+ <td width='300' valign='top'>
177
+ <?php _e("Tenor API key", "wplivechat") ?>: <i class="fa fa-question-circle wplc_light_grey wplc_settings_tooltip" title="<?php _e("The API key created for you when you register an app on Tenor", "wplivechat") ?>"></i>
178
+ </td>
179
+ <td>
180
+ <input id='wplc_tenor_api_key' name="wplc_tenor_api_key" type="text" value="<?php echo (isset($wplc_settings['wplc_tenor_api_key']) ? urldecode($wplc_settings['wplc_tenor_api_key']) : '' ); ?>" placeholder="<?php _e('Tenor API key', 'wplivechat'); ?>" />
181
+ </td>
182
+ </tr>
183
+ </tbody>
184
+ </table>
185
+ <!-- ./GIF Integration -->
186
+ <?php
187
+
188
+ }
modules/node_server.php CHANGED
@@ -12,6 +12,7 @@ define("BLEEPER_NODE_SERVER_URL", "https://bleeper.us-3.evennode.com");
12
  define("BLEEPER_NODE_END_POINTS_ROUTE", "api/v1/");
13
  define("BLEEPER_NODE_END_POINT_TOKEN", "zf6fe1399sdfgsdfg02ad09ab6a8cb7345s");
14
 
 
15
  add_action("wplc_activate_hook", "wplc_node_server_token_check", 10);
16
  add_action("wplc_update_hook", "wplc_node_server_token_check", 10);
17
  /**
@@ -524,6 +525,21 @@ function wplc_admin_remote_dashboard_scripts($wplc_settings){
524
  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);
525
  wp_enqueue_script('my-wplc-admin-chatbox-ui-events');
526
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
527
  $wplc_node_token = get_option("wplc_node_server_secret_token");
528
  if(!$wplc_node_token){
529
  if(function_exists("wplc_node_server_token_regenerate")){
@@ -566,7 +582,11 @@ function wplc_admin_remote_dashboard_scripts($wplc_settings){
566
 
567
 
568
 
569
-
 
 
 
 
570
 
571
 
572
 
@@ -583,7 +603,7 @@ function wplc_admin_remote_dashboard_scripts($wplc_settings){
583
  } else {
584
  wp_localize_script('wplc-admin-js-agent', 'bleeper_pro_auth', 'false');
585
  }
586
- wp_localize_script('wplc-admin-js-agent', 'bleeper_agent_verification_end_point', get_rest_url() . "wp_live_chat_support/v1/validate_agent");
587
  wp_localize_script('wplc-admin-js-agent', 'bleeper_disable_mongo', "true");
588
  wp_localize_script('wplc-admin-js-agent', 'bleeper_disable_add_message', "true");
589
  wp_localize_script('wplc-admin-js-agent', 'wplc_nonce', wp_create_nonce("wplc"));
@@ -612,8 +632,8 @@ function wplc_admin_remote_dashboard_scripts($wplc_settings){
612
  if(class_exists("WP_REST_Request")) {
613
  wp_localize_script('wplc-admin-js-agent', 'wplc_restapi_enabled', '1');
614
  wp_localize_script('wplc-admin-js-agent', 'wplc_restapi_token', get_option('wplc_api_secret_token'));
615
- wp_localize_script('wplc-admin-js-agent', 'wplc_restapi_endpoint', site_url().'/wp-json/wp_live_chat_support/v1');
616
- wp_localize_script('wplc-admin-js-agent', 'bleeper_override_upload_url', site_url().'/wp-json/wp_live_chat_support/v1/remote_upload');
617
  wp_localize_script('wplc-admin-js-agent', 'wplc_restapi_nonce', wp_create_nonce( 'wp_rest' ));
618
 
619
  } else {
@@ -720,6 +740,17 @@ function wplc_admin_remote_dashboard_localize_upselling_tips(){
720
 
721
  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'));
722
 
 
 
 
 
 
 
 
 
 
 
 
723
 
724
  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' ) );
725
 
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
  /**
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")){
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
 
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"));
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 {
740
 
741
  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'));
742
 
743
+ $initiate_upsell = "<i class='fa fa-horn'></i> ".__("With the Pro add-on of WP Live Chat Support, you can", "wplivechat");
744
+ $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\">';
745
+ $initiate_upsell .= __("initiate chats", "wplivechat");
746
+ $initiate_upsell .= '</a> '.__("with your online visitors with the click of a button.", "wplivechat");
747
+ $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\">';
748
+ $initiate_upsell .= '<strong>'.__("Buy the Pro add-on now.", "wplivechat").'</strong></a>';
749
+
750
+
751
+
752
+ wp_localize_script( 'wplc-admin-js-agent', 'initiate_chat_upsell', $initiate_upsell);
753
+
754
 
755
  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' ) );
756
 
readme.txt CHANGED
@@ -12,7 +12,7 @@ Fully functional Live Chat plugin. Chat with your visitors for free! No need for
12
 
13
  == Description ==
14
 
15
- The most cost effective Live Chat plugin. Chat with your visitors for free! WP Live Chat Support is perfect for small businesses. No third party connections required. There's no need to pay for live chat monthly subscriptions in order to better understand your visitors. This is a fully functional live chat plugin. Increase your conversion rates by communicating directly with your visitors when they're ready to do so using WP Live Chat Support.
16
 
17
  = Free Version Features =
18
 
@@ -34,10 +34,9 @@ The most cost effective Live Chat plugin. Chat with your visitors for free! WP L
34
  * Compatible with translation plugins
35
  * Google Analytics integration
36
  * Create a custom offline message form when you're not online
37
- * No advertising or links
38
  * Add surveys or polls to your chat box, before or after a chat session
39
  * Anonymity for your visitors
40
- * No "Powered by" links on the live chat window
41
  * No monthly live chat subscriptions needed
42
  * Allow the live chat box to automatically pop up
43
  * Limit the live chat box to only show to registered users
@@ -59,12 +58,14 @@ The most cost effective Live Chat plugin. Chat with your visitors for free! WP L
59
 
60
  * Unlimited live chat agents
61
  * Initiate live chats with online visitors
 
 
 
62
  * Quick Responses (insert a predefined response to your live chat box)
63
  * Data triggers (time trigger, scroll trigger, page trigger, on page leave trigger)
64
  * Reporting (chat stats, popular pages, ROI tracking and reporting, customer satisfaction ratings)
65
  * Customer satisfaction ratings for each chat session
66
  * ROI tracking
67
- * Encrypt your live chat conversations
68
  * Fully responsive admin chat dashboard
69
  * Compatible with all caching plugins (live chat window loaded via Ajax)
70
  * Desktop Notifications when receiving new live chats
@@ -230,6 +231,16 @@ It is highly recommended that you upgrade to WP Live Chat Support version 4.4.0
230
 
231
  == Changelog ==
232
 
 
 
 
 
 
 
 
 
 
 
233
  = 8.0.04 - 2018-02-12 - Low priority =
234
  * Allowed strings from the front end to be translated
235
  * Fixed the iPhone Safari display bug (zooming in to the chat box)
12
 
13
  == Description ==
14
 
15
+ The most cost effective Live Chat plugin. Chat with your visitors for free! WP Live Chat Support is perfect for small businesses. There's no need to pay for live chat monthly subscriptions in order to better understand your visitors. This is a fully functional live chat plugin. Increase your conversion rates by communicating directly with your visitors when they're ready to do so using WP Live Chat Support.
16
 
17
  = Free Version Features =
18
 
34
  * Compatible with translation plugins
35
  * Google Analytics integration
36
  * Create a custom offline message form when you're not online
 
37
  * Add surveys or polls to your chat box, before or after a chat session
38
  * Anonymity for your visitors
39
+ * GIF integration
40
  * No monthly live chat subscriptions needed
41
  * Allow the live chat box to automatically pop up
42
  * Limit the live chat box to only show to registered users
58
 
59
  * Unlimited live chat agents
60
  * Initiate live chats with online visitors
61
+ * Agent to agent chats
62
+ * See what your users are typing before they send their message
63
+ * Track certain visitor events (scrolling, clicking, page views, etc.)
64
  * Quick Responses (insert a predefined response to your live chat box)
65
  * Data triggers (time trigger, scroll trigger, page trigger, on page leave trigger)
66
  * Reporting (chat stats, popular pages, ROI tracking and reporting, customer satisfaction ratings)
67
  * Customer satisfaction ratings for each chat session
68
  * ROI tracking
 
69
  * Fully responsive admin chat dashboard
70
  * Compatible with all caching plugins (live chat window loaded via Ajax)
71
  * Desktop Notifications when receiving new live chats
231
 
232
  == Changelog ==
233
 
234
+ = 8.0.05 - 2018-03-09 - Medium priority =
235
+ * Chat minimize is now respected
236
+ * GIF integration support (Giphy, Tenor)
237
+ * Fixed get correct rest api endpoint urls
238
+ * Fixed chat box header not respecting Use WordPress name instead option
239
+ * Fixes CSS issue in dashboard with the action column
240
+ * Fixes chat history styling
241
+ * Mac style fix (front end)
242
+ * Email transcript integrated
243
+
244
  = 8.0.04 - 2018-02-12 - Low priority =
245
  * Allowed strings from the front end to be translated
246
  * Fixed the iPhone Safari display bug (zooming in to the chat box)
wp-live-chat-support.php CHANGED
@@ -3,7 +3,7 @@
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. No third party connection required!
6
- Version: 8.0.04
7
  Author: WP-LiveChat
8
  Author URI: http://www.wp-livechat.com
9
  Text Domain: wplivechat
@@ -11,7 +11,16 @@
11
  */
12
 
13
  /**
14
- *
 
 
 
 
 
 
 
 
 
15
  * 8.0.04 - 2018-02-12 - Low priority
16
  * Allowed strings from the front end to be translated
17
  * Fixed the iPhone Safari display bug (zooming in to the chat box)
@@ -599,7 +608,7 @@ global $debug_start;
599
  $wplc_tblname_offline_msgs = $wpdb->prefix . "wplc_offline_messages";
600
  $wplc_tblname_chats = $wpdb->prefix . "wplc_chat_sessions";
601
  $wplc_tblname_msgs = $wpdb->prefix . "wplc_chat_msgs";
602
- $wplc_version = "8.0.04";
603
 
604
  define('WPLC_BASIC_PLUGIN_DIR', dirname(__FILE__));
605
  define('WPLC_BASIC_PLUGIN_URL', plugins_url( '/', __FILE__ ) );
@@ -627,6 +636,7 @@ require_once (plugin_dir_path(__FILE__) . "modules/api/wplc-api.php");
627
  require_once (plugin_dir_path(__FILE__) . "modules/beta_features.php");
628
  require_once (plugin_dir_path(__FILE__) . "modules/node_server.php");
629
  require_once (plugin_dir_path(__FILE__) . "modules/module_subscribe.php");
 
630
  require_once (plugin_dir_path(__FILE__) . "includes/update_control.class.php");
631
  require_once (plugin_dir_path(__FILE__) . "modules/webhooks_manager.php");
632
 
@@ -824,6 +834,11 @@ function wplc_version_control() {
824
  if (!isset($wplc_settings['wplc_settings_fill'])) { $wplc_settings["wplc_settings_fill"] = "ed832f"; }
825
 
826
  if (!isset($wplc_settings['wplc_settings_font'])) { $wplc_settings["wplc_settings_font"] = "FFFFFF"; }
 
 
 
 
 
827
  wplc_handle_db();
828
  update_option("wplc_current_version", $wplc_version);
829
 
@@ -924,6 +939,7 @@ function wplc_action_callback() {
924
  die(); // this is required to return a proper result
925
  }
926
 
 
927
  function wplc_feedback_page_include() {
928
  include 'includes/feedback-page.php';
929
  }
@@ -1272,7 +1288,7 @@ function wplc_push_js_to_front_basic() {
1272
  if(class_exists("WP_REST_Request")) {
1273
  wp_localize_script('wplc-user-script', 'wplc_restapi_enabled', '1');
1274
  wp_localize_script('wplc-user-script', 'wplc_restapi_token', get_option('wplc_api_secret_token'));
1275
- wp_localize_script('wplc-user-script', 'wplc_restapi_endpoint', site_url().'/wp-json/wp_live_chat_support/v1');
1276
  wp_localize_script('wplc-user-script', 'wplc_restapi_nonce', wp_create_nonce( 'wp_rest' ));
1277
  } else {
1278
  wp_localize_script('wplc-user-script', 'wplc_restapi_enabled', '0');
@@ -1322,6 +1338,8 @@ function wplc_push_js_to_front_basic() {
1322
  wp_localize_script( 'wplc-user-script', 'wplc_show_chat_detail', $wplc_chat_detail );
1323
  }
1324
 
 
 
1325
  /**
1326
  * Create a JS object for all Agent ID's and Gravatar MD5's
1327
  */
@@ -2347,6 +2365,7 @@ function wplc_filter_control_loggedin($logged_in) {
2347
  }
2348
 
2349
  $logged_in_checks = apply_filters("wplc_filter_is_admin_logged_in",array());
 
2350
  /* if we are logged in ANYWHERE, set this to true */
2351
  foreach($logged_in_checks as $key => $val) {
2352
  if ($val) { $logged_in = true; break; }
@@ -2485,6 +2504,7 @@ function wplc_output_box_ajax_new($cid = null) {
2485
  function wplc_return_default_theme($wplc_settings,$logged_in,$wplc_using_locale,$cid) {
2486
  $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));
2487
  $ret_msg .= "<div class=\"wp-live-chat-wraper\">";
 
2488
  $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));
2489
  $ret_msg .= " <i id=\"wp-live-chat-minimize\" class=\"fa fa-minus wplc-color-bg-2 wplc-color-1\" style=\"display:none;\"></i>";
2490
  $ret_msg .= " <i id=\"wp-live-chat-close\" class=\"fa fa-times\" style=\"display:none;\" ></i>";
@@ -2536,6 +2556,7 @@ function wplc_theme_control_function($wplc_settings,$logged_in,$wplc_using_local
2536
  else if($wplc_newtheme == 'theme-2') {
2537
  $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));
2538
  $ret_msg .= "<div class=\"wp-live-chat-wraper\">";
 
2539
  $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));
2540
  $ret_msg .= " </div>";
2541
  $ret_msg .= '<div id="wplc-chat-alert" class="wplc-chat-alert wplc-chat-alert--' . $wplc_settings["wplc_theme"] . '"></div>';
@@ -2800,7 +2821,7 @@ function wplc_superadmin_javascript() {
2800
  }
2801
  do_action("wplc_hook_admin_javascript_chat");
2802
  } else {
2803
- /* load this on every other admin page */
2804
  if (function_exists("wplc_register_pro_version")) {
2805
  wplc_pro_admin_javascript();
2806
  } else {
@@ -3618,9 +3639,10 @@ function wplc_return_admin_chat_javascript($cid) {
3618
  wp_localize_script('wplc-admin-chat-server', 'wplc_admin_agent_email', md5($agent_data->user_email));
3619
  }
3620
 
 
 
 
3621
 
3622
- wp_register_script('wplc-admin-chat-js', plugins_url('js/wplc_u_admin_chat.js', __FILE__), array('wplc-admin-chat-server'), $wplc_version, false);
3623
- wp_enqueue_script('wplc-admin-chat-js');
3624
 
3625
  global $wplc_pro_version;
3626
  $wplc_ver = str_replace('.', '', $wplc_pro_version);
@@ -3685,11 +3707,11 @@ function wplc_return_admin_chat_javascript($cid) {
3685
  wp_enqueue_script('wplc-admin-chat-js');
3686
  wp_localize_script( 'wplc-admin-chat-js', 'wplc_show_chat_detail', $wplc_chat_detail );
3687
 
3688
-
3689
-
3690
  if (!empty( $wplc_agent_data ) ) {
3691
  wp_localize_script( 'wplc-admin-chat-js', 'wplc_agent_name', $wplc_agent_data->display_name );
3692
- wp_localize_script( 'wplc-admin-chat-js', 'wplc_agent_email', md5( $wplc_agent_data->user_email ) );
3693
  } else {
3694
  wp_localize_script( 'wplc-admin-chat-js', 'wplc_agent_name', '' );
3695
  wp_localize_script( 'wplc-admin-chat-js', 'wplc_agent_email', '' );
@@ -3701,7 +3723,7 @@ function wplc_return_admin_chat_javascript($cid) {
3701
  if(class_exists("WP_REST_Request")) {
3702
  wp_localize_script('wplc-admin-chat-js', 'wplc_restapi_enabled', '1');
3703
  wp_localize_script('wplc-admin-chat-js', 'wplc_restapi_token', get_option('wplc_api_secret_token'));
3704
- wp_localize_script('wplc-admin-chat-js', 'wplc_restapi_endpoint', site_url().'/wp-json/wp_live_chat_support/v1');
3705
  } else {
3706
  wp_localize_script('wplc-admin-chat-js', 'wplc_restapi_enabled', '0');
3707
  }
@@ -3948,6 +3970,7 @@ function wplc_add_user_stylesheet() {
3948
  $wplc_settings = get_option( 'WPLC_SETTINGS' );
3949
  if ( isset( $wplc_settings ) && isset( $wplc_settings['wplc_enable_font_awesome'] ) && '1' === $wplc_settings['wplc_enable_font_awesome'] ) {
3950
  wp_register_style( 'wplc-font-awesome', plugins_url( '/css/font-awesome.min.css', __FILE__ ) );
 
3951
  wp_enqueue_style( 'wplc-font-awesome' );
3952
  }
3953
  wp_register_style('wplc-style', plugins_url('/css/wplcstyle.css', __FILE__), array(), $wplc_version);
@@ -4090,7 +4113,9 @@ function wplc_add_user_stylesheet() {
4090
  wp_register_style( 'wplc-gutenberg-template-styles-user', plugins_url( '/includes/blocks/wplc-chat-box/wplc_gutenberg_template_styles.css', __FILE__ ) );
4091
  wp_enqueue_style( 'wplc-gutenberg-template-styles-user' );
4092
 
4093
-
 
 
4094
  }
4095
  if(function_exists('wplc_ce_activate')){
4096
  if(function_exists('wplc_ce_load_user_styles')){
@@ -4180,7 +4205,7 @@ function wplc_add_admin_stylesheet() {
4180
  wp_enqueue_style('wplc-admin-chat-box-style');
4181
  }
4182
 
4183
- wp_register_style( 'wplc-font-awesome', plugins_url( '/css/font-awesome.min.css', __FILE__ ), false, $wplc_version );
4184
  wp_enqueue_style( 'wplc-font-awesome' );
4185
 
4186
  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')) {
@@ -4194,7 +4219,7 @@ function wplc_add_admin_stylesheet() {
4194
  wp_register_style( 'wplc-gutenberg-template-styles', plugins_url( '/includes/blocks/wplc-chat-box/wplc_gutenberg_template_styles.css', __FILE__ ) );
4195
  wp_enqueue_style( 'wplc-gutenberg-template-styles' );
4196
 
4197
- wp_register_style( 'wplc-admin-styles', plugins_url( '/css/admin_styles.css', __FILE__ ), false, $wplc_version );
4198
  wp_enqueue_style( 'wplc-admin-styles' );
4199
 
4200
  // Old admin chat style
@@ -4209,7 +4234,10 @@ function wplc_add_admin_stylesheet() {
4209
  }
4210
  }
4211
 
4212
-
 
 
 
4213
  // This loads the chat styling on all admin pages as we are using the popout dashboard
4214
  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') ) {
4215
 
@@ -4649,10 +4677,20 @@ function wplc_head_basic() {
4649
  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']); }
4650
  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']) ) ); }
4651
 
 
 
 
 
 
4652
  $wplc_data['wplc_disable_emojis'] = !empty($_POST['wplc_disable_emojis']);
4653
 
4654
  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"; }
 
4655
  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"; }
 
 
 
 
4656
  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"; }
4657
  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"; }
4658
 
@@ -4757,9 +4795,8 @@ function wplc_head_basic() {
4757
  update_option('wplc_mail_username', $_POST['wplc_mail_username']);
4758
  update_option('wplc_mail_password', $_POST['wplc_mail_password']);
4759
 
4760
- echo "<div class='updated wplc_settings_save_notice' style='display: none;'>";
4761
- _e("Your settings have been saved.", "wplivechat");
4762
- echo "</div>";
4763
  }
4764
  if (isset($_POST['action']) && $_POST['action'] == "wplc_submit_find_us") {
4765
  if (function_exists('curl_version')) {
@@ -4804,6 +4841,12 @@ function wplc_head_basic() {
4804
  }
4805
  }
4806
 
 
 
 
 
 
 
4807
  add_action('wp_logout', 'wplc_logout');
4808
  /**
4809
  * Deletes the chat transient when a user logs out
@@ -6471,3 +6514,368 @@ function wplc_register_plugin_for_deactivation_feedback_form($plugins) {
6471
 
6472
  add_filter('codecabin_deactivate_feedback_form_plugins', 'wplc_register_plugin_for_deactivation_feedback_form');
6473
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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. No third party connection required!
6
+ Version: 8.0.05
7
  Author: WP-LiveChat
8
  Author URI: http://www.wp-livechat.com
9
  Text Domain: wplivechat
11
  */
12
 
13
  /**
14
+ * 8.0.05 - 2018-03-09 - Medium priority
15
+ * Chat minimize is now respected
16
+ * GIF integration support (Giphy, Tenor)
17
+ * Fixed get correct rest api endpoint urls
18
+ * Fixed chat box header not respecting Use WordPress name instead option
19
+ * Fixes CSS issue in dashboard with the action column
20
+ * Fixes chat history styling
21
+ * Mac style fix (front end)
22
+ * Email transcript integrated
23
+ *
24
  * 8.0.04 - 2018-02-12 - Low priority
25
  * Allowed strings from the front end to be translated
26
  * Fixed the iPhone Safari display bug (zooming in to the chat box)
608
  $wplc_tblname_offline_msgs = $wpdb->prefix . "wplc_offline_messages";
609
  $wplc_tblname_chats = $wpdb->prefix . "wplc_chat_sessions";
610
  $wplc_tblname_msgs = $wpdb->prefix . "wplc_chat_msgs";
611
+ $wplc_version = "8.0.05";
612
 
613
  define('WPLC_BASIC_PLUGIN_DIR', dirname(__FILE__));
614
  define('WPLC_BASIC_PLUGIN_URL', plugins_url( '/', __FILE__ ) );
636
  require_once (plugin_dir_path(__FILE__) . "modules/beta_features.php");
637
  require_once (plugin_dir_path(__FILE__) . "modules/node_server.php");
638
  require_once (plugin_dir_path(__FILE__) . "modules/module_subscribe.php");
639
+ require_once (plugin_dir_path(__FILE__) . "modules/module_gif.php");
640
  require_once (plugin_dir_path(__FILE__) . "includes/update_control.class.php");
641
  require_once (plugin_dir_path(__FILE__) . "modules/webhooks_manager.php");
642
 
834
  if (!isset($wplc_settings['wplc_settings_fill'])) { $wplc_settings["wplc_settings_fill"] = "ed832f"; }
835
 
836
  if (!isset($wplc_settings['wplc_settings_font'])) { $wplc_settings["wplc_settings_font"] = "FFFFFF"; }
837
+
838
+ if (!isset($wplc_settings['wplc_preferred_gif_provider'])) { $wplc_settings["wplc_preferred_gif_provider"] = 1; }
839
+ if (!isset($wplc_settings['wplc_giphy_api_key'])) { $wplc_settings["wplc_giphy_api_key"] = ""; }
840
+ if (!isset($wplc_settings['wplc_tenor_api_key'])) { $wplc_settings["wplc_tenor_api_key"] = ""; }
841
+
842
  wplc_handle_db();
843
  update_option("wplc_current_version", $wplc_version);
844
 
939
  die(); // this is required to return a proper result
940
  }
941
 
942
+
943
  function wplc_feedback_page_include() {
944
  include 'includes/feedback-page.php';
945
  }
1288
  if(class_exists("WP_REST_Request")) {
1289
  wp_localize_script('wplc-user-script', 'wplc_restapi_enabled', '1');
1290
  wp_localize_script('wplc-user-script', 'wplc_restapi_token', get_option('wplc_api_secret_token'));
1291
+ wp_localize_script('wplc-user-script', 'wplc_restapi_endpoint', rest_url('wp_live_chat_support/v1'));
1292
  wp_localize_script('wplc-user-script', 'wplc_restapi_nonce', wp_create_nonce( 'wp_rest' ));
1293
  } else {
1294
  wp_localize_script('wplc-user-script', 'wplc_restapi_enabled', '0');
1338
  wp_localize_script( 'wplc-user-script', 'wplc_show_chat_detail', $wplc_chat_detail );
1339
  }
1340
 
1341
+
1342
+
1343
  /**
1344
  * Create a JS object for all Agent ID's and Gravatar MD5's
1345
  */
2365
  }
2366
 
2367
  $logged_in_checks = apply_filters("wplc_filter_is_admin_logged_in",array());
2368
+
2369
  /* if we are logged in ANYWHERE, set this to true */
2370
  foreach($logged_in_checks as $key => $val) {
2371
  if ($val) { $logged_in = true; break; }
2504
  function wplc_return_default_theme($wplc_settings,$logged_in,$wplc_using_locale,$cid) {
2505
  $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));
2506
  $ret_msg .= "<div class=\"wp-live-chat-wraper\">";
2507
+ $ret_msg .= "<div id='bleeper_bell' class='wplc-color-bg-1 wplc-color-2' style='display:none;'><i class='fa fa-bell'></i></div>";
2508
  $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));
2509
  $ret_msg .= " <i id=\"wp-live-chat-minimize\" class=\"fa fa-minus wplc-color-bg-2 wplc-color-1\" style=\"display:none;\"></i>";
2510
  $ret_msg .= " <i id=\"wp-live-chat-close\" class=\"fa fa-times\" style=\"display:none;\" ></i>";
2556
  else if($wplc_newtheme == 'theme-2') {
2557
  $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));
2558
  $ret_msg .= "<div class=\"wp-live-chat-wraper\">";
2559
+ $ret_msg .= "<div id='bleeper_bell' class='wplc-color-bg-1 wplc-color-2' style='display:none;'><i class='fa fa-bell'></i></div>";
2560
  $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));
2561
  $ret_msg .= " </div>";
2562
  $ret_msg .= '<div id="wplc-chat-alert" class="wplc-chat-alert wplc-chat-alert--' . $wplc_settings["wplc_theme"] . '"></div>';
2821
  }
2822
  do_action("wplc_hook_admin_javascript_chat");
2823
  } else {
2824
+ /* load this on every other admin page */
2825
  if (function_exists("wplc_register_pro_version")) {
2826
  wplc_pro_admin_javascript();
2827
  } else {
3639
  wp_localize_script('wplc-admin-chat-server', 'wplc_admin_agent_email', md5($agent_data->user_email));
3640
  }
3641
 
3642
+
3643
+ wp_register_script('wplc-admin-chat-js', plugins_url('js/wplc_u_admin_chat.js', __FILE__), array('wplc-admin-chat-server'), $wplc_version, false);
3644
+ wp_enqueue_script('wplc-admin-chat-js');
3645
 
 
 
3646
 
3647
  global $wplc_pro_version;
3648
  $wplc_ver = str_replace('.', '', $wplc_pro_version);
3707
  wp_enqueue_script('wplc-admin-chat-js');
3708
  wp_localize_script( 'wplc-admin-chat-js', 'wplc_show_chat_detail', $wplc_chat_detail );
3709
 
3710
+
3711
+
3712
  if (!empty( $wplc_agent_data ) ) {
3713
  wp_localize_script( 'wplc-admin-chat-js', 'wplc_agent_name', $wplc_agent_data->display_name );
3714
+ wp_localize_script( 'wplc-admin-chat-js', 'wplc_agent_email', md5( $wplc_agent_data->user_email ) );
3715
  } else {
3716
  wp_localize_script( 'wplc-admin-chat-js', 'wplc_agent_name', '' );
3717
  wp_localize_script( 'wplc-admin-chat-js', 'wplc_agent_email', '' );
3723
  if(class_exists("WP_REST_Request")) {
3724
  wp_localize_script('wplc-admin-chat-js', 'wplc_restapi_enabled', '1');
3725
  wp_localize_script('wplc-admin-chat-js', 'wplc_restapi_token', get_option('wplc_api_secret_token'));
3726
+ wp_localize_script('wplc-admin-chat-js', 'wplc_restapi_endpoint', rest_url('wp_live_chat_support/v1'));
3727
  } else {
3728
  wp_localize_script('wplc-admin-chat-js', 'wplc_restapi_enabled', '0');
3729
  }
3970
  $wplc_settings = get_option( 'WPLC_SETTINGS' );
3971
  if ( isset( $wplc_settings ) && isset( $wplc_settings['wplc_enable_font_awesome'] ) && '1' === $wplc_settings['wplc_enable_font_awesome'] ) {
3972
  wp_register_style( 'wplc-font-awesome', plugins_url( '/css/font-awesome.min.css', __FILE__ ) );
3973
+
3974
  wp_enqueue_style( 'wplc-font-awesome' );
3975
  }
3976
  wp_register_style('wplc-style', plugins_url('/css/wplcstyle.css', __FILE__), array(), $wplc_version);
4113
  wp_register_style( 'wplc-gutenberg-template-styles-user', plugins_url( '/includes/blocks/wplc-chat-box/wplc_gutenberg_template_styles.css', __FILE__ ) );
4114
  wp_enqueue_style( 'wplc-gutenberg-template-styles-user' );
4115
 
4116
+ // GIF integration styles - user
4117
+ wp_register_style( 'wplc-gif-integration-user', plugins_url( '/css/wplc_gif_integration.css', __FILE__ ) );
4118
+ wp_enqueue_style( 'wplc-gif-integration-user' );
4119
  }
4120
  if(function_exists('wplc_ce_activate')){
4121
  if(function_exists('wplc_ce_load_user_styles')){
4205
  wp_enqueue_style('wplc-admin-chat-box-style');
4206
  }
4207
 
4208
+ wp_register_style( 'wplc-font-awesome', plugins_url('css/font-awesome.min.css', __FILE__ ), false, $wplc_version );
4209
  wp_enqueue_style( 'wplc-font-awesome' );
4210
 
4211
  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')) {
4219
  wp_register_style( 'wplc-gutenberg-template-styles', plugins_url( '/includes/blocks/wplc-chat-box/wplc_gutenberg_template_styles.css', __FILE__ ) );
4220
  wp_enqueue_style( 'wplc-gutenberg-template-styles' );
4221
 
4222
+ wp_register_style( 'wplc-admin-styles', plugins_url( '/css/admin_styles.css', __FILE__ ), false, $wplc_version );
4223
  wp_enqueue_style( 'wplc-admin-styles' );
4224
 
4225
  // Old admin chat style
4234
  }
4235
  }
4236
 
4237
+ // Gif Integration styles - admin
4238
+ wp_register_style( 'wplc-gif-integration', plugins_url( '/css/wplc_gif_integration.css', __FILE__ ) );
4239
+ wp_enqueue_style( 'wplc-gif-integration' );
4240
+
4241
  // This loads the chat styling on all admin pages as we are using the popout dashboard
4242
  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') ) {
4243
 
4677
  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']); }
4678
  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']) ) ); }
4679
 
4680
+ if (isset($_POST['wplc_is_gif_integration_enabled'] )){ $wplc_data['wplc_is_gif_integration_enabled'] = esc_attr($_POST['wplc_is_gif_integration_enabled']); }
4681
+ if (isset($_POST['wplc_preferred_gif_provider'])) { $wplc_data['wplc_preferred_gif_provider'] = esc_attr($_POST['wplc_preferred_gif_provider']); }
4682
+ if (isset($_POST['wplc_giphy_api_key'])) { $wplc_data['wplc_giphy_api_key'] = esc_attr($_POST['wplc_giphy_api_key']); }
4683
+ if (isset($_POST['wplc_tenor_api_key'])) { $wplc_data['wplc_tenor_api_key'] = esc_attr($_POST['wplc_tenor_api_key']); }
4684
+
4685
  $wplc_data['wplc_disable_emojis'] = !empty($_POST['wplc_disable_emojis']);
4686
 
4687
  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"; }
4688
+
4689
  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"; }
4690
+
4691
+ 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"; }
4692
+
4693
+
4694
  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"; }
4695
  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"; }
4696
 
4795
  update_option('wplc_mail_username', $_POST['wplc_mail_username']);
4796
  update_option('wplc_mail_password', $_POST['wplc_mail_password']);
4797
 
4798
+
4799
+ add_action( 'admin_notices', 'wplc_save_settings_action' );
 
4800
  }
4801
  if (isset($_POST['action']) && $_POST['action'] == "wplc_submit_find_us") {
4802
  if (function_exists('curl_version')) {
4841
  }
4842
  }
4843
 
4844
+ function wplc_save_settings_action() { ?>
4845
+ <div class='notice notice-success updated wplc_settings_save_notice'>
4846
+ <?php _e("Your settings have been saved.", "wplivechat"); ?>
4847
+ </div>
4848
+ <?php }
4849
+
4850
  add_action('wp_logout', 'wplc_logout');
4851
  /**
4852
  * Deletes the chat transient when a user logs out
6514
 
6515
  add_filter('codecabin_deactivate_feedback_form_plugins', 'wplc_register_plugin_for_deactivation_feedback_form');
6516
 
6517
+ if ( function_exists( 'wplc_et_first_run_check' ) ) {
6518
+ add_action( 'admin_notices', 'wplc_transcript_admin_notice' );
6519
+ }
6520
+ function wplc_transcript_admin_notice() {
6521
+ 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' ) );
6522
+ }
6523
+
6524
+ add_action( 'init', 'wplc_transcript_first_run_check' );
6525
+ function wplc_transcript_first_run_check() {
6526
+ if ( ! get_option( "WPLC_ET_FIRST_RUN" ) ) {
6527
+ /* set the default settings */
6528
+ $wplc_et_data['wplc_enable_transcripts'] = 1;
6529
+ $wplc_et_data['wplc_send_transcripts_to'] = 'user';
6530
+ $wplc_et_data['wplc_send_transcripts_when_chat_ends'] = 0;
6531
+ $wplc_et_data['wplc_et_email_body'] = wplc_transcript_return_default_email_body();
6532
+ $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>';
6533
+
6534
+ $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' ),
6535
+ 'mailto:' . get_bloginfo( 'admin_email' )
6536
+ );
6537
+
6538
+ $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>";
6539
+
6540
+
6541
+ update_option( 'WPLC_ET_SETTINGS', $wplc_et_data );
6542
+ update_option( "WPLC_ET_FIRST_RUN", true );
6543
+ }
6544
+ }
6545
+
6546
+ add_action( 'wplc_hook_admin_visitor_info_display_after', 'wplc_transcript_add_admin_button' );
6547
+ function wplc_transcript_add_admin_button( $cid ) {
6548
+ $wplc_et_settings = get_option( "WPLC_ET_SETTINGS" );
6549
+ $wplc_enable_transcripts = $wplc_et_settings['wplc_enable_transcripts'];
6550
+ if ( isset( $wplc_enable_transcripts ) && $wplc_enable_transcripts == 1 ) {
6551
+ 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>";
6552
+ }
6553
+ }
6554
+
6555
+ add_action( 'wplc_hook_admin_javascript_chat', 'wplc_transcript_admin_javascript' );
6556
+ function wplc_transcript_admin_javascript() {
6557
+ $wplc_et_ajax_nonce = wp_create_nonce( "wplc_et_nonce" );
6558
+ wp_register_script( 'wplc_transcript_admin', plugins_url( '/js/wplc_transcript.js', __FILE__ ), null, '', true );
6559
+ $wplc_transcript_localizations = array(
6560
+ 'ajax_nonce' => $wplc_et_ajax_nonce,
6561
+ 'string_loading' => __( "Sending transcript...", "wplivechat" ),
6562
+ 'string_title' => __( "Sending Transcript", "wplivechat" ),
6563
+ 'string_close' => __( "Close", "wplivechat" ),
6564
+ 'string_chat_emailed' => __( "The chat transcript has been emailed.", "wplivechat" ),
6565
+ '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" )
6566
+ );
6567
+ wp_localize_script( 'wplc_transcript_admin', 'wplc_transcript_nonce', $wplc_transcript_localizations );
6568
+ wp_enqueue_script( 'wplc_transcript_admin' );
6569
+ }
6570
+
6571
+ add_action( 'wp_ajax_wplc_et_admin_email_transcript', 'wplc_transcript_callback' );
6572
+ function wplc_transcript_callback() {
6573
+ $check = check_ajax_referer( 'wplc_et_nonce', 'security' );
6574
+ if ( $check == 1 ) {
6575
+
6576
+ if ( isset( $_POST['el'] ) && $_POST['el'] === 'endChat' ) {
6577
+ $wplc_et_settings = get_option( "WPLC_ET_SETTINGS" );
6578
+ $transcript_chat_ends = $wplc_et_settings['wplc_send_transcripts_when_chat_ends'];
6579
+ if ( $transcript_chat_ends === 0 ) {
6580
+ wp_die();
6581
+ }
6582
+ }
6583
+
6584
+ if ( $_POST['action'] == "wplc_et_admin_email_transcript" ) {
6585
+ if ( isset( $_POST['cid'] ) ) {
6586
+ $cid = wplc_return_chat_id_by_rel( $_POST['cid'] );
6587
+ echo json_encode( wplc_send_transcript( sanitize_text_field( $cid ) ) );
6588
+ } else {
6589
+ echo json_encode( array( "error" => "no CID" ) );
6590
+ }
6591
+ wp_die();
6592
+ }
6593
+
6594
+ wp_die();
6595
+ }
6596
+ wp_die();
6597
+ }
6598
+
6599
+ function wplc_send_transcript( $cid ) {
6600
+ if ( ! $cid ) {
6601
+ return array( "error" => "no CID", "cid" => $cid );
6602
+ }
6603
+
6604
+ $email = false;
6605
+ $wplc_et_settings = get_option( "WPLC_ET_SETTINGS" );
6606
+
6607
+ if ( function_exists( "wplc_get_chat_data" ) ) {
6608
+ $cdata = wplc_get_chat_data( $cid );
6609
+ if ( $cdata ) {
6610
+ if ( $wplc_et_settings['wplc_send_transcripts_to'] === 'admin' ) {
6611
+ $user = wp_get_current_user();
6612
+ $email = $user->user_email;
6613
+ } else {
6614
+ $email = $cdata->email;
6615
+ }
6616
+ if ( ! $email ) {
6617
+ return array( "error" => "no email" );
6618
+ }
6619
+ } else {
6620
+ return array( "error" => "no chat data" );
6621
+ }
6622
+ } else {
6623
+ return array( "error" => "basic funtion missing" );
6624
+ }
6625
+
6626
+ $headers = array( 'Content-Type: text/html; charset=UTF-8' );
6627
+ $subject = sprintf( __( 'Your chat transcript from %1$s', 'wplivechat' ),
6628
+ get_bloginfo( 'url' )
6629
+ );
6630
+ wp_mail( $email, $subject, wplc_transcript_return_chat_messages( $cid ), $headers );
6631
+
6632
+ return array( "success" => 1 );
6633
+
6634
+ }
6635
+
6636
+ function wplc_transcript_return_chat_messages( $cid ) {
6637
+ global $current_chat_id;
6638
+ $current_chat_id = $cid;
6639
+ $wplc_et_settings = get_option( "WPLC_ET_SETTINGS" );
6640
+ $body = html_entity_decode( stripslashes( $wplc_et_settings['wplc_et_email_body'] ) );
6641
+
6642
+ if ( ! $body ) {
6643
+ $body = do_shortcode( wplc_transcript_return_default_email_body() );
6644
+ } else {
6645
+ $body = do_shortcode( $body );
6646
+ }
6647
+
6648
+ return $body;
6649
+ }
6650
+
6651
+ function wplc_transcript_return_default_email_body() {
6652
+ $body = '
6653
+ <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">
6654
+ <html>
6655
+
6656
+ <body>
6657
+
6658
+
6659
+
6660
+ <table id="" border="0" cellpadding="0" cellspacing="0" width="100%" style="background-color: #ec822c;">
6661
+ <tbody>
6662
+ <tr>
6663
+ <td width="100%" style="padding: 30px 20px 100px 20px;">
6664
+ <table align="center" cellpadding="0" cellspacing="0" class="" width="100%" style="border-collapse: separate; max-width:600px;">
6665
+ <tbody>
6666
+ <tr>
6667
+ <td style="text-align: center; padding-bottom: 20px;">
6668
+
6669
+ <p>[wplc_et_transcript_header_text]</p>
6670
+ </td>
6671
+ </tr>
6672
+ </tbody>
6673
+ </table>
6674
+
6675
+ <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);">
6676
+ <tbody>
6677
+ <tr>
6678
+ <td class="sortable-list ui-sortable" style="padding:20px;">
6679
+ [wplc_et_transcript]
6680
+ </td>
6681
+ </tr>
6682
+ </tbody>
6683
+ </table>
6684
+
6685
+ <table align="center" cellpadding="0" cellspacing="0" class="" width="100%" style="border-collapse: separate; max-width:100%;">
6686
+ <tbody>
6687
+ <tr>
6688
+ <td style="padding:20px;">
6689
+ <table border="0" cellpadding="0" cellspacing="0" class="" width="100%">
6690
+ <tbody>
6691
+ <tr>
6692
+ <td id="" align="center">
6693
+ <p>[wplc_et_transcript_footer_text]</p>
6694
+ </td>
6695
+ </tr>
6696
+ </tbody>
6697
+ </table>
6698
+ </td>
6699
+ </tr>
6700
+ </tbody>
6701
+ </table>
6702
+ </td>
6703
+ </tr>
6704
+ </tbody>
6705
+ </table>
6706
+
6707
+
6708
+
6709
+ </div>
6710
+ </body>
6711
+ </html>
6712
+ ';
6713
+
6714
+ return $body;
6715
+ }
6716
+
6717
+ add_action( 'wplc_hook_admin_settings_save', 'wplc_transcript_save_settings' );
6718
+ function wplc_transcript_save_settings() {
6719
+ if ( isset( $_POST['wplc_save_settings'] ) ) {
6720
+ if ( isset( $_POST['wplc_enable_transcripts'] ) ) {
6721
+ $wplc_et_data['wplc_enable_transcripts'] = esc_attr( $_POST['wplc_enable_transcripts'] );
6722
+ } else {
6723
+ $wplc_et_data['wplc_enable_transcripts'] = 0;
6724
+ }
6725
+ if ( isset( $_POST['wplc_send_transcripts_to'] ) ) {
6726
+ $wplc_et_data['wplc_send_transcripts_to'] = esc_attr( $_POST['wplc_send_transcripts_to'] );
6727
+ } else {
6728
+ $wplc_et_data['wplc_send_transcripts_to'] = 'user';
6729
+ }
6730
+ if ( isset( $_POST['wplc_send_transcripts_when_chat_ends'] ) ) {
6731
+ $wplc_et_data['wplc_send_transcripts_when_chat_ends'] = esc_attr( $_POST['wplc_send_transcripts_when_chat_ends'] );
6732
+ } else {
6733
+ $wplc_et_data['wplc_send_transcripts_when_chat_ends'] = 0;
6734
+ }
6735
+ if ( isset( $_POST['wplc_et_email_header'] ) ) {
6736
+ $wplc_et_data['wplc_et_email_header'] = esc_attr( $_POST['wplc_et_email_header'] );
6737
+ }
6738
+ if ( isset( $_POST['wplc_et_email_footer'] ) ) {
6739
+ $wplc_et_data['wplc_et_email_footer'] = esc_attr( $_POST['wplc_et_email_footer'] );
6740
+ }
6741
+ if ( isset( $_POST['wplc_et_email_body'] ) ) {
6742
+ $wplc_et_data['wplc_et_email_body'] = esc_html( $_POST['wplc_et_email_body'] );
6743
+ }
6744
+ update_option( 'WPLC_ET_SETTINGS', $wplc_et_data );
6745
+
6746
+ }
6747
+ }
6748
+
6749
+ add_action( 'wplc_hook_admin_settings_main_settings_after', 'wplc_hook_admin_transcript_settings' );
6750
+ function wplc_hook_admin_transcript_settings() {
6751
+ $wplc_et_settings = get_option( "WPLC_ET_SETTINGS" );
6752
+ echo "<hr />";
6753
+ echo "<h3>" . __( "Chat Transcript Settings", 'wplivechat' ) . "</h3>";
6754
+ echo "<table class='form-table wp-list-table widefat fixed striped pages' width='700'>";
6755
+ echo " <tr>";
6756
+ echo " <td width='400' valign='top'>" . __( "Enable chat transcripts:", "wplivechat" ) . "</td>";
6757
+ echo " <td>";
6758
+ echo " <input type=\"checkbox\" value=\"1\" name=\"wplc_enable_transcripts\" ";
6759
+ if ( isset( $wplc_et_settings['wplc_enable_transcripts'] ) && $wplc_et_settings['wplc_enable_transcripts'] == 1 ) {
6760
+ echo "checked";
6761
+ }
6762
+ echo " />";
6763
+ echo " </td>";
6764
+ echo " </tr>";
6765
+
6766
+ echo " <tr>";
6767
+ echo " <td width='400' valign='top'>" . __( "Send transcripts to:", "wplivechat" ) . "</td>";
6768
+ echo " <td>";
6769
+ echo " <select name=\"wplc_send_transcripts_to\">";
6770
+ echo " <option value=\"user\" ";
6771
+ if ( isset( $wplc_et_settings['wplc_send_transcripts_to'] ) && $wplc_et_settings['wplc_send_transcripts_to'] == 'user' ) {
6772
+ echo "selected";
6773
+ }
6774
+ echo ">" . __( "User", "wplivechat" ) . "</option>";
6775
+ echo " <option value=\"admin\" ";
6776
+ if ( isset( $wplc_et_settings['wplc_send_transcripts_to'] ) && $wplc_et_settings['wplc_send_transcripts_to'] == 'admin' ) {
6777
+ echo "selected";
6778
+ }
6779
+ echo ">" . __( "Admin", "wplivechat" ) . "</option>";
6780
+ echo " </select>";
6781
+ echo " </td>";
6782
+ echo " </tr>";
6783
+
6784
+ echo " <tr>";
6785
+ echo " <td width='400' valign='top'>" . __( "Send transcripts when chat ends:", "wplivechat" ) . "</td>";
6786
+ echo " <td>";
6787
+ echo " <input type=\"checkbox\" value=\"1\" name=\"wplc_send_transcripts_when_chat_ends\" ";
6788
+ if ( isset( $wplc_et_settings['wplc_send_transcripts_when_chat_ends'] ) && $wplc_et_settings['wplc_send_transcripts_when_chat_ends'] == 1 ) {
6789
+ echo "checked";
6790
+ }
6791
+ echo " />";
6792
+ echo " </td>";
6793
+ echo " </tr>";
6794
+
6795
+ echo " <tr>";
6796
+ echo " <td width='400' valign='top'>" . __( "Email body", "wplivechat" ) . "</td>";
6797
+ echo " <td>";
6798
+ echo " <textarea cols='85' rows='15' name=\"wplc_et_email_body\">";
6799
+ if ( isset( $wplc_et_settings['wplc_et_email_body'] ) ) {
6800
+ echo html_entity_decode( stripslashes( $wplc_et_settings['wplc_et_email_body'] ) );
6801
+ }
6802
+ echo " </textarea>";
6803
+ echo " </td>";
6804
+ echo " </tr>";
6805
+
6806
+
6807
+ echo " <tr>";
6808
+ echo " <td width='400' valign='top'>" . __( "Email header", "wplivechat" ) . "</td>";
6809
+ echo " <td>";
6810
+ echo " <textarea cols='85' rows='5' name=\"wplc_et_email_header\">";
6811
+ if ( isset( $wplc_et_settings['wplc_et_email_header'] ) ) {
6812
+ echo stripslashes( $wplc_et_settings['wplc_et_email_header'] );
6813
+ }
6814
+ echo " </textarea>";
6815
+ echo " </td>";
6816
+ echo " </tr>";
6817
+
6818
+ echo " <tr>";
6819
+ echo " <td width='400' valign='top'>" . __( "Email footer", "wplivechat" ) . "</td>";
6820
+ echo " <td>";
6821
+ echo " <textarea cols='85' rows='5' name=\"wplc_et_email_footer\">";
6822
+ if ( isset( $wplc_et_settings['wplc_et_email_footer'] ) ) {
6823
+ echo stripslashes( $wplc_et_settings['wplc_et_email_footer'] );
6824
+ }
6825
+ echo " </textarea>";
6826
+ echo " </td>";
6827
+ echo " </tr>";
6828
+
6829
+
6830
+ echo "</table>";
6831
+ }
6832
+
6833
+ add_shortcode('wplc_et_transcript', 'wplc_transcript_get_transcript');
6834
+ function wplc_transcript_get_transcript() {
6835
+ global $current_chat_id;
6836
+ $cid = $current_chat_id;
6837
+
6838
+ if ( intval( $cid ) > 0 ) {
6839
+ return wplc_return_chat_messages( intval( $cid ), true );
6840
+ } else {
6841
+ return "0";
6842
+ }
6843
+ }
6844
+
6845
+ add_shortcode( 'wplc_et_transcript_footer_text', 'wplc_transcript_get_footer_text' );
6846
+ function wplc_transcript_get_footer_text() {
6847
+ $wplc_et_settings = get_option( "WPLC_ET_SETTINGS" );
6848
+ $wplc_et_footer = html_entity_decode( stripslashes( $wplc_et_settings['wplc_et_email_footer'] ) );
6849
+ if ( $wplc_et_footer ) {
6850
+ return $wplc_et_footer;
6851
+ } else {
6852
+ return "";
6853
+ }
6854
+ }
6855
+
6856
+ add_shortcode( 'wplc_et_transcript_header_text', 'wplc_transcript_get_header_text' );
6857
+ function wplc_transcript_get_header_text() {
6858
+ $wplc_et_settings = get_option( "WPLC_ET_SETTINGS" );
6859
+
6860
+ global $current_chat_id;
6861
+ $cid = $current_chat_id;
6862
+
6863
+ $from_email = "Unknown@unknown.com";
6864
+ $from_name = "User";
6865
+ if ( intval( $cid ) > 0 ) {
6866
+ $chat_data = wplc_get_chat_data( $cid );
6867
+ if ( isset( $chat_data->email ) ) {
6868
+ $from_email = $chat_data->email;
6869
+ }
6870
+ if ( isset( $chat_data->name ) ) {
6871
+ $from_name = $chat_data->name;
6872
+ }
6873
+ }
6874
+
6875
+ $wplc_et_header = "<h3>".$from_name." (".$from_email.")"."</h3>".html_entity_decode( stripslashes( $wplc_et_settings['wplc_et_email_header'] ) );
6876
+ if ( $wplc_et_header ) {
6877
+ return $wplc_et_header;
6878
+ } else {
6879
+ return "";
6880
+ }
6881
+ }