Click to Chat for WhatsApp Chat - Version 3.9

Version Description

  • New: Greetings Dialogs
    • Greetings 1: Customizable Design
    • Greetings 2: Content Specific
Download this release

Release Info

Developer bhvreddy
Plugin Icon 128x128 Click to Chat for WhatsApp Chat
Version 3.9
Comparing to
See all releases

Code changes from version 3.8.1 to 3.9

Files changed (46) hide show
  1. click-to-chat.php +2 -2
  2. new/admin/admin.php +3 -0
  3. new/admin/admin_assets/css/admin.css +2 -0
  4. new/admin/admin_assets/js/333.admin.js +50 -27
  5. new/admin/admin_assets/js/admin.js +33 -17
  6. new/admin/admin_assets/js/greetings.js +103 -0
  7. new/admin/admin_commons/admin-sidebar-content.php +1 -4
  8. new/admin/admin_commons/class-ht-ctc-admin-hooks.php +10 -5
  9. new/admin/class-ht-ctc-admin-greetings-page.php +566 -0
  10. new/admin/class-ht-ctc-admin-scripts.php +8 -2
  11. new/admin/components/checkbox.php +3 -1
  12. new/admin/components/collapsible_start.php +9 -7
  13. new/admin/components/color.php +10 -1
  14. new/admin/components/editor.php +2 -1
  15. new/admin/components/heading.php +3 -1
  16. new/admin/components/list/ht-ctc-admin-list-page.php +45 -0
  17. new/admin/components/number.php +2 -1
  18. new/admin/components/select.php +30 -23
  19. new/admin/components/text.php +2 -1
  20. new/admin/components/textarea.php +2 -1
  21. new/admin/db/class-ht-ctc-db.php +2 -0
  22. new/admin/db/class-ht-ctc-db2.php +1 -1
  23. new/admin/db/defaults/class-ht-ctc-defaults-greetings.php +68 -0
  24. new/admin/db/defaults/class-ht-ctc-defaults.php +26 -0
  25. new/inc/assets/js/331.app.js +1 -1
  26. new/inc/assets/js/332.app.js +1 -1
  27. new/inc/assets/js/app.js +1 -1
  28. new/inc/assets/js/dev/app.dev.js +3 -8
  29. new/inc/chat/class-ht-ctc-chat.php +24 -0
  30. new/inc/class-ht-ctc-register.php +2 -0
  31. new/inc/commons/class-ht-ctc-scripts.php +2 -2
  32. new/inc/greetings/class-ht-ctc-chat-greetings.php +224 -0
  33. new/inc/greetings/greetings-1.php +149 -0
  34. new/inc/greetings/greetings-2.php +59 -0
  35. new/inc/greetings/greetings_styles/g-cta-1.php +48 -0
  36. new/inc/greetings/greetings_styles/g-cta-7_1.php +74 -0
  37. new/inc/styles-shortcode/sc-style-7.php +4 -1
  38. new/inc/styles/style-2.php +1 -1
  39. new/inc/styles/style-3.php +1 -1
  40. new/inc/styles/style-3_1.php +3 -3
  41. new/inc/styles/style-5.php +1 -1
  42. new/inc/styles/style-7.php +4 -4
  43. new/inc/styles/style-7_1.php +4 -4
  44. new/inc/styles/style-8.php +1 -1
  45. new/tools/woo/class-ht-ctc-woo.php +56 -0
  46. readme.txt +6 -1
click-to-chat.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Click to Chat
4
  Plugin URI: https://wordpress.org/plugins/click-to-chat-for-whatsapp/
5
  Description: Lets make your Web page visitors contact you through WhatsApp with a single click/tap
6
- Version: 3.8.1
7
  Author: HoliThemes
8
  Author URI: https://holithemes.com/plugins/click-to-chat/
9
  License: GPL2
@@ -17,7 +17,7 @@ if ( ! defined( 'WPINC' ) ) {
17
 
18
  // ctc - Version - update version at readme 'Stable tag'
19
  if ( ! defined( 'HT_CTC_VERSION' ) ) {
20
- define( 'HT_CTC_VERSION', '3.8.1' );
21
  }
22
 
23
  // define HT_CTC_PLUGIN_FILE
3
  Plugin Name: Click to Chat
4
  Plugin URI: https://wordpress.org/plugins/click-to-chat-for-whatsapp/
5
  Description: Lets make your Web page visitors contact you through WhatsApp with a single click/tap
6
+ Version: 3.9
7
  Author: HoliThemes
8
  Author URI: https://holithemes.com/plugins/click-to-chat/
9
  License: GPL2
17
 
18
  // ctc - Version - update version at readme 'Stable tag'
19
  if ( ! defined( 'HT_CTC_VERSION' ) ) {
20
+ define( 'HT_CTC_VERSION', '3.9' );
21
  }
22
 
23
  // define HT_CTC_PLUGIN_FILE
new/admin/admin.php CHANGED
@@ -43,6 +43,9 @@ if ( isset ( $ht_ctc_othersettings['enable_share'] ) ) {
43
  // customize
44
  include_once HT_CTC_PLUGIN_DIR .'new/admin/class-ht-ctc-admin-customize-styles.php';
45
 
 
 
 
46
  // other settings - enable options ..
47
  include_once HT_CTC_PLUGIN_DIR .'new/admin/class-ht-ctc-admin-other-settings.php';
48
 
43
  // customize
44
  include_once HT_CTC_PLUGIN_DIR .'new/admin/class-ht-ctc-admin-customize-styles.php';
45
 
46
+ // greetings
47
+ include_once HT_CTC_PLUGIN_DIR .'new/admin/class-ht-ctc-admin-greetings-page.php';
48
+
49
  // other settings - enable options ..
50
  include_once HT_CTC_PLUGIN_DIR .'new/admin/class-ht-ctc-admin-other-settings.php';
51
 
new/admin/admin_assets/css/admin.css CHANGED
@@ -29,6 +29,7 @@
29
  .not_samesettings,
30
  .show_settings,
31
  .hide_settings,
 
32
  .ctc_init_display_none {
33
  display: none;
34
  }
@@ -45,6 +46,7 @@
45
  padding: 2px 11px;
46
  }
47
 
 
48
  .click-to-chat_page_click-to-chat-greetings .link-target #wp-link-target {
49
  opacity: 1 !important;
50
  }
29
  .not_samesettings,
30
  .show_settings,
31
  .hide_settings,
32
+ .ctc_greetings_settings,
33
  .ctc_init_display_none {
34
  display: none;
35
  }
46
  padding: 2px 11px;
47
  }
48
 
49
+ /* Editior */
50
  .click-to-chat_page_click-to-chat-greetings .link-target #wp-link-target {
51
  opacity: 1 !important;
52
  }
new/admin/admin_assets/js/333.admin.js CHANGED
@@ -1,19 +1,22 @@
1
  // Click to Chat
2
  document.addEventListener('DOMContentLoaded', function () {
3
 
4
- // M.AutoInit();
 
 
 
 
5
 
6
- var elems = document.querySelectorAll('select');
7
- M.FormSelect.init(elems, {});
8
 
9
- var elems = document.querySelectorAll('.collapsible');
10
- M.Collapsible.init(elems, {});
11
 
12
- var elems = document.querySelectorAll('.modal');
13
- M.Modal.init(elems, {});
14
-
15
- var elems = document.querySelectorAll('.tooltipped');
16
- M.Tooltip.init(elems, {});
17
 
18
  });
19
 
@@ -22,11 +25,27 @@ document.addEventListener('DOMContentLoaded', function () {
22
  // ready
23
  $(function () {
24
 
25
- $('select').formSelect();
26
- $('.collapsible').collapsible();
27
- $('.modal').modal();
28
- $('.tooltipped').tooltip();
29
- $('.ht-ctc-color').wpColorPicker();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
 
31
 
32
  // functions
@@ -43,8 +62,12 @@ document.addEventListener('DOMContentLoaded', function () {
43
  try {
44
  woo_page();
45
  collapsible();
46
- } catch (e) {}
47
-
 
 
 
 
48
 
49
 
50
  // show/hide settings
@@ -157,7 +180,7 @@ document.addEventListener('DOMContentLoaded', function () {
157
 
158
  }
159
 
160
-
161
 
162
  function ht_ctc_admin_animations() {
163
  // default display
@@ -181,7 +204,7 @@ document.addEventListener('DOMContentLoaded', function () {
181
  }
182
  });
183
  }
184
-
185
 
186
  // Deskop, Mobile - same settings
187
  function desktop_mobile() {
@@ -205,7 +228,7 @@ document.addEventListener('DOMContentLoaded', function () {
205
  });
206
 
207
  }
208
-
209
 
210
  // WhatsApp number
211
  function wn() {
@@ -258,7 +281,7 @@ document.addEventListener('DOMContentLoaded', function () {
258
  $('.woo_single_position_select').on("change", function (e) {
259
  var position_change_val = e.target.value;
260
  var style_val = $('.woo_single_style_select').find(":selected").val();
261
-
262
  if (position_change_val == 'select') {
263
  $('.woo_single_position_settings').hide(200);
264
  hide_cart_layout();
@@ -299,7 +322,7 @@ document.addEventListener('DOMContentLoaded', function () {
299
  // woo shop page ..
300
  if ($('#woo_shop_add_whatsapp').is(':checked')) {
301
  $(".woo_shop_add_whatsapp_settings").show();
302
-
303
  var shop_style_val = $('.woo_shop_style').find(":selected").val();
304
  if (shop_style_val == '1' || shop_style_val == '8') {
305
  shop_show_cart_layout();
@@ -307,7 +330,7 @@ document.addEventListener('DOMContentLoaded', function () {
307
  }
308
 
309
 
310
-
311
 
312
  $("#woo_shop_add_whatsapp").on("change", function (e) {
313
  if ($('#woo_shop_add_whatsapp').is(':checked')) {
@@ -325,7 +348,7 @@ document.addEventListener('DOMContentLoaded', function () {
325
  }
326
  });
327
 
328
-
329
  // on change - style - for cart layout
330
  $('.woo_shop_style').on("change", function (e) {
331
  var shop_style_change_val = e.target.value;
@@ -353,7 +376,7 @@ document.addEventListener('DOMContentLoaded', function () {
353
  }
354
 
355
  }
356
-
357
 
358
  // webhook
359
  function hook() {
@@ -374,7 +397,7 @@ document.addEventListener('DOMContentLoaded', function () {
374
  });
375
 
376
  }
377
-
378
 
379
  // things based on screen size
380
  function ss() {
@@ -389,7 +412,7 @@ document.addEventListener('DOMContentLoaded', function () {
389
  $("#whatsapp_number").attr('data-position', 'bottom');
390
  }
391
  }
392
-
393
 
394
  function other() {
395
 
1
  // Click to Chat
2
  document.addEventListener('DOMContentLoaded', function () {
3
 
4
+ try {
5
+ // M.AutoInit();
6
+
7
+ var elems = document.querySelectorAll('select');
8
+ M.FormSelect.init(elems, {});
9
 
10
+ var elems = document.querySelectorAll('.collapsible');
11
+ M.Collapsible.init(elems, {});
12
 
13
+ var elems = document.querySelectorAll('.modal');
14
+ M.Modal.init(elems, {});
15
 
16
+ var elems = document.querySelectorAll('.tooltipped');
17
+ M.Tooltip.init(elems, {});
18
+ } catch (e) { }
19
+
 
20
 
21
  });
22
 
25
  // ready
26
  $(function () {
27
 
28
+ try {
29
+ $('select').formSelect();
30
+ $('.collapsible').collapsible();
31
+ $('.modal').modal();
32
+ $('.tooltipped').tooltip();
33
+ } catch (e) { }
34
+
35
+ var color_picker = {
36
+ palettes: [
37
+ '#000000',
38
+ '#FFFFFF',
39
+ '#075e54',
40
+ '#128C7E',
41
+ '#25d366',
42
+ '#DCF8C6',
43
+ '#34B7F1',
44
+ '#ECE5DD',
45
+ ],
46
+ }
47
+
48
+ $('.ht-ctc-color').wpColorPicker(color_picker);
49
 
50
 
51
  // functions
62
  try {
63
  woo_page();
64
  collapsible();
65
+ } catch (e) { }
66
+
67
+ try {
68
+ greetings();
69
+ } catch (e) { }
70
+
71
 
72
 
73
  // show/hide settings
180
 
181
  }
182
 
183
+
184
 
185
  function ht_ctc_admin_animations() {
186
  // default display
204
  }
205
  });
206
  }
207
+
208
 
209
  // Deskop, Mobile - same settings
210
  function desktop_mobile() {
228
  });
229
 
230
  }
231
+
232
 
233
  // WhatsApp number
234
  function wn() {
281
  $('.woo_single_position_select').on("change", function (e) {
282
  var position_change_val = e.target.value;
283
  var style_val = $('.woo_single_style_select').find(":selected").val();
284
+
285
  if (position_change_val == 'select') {
286
  $('.woo_single_position_settings').hide(200);
287
  hide_cart_layout();
322
  // woo shop page ..
323
  if ($('#woo_shop_add_whatsapp').is(':checked')) {
324
  $(".woo_shop_add_whatsapp_settings").show();
325
+
326
  var shop_style_val = $('.woo_shop_style').find(":selected").val();
327
  if (shop_style_val == '1' || shop_style_val == '8') {
328
  shop_show_cart_layout();
330
  }
331
 
332
 
333
+
334
 
335
  $("#woo_shop_add_whatsapp").on("change", function (e) {
336
  if ($('#woo_shop_add_whatsapp').is(':checked')) {
348
  }
349
  });
350
 
351
+
352
  // on change - style - for cart layout
353
  $('.woo_shop_style').on("change", function (e) {
354
  var shop_style_change_val = e.target.value;
376
  }
377
 
378
  }
379
+
380
 
381
  // webhook
382
  function hook() {
397
  });
398
 
399
  }
400
+
401
 
402
  // things based on screen size
403
  function ss() {
412
  $("#whatsapp_number").attr('data-position', 'bottom');
413
  }
414
  }
415
+
416
 
417
  function other() {
418
 
new/admin/admin_assets/js/admin.js CHANGED
@@ -1,19 +1,22 @@
1
  // Click to Chat
2
  document.addEventListener('DOMContentLoaded', function () {
3
 
4
- // M.AutoInit();
 
5
 
6
- var elems = document.querySelectorAll('select');
7
- M.FormSelect.init(elems, {});
8
 
9
- var elems = document.querySelectorAll('.collapsible');
10
- M.Collapsible.init(elems, {});
11
 
12
- var elems = document.querySelectorAll('.modal');
13
- M.Modal.init(elems, {});
 
 
 
 
14
 
15
- var elems = document.querySelectorAll('.tooltipped');
16
- M.Tooltip.init(elems, {});
17
 
18
  });
19
 
@@ -22,11 +25,27 @@ document.addEventListener('DOMContentLoaded', function () {
22
  // ready
23
  $(function () {
24
 
25
- $('select').formSelect();
26
- $('.collapsible').collapsible();
27
- $('.modal').modal();
28
- $('.tooltipped').tooltip();
29
- $('.ht-ctc-color').wpColorPicker();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
 
31
 
32
  // functions
@@ -46,7 +65,6 @@ document.addEventListener('DOMContentLoaded', function () {
46
  } catch (e) { }
47
 
48
 
49
-
50
  // show/hide settings
51
  function show_hide_options() {
52
 
@@ -549,6 +567,4 @@ document.addEventListener('DOMContentLoaded', function () {
549
 
550
 
551
  });
552
-
553
-
554
  })(jQuery);
1
  // Click to Chat
2
  document.addEventListener('DOMContentLoaded', function () {
3
 
4
+ try {
5
+ // M.AutoInit();
6
 
7
+ var elems = document.querySelectorAll('select');
8
+ M.FormSelect.init(elems, {});
9
 
10
+ var elems = document.querySelectorAll('.collapsible');
11
+ M.Collapsible.init(elems, {});
12
 
13
+ var elems = document.querySelectorAll('.modal');
14
+ M.Modal.init(elems, {});
15
+
16
+ var elems = document.querySelectorAll('.tooltipped');
17
+ M.Tooltip.init(elems, {});
18
+ } catch (e) { }
19
 
 
 
20
 
21
  });
22
 
25
  // ready
26
  $(function () {
27
 
28
+ try {
29
+ $('select').formSelect();
30
+ $('.collapsible').collapsible();
31
+ $('.modal').modal();
32
+ $('.tooltipped').tooltip();
33
+ } catch (e) { }
34
+
35
+ var color_picker = {
36
+ palettes: [
37
+ '#000000',
38
+ '#FFFFFF',
39
+ '#075e54',
40
+ '#128C7E',
41
+ '#25d366',
42
+ '#DCF8C6',
43
+ '#34B7F1',
44
+ '#ECE5DD',
45
+ ],
46
+ }
47
+
48
+ $('.ht-ctc-color').wpColorPicker(color_picker);
49
 
50
 
51
  // functions
65
  } catch (e) { }
66
 
67
 
 
68
  // show/hide settings
69
  function show_hide_options() {
70
 
567
 
568
 
569
  });
 
 
570
  })(jQuery);
new/admin/admin_assets/js/greetings.js ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function ($) {
2
+
3
+ // ready
4
+ $(function () {
5
+
6
+ try {
7
+ greetings();
8
+ } catch (e) { }
9
+
10
+ /**
11
+ * Greetings
12
+ */
13
+ function greetings() {
14
+
15
+
16
+ var greetings_template = $('.pr_greetings_template select').find(":selected").val();
17
+
18
+ console.log(greetings_template);
19
+
20
+ // greetings-1
21
+ if (greetings_template == 'greetings-1') {
22
+ $('.ctc_greetings_settings.ctc_g_1').show();
23
+ $('.pr_ht_ctc_greetings_1').show();
24
+ $('.pr_ht_ctc_greetings_settings').show();
25
+ }
26
+
27
+ // greetings-2
28
+ if (greetings_template == 'greetings-2') {
29
+ $('.ctc_greetings_settings.ctc_g_2').show();
30
+ $('.pr_ht_ctc_greetings_2').show();
31
+ $('.pr_ht_ctc_greetings_settings').show();
32
+ }
33
+
34
+ // on change
35
+ $('.pr_greetings_template select').on("change", function (e) {
36
+ var greetings_template = e.target.value;
37
+ console.log(greetings_template);
38
+
39
+ // ctc_greetings_settings
40
+ if (greetings_template == 'no') {
41
+ $(" .ctc_greetings_settings").hide(100);
42
+ } else {
43
+ // $(" ." + greetings_template).show(100);
44
+
45
+ // if not no - then first hide all and again display required fields..
46
+ $(" .ctc_greetings_settings").hide();
47
+
48
+ // greetings-1
49
+ if (greetings_template == 'greetings-1') {
50
+ $('.ctc_greetings_settings.ctc_g_1').show(100);
51
+ $('.pr_ht_ctc_greetings_1').show(100);
52
+ }
53
+ // greetings-2
54
+ if (greetings_template == 'greetings-2') {
55
+ $('.ctc_greetings_settings.ctc_g_2').show(100);
56
+ $('.pr_ht_ctc_greetings_2').show(100);
57
+ }
58
+
59
+ $('.pr_ht_ctc_greetings_settings').show();
60
+
61
+ }
62
+ });
63
+
64
+
65
+ // tinymce editor - bg color
66
+ var check = 1;
67
+ var check_interval = 1000;
68
+ var check_times = 28; // ( check_times * check_interval = total milliseconds )
69
+
70
+ function tiny_bg() {
71
+ if (document.getElementById("header_content_ifr")) {
72
+ tiny_bg_color();
73
+ } else {
74
+ check++;
75
+ if (check < check_times) {
76
+ setTimeout(tiny_bg, check_interval);
77
+ }
78
+ }
79
+ }
80
+ tiny_bg();
81
+
82
+ function tiny_bg_color() {
83
+ // f0f0f1
84
+ var header_content_ifr = document.getElementById("header_content_ifr");
85
+ var elmnt = header_content_ifr.contentWindow.document.getElementsByTagName("body")[0];
86
+ elmnt.style.backgroundColor = "#26a69a";
87
+
88
+ var main_content_ifr = document.getElementById("main_content_ifr");
89
+ var elmnt = main_content_ifr.contentWindow.document.getElementsByTagName("body")[0];
90
+ elmnt.style.backgroundColor = "#26a69a";
91
+
92
+ var bottom_content_ifr = document.getElementById("bottom_content_ifr");
93
+ var elmnt = bottom_content_ifr.contentWindow.document.getElementsByTagName("body")[0];
94
+ elmnt.style.backgroundColor = "#26a69a";
95
+ }
96
+
97
+ }
98
+
99
+
100
+ });
101
+
102
+
103
+ }) (jQuery);
new/admin/admin_commons/admin-sidebar-content.php CHANGED
@@ -53,11 +53,8 @@ $othersettings = get_option('ht_ctc_othersettings');
53
  <p class="description">&emsp;website visitor login status</p>
54
  <p class="description">Page level settings: style, time, scroll dealy</p>
55
  <p class="description">Add WhatsApp in WooCommerce Product pages</p>
 
56
  <p class="description">More features</p>
57
- <br>
58
- <p class="description">Next: (coming soon)</p>
59
- <p class="description">Greetings Dialog</p>
60
- <p class="description">Form Filling</p>
61
 
62
  <p class="description" style="text-align: center; position:sticky; bottom:2px; margin-top:20px;"><a target="_blank" href="https://holithemes.com/plugins/click-to-chat/pricing/" class="waves-effect waves-light btn" style="width: 100%;">PRO Version</a></p>
63
 
53
  <p class="description">&emsp;website visitor login status</p>
54
  <p class="description">Page level settings: style, time, scroll dealy</p>
55
  <p class="description">Add WhatsApp in WooCommerce Product pages</p>
56
+ <p class="description">Form Filling (coming soon)</p>
57
  <p class="description">More features</p>
 
 
 
 
58
 
59
  <p class="description" style="text-align: center; position:sticky; bottom:2px; margin-top:20px;"><a target="_blank" href="https://holithemes.com/plugins/click-to-chat/pricing/" class="waves-effect waves-light btn" style="width: 100%;">PRO Version</a></p>
60
 
new/admin/admin_commons/class-ht-ctc-admin-hooks.php CHANGED
@@ -287,8 +287,9 @@ class HT_CTC_Admin_Others {
287
  // }
288
  // update_option( 'ht_ctc_notices', $update_values );
289
 
290
- // // todo - wp_send_json_success or wp_die
291
- // // wp_send_json_success();
 
292
  // wp_die();
293
  // }
294
 
@@ -306,8 +307,12 @@ class HT_CTC_Admin_Others {
306
 
307
  add_action( 'wp_print_scripts', [$this, 'dequeue_scripts'] );
308
 
309
- // add_action( 'wp_print_scripts', [$this, 'dequeue_styles'] );
310
- add_action( 'admin_enqueue_scripts', [$this, 'dequeue_styles'], 99 );
 
 
 
 
311
  }
312
  }
313
 
@@ -422,7 +427,7 @@ class HT_CTC_Admin_Others {
422
  // https://wordpress.org/support/topic/the-plugin-is-attempting-to-do-a-cache-purge/
423
  // PagelyCachePurge::purgeAll();
424
  // }
425
-
426
  // Comet cache
427
  if( class_exists('comet_cache') && method_exists('comet_cache', 'clear') ) {
428
  comet_cache::clear();
287
  // }
288
  // update_option( 'ht_ctc_notices', $update_values );
289
 
290
+ // wp_send_json_success();
291
+
292
+ // // this wont run
293
  // wp_die();
294
  // }
295
 
307
 
308
  add_action( 'wp_print_scripts', [$this, 'dequeue_scripts'] );
309
 
310
+ // &special&nocss
311
+ if ( isset($_GET['nocss']) ) {
312
+ // add_action( 'wp_print_scripts', [$this, 'dequeue_styles'] );
313
+ add_action( 'admin_enqueue_scripts', [$this, 'dequeue_styles'], 99 );
314
+ }
315
+
316
  }
317
  }
318
 
427
  // https://wordpress.org/support/topic/the-plugin-is-attempting-to-do-a-cache-purge/
428
  // PagelyCachePurge::purgeAll();
429
  // }
430
+
431
  // Comet cache
432
  if( class_exists('comet_cache') && method_exists('comet_cache', 'clear') ) {
433
  comet_cache::clear();
new/admin/class-ht-ctc-admin-greetings-page.php ADDED
@@ -0,0 +1,566 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Start page
4
+ *
5
+ * Admin
6
+ * @since 1.0
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) exit;
10
+
11
+ if ( ! class_exists( 'HT_CTC_Admin_Greetings' ) ) :
12
+
13
+ class HT_CTC_Admin_Greetings {
14
+
15
+ public $values = '';
16
+
17
+ public function __construct() {
18
+
19
+ add_action('admin_menu', [$this, 'menu'] );
20
+
21
+
22
+
23
+ // only if options.php or this settings page..
24
+ // @admin_perfomance - if this method is not working then we can add at add_settings_section ..
25
+
26
+ // check for options.php, _GET page = click-to-chat-greetings
27
+ $get_url = ( isset($_GET) && isset($_GET['page']) && 'click-to-chat-greetings' == $_GET['page'] ) ? true : false;
28
+
29
+ $options_page = false;
30
+ // if request url have options.php .. (or if requesturl is not set.. or empty ) then $options_page = true
31
+ if ( isset($_SERVER['REQUEST_URI']) ) {
32
+ if ( !empty($_SERVER['REQUEST_URI']) ) {
33
+ if ( false !== strpos( $_SERVER['REQUEST_URI'], 'options.php' ) ) {
34
+ // if options.php page
35
+ $options_page = true;
36
+ }
37
+ } else {
38
+ $options_page = true;
39
+ }
40
+ } else {
41
+ $options_page = true;
42
+ }
43
+
44
+ if ( true == $options_page || true == $get_url ) {
45
+
46
+
47
+ /**
48
+ *
49
+ * fallback_values:
50
+ * created this because
51
+ * options_sanitize runs mulitiple times if settings field not exist
52
+ * https://core.trac.wordpress.org/ticket/21989
53
+ * due to this htmlentities calling twice at options_sanitize and changes values..
54
+ * but untill user save the first settings, fallback values have to display at settings field.. for easy to understand
55
+ * so here we added option with key fallback_values - as need to load fallback values to display in input fileds as user not saved any values..
56
+ */
57
+ $ht_ctc_greetings_options = get_option('ht_ctc_greetings_options');
58
+ if ( isset($ht_ctc_greetings_options['greetings_template']) || isset($ht_ctc_greetings_options['fallback_values']) ) {
59
+ } else {
60
+ $values = array(
61
+ 'fallback_values' => 'yes',
62
+ );
63
+ add_option('ht_ctc_greetings_options', $values);
64
+ }
65
+
66
+
67
+
68
+ add_action('admin_init', [$this, 'settings'] );
69
+ }
70
+
71
+ }
72
+
73
+
74
+ /**
75
+ *
76
+ * Settings
77
+ *
78
+ *
79
+ *
80
+ *
81
+ * class names
82
+ * pr_: parent element class name
83
+ * table class names - pr_ht_ctc_greetings_options,
84
+ * parent_class
85
+ * pr_greetings_template (for template select)
86
+ * ctc_greetings_settings
87
+ * greetings-1
88
+ *
89
+ */
90
+ public function settings_values() {
91
+
92
+ include_once HT_CTC_PLUGIN_DIR . 'new/admin/db/defaults/class-ht-ctc-defaults-greetings.php';
93
+ $default_greetings = new HT_CTC_Defaults_Greetings();
94
+
95
+ $greetings_fallback_values = $default_greetings->greetings;
96
+ $g1_fallback_values = $default_greetings->g_1;
97
+ $g2_fallback_values = $default_greetings->g_2;
98
+
99
+
100
+ $start_values = [
101
+ 'main' => [
102
+ // settings filed - add_settings_field
103
+ 'id' => 'ht_ctc_greetings',
104
+ 'title' => __( 'Add Greetings Dialog', 'click-to-chat-for-whatsapp'),
105
+ 'dbrow' => 'ht_ctc_greetings_options',
106
+ 'fallback_values' => $greetings_fallback_values,
107
+ 'class' => 'pr_ht_ctc_greetings_options',
108
+ 'inputs' => [
109
+ // with in single add_settings_field add single or multiple things..
110
+ [
111
+ 'title' => 'Greetings Dialog',
112
+ 'db' => 'greetings_template',
113
+ 'template' => 'select',
114
+ 'description' => "",
115
+ 'list_cb' => 'greetings_template',
116
+ 'parent_class' => 'pr_greetings_template',
117
+ 'description' => "<a href='https://holithemes.com/plugins/click-to-chat/greetings/' target='_blank'>Greetings</a> | <a href='https://holithemes.com/plugins/click-to-chat/greetings-1/' target='_blank'>Greetings-1</a> | <a href='https://holithemes.com/plugins/click-to-chat/greetings-2/' target='_blank'>Greetings-2</a> | <a href='https://holithemes.com/plugins/click-to-chat/greetings-form/' target='_blank'>Greetings Form </a> ",
118
+ ],
119
+ [
120
+ 'db' => 'empty',
121
+ 'template' => 'empty',
122
+ ],
123
+ 'header_content' => [
124
+ 'title' => __( 'Header Content', 'click-to-chat-for-whatsapp'),
125
+ 'db' => 'header_content',
126
+ 'template' => 'editor',
127
+ 'label' => 'Header Content',
128
+ 'description' => '',
129
+ 'link_url' => '',
130
+ 'link_title' => 'more info',
131
+ 'parent_class' => 'pr_header_content ctc_greetings_settings ctc_g_1',
132
+ ],
133
+ 'main_content' => [
134
+ 'title' => 'Main Content',
135
+ 'db' => 'main_content',
136
+ 'template' => 'editor',
137
+ 'label' => 'Main Content',
138
+ 'description' => '',
139
+ 'parent_class' => 'pr_main_content ctc_greetings_settings ctc_g_1 ctc_g_2',
140
+ ],
141
+ 'bottom_content' => [
142
+ 'title' => 'Bottom Content',
143
+ 'db' => 'bottom_content',
144
+ 'template' => 'editor',
145
+ 'label' => 'Bottom Content',
146
+ 'description' => '',
147
+ 'parent_style' => "margin-bottom: 20px;",
148
+ 'parent_class' => 'pr_bottom_content ctc_greetings_settings ctc_g_1 ctc_g_2',
149
+ ],
150
+ [
151
+ 'title' => 'Call to Action',
152
+ 'db' => 'call_to_action',
153
+ 'template' => 'text',
154
+ 'label' => 'Call to Action',
155
+ 'description' => 'Call to Action (Button/Link Text)',
156
+ 'parent_class' => 'pr_call_to_action ctc_greetings_settings ctc_g_1 ctc_g_2',
157
+ ],
158
+ ]
159
+ ],
160
+ 'greetings_1' => [
161
+ 'id' => 'ht_ctc_greetings_1',
162
+ 'title' => 'Greetings Dialog - 1',
163
+ 'dbrow' => 'ht_ctc_greetings_1',
164
+ 'fallback_values' => $g1_fallback_values,
165
+ 'class' => 'pr_ht_ctc_greetings_1 ctc_greetings_settings',
166
+ 'inputs' => [
167
+ [
168
+ 'template' => 'collapsible_start',
169
+ 'title' => 'Greetings Dialog - 1 - Customizable',
170
+ ],
171
+ [
172
+ 'db' => 'empty',
173
+ 'template' => 'empty',
174
+ ],
175
+ [
176
+ 'title' => 'Header - Background Color',
177
+ 'db' => 'header_bg_color',
178
+ 'template' => 'color',
179
+ 'default_color' => '#075e54',
180
+ 'description' => 'Header - Background Color',
181
+ 'parent_class' => 'pr_g1_header_bg_color',
182
+ ],
183
+ [
184
+ 'title' => 'Main Content - Background Color',
185
+ 'db' => 'main_bg_color',
186
+ 'template' => 'color',
187
+ 'default_color' => '#ece5dd',
188
+ 'description' => 'Main Content - Background Color',
189
+ 'parent_class' => 'pr_g1_main_bg_color',
190
+ ],
191
+ [
192
+ 'title' => 'Message Box - Background Color',
193
+ 'db' => 'message_box_bg_color',
194
+ 'template' => 'color',
195
+ 'default_color' => '#dcf8c6',
196
+ 'description' => 'Main Content as a Message Box with Background Color',
197
+ 'parent_class' => 'pr_g1_message_box_bg_color',
198
+ ],
199
+ [
200
+ 'title' => __( 'Call to Action - button type', 'click-to-chat-for-whatsapp'),
201
+ 'db' => 'cta_style',
202
+ 'template' => 'select',
203
+ 'description' => "Call to Action - button type (Color settings at Click to Chat -> Customize)",
204
+ 'list' => [
205
+ '1' => 'Themes Button (style-1)',
206
+ '7_1' => 'Button with WhatsApp Icon (style-7 Extend)',
207
+ ],
208
+ 'parent_class' => 'pr_g1_cta_style',
209
+ ],
210
+ [
211
+ 'template' => 'collapsible_end',
212
+ 'description' => "<a href='https://holithemes.com/plugins/click-to-chat/greetings-1/' target='_blank'>Greetings-1</a>",
213
+ ],
214
+ ]
215
+ ],
216
+ 'greetings_2' => [
217
+ 'id' => 'ht_ctc_greetings_2',
218
+ 'title' => 'Greetings Dialog - 2',
219
+ 'dbrow' => 'ht_ctc_greetings_2',
220
+ 'fallback_values' => $g2_fallback_values,
221
+ 'class' => 'pr_ht_ctc_greetings_2 ctc_greetings_settings',
222
+ 'inputs' => [
223
+ [
224
+ 'template' => 'collapsible_start',
225
+ 'title' => 'Greetings Dialog - 2 - Content Specific',
226
+ ],
227
+ [
228
+ 'db' => 'empty',
229
+ 'template' => 'empty',
230
+ ],
231
+ [
232
+ 'title' => 'Background Color',
233
+ 'db' => 'bg_color',
234
+ 'template' => 'color',
235
+ 'default_color' => '#ffffff',
236
+ 'description' => 'Greetings Dialog Background Color',
237
+ 'parent_class' => 'pr_g2_bg_color greetings-2',
238
+ ],
239
+ [
240
+ 'template' => 'collapsible_end',
241
+ 'description' => "<a href='https://holithemes.com/plugins/click-to-chat/greetings-2/' target='_blank'>Greetings-2</a> <br> Customize 'Call to Action' button from 'Click to Chat' -> Customize - Style-1 ",
242
+ ],
243
+ ]
244
+ ],
245
+ 'greetings_settings' => [
246
+ 'id' => 'ht_ctc_greetings_settings',
247
+ 'title' => 'Additional Settings',
248
+ 'dbrow' => 'ht_ctc_greetings_settings',
249
+ 'class' => 'pr_ht_ctc_greetings_settings ctc_greetings_settings',
250
+ 'inputs' => [
251
+ [
252
+ 'db' => 'empty',
253
+ 'template' => 'empty',
254
+ ],
255
+ [
256
+ 'title' => __( 'Display', 'click-to-chat-for-whatsapp'),
257
+ 'db' => 'g_device',
258
+ 'template' => 'select',
259
+ 'description' => "Display Greetings Dialog based on device",
260
+ 'list' => [
261
+ 'all' => 'Desktop and Mobile',
262
+ 'desktop' => 'Desktop Only',
263
+ 'mobile' => 'Mobile Only'
264
+ ],
265
+ 'parent_class' => 'pr_g_device',
266
+ ],
267
+ [
268
+ 'title' => __( 'Initial stage', 'click-to-chat-for-whatsapp'),
269
+ 'db' => 'g_init',
270
+ 'template' => 'select',
271
+ 'description' => "Open: Displays by default until user closes the first time <br>(Once user closes the Greetings Dialog on any page, greetings dialog won't display until user clicks to open again) <br> Close: Hidden by default and displays when user clicks <span class='g_user_closed_content'><span>",
272
+ 'list' => [
273
+ 'open' => 'Open',
274
+ 'close' => 'Close',
275
+ ],
276
+ 'parent_class' => 'pr_g_init',
277
+ ],
278
+ ]
279
+ ]
280
+
281
+ ];
282
+
283
+ $start_values = apply_filters( 'ht_ctc_fh_greetings_setting_values', $start_values );
284
+
285
+ return $start_values;
286
+ }
287
+
288
+
289
+ function settings_cb($s) {
290
+
291
+ $dbrow = $s['dbrow'];
292
+
293
+ $fallback_values = '';
294
+ if (isset($s['fallback_values'])) {
295
+ $fallback_values = $s['fallback_values'];
296
+ }
297
+
298
+ $options = get_option($dbrow, $fallback_values);
299
+
300
+ if (isset($options['fallback_values'])) {
301
+ $options = $fallback_values;
302
+ }
303
+
304
+ $inputs = $s['inputs'];
305
+
306
+ foreach ($inputs as $input) {
307
+
308
+ if (isset($input['template'])) {
309
+
310
+ $db_key = '';
311
+ $db_value = '';
312
+ if (isset($input['db'])) {
313
+ $db_key = $input['db'];
314
+ $db_value = ( isset( $options[$db_key]) ) ? esc_attr( $options[$db_key] ) : '';
315
+ }
316
+
317
+ $template = $input['template'];
318
+
319
+ $components = (isset($input['path'])) ? $input['path'] : HT_CTC_PLUGIN_DIR ."new/admin/components";
320
+
321
+ $path = "$components/$template.php";
322
+
323
+ include $path;
324
+ }
325
+
326
+
327
+ }
328
+
329
+
330
+ }
331
+
332
+
333
+ public function menu() {
334
+
335
+ add_submenu_page(
336
+ 'click-to-chat',
337
+ 'Greetings',
338
+ 'Greetings',
339
+ 'manage_options',
340
+ 'click-to-chat-greetings',
341
+ array( $this, 'settings_page' )
342
+ );
343
+ }
344
+
345
+ public function settings_page() {
346
+
347
+ if ( ! current_user_can('manage_options') ) {
348
+ return;
349
+ }
350
+
351
+ ?>
352
+
353
+ <div class="wrap">
354
+
355
+ <?php settings_errors(); ?>
356
+
357
+ <!-- full row -->
358
+ <div class="row">
359
+
360
+ <div class="col s12 m12 xl7 options">
361
+ <form action="options.php" method="post" class="">
362
+ <?php settings_fields( 'ht_ctc_greetings_page_settings_fields' ); ?>
363
+ <?php do_settings_sections( 'ht_ctc_greetings_page_settings_section' ) ?>
364
+ <?php submit_button() ?>
365
+ </form>
366
+ </div>
367
+
368
+ <!-- sidebar content -->
369
+ <div class="col s12 m9 l7 xl4 ht-ctc-admin-sidebar ht-ctc-greetings-admin-sidebar sticky-sidebar">
370
+
371
+ <div class="sidebar-content">
372
+ <div class="col s12 m8 l12 xl12">
373
+ <div class="row">
374
+ <ul class="collapsible popout ht_ctc_sidebar_contat">
375
+ <li class="active">
376
+ <div class="collapsible-header"><?php _e( 'Contact Us', 'click-to-chat-for-whatsapp' ); ?></div>
377
+ <div class="collapsible-body">
378
+ <p class="description"><strong>New Feature</strong>: We are planning to improve this feature. <br> Contact us for any suggestions <br><br></p>
379
+ <p class="description"><a href="http://api.whatsapp.com/send?phone=919494429789&text=<?php echo get_bloginfo('url'); ?>%0AHi%20HoliThemes,%0AI%20have%20a%20Suggestion/Feedback:" target="_blank"><?php _e( 'WhatsApp', 'click-to-chat-for-whatsapp' ); ?></a></p>
380
+ <p class="description"><a href="mailto: ctc@holithemes.com"> ctc@holithemes.com</a></p>
381
+ <p class="description"><a target="_blank" href="https://holithemes.com/plugins/click-to-chat/support/">Support Page</a></p>
382
+ </div>
383
+ </li>
384
+ </ul>
385
+ </div>
386
+ </div>
387
+ </div>
388
+
389
+ </div>
390
+
391
+ </div>
392
+
393
+ <!-- new row - After settings page -->
394
+ <div class="row">
395
+ </div>
396
+
397
+ </div>
398
+
399
+ <?php
400
+
401
+ }
402
+
403
+
404
+ public function settings() {
405
+
406
+
407
+ // @uses for register_setting
408
+ $greetings_list = [
409
+ 'ht_ctc_greetings_options',
410
+ 'ht_ctc_greetings_1',
411
+ 'ht_ctc_greetings_2',
412
+ 'ht_ctc_greetings_settings',
413
+ ];
414
+
415
+ $greetings_list = apply_filters( 'ht_ctc_fh_greetings_register', $greetings_list );
416
+
417
+ // register_setting
418
+ foreach ($greetings_list as $g) {
419
+
420
+ register_setting(
421
+ 'ht_ctc_greetings_page_settings_fields',
422
+ $g,
423
+ [$this, 'options_sanitize']
424
+ );
425
+
426
+ }
427
+
428
+ // @admin_perfomance - if the above method is not working then add here..
429
+
430
+ add_settings_section( 'ht_ctc_greetings_page_settings_sections_add', '', array( $this, 'ht_ctc_greetings_section_cb' ), 'ht_ctc_greetings_page_settings_section' );
431
+
432
+
433
+ $settings = $this->settings_values();
434
+ foreach ($settings as $s) {
435
+ add_settings_field(
436
+ $s['id'],
437
+ $s['title'],
438
+ array( $this, 'settings_cb' ),
439
+ 'ht_ctc_greetings_page_settings_section',
440
+ 'ht_ctc_greetings_page_settings_sections_add',
441
+ $s
442
+ );
443
+ }
444
+
445
+
446
+
447
+
448
+ }
449
+
450
+
451
+ public function ht_ctc_greetings_section_cb() {
452
+ ?>
453
+ <h1 id="greetings_settings">Greetings Dialog</h1>
454
+ <p class="description"> <b style="color:#42a69a;">New feature: </b> We are planning to expand this feature. please <a target="_blank" href="https://holithemes.com/plugins/click-to-chat/support">contact us</a> for any suggestions</p>
455
+ <br>
456
+ <?php
457
+ do_action('ht_ctc_ah_admin' );
458
+
459
+ }
460
+
461
+
462
+
463
+
464
+
465
+ /**
466
+ * Sanitize each setting field as needed
467
+ *
468
+ * @param array $input Contains all settings fields as array keys
469
+ */
470
+ public function options_sanitize( $input ) {
471
+
472
+ if ( ! current_user_can( 'manage_options' ) ) {
473
+ wp_die( 'not allowed to modify - please contact admin ' );
474
+ }
475
+
476
+ $textarea = [];
477
+
478
+ $editor = [
479
+ 'header_content',
480
+ 'main_content',
481
+ 'bottom_content'
482
+ ];
483
+
484
+ // formatting api - emoji ..
485
+ include_once HT_CTC_PLUGIN_DIR .'new/admin/admin_commons/ht-ctc-admin-formatting.php';
486
+
487
+ $editor = apply_filters( 'ht_ctc_fh_greetings_setting_editor_values', $editor );
488
+
489
+
490
+ $new_input = array();
491
+
492
+ foreach ($input as $key => $value) {
493
+ if( isset( $input[$key] ) ) {
494
+
495
+ if ( is_array( $input[$key] ) ) {
496
+ $new_input[$key] = map_deep( $input[$key], 'sanitize_text_field' );
497
+ } else {
498
+
499
+ if ( in_array( $key, $editor ) ) {
500
+ // editor
501
+ if ( !empty( $input[$key]) && '' !== $input[$key] ) {
502
+
503
+ if ( function_exists('ht_ctc_wp_encode_emoji') ) {
504
+ $input[$key] = ht_ctc_wp_encode_emoji( $input[$key] );
505
+ }
506
+
507
+ $allowed_html = wp_kses_allowed_html( 'post' );
508
+
509
+ $new_input[$key] = wp_kses($input[$key], $allowed_html);
510
+ // htmlentities this $new_input[$key] (double security ..)
511
+ $new_input[$key] = htmlentities( $new_input[$key] );
512
+
513
+ // (may not needed - but extra security)
514
+ $new_input[$key] = sanitize_textarea_field( $new_input[$key] );
515
+
516
+ } else {
517
+ // save field even if the value is empty..
518
+ $new_input[$key] = sanitize_text_field( $input[$key] );
519
+ }
520
+ } else if ( in_array( $key, $textarea ) ) {
521
+ // textarea
522
+ if ( function_exists('ht_ctc_wp_encode_emoji') ) {
523
+ $input[$key] = ht_ctc_wp_encode_emoji( $input[$key] );
524
+ }
525
+ $new_input[$key] = sanitize_textarea_field( $input[$key] );
526
+
527
+ } else {
528
+ $new_input[$key] = sanitize_text_field( $input[$key] );
529
+ }
530
+ }
531
+ }
532
+ }
533
+
534
+
535
+ $local = [
536
+ 'header_content',
537
+ 'main_content',
538
+ 'bottom_content',
539
+ 'call_to_action'
540
+ ];
541
+
542
+ $local = apply_filters( 'ht_ctc_fh_greetings_setting_local_values', $local );
543
+
544
+ // l10n
545
+ foreach ($input as $key => $value) {
546
+ if ( in_array( $key, $local ) ) {
547
+ do_action( 'wpml_register_single_string', 'Click to Chat for WhatsApp', "greetings_$key", $input[$key] );
548
+ }
549
+ }
550
+
551
+ do_action('ht_ctc_ah_admin_after_sanitize' );
552
+
553
+
554
+ return $new_input;
555
+ }
556
+
557
+
558
+ }
559
+
560
+
561
+ if ( current_user_can( 'manage_options' ) ) {
562
+ new HT_CTC_Admin_Greetings();
563
+ }
564
+
565
+
566
+ endif; // END class_exists check
new/admin/class-ht-ctc-admin-scripts.php CHANGED
@@ -20,8 +20,10 @@ class HT_CTC_Admin_Scripts {
20
  // true/false
21
  $load_js_bottom = apply_filters( 'ht_ctc_fh_load_admin_js_bottom', true );
22
 
23
- // $admin_js = 'admin.js';
24
- $admin_js = '333.admin.js';
 
 
25
 
26
  // hook ..
27
  if( 'toplevel_page_click-to-chat' == $hook || 'click-to-chat_page_click-to-chat-chat-feature' == $hook || 'click-to-chat_page_click-to-chat-group-feature' == $hook || 'click-to-chat_page_click-to-chat-share-feature' == $hook || 'click-to-chat_page_click-to-chat-customize-styles' == $hook || 'click-to-chat_page_click-to-chat-other-settings' == $hook || 'click-to-chat_page_click-to-chat-woocommerce' == $hook || 'click-to-chat_page_click-to-chat-greetings' == $hook ) {
@@ -35,6 +37,10 @@ class HT_CTC_Admin_Scripts {
35
  wp_enqueue_script( 'ctc_admin_md_js', plugins_url( 'new/admin/admin_assets/js/materialize.min.js', HT_CTC_PLUGIN_FILE ), array( 'jquery' ), HT_CTC_VERSION, $load_js_bottom );
36
  wp_enqueue_script( 'ctc_admin_js', plugins_url( "new/admin/admin_assets/js/$admin_js", HT_CTC_PLUGIN_FILE ), array( 'jquery', 'wp-color-picker', 'ctc_admin_md_js' ), HT_CTC_VERSION, $load_js_bottom );
37
 
 
 
 
 
38
  do_action('ht_ctc_ah_admin_scripts_end');
39
 
40
  } else {
20
  // true/false
21
  $load_js_bottom = apply_filters( 'ht_ctc_fh_load_admin_js_bottom', true );
22
 
23
+ $admin_js = 'admin.js';
24
+ // $admin_js = '333.admin.js';
25
+
26
+ $greetings_js = 'greetings.js';
27
 
28
  // hook ..
29
  if( 'toplevel_page_click-to-chat' == $hook || 'click-to-chat_page_click-to-chat-chat-feature' == $hook || 'click-to-chat_page_click-to-chat-group-feature' == $hook || 'click-to-chat_page_click-to-chat-share-feature' == $hook || 'click-to-chat_page_click-to-chat-customize-styles' == $hook || 'click-to-chat_page_click-to-chat-other-settings' == $hook || 'click-to-chat_page_click-to-chat-woocommerce' == $hook || 'click-to-chat_page_click-to-chat-greetings' == $hook ) {
37
  wp_enqueue_script( 'ctc_admin_md_js', plugins_url( 'new/admin/admin_assets/js/materialize.min.js', HT_CTC_PLUGIN_FILE ), array( 'jquery' ), HT_CTC_VERSION, $load_js_bottom );
38
  wp_enqueue_script( 'ctc_admin_js', plugins_url( "new/admin/admin_assets/js/$admin_js", HT_CTC_PLUGIN_FILE ), array( 'jquery', 'wp-color-picker', 'ctc_admin_md_js' ), HT_CTC_VERSION, $load_js_bottom );
39
 
40
+ if ('click-to-chat_page_click-to-chat-greetings' == $hook) {
41
+ wp_enqueue_script( 'ctc_admin_greetings_js', plugins_url( "new/admin/admin_assets/js/$greetings_js", HT_CTC_PLUGIN_FILE ), array( 'jquery', 'ctc_admin_js' ), HT_CTC_VERSION, $load_js_bottom );
42
+ }
43
+
44
  do_action('ht_ctc_ah_admin_scripts_end');
45
 
46
  } else {
new/admin/components/checkbox.php CHANGED
@@ -6,9 +6,11 @@
6
  if ( ! defined( 'ABSPATH' ) ) exit;
7
 
8
  $title = (isset($input['title'])) ? esc_attr($input['title']) : '';
 
 
9
 
10
  ?>
11
- <div class="row">
12
  <p>
13
  <label>
14
  <input name="<?= $dbrow ?>[<?= $db_key ?>]" type="checkbox" value="1" <?php checked( $db_value, 1 ); ?> />
6
  if ( ! defined( 'ABSPATH' ) ) exit;
7
 
8
  $title = (isset($input['title'])) ? esc_attr($input['title']) : '';
9
+ $parent_class = (isset($input['parent_class'])) ? $input['parent_class'] : '';
10
+
11
 
12
  ?>
13
+ <div class="row ctc_component_checkbox <?= $parent_class ?>">
14
  <p>
15
  <label>
16
  <input name="<?= $dbrow ?>[<?= $db_key ?>]" type="checkbox" value="1" <?php checked( $db_value, 1 ); ?> />
new/admin/components/collapsible_start.php CHANGED
@@ -9,15 +9,17 @@ if ( ! defined( 'ABSPATH' ) ) exit;
9
  $title = (isset($input['title'])) ? esc_attr($input['title']) : '';
10
 
11
  $description = (isset($input['description'])) ? $input['description'] : '';
12
-
13
- if ('' !== $description) {
14
- ?>
15
- <p class="description"><?= $description; ?></p>
16
- <?php
17
- }
18
  ?>
19
 
20
  <ul class="collapsible">
21
  <li class="active">
22
  <div class="collapsible-header" id="showhide_settings"><?= $title ?></div>
23
- <div class="collapsible-body">
 
 
 
 
 
 
 
 
9
  $title = (isset($input['title'])) ? esc_attr($input['title']) : '';
10
 
11
  $description = (isset($input['description'])) ? $input['description'] : '';
 
 
 
 
 
 
12
  ?>
13
 
14
  <ul class="collapsible">
15
  <li class="active">
16
  <div class="collapsible-header" id="showhide_settings"><?= $title ?></div>
17
+ <div class="collapsible-body">
18
+
19
+ <?php
20
+ if ('' !== $description) {
21
+ ?>
22
+ <p class="description"><?= $description; ?></p>
23
+ <br>
24
+ <?php
25
+ }
new/admin/components/color.php CHANGED
@@ -8,13 +8,22 @@ if ( ! defined( 'ABSPATH' ) ) exit;
8
 
9
  $title = (isset($input['title'])) ? $input['title'] : '';
10
  $default_color = (isset($input['default_color'])) ? $input['default_color'] : '';
 
 
11
 
12
  ?>
13
- <div class="row">
14
  <div class="col s6">
15
  <p><?= $title ?></p>
16
  </div>
17
  <div class="input-field col s6">
18
  <input class="ht-ctc-color" name="<?= $dbrow ?>[<?= $db_key ?>]" data-default-color="<?= $default_color ?>" id="<?= $db_key ?>" value="<?= $db_value ?>" type="text">
 
 
 
 
 
 
 
19
  </div>
20
  </div>
8
 
9
  $title = (isset($input['title'])) ? $input['title'] : '';
10
  $default_color = (isset($input['default_color'])) ? $input['default_color'] : '';
11
+ $description = (isset($input['description'])) ? $input['description'] : '';
12
+ $parent_class = (isset($input['parent_class'])) ? $input['parent_class'] : '';
13
 
14
  ?>
15
+ <div class="row ctc_component_color <?= $parent_class ?>">
16
  <div class="col s6">
17
  <p><?= $title ?></p>
18
  </div>
19
  <div class="input-field col s6">
20
  <input class="ht-ctc-color" name="<?= $dbrow ?>[<?= $db_key ?>]" data-default-color="<?= $default_color ?>" id="<?= $db_key ?>" value="<?= $db_value ?>" type="text">
21
+ <?php
22
+ if ('' !== $description) {
23
+ ?>
24
+ <p class="description"><?= $description ?></p>
25
+ <?php
26
+ }
27
+ ?>
28
  </div>
29
  </div>
new/admin/components/editor.php CHANGED
@@ -14,6 +14,7 @@ $description = (isset($input['description'])) ? $input['description'] : '';
14
  $label = (isset($input['label'])) ? $input['label'] : '';
15
  $placeholder = (isset($input['placeholder'])) ? $input['placeholder'] : '';
16
  $parent_style = (isset($input['parent_style'])) ? $input['parent_style'] : '';
 
17
 
18
 
19
  // function ctc_edit_quicktags( $qtInit, $editor_id = 'content' ) {
@@ -64,7 +65,7 @@ if ( '' !== $db_value ) {
64
  }
65
 
66
  ?>
67
- <div class="row" style="<?= $parent_style ?>">
68
  <p class="description ht_ctc_subtitle" style="margin-top: 40px;"><?php _e( $title, 'click-to-chat-for-whatsapp' ); ?> </p>
69
  <?php
70
 
14
  $label = (isset($input['label'])) ? $input['label'] : '';
15
  $placeholder = (isset($input['placeholder'])) ? $input['placeholder'] : '';
16
  $parent_style = (isset($input['parent_style'])) ? $input['parent_style'] : '';
17
+ $parent_class = (isset($input['parent_class'])) ? $input['parent_class'] : '';
18
 
19
 
20
  // function ctc_edit_quicktags( $qtInit, $editor_id = 'content' ) {
65
  }
66
 
67
  ?>
68
+ <div class="row ctc_component_editor <?= $parent_class ?>" style="<?= $parent_style ?>">
69
  <p class="description ht_ctc_subtitle" style="margin-top: 40px;"><?php _e( $title, 'click-to-chat-for-whatsapp' ); ?> </p>
70
  <?php
71
 
new/admin/components/heading.php CHANGED
@@ -6,8 +6,10 @@
6
  if ( ! defined( 'ABSPATH' ) ) exit;
7
 
8
  $title = (isset($input['title'])) ? $input['title'] : '';
 
 
9
  ?>
10
 
11
- <div class="row">
12
  <p class="description ht_ctc_subtitle"><?php _e( $title, 'click-to-chat-for-whatsapp' ); ?> </p>
13
  </div>
6
  if ( ! defined( 'ABSPATH' ) ) exit;
7
 
8
  $title = (isset($input['title'])) ? $input['title'] : '';
9
+ $parent_class = (isset($input['parent_class'])) ? $input['parent_class'] : '';
10
+
11
  ?>
12
 
13
+ <div class="row ctc_component_heading <?= $parent_class ?>">
14
  <p class="description ht_ctc_subtitle"><?php _e( $title, 'click-to-chat-for-whatsapp' ); ?> </p>
15
  </div>
new/admin/components/list/ht-ctc-admin-list-page.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * list ..
4
+ */
5
+
6
+ if ( ! defined( 'ABSPATH' ) ) exit;
7
+
8
+ if ( ! class_exists( 'HT_CTC_Admin_List_Page' ) ) :
9
+
10
+ class HT_CTC_Admin_List_Page {
11
+
12
+ private static $instance = null;
13
+
14
+ public static function instance() {
15
+ if ( is_null( self::$instance ) ) {
16
+ self::$instance = new self();
17
+ }
18
+ return self::$instance;
19
+ }
20
+
21
+ function greetings_template() {
22
+
23
+ /**
24
+ * keys are like the file names (expect no)
25
+ * Note: dont inclued 'pro' keyword in this list.
26
+ */
27
+ $values = array(
28
+ 'no' => '-- No Greetings Dialog --',
29
+ 'greetings-1' => 'Greetings-1 - Customizable Design',
30
+ 'greetings-2' => 'Greetings-2 - Content Specific'
31
+ );
32
+
33
+ $values = apply_filters( 'ht_ctc_fh_greetings_templates', $values );
34
+
35
+ return $values;
36
+ }
37
+
38
+
39
+
40
+
41
+
42
+
43
+ }
44
+
45
+ endif; // END class_exists check
new/admin/components/number.php CHANGED
@@ -11,6 +11,7 @@ $label = (isset($input['label'])) ? esc_attr($input['label']) : '';
11
  $placeholder = (isset($input['placeholder'])) ? esc_attr($input['placeholder']) : '';
12
 
13
  $min = (isset($input['min'])) ? esc_attr($input['min']) : '';
 
14
 
15
  $attr = '';
16
 
@@ -19,7 +20,7 @@ if ('' !== $min) {
19
  }
20
 
21
  ?>
22
- <div class="row">
23
  <div class="input-field col s12">
24
  <input name="<?= $dbrow ?>[<?= $db_key ?>]" type="number" <?= $attr ?> value="<?= $db_value ?>" placeholder="<?= $placeholder ?>"/>
25
  <label for="pre_filled"><?= $label ?></label>
11
  $placeholder = (isset($input['placeholder'])) ? esc_attr($input['placeholder']) : '';
12
 
13
  $min = (isset($input['min'])) ? esc_attr($input['min']) : '';
14
+ $parent_class = (isset($input['parent_class'])) ? $input['parent_class'] : '';
15
 
16
  $attr = '';
17
 
20
  }
21
 
22
  ?>
23
+ <div class="row ctc_component_number <?= $parent_class ?>">
24
  <div class="input-field col s12">
25
  <input name="<?= $dbrow ?>[<?= $db_key ?>]" type="number" <?= $attr ?> value="<?= $db_value ?>" placeholder="<?= $placeholder ?>"/>
26
  <label for="pre_filled"><?= $label ?></label>
new/admin/components/select.php CHANGED
@@ -9,41 +9,48 @@
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit;
11
 
12
- // todo: improve this .. to not create multiple instance ..
13
- include_once HT_CTC_PLUGIN_DIR ."new/admin/components/list/ht-ctc-admin-list-greetings-page.php";
14
- $lists = new HT_CTC_Admin_List_Greetings_Page();
15
-
16
  $title = (isset($input['title'])) ? $input['title'] : '';
17
  $description = (isset($input['description'])) ? $input['description'] : '';
 
18
 
19
  // list
 
 
20
  if (isset($input['list'])) {
21
  $list = $input['list'];
22
  } elseif (isset($input['list_cb'])) {
23
-
24
  $list_cb = $input['list_cb'];
25
- // $lists is instance
26
- $list = $lists->$list_cb();
27
- }
28
 
29
- if ( '' !== $title ) {
30
- ?>
31
- <p class="description"><?php _e( $title, 'click-to-chat-for-whatsapp' ); ?> </p>
32
- <?php
 
 
 
33
  }
34
 
35
  ?>
36
- <div class="row">
37
- <div class="input-field col s12">
38
- <select name="<?= $dbrow ?>[<?= $db_key ?>]" class="">
39
- <?php
40
- foreach ($list as $k => $v) {
41
- ?>
42
- <option value="<?= $k ?>" <?= $db_value == $k ? 'SELECTED' : ''; ?> ><?= $v ?></option>
 
 
 
 
43
  <?php
44
- }
45
- ?>
46
- </select>
47
- <p class="description"><?= $description ?></p>
 
 
 
 
 
48
  </div>
49
  </div>
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit;
11
 
 
 
 
 
12
  $title = (isset($input['title'])) ? $input['title'] : '';
13
  $description = (isset($input['description'])) ? $input['description'] : '';
14
+ $parent_class = (isset($input['parent_class'])) ? $input['parent_class'] : '';
15
 
16
  // list
17
+ $list = [];
18
+
19
  if (isset($input['list'])) {
20
  $list = $input['list'];
21
  } elseif (isset($input['list_cb'])) {
 
22
  $list_cb = $input['list_cb'];
 
 
 
23
 
24
+ $lists_file = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/admin/components/list/ht-ctc-admin-list-page.php';
25
+ if ( is_file( $lists_file ) ) {
26
+ include_once $lists_file;
27
+ $lists_instance = HT_CTC_Admin_List_Page::instance();
28
+ $list = ( class_exists('HT_CTC_Admin_List_Page') && method_exists('HT_CTC_Admin_List_Page',$list_cb) ) ? $lists_instance->$list_cb() : [];
29
+ }
30
+
31
  }
32
 
33
  ?>
34
+ <div class="row ctc_component_select <?= $parent_class ?>" style="margin:0;">
35
+ <?php
36
+ if ( '' !== $title ) {
37
+ ?>
38
+ <p class="description"><?php _e( $title, 'click-to-chat-for-whatsapp' ); ?> </p>
39
+ <?php
40
+ }
41
+ ?>
42
+ <div class="row">
43
+ <div class="input-field col s12">
44
+ <select name="<?= $dbrow ?>[<?= $db_key ?>]" class="">
45
  <?php
46
+ foreach ($list as $k => $v) {
47
+ ?>
48
+ <option value="<?= $k ?>" <?= $db_value == $k ? 'SELECTED' : ''; ?> ><?= $v ?></option>
49
+ <?php
50
+ }
51
+ ?>
52
+ </select>
53
+ <p class="description"><?= $description ?></p>
54
+ </div>
55
  </div>
56
  </div>
new/admin/components/text.php CHANGED
@@ -9,9 +9,10 @@ $title = (isset($input['title'])) ? $input['title'] : '';
9
  $description = (isset($input['description'])) ? $input['description'] : '';
10
  $label = (isset($input['label'])) ? $input['label'] : '';
11
  $placeholder = (isset($input['placeholder'])) ? $input['placeholder'] : '';
 
12
 
13
  ?>
14
- <div class="row">
15
  <div class="input-field col s12">
16
  <input name="<?= $dbrow ?>[<?= $db_key ?>]" type="text" value="<?= $db_value ?>" placeholder="<?= $placeholder ?>"/>
17
  <label for="pre_filled"><?= $label ?></label>
9
  $description = (isset($input['description'])) ? $input['description'] : '';
10
  $label = (isset($input['label'])) ? $input['label'] : '';
11
  $placeholder = (isset($input['placeholder'])) ? $input['placeholder'] : '';
12
+ $parent_class = (isset($input['parent_class'])) ? $input['parent_class'] : '';
13
 
14
  ?>
15
+ <div class="row ctc_component_text <?= $parent_class ?>">
16
  <div class="input-field col s12">
17
  <input name="<?= $dbrow ?>[<?= $db_key ?>]" type="text" value="<?= $db_value ?>" placeholder="<?= $placeholder ?>"/>
18
  <label for="pre_filled"><?= $label ?></label>
new/admin/components/textarea.php CHANGED
@@ -9,9 +9,10 @@ $title = (isset($input['title'])) ? $input['title'] : '';
9
  $description = (isset($input['description'])) ? $input['description'] : '';
10
  $label = (isset($input['label'])) ? $input['label'] : '';
11
  $placeholder = (isset($input['placeholder'])) ? $input['placeholder'] : '';
 
12
 
13
  ?>
14
- <div class="row">
15
  <div class="input-field col s12">
16
  <textarea name="<?= $dbrow ?>[<?= $db_key ?>]" style="min-height: 84px;" placeholder="<?= $placeholder ?>" id="pre_filled" class="materialize-textarea input-margin"><?= $db_value ?></textarea>
17
  <label for="pre_filled"><?= $label ?></label>
9
  $description = (isset($input['description'])) ? $input['description'] : '';
10
  $label = (isset($input['label'])) ? $input['label'] : '';
11
  $placeholder = (isset($input['placeholder'])) ? $input['placeholder'] : '';
12
+ $parent_class = (isset($input['parent_class'])) ? $input['parent_class'] : '';
13
 
14
  ?>
15
+ <div class="row ctc_component_textarea <?= $parent_class ?>">
16
  <div class="input-field col s12">
17
  <textarea name="<?= $dbrow ?>[<?= $db_key ?>]" style="min-height: 84px;" placeholder="<?= $placeholder ?>" id="pre_filled" class="materialize-textarea input-margin"><?= $db_value ?></textarea>
18
  <label for="pre_filled"><?= $label ?></label>
new/admin/db/class-ht-ctc-db.php CHANGED
@@ -52,6 +52,7 @@ class HT_CTC_DB {
52
 
53
  }
54
 
 
55
 
56
  /**
57
  * table name: "ht_ctc_othersettings"
@@ -220,6 +221,7 @@ class HT_CTC_DB {
220
  'v3_3_5' => $time,
221
  'v3_7' => $time,
222
  'v3_8' => $time,
 
223
  );
224
 
225
  $db_values = get_option( 'ht_ctc_plugin_details', array() );
52
 
53
  }
54
 
55
+
56
 
57
  /**
58
  * table name: "ht_ctc_othersettings"
221
  'v3_3_5' => $time,
222
  'v3_7' => $time,
223
  'v3_8' => $time,
224
+ 'v3_9' => $time,
225
  );
226
 
227
  $db_values = get_option( 'ht_ctc_plugin_details', array() );
new/admin/db/class-ht-ctc-db2.php CHANGED
@@ -62,7 +62,6 @@ class HT_CTC_DB2 {
62
 
63
  $this->ht_ctc_one_time();
64
 
65
-
66
  }
67
 
68
 
@@ -572,6 +571,7 @@ class HT_CTC_DB2 {
572
 
573
  }
574
 
 
575
  /**
576
  * name: ht_ctc_one_time
577
  *
62
 
63
  $this->ht_ctc_one_time();
64
 
 
65
  }
66
 
67
 
571
 
572
  }
573
 
574
+
575
  /**
576
  * name: ht_ctc_one_time
577
  *
new/admin/db/defaults/class-ht-ctc-defaults-greetings.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * default values: Greetings
4
+ * @since 3.9
5
+ */
6
+
7
+ if ( ! defined( 'ABSPATH' ) ) exit;
8
+
9
+ if ( ! class_exists( 'HT_CTC_Defaults_Greetings' ) ) :
10
+
11
+ class HT_CTC_Defaults_Greetings {
12
+
13
+ public $greetings = '';
14
+ public $g_1 = '';
15
+ public $g_2 = '';
16
+
17
+ public function __construct() {
18
+ $this->defaults();
19
+ }
20
+
21
+ function defaults() {
22
+ $this->greetings = $this->greetings();
23
+ $this->g_1 = $this->g_1();
24
+ $this->g_2 = $this->g_2();
25
+ }
26
+
27
+
28
+ function greetings() {
29
+
30
+ $values = array(
31
+ 'greetings_template' => 'no',
32
+ 'header_content' => '<span style="color: #ffffff;">{site}</span>',
33
+ 'main_content' => 'Any questions related to {title}?',
34
+ 'bottom_content' => '<p style="text-align: center;"><span style="font-size: 12px;">🟢 we are online | privacy policy</span></p>',
35
+ 'call_to_action' => 'Whatsapp Us',
36
+ 'g_device' => 'all',
37
+ 'g_init' => 'open',
38
+ );
39
+
40
+ return $values;
41
+ }
42
+
43
+ function g_1() {
44
+
45
+ $values = array(
46
+ 'header_bg_color' => '#075e54',
47
+ 'main_bg_color' => '#ece5dd',
48
+ 'message_box_bg_color' => '#dcf8c6',
49
+ 'cta_style' => '7_1',
50
+ );
51
+
52
+ return $values;
53
+ }
54
+
55
+ function g_2() {
56
+
57
+ $values = array(
58
+ 'bg_color' => '#ffffff',
59
+ );
60
+
61
+ return $values;
62
+ }
63
+
64
+ }
65
+
66
+ new HT_CTC_Defaults_Greetings();
67
+
68
+ endif; // END class_exists check
new/admin/db/defaults/class-ht-ctc-defaults.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * default values..
4
+ * @since 3.9
5
+ *
6
+ */
7
+
8
+ if ( ! defined( 'ABSPATH' ) ) exit;
9
+
10
+ if ( ! class_exists( 'HT_CTC_Defaults' ) ) :
11
+
12
+ class HT_CTC_Defaults {
13
+
14
+ public $main_options = '';
15
+
16
+ public function __construct() {
17
+ }
18
+
19
+
20
+
21
+
22
+ }
23
+
24
+ new HT_CTC_Defaults();
25
+
26
+ endif; // END class_exists check
new/inc/assets/js/331.app.js CHANGED
@@ -1 +1 @@
1
- !function(l){l(function(){var t,o=window.location.href,a=void 0!==document.title?document.title:"",n=void 0!==screen.width&&1024<screen.width?"no":"yes",h="",i="";if("undefined"!=typeof ht_ctc_chat_var)i=ht_ctc_chat_var,e(),c();else{try{document.querySelector(".ht_ctc_chat_data")&&(t=l(".ht_ctc_chat_data").attr("data-settings"),i=JSON.parse(t))}catch(t){i={}}e(),c()}function e(){var t=document.querySelector(".ht_ctc_chat_data");t&&(h=l(".ht_ctc_chat_data").attr("data-no_number"),t.remove())}function c(){var t;l(document).trigger("ht_ctc_ce_settings",[i]),document.dispatchEvent(new CustomEvent("ht_ctc_event_settings",{detail:{ctc:i}})),(t=document.querySelector(".ht-ctc-chat"))&&(l(document).trigger("ht_ctc_ce_chat"),document.dispatchEvent(new CustomEvent("ht_ctc_event_chat")),function(t){"yes"==i.schedule?(l(document).trigger("ht_ctc_ce_display",[i,r,t]),document.dispatchEvent(new CustomEvent("ht_ctc_event_display",{detail:{ctc:i,display_chat:r,ht_ctc_chat:t}}))):r(t)}(t),t.addEventListener("click",function(){d(t)})),l(document).on("click",".ht-ctc-sc-chat",function(){var t=this.getAttribute("data-number"),e=(e=this.getAttribute("data-pre_filled")).replace(/\[url]/gi,o);e=encodeURIComponent(e),i.web&&"yes"!==n?window.open("https://web.whatsapp.com/send?phone="+t+"&text="+e,"_blank","noopener"):window.open("https://wa.me/"+t+"?text="+e,"_blank","noopener"),s(this),u(t)}),l(document).on("click",".ctc_chat, #ctc_chat",function(){d(this)}),l(document).on("click",'[href="#ctc_chat"]',function(t){t.preventDefault(),d(this)})}function r(t){var e;"yes"==n?"show"==i.dis_m&&((e=document.querySelector(".ht_ctc_desktop_chat"))&&e.remove(),t.style.cssText=i.pos_m+i.css,_(t)):"show"==i.dis_d&&((e=document.querySelector(".ht_ctc_mobile_chat"))&&e.remove(),t.style.cssText=i.pos_d+i.css,_(t))}function _(e){try{l(e).show(parseInt(i.se))}catch(t){e.style.display="block"}var t,c;c=l(t=e).hasClass("ht_ctc_entry_animation")?1200:120,setTimeout(function(){t.classList.add("ht_ctc_animation",i.ani)},c),l(".ht-ctc-chat").hover(function(){l(".ht-ctc-chat .ht-ctc-cta-hover").show(120)},function(){l(".ht-ctc-chat .ht-ctc-cta-hover").hide(100)})}function s(t){document.dispatchEvent(new CustomEvent("ht_ctc_event_analytics"));var e=i.number;t.classList.contains("ht-ctc-sc")&&(e=t.getAttribute("data-number"));var c="Click to Chat for WhatsApp",n="chat: "+e,t=a+", "+o;(i.ga||i.ga4)&&("undefined"!=typeof gtag?i.ga4?gtag("event","click to chat",{number:e,title:a,url:o}):gtag("event",n,{event_category:c,event_label:t}):"undefined"!=typeof ga&&void 0!==ga.getAll?ga.getAll()[0].send("event",c,n,t):"undefined"!=typeof __gaTracker&&__gaTracker("send","event",c,n,t)),"undefined"!=typeof dataLayer&&dataLayer.push({event:"Click to Chat",type:"chat",number:e,title:a,url:o,event_category:c,event_label:t,event_action:n}),i.ads&&"undefined"!=typeof gtag_report_conversion&&gtag_report_conversion(),i.fb&&"undefined"!=typeof fbq&&fbq("trackCustom","Click to Chat by HoliThemes",{Category:"Click to Chat for WhatsApp",return_type:"chat",ID:e,Title:a,URL:o})}function d(t){l(document).trigger("ht_ctc_ce_number",[i]),document.dispatchEvent(new CustomEvent("ht_ctc_event_number",{detail:{ctc:i}}));var e=i.number,c=(c=i.pre_filled).replace(/\[url]/gi,o);c=encodeURIComponent(c),""!=e?(i.web&&"yes"!==n?window.open("https://web.whatsapp.com/send?phone="+e+"&text="+c,"_blank","noopener"):window.open("https://wa.me/"+e+"?text="+c,"_blank","noopener"),s(t),u(e)):l(".ht-ctc-chat").html(h)}function u(t){var e,c;i.hook_url&&(e=i.hook_url,c={},i.hook_v&&(c=i.hook_v),l(document).trigger("ht_ctc_ce_hook",[i,t]),document.dispatchEvent(new CustomEvent("ht_ctc_event_hook",{detail:{ctc:i,number:t}})),e=i.hook_url,c=i.hook_v,data=JSON.stringify(c),l.ajax({url:e,type:"POST",mode:"no-cors",data:data,success:function(t){}}))}})}(jQuery);
1
+ !function(f){f(function(){var o=window.location.href,a=void 0!==document.title?document.title:"",n=void 0!==screen.width&&1024<screen.width?"no":"yes",_="",c={};function e(t,e){c[t]=e;e=JSON.stringify(c);localStorage.setItem("ht_ctc_storage",e)}localStorage.getItem("ht_ctc_storage")&&(c=localStorage.getItem("ht_ctc_storage"),c=JSON.parse(c));var t,i="";if("undefined"!=typeof ht_ctc_chat_var)i=ht_ctc_chat_var,s(),r();else{try{document.querySelector(".ht_ctc_chat_data")&&(t=f(".ht_ctc_chat_data").attr("data-settings"),i=JSON.parse(t))}catch(t){i={}}s(),r()}function s(){var t=document.querySelector(".ht_ctc_chat_data");t&&(_=f(".ht_ctc_chat_data").attr("data-no_number"),t.remove())}function r(){var e;document.dispatchEvent(new CustomEvent("ht_ctc_event_settings",{detail:{ctc:i}})),(e=document.querySelector(".ht-ctc-chat"))&&(document.dispatchEvent(new CustomEvent("ht_ctc_event_chat")),function(t){"yes"==i.schedule?document.dispatchEvent(new CustomEvent("ht_ctc_event_display",{detail:{ctc:i,display_chat:l,ht_ctc_chat:t}})):l(t)}(e),e.addEventListener("click",function(){f(".ht_ctc_chat_greetings_box").length||p(e)}),f(".ht_ctc_chat_greetings_box").length&&f(document).on("click",".ht_ctc_chat_style",function(t){(f(".ht_ctc_chat_greetings_box").hasClass("ctc_greetings_opened")?u:d)()}),f(document).on("click",".ctc_greetings_close_btn",function(t){u()}),f(document).on("click",".ht_ctc_chat_greetings_box_link",function(t){t.preventDefault(),p(e),document.dispatchEvent(new CustomEvent("ht_ctc_event_greetings"))})),f(document).on("click",".ht-ctc-sc-chat",function(){var t=this.getAttribute("data-number"),e=(e=this.getAttribute("data-pre_filled")).replace(/\[url]/gi,o);e=encodeURIComponent(e),i.web&&"yes"!==n?window.open("https://web.whatsapp.com/send?phone="+t+"&text="+e,"_blank","noopener"):window.open("https://wa.me/"+t+"?text="+e,"_blank","noopener"),v(this),m(t)}),f(document).on("click",".ctc_chat, #ctc_chat",function(t){p(this),f(this).hasClass("ctc_woo_place")&&t.preventDefault()}),f(document).on("click",'[href="#ctc_chat"]',function(t){t.preventDefault(),p(this)})}function h(){if(f(".ht_ctc_chat_greetings_box").length){if(i.g_device){if("yes"!==n&&"mobile"==i.g_device)return void f(".ht_ctc_chat_greetings_box").remove();if("yes"==n&&"desktop"==i.g_device)return void f(".ht_ctc_chat_greetings_box").remove()}document.dispatchEvent(new CustomEvent("ht_ctc_event_after_chat_displayed",{detail:{ctc:i,greetings_open:d,greetings_close:u}})),i.g_init&&"open"==i.g_init&&"user_closed"!==(c["g_user_action"]||!1)&&d("init")}}function d(t){f(".ctc_cta_stick").remove(),f(".ht_ctc_chat_greetings_box").show(70),f(".ht_ctc_chat_greetings_box").addClass("ctc_greetings_opened").removeClass("ctc_greetings_closed"),e("g_action",t),"user_opened"==t&&e("g_user_action",t)}function u(t="user_closed"){f(".ht_ctc_chat_greetings_box").hide(70),f(".ht_ctc_chat_greetings_box").addClass("ctc_greetings_closed").removeClass("ctc_greetings_opened"),e("g_action",t),"user_closed"==t&&e("g_user_action",t)}function l(t){var e;"yes"==n?"show"==i.dis_m&&((e=document.querySelector(".ht_ctc_desktop_chat"))&&e.remove(),t.style.cssText=i.pos_m+i.css,g(t)):"show"==i.dis_d&&((e=document.querySelector(".ht_ctc_mobile_chat"))&&e.remove(),t.style.cssText=i.pos_d+i.css,g(t))}function g(e){try{f(e).show(parseInt(i.se))}catch(t){e.style.display="block"}var t,c;h(),c=f(t=e).hasClass("ht_ctc_entry_animation")?1200:120,setTimeout(function(){t.classList.add("ht_ctc_animation",i.ani)},c),f(".ht-ctc-chat").hover(function(){f(".ht-ctc-chat .ht-ctc-cta-hover").show(120)},function(){f(".ht-ctc-chat .ht-ctc-cta-hover").hide(100)})}function v(t){document.dispatchEvent(new CustomEvent("ht_ctc_event_analytics"));var e=i.number;t.classList.contains("ht-ctc-sc")&&(e=t.getAttribute("data-number"));var c="Click to Chat for WhatsApp",n="chat: "+e,t=a+", "+o;(i.ga||i.ga4)&&("undefined"!=typeof gtag?i.ga4?gtag("event","click to chat",{number:e,title:a,url:o}):gtag("event",n,{event_category:c,event_label:t}):"undefined"!=typeof ga&&void 0!==ga.getAll?ga.getAll()[0].send("event",c,n,t):"undefined"!=typeof __gaTracker&&__gaTracker("send","event",c,n,t)),"undefined"!=typeof dataLayer&&dataLayer.push({event:"Click to Chat",type:"chat",number:e,title:a,url:o,event_category:c,event_label:t,event_action:n}),i.ads&&"undefined"!=typeof gtag_report_conversion&&gtag_report_conversion(),i.fb&&"undefined"!=typeof fbq&&fbq("trackCustom","Click to Chat by HoliThemes",{Category:"Click to Chat for WhatsApp",return_type:"chat",ID:e,Title:a,URL:o})}function p(t){document.dispatchEvent(new CustomEvent("ht_ctc_event_number",{detail:{ctc:i}}));var e=i.number,c=i.pre_filled;t.hasAttribute("data-number")&&(e=t.getAttribute("data-number")),t.hasAttribute("data-pre_filled")&&(c=t.getAttribute("data-pre_filled")),c=c.replace(/\[url]/gi,o),c=encodeURIComponent(c),""!=e?(i.web&&"yes"!==n?window.open("https://web.whatsapp.com/send?phone="+e+"&text="+c,"_blank","noopener"):window.open("https://wa.me/"+e+"?text="+c,"_blank","noopener"),v(t),m(e)):f(".ht-ctc-chat").html(_)}function m(t){var e,c;i.hook_url&&(e=i.hook_url,c={},i.hook_v&&(c=i.hook_v),document.dispatchEvent(new CustomEvent("ht_ctc_event_hook",{detail:{ctc:i,number:t}})),e=i.hook_url,c=i.hook_v,data=JSON.stringify(c),f.ajax({url:e,type:"POST",mode:"no-cors",data:data,success:function(t){}}))}})}(jQuery);
new/inc/assets/js/332.app.js CHANGED
@@ -1 +1 @@
1
- !function(f){f(function(){var o=window.location.href,a=void 0!==document.title?document.title:"",n=void 0!==screen.width&&1024<screen.width?"no":"yes",_="",c={};function e(t,e){c[t]=e;e=JSON.stringify(c);localStorage.setItem("ht_ctc_storage",e)}localStorage.getItem("ht_ctc_storage")&&(c=localStorage.getItem("ht_ctc_storage"),c=JSON.parse(c));var t,i="";if("undefined"!=typeof ht_ctc_chat_var)i=ht_ctc_chat_var,s(),r();else{try{document.querySelector(".ht_ctc_chat_data")&&(t=f(".ht_ctc_chat_data").attr("data-settings"),i=JSON.parse(t))}catch(t){i={}}s(),r()}function s(){var t=document.querySelector(".ht_ctc_chat_data");t&&(_=f(".ht_ctc_chat_data").attr("data-no_number"),t.remove())}function r(){var e;document.dispatchEvent(new CustomEvent("ht_ctc_event_settings",{detail:{ctc:i}})),(e=document.querySelector(".ht-ctc-chat"))&&(document.dispatchEvent(new CustomEvent("ht_ctc_event_chat")),function(t){"yes"==i.schedule?document.dispatchEvent(new CustomEvent("ht_ctc_event_display",{detail:{ctc:i,display_chat:l,ht_ctc_chat:t}})):l(t)}(e),e.addEventListener("click",function(){f(".ht_ctc_chat_greetings_box").length||p(e)}),function(){var t;f(".ht_ctc_chat_greetings_box").length&&(t=f(window).height(),t-=t/3,f(".ht_ctc_chat_greetings_box_layout").css({maxHeight:t+"px"}),f(document).on("click",".ht_ctc_chat_style",function(t){(f(".ht_ctc_chat_greetings_box").hasClass("ctc_greetings_opened")?u:d)()})),f(document).on("click",".ctc_greetings_close_btn",function(t){u()})}(),f(document).on("click",".ht_ctc_chat_greetings_box_link",function(t){t.preventDefault(),p(e),document.dispatchEvent(new CustomEvent("ht_ctc_event_greetings"))})),f(document).on("click",".ht-ctc-sc-chat",function(){var t=this.getAttribute("data-number"),e=(e=this.getAttribute("data-pre_filled")).replace(/\[url]/gi,o);e=encodeURIComponent(e),i.web&&"yes"!==n?window.open("https://web.whatsapp.com/send?phone="+t+"&text="+e,"_blank","noopener"):window.open("https://wa.me/"+t+"?text="+e,"_blank","noopener"),v(this),m(t)}),f(document).on("click",".ctc_chat, #ctc_chat",function(t){p(this),f(this).hasClass("ctc_woo_place")&&t.preventDefault()}),f(document).on("click",'[href="#ctc_chat"]',function(t){t.preventDefault(),p(this)})}function h(){if(f(".ht_ctc_chat_greetings_box").length){if(i.g_device){if("yes"!==n&&"mobile"==i.g_device)return void f(".ht_ctc_chat_greetings_box").remove();if("yes"==n&&"desktop"==i.g_device)return void f(".ht_ctc_chat_greetings_box").remove()}document.dispatchEvent(new CustomEvent("ht_ctc_event_after_chat_displayed",{detail:{ctc:i,greetings_open:d,greetings_close:u}})),i.g_init&&"open"==i.g_init&&"user_closed"!==(c["g_user_action"]||!1)&&d("init")}}function d(t){f(".ht_ctc_chat_greetings_box").show(70),f(".ht_ctc_chat_greetings_box").addClass("ctc_greetings_opened").removeClass("ctc_greetings_closed"),e("g_action",t),"user_opened"==t&&e("g_user_action",t)}function u(t="user_closed"){f(".ht_ctc_chat_greetings_box").hide(70),f(".ht_ctc_chat_greetings_box").addClass("ctc_greetings_closed").removeClass("ctc_greetings_opened"),e("g_action",t),"user_closed"==t&&e("g_user_action",t)}function l(t){var e;"yes"==n?"show"==i.dis_m&&((e=document.querySelector(".ht_ctc_desktop_chat"))&&e.remove(),t.style.cssText=i.pos_m+i.css,g(t)):"show"==i.dis_d&&((e=document.querySelector(".ht_ctc_mobile_chat"))&&e.remove(),t.style.cssText=i.pos_d+i.css,g(t))}function g(e){try{f(e).show(parseInt(i.se))}catch(t){e.style.display="block"}var t,c;h(),c=f(t=e).hasClass("ht_ctc_entry_animation")?1200:120,setTimeout(function(){t.classList.add("ht_ctc_animation",i.ani)},c),f(".ht-ctc-chat").hover(function(){f(".ht-ctc-chat .ht-ctc-cta-hover").show(120)},function(){f(".ht-ctc-chat .ht-ctc-cta-hover").hide(100)})}function v(t){document.dispatchEvent(new CustomEvent("ht_ctc_event_analytics"));var e=i.number;t.classList.contains("ht-ctc-sc")&&(e=t.getAttribute("data-number"));var c="Click to Chat for WhatsApp",n="chat: "+e,t=a+", "+o;(i.ga||i.ga4)&&("undefined"!=typeof gtag?i.ga4?gtag("event","click to chat",{number:e,title:a,url:o}):gtag("event",n,{event_category:c,event_label:t}):"undefined"!=typeof ga&&void 0!==ga.getAll?ga.getAll()[0].send("event",c,n,t):"undefined"!=typeof __gaTracker&&__gaTracker("send","event",c,n,t)),"undefined"!=typeof dataLayer&&dataLayer.push({event:"Click to Chat",type:"chat",number:e,title:a,url:o,event_category:c,event_label:t,event_action:n}),i.ads&&"undefined"!=typeof gtag_report_conversion&&gtag_report_conversion(),i.fb&&"undefined"!=typeof fbq&&fbq("trackCustom","Click to Chat by HoliThemes",{Category:"Click to Chat for WhatsApp",return_type:"chat",ID:e,Title:a,URL:o})}function p(t){document.dispatchEvent(new CustomEvent("ht_ctc_event_number",{detail:{ctc:i}}));var e=i.number,c=i.pre_filled;t.hasAttribute("data-number")&&(e=t.getAttribute("data-number")),t.hasAttribute("data-pre_filled")&&(c=t.getAttribute("data-pre_filled")),c=c.replace(/\[url]/gi,o),c=encodeURIComponent(c),""!=e?(i.web&&"yes"!==n?window.open("https://web.whatsapp.com/send?phone="+e+"&text="+c,"_blank","noopener"):window.open("https://wa.me/"+e+"?text="+c,"_blank","noopener"),v(t),m(e)):f(".ht-ctc-chat").html(_)}function m(t){var e,c;i.hook_url&&(e=i.hook_url,c={},i.hook_v&&(c=i.hook_v),document.dispatchEvent(new CustomEvent("ht_ctc_event_hook",{detail:{ctc:i,number:t}})),e=i.hook_url,c=i.hook_v,data=JSON.stringify(c),f.ajax({url:e,type:"POST",mode:"no-cors",data:data,success:function(t){}}))}})}(jQuery);
1
+ !function(f){f(function(){var o=window.location.href,a=void 0!==document.title?document.title:"",n=void 0!==screen.width&&1024<screen.width?"no":"yes",_="",c={};function e(t,e){c[t]=e;e=JSON.stringify(c);localStorage.setItem("ht_ctc_storage",e)}localStorage.getItem("ht_ctc_storage")&&(c=localStorage.getItem("ht_ctc_storage"),c=JSON.parse(c));var t,i="";if("undefined"!=typeof ht_ctc_chat_var)i=ht_ctc_chat_var,s(),r();else{try{document.querySelector(".ht_ctc_chat_data")&&(t=f(".ht_ctc_chat_data").attr("data-settings"),i=JSON.parse(t))}catch(t){i={}}s(),r()}function s(){var t=document.querySelector(".ht_ctc_chat_data");t&&(_=f(".ht_ctc_chat_data").attr("data-no_number"),t.remove())}function r(){var e;document.dispatchEvent(new CustomEvent("ht_ctc_event_settings",{detail:{ctc:i}})),(e=document.querySelector(".ht-ctc-chat"))&&(document.dispatchEvent(new CustomEvent("ht_ctc_event_chat")),function(t){"yes"==i.schedule?document.dispatchEvent(new CustomEvent("ht_ctc_event_display",{detail:{ctc:i,display_chat:l,ht_ctc_chat:t}})):l(t)}(e),e.addEventListener("click",function(){f(".ht_ctc_chat_greetings_box").length||p(e)}),f(".ht_ctc_chat_greetings_box").length&&f(document).on("click",".ht_ctc_chat_style",function(t){(f(".ht_ctc_chat_greetings_box").hasClass("ctc_greetings_opened")?u:d)()}),f(document).on("click",".ctc_greetings_close_btn",function(t){u()}),f(document).on("click",".ht_ctc_chat_greetings_box_link",function(t){t.preventDefault(),p(e),document.dispatchEvent(new CustomEvent("ht_ctc_event_greetings"))})),f(document).on("click",".ht-ctc-sc-chat",function(){var t=this.getAttribute("data-number"),e=(e=this.getAttribute("data-pre_filled")).replace(/\[url]/gi,o);e=encodeURIComponent(e),i.web&&"yes"!==n?window.open("https://web.whatsapp.com/send?phone="+t+"&text="+e,"_blank","noopener"):window.open("https://wa.me/"+t+"?text="+e,"_blank","noopener"),v(this),m(t)}),f(document).on("click",".ctc_chat, #ctc_chat",function(t){p(this),f(this).hasClass("ctc_woo_place")&&t.preventDefault()}),f(document).on("click",'[href="#ctc_chat"]',function(t){t.preventDefault(),p(this)})}function h(){if(f(".ht_ctc_chat_greetings_box").length){if(i.g_device){if("yes"!==n&&"mobile"==i.g_device)return void f(".ht_ctc_chat_greetings_box").remove();if("yes"==n&&"desktop"==i.g_device)return void f(".ht_ctc_chat_greetings_box").remove()}document.dispatchEvent(new CustomEvent("ht_ctc_event_after_chat_displayed",{detail:{ctc:i,greetings_open:d,greetings_close:u}})),i.g_init&&"open"==i.g_init&&"user_closed"!==(c["g_user_action"]||!1)&&d("init")}}function d(t){f(".ctc_cta_stick").remove(),f(".ht_ctc_chat_greetings_box").show(70),f(".ht_ctc_chat_greetings_box").addClass("ctc_greetings_opened").removeClass("ctc_greetings_closed"),e("g_action",t),"user_opened"==t&&e("g_user_action",t)}function u(t="user_closed"){f(".ht_ctc_chat_greetings_box").hide(70),f(".ht_ctc_chat_greetings_box").addClass("ctc_greetings_closed").removeClass("ctc_greetings_opened"),e("g_action",t),"user_closed"==t&&e("g_user_action",t)}function l(t){var e;"yes"==n?"show"==i.dis_m&&((e=document.querySelector(".ht_ctc_desktop_chat"))&&e.remove(),t.style.cssText=i.pos_m+i.css,g(t)):"show"==i.dis_d&&((e=document.querySelector(".ht_ctc_mobile_chat"))&&e.remove(),t.style.cssText=i.pos_d+i.css,g(t))}function g(e){try{f(e).show(parseInt(i.se))}catch(t){e.style.display="block"}var t,c;h(),c=f(t=e).hasClass("ht_ctc_entry_animation")?1200:120,setTimeout(function(){t.classList.add("ht_ctc_animation",i.ani)},c),f(".ht-ctc-chat").hover(function(){f(".ht-ctc-chat .ht-ctc-cta-hover").show(120)},function(){f(".ht-ctc-chat .ht-ctc-cta-hover").hide(100)})}function v(t){document.dispatchEvent(new CustomEvent("ht_ctc_event_analytics"));var e=i.number;t.classList.contains("ht-ctc-sc")&&(e=t.getAttribute("data-number"));var c="Click to Chat for WhatsApp",n="chat: "+e,t=a+", "+o;(i.ga||i.ga4)&&("undefined"!=typeof gtag?i.ga4?gtag("event","click to chat",{number:e,title:a,url:o}):gtag("event",n,{event_category:c,event_label:t}):"undefined"!=typeof ga&&void 0!==ga.getAll?ga.getAll()[0].send("event",c,n,t):"undefined"!=typeof __gaTracker&&__gaTracker("send","event",c,n,t)),"undefined"!=typeof dataLayer&&dataLayer.push({event:"Click to Chat",type:"chat",number:e,title:a,url:o,event_category:c,event_label:t,event_action:n}),i.ads&&"undefined"!=typeof gtag_report_conversion&&gtag_report_conversion(),i.fb&&"undefined"!=typeof fbq&&fbq("trackCustom","Click to Chat by HoliThemes",{Category:"Click to Chat for WhatsApp",return_type:"chat",ID:e,Title:a,URL:o})}function p(t){document.dispatchEvent(new CustomEvent("ht_ctc_event_number",{detail:{ctc:i}}));var e=i.number,c=i.pre_filled;t.hasAttribute("data-number")&&(e=t.getAttribute("data-number")),t.hasAttribute("data-pre_filled")&&(c=t.getAttribute("data-pre_filled")),c=c.replace(/\[url]/gi,o),c=encodeURIComponent(c),""!=e?(i.web&&"yes"!==n?window.open("https://web.whatsapp.com/send?phone="+e+"&text="+c,"_blank","noopener"):window.open("https://wa.me/"+e+"?text="+c,"_blank","noopener"),v(t),m(e)):f(".ht-ctc-chat").html(_)}function m(t){var e,c;i.hook_url&&(e=i.hook_url,c={},i.hook_v&&(c=i.hook_v),document.dispatchEvent(new CustomEvent("ht_ctc_event_hook",{detail:{ctc:i,number:t}})),e=i.hook_url,c=i.hook_v,data=JSON.stringify(c),f.ajax({url:e,type:"POST",mode:"no-cors",data:data,success:function(t){}}))}})}(jQuery);
new/inc/assets/js/app.js CHANGED
@@ -1 +1 @@
1
- !function(f){f(function(){var o=window.location.href,a=void 0!==document.title?document.title:"",n=void 0!==screen.width&&1024<screen.width?"no":"yes",_="",c={};function e(t,e){c[t]=e;e=JSON.stringify(c);localStorage.setItem("ht_ctc_storage",e)}localStorage.getItem("ht_ctc_storage")&&(c=localStorage.getItem("ht_ctc_storage"),c=JSON.parse(c));var t,i="";if("undefined"!=typeof ht_ctc_chat_var)i=ht_ctc_chat_var,s(),r();else{try{document.querySelector(".ht_ctc_chat_data")&&(t=f(".ht_ctc_chat_data").attr("data-settings"),i=JSON.parse(t))}catch(t){i={}}s(),r()}function s(){var t=document.querySelector(".ht_ctc_chat_data");t&&(_=f(".ht_ctc_chat_data").attr("data-no_number"),t.remove())}function r(){var e;document.dispatchEvent(new CustomEvent("ht_ctc_event_settings",{detail:{ctc:i}})),(e=document.querySelector(".ht-ctc-chat"))&&(document.dispatchEvent(new CustomEvent("ht_ctc_event_chat")),function(t){"yes"==i.schedule?document.dispatchEvent(new CustomEvent("ht_ctc_event_display",{detail:{ctc:i,display_chat:l,ht_ctc_chat:t}})):l(t)}(e),e.addEventListener("click",function(){f(".ht_ctc_chat_greetings_box").length||p(e)}),function(){var t;f(".ht_ctc_chat_greetings_box").length&&(t=f(window).height(),t-=t/3,f(".ht_ctc_chat_greetings_box_layout").css({maxHeight:t+"px"}),f(document).on("click",".ht_ctc_chat_style",function(t){(f(".ht_ctc_chat_greetings_box").hasClass("ctc_greetings_opened")?u:d)()})),f(document).on("click",".ctc_greetings_close_btn",function(t){u()})}(),f(document).on("click",".ht_ctc_chat_greetings_box_link",function(t){t.preventDefault(),p(e),document.dispatchEvent(new CustomEvent("ht_ctc_event_greetings"))})),f(document).on("click",".ht-ctc-sc-chat",function(){var t=this.getAttribute("data-number"),e=(e=this.getAttribute("data-pre_filled")).replace(/\[url]/gi,o);e=encodeURIComponent(e),i.web&&"yes"!==n?window.open("https://web.whatsapp.com/send?phone="+t+"&text="+e,"_blank","noopener"):window.open("https://wa.me/"+t+"?text="+e,"_blank","noopener"),v(this),m(t)}),f(document).on("click",".ctc_chat, #ctc_chat",function(t){p(this),f(this).hasClass("ctc_woo_place")&&t.preventDefault()}),f(document).on("click",'[href="#ctc_chat"]',function(t){t.preventDefault(),p(this)})}function h(){if(f(".ht_ctc_chat_greetings_box").length){if(i.g_device){if("yes"!==n&&"mobile"==i.g_device)return void f(".ht_ctc_chat_greetings_box").remove();if("yes"==n&&"desktop"==i.g_device)return void f(".ht_ctc_chat_greetings_box").remove()}document.dispatchEvent(new CustomEvent("ht_ctc_event_after_chat_displayed",{detail:{ctc:i,greetings_open:d,greetings_close:u}})),i.g_init&&"open"==i.g_init&&"user_closed"!==(c["g_user_action"]||!1)&&d("init")}}function d(t){f(".ht_ctc_chat_greetings_box").show(70),f(".ht_ctc_chat_greetings_box").addClass("ctc_greetings_opened").removeClass("ctc_greetings_closed"),e("g_action",t),"user_opened"==t&&e("g_user_action",t)}function u(t="user_closed"){f(".ht_ctc_chat_greetings_box").hide(70),f(".ht_ctc_chat_greetings_box").addClass("ctc_greetings_closed").removeClass("ctc_greetings_opened"),e("g_action",t),"user_closed"==t&&e("g_user_action",t)}function l(t){var e;"yes"==n?"show"==i.dis_m&&((e=document.querySelector(".ht_ctc_desktop_chat"))&&e.remove(),t.style.cssText=i.pos_m+i.css,g(t)):"show"==i.dis_d&&((e=document.querySelector(".ht_ctc_mobile_chat"))&&e.remove(),t.style.cssText=i.pos_d+i.css,g(t))}function g(e){try{f(e).show(parseInt(i.se))}catch(t){e.style.display="block"}var t,c;h(),c=f(t=e).hasClass("ht_ctc_entry_animation")?1200:120,setTimeout(function(){t.classList.add("ht_ctc_animation",i.ani)},c),f(".ht-ctc-chat").hover(function(){f(".ht-ctc-chat .ht-ctc-cta-hover").show(120)},function(){f(".ht-ctc-chat .ht-ctc-cta-hover").hide(100)})}function v(t){document.dispatchEvent(new CustomEvent("ht_ctc_event_analytics"));var e=i.number;t.classList.contains("ht-ctc-sc")&&(e=t.getAttribute("data-number"));var c="Click to Chat for WhatsApp",n="chat: "+e,t=a+", "+o;(i.ga||i.ga4)&&("undefined"!=typeof gtag?i.ga4?gtag("event","click to chat",{number:e,title:a,url:o}):gtag("event",n,{event_category:c,event_label:t}):"undefined"!=typeof ga&&void 0!==ga.getAll?ga.getAll()[0].send("event",c,n,t):"undefined"!=typeof __gaTracker&&__gaTracker("send","event",c,n,t)),"undefined"!=typeof dataLayer&&dataLayer.push({event:"Click to Chat",type:"chat",number:e,title:a,url:o,event_category:c,event_label:t,event_action:n}),i.ads&&"undefined"!=typeof gtag_report_conversion&&gtag_report_conversion(),i.fb&&"undefined"!=typeof fbq&&fbq("trackCustom","Click to Chat by HoliThemes",{Category:"Click to Chat for WhatsApp",return_type:"chat",ID:e,Title:a,URL:o})}function p(t){document.dispatchEvent(new CustomEvent("ht_ctc_event_number",{detail:{ctc:i}}));var e=i.number,c=i.pre_filled;t.hasAttribute("data-number")&&(e=t.getAttribute("data-number")),t.hasAttribute("data-pre_filled")&&(c=t.getAttribute("data-pre_filled")),c=c.replace(/\[url]/gi,o),c=encodeURIComponent(c),""!=e?(i.web&&"yes"!==n?window.open("https://web.whatsapp.com/send?phone="+e+"&text="+c,"_blank","noopener"):window.open("https://wa.me/"+e+"?text="+c,"_blank","noopener"),v(t),m(e)):f(".ht-ctc-chat").html(_)}function m(t){var e,c;i.hook_url&&(e=i.hook_url,c={},i.hook_v&&(c=i.hook_v),document.dispatchEvent(new CustomEvent("ht_ctc_event_hook",{detail:{ctc:i,number:t}})),e=i.hook_url,c=i.hook_v,data=JSON.stringify(c),f.ajax({url:e,type:"POST",mode:"no-cors",data:data,success:function(t){}}))}})}(jQuery);
1
+ !function(f){f(function(){var o=window.location.href,a=void 0!==document.title?document.title:"",n=void 0!==screen.width&&1024<screen.width?"no":"yes",_="",c={};function e(t,e){c[t]=e;e=JSON.stringify(c);localStorage.setItem("ht_ctc_storage",e)}localStorage.getItem("ht_ctc_storage")&&(c=localStorage.getItem("ht_ctc_storage"),c=JSON.parse(c));var t,i="";if("undefined"!=typeof ht_ctc_chat_var)i=ht_ctc_chat_var,s(),r();else{try{document.querySelector(".ht_ctc_chat_data")&&(t=f(".ht_ctc_chat_data").attr("data-settings"),i=JSON.parse(t))}catch(t){i={}}s(),r()}function s(){var t=document.querySelector(".ht_ctc_chat_data");t&&(_=f(".ht_ctc_chat_data").attr("data-no_number"),t.remove())}function r(){var e;document.dispatchEvent(new CustomEvent("ht_ctc_event_settings",{detail:{ctc:i}})),(e=document.querySelector(".ht-ctc-chat"))&&(document.dispatchEvent(new CustomEvent("ht_ctc_event_chat")),function(t){"yes"==i.schedule?document.dispatchEvent(new CustomEvent("ht_ctc_event_display",{detail:{ctc:i,display_chat:l,ht_ctc_chat:t}})):l(t)}(e),e.addEventListener("click",function(){f(".ht_ctc_chat_greetings_box").length||p(e)}),f(".ht_ctc_chat_greetings_box").length&&f(document).on("click",".ht_ctc_chat_style",function(t){(f(".ht_ctc_chat_greetings_box").hasClass("ctc_greetings_opened")?u:d)()}),f(document).on("click",".ctc_greetings_close_btn",function(t){u()}),f(document).on("click",".ht_ctc_chat_greetings_box_link",function(t){t.preventDefault(),p(e),document.dispatchEvent(new CustomEvent("ht_ctc_event_greetings"))})),f(document).on("click",".ht-ctc-sc-chat",function(){var t=this.getAttribute("data-number"),e=(e=this.getAttribute("data-pre_filled")).replace(/\[url]/gi,o);e=encodeURIComponent(e),i.web&&"yes"!==n?window.open("https://web.whatsapp.com/send?phone="+t+"&text="+e,"_blank","noopener"):window.open("https://wa.me/"+t+"?text="+e,"_blank","noopener"),v(this),m(t)}),f(document).on("click",".ctc_chat, #ctc_chat",function(t){p(this),f(this).hasClass("ctc_woo_place")&&t.preventDefault()}),f(document).on("click",'[href="#ctc_chat"]',function(t){t.preventDefault(),p(this)})}function h(){if(f(".ht_ctc_chat_greetings_box").length){if(i.g_device){if("yes"!==n&&"mobile"==i.g_device)return void f(".ht_ctc_chat_greetings_box").remove();if("yes"==n&&"desktop"==i.g_device)return void f(".ht_ctc_chat_greetings_box").remove()}document.dispatchEvent(new CustomEvent("ht_ctc_event_after_chat_displayed",{detail:{ctc:i,greetings_open:d,greetings_close:u}})),i.g_init&&"open"==i.g_init&&"user_closed"!==(c["g_user_action"]||!1)&&d("init")}}function d(t){f(".ctc_cta_stick").remove(),f(".ht_ctc_chat_greetings_box").show(70),f(".ht_ctc_chat_greetings_box").addClass("ctc_greetings_opened").removeClass("ctc_greetings_closed"),e("g_action",t),"user_opened"==t&&e("g_user_action",t)}function u(t="user_closed"){f(".ht_ctc_chat_greetings_box").hide(70),f(".ht_ctc_chat_greetings_box").addClass("ctc_greetings_closed").removeClass("ctc_greetings_opened"),e("g_action",t),"user_closed"==t&&e("g_user_action",t)}function l(t){var e;"yes"==n?"show"==i.dis_m&&((e=document.querySelector(".ht_ctc_desktop_chat"))&&e.remove(),t.style.cssText=i.pos_m+i.css,g(t)):"show"==i.dis_d&&((e=document.querySelector(".ht_ctc_mobile_chat"))&&e.remove(),t.style.cssText=i.pos_d+i.css,g(t))}function g(e){try{f(e).show(parseInt(i.se))}catch(t){e.style.display="block"}var t,c;h(),c=f(t=e).hasClass("ht_ctc_entry_animation")?1200:120,setTimeout(function(){t.classList.add("ht_ctc_animation",i.ani)},c),f(".ht-ctc-chat").hover(function(){f(".ht-ctc-chat .ht-ctc-cta-hover").show(120)},function(){f(".ht-ctc-chat .ht-ctc-cta-hover").hide(100)})}function v(t){document.dispatchEvent(new CustomEvent("ht_ctc_event_analytics"));var e=i.number;t.classList.contains("ht-ctc-sc")&&(e=t.getAttribute("data-number"));var c="Click to Chat for WhatsApp",n="chat: "+e,t=a+", "+o;(i.ga||i.ga4)&&("undefined"!=typeof gtag?i.ga4?gtag("event","click to chat",{number:e,title:a,url:o}):gtag("event",n,{event_category:c,event_label:t}):"undefined"!=typeof ga&&void 0!==ga.getAll?ga.getAll()[0].send("event",c,n,t):"undefined"!=typeof __gaTracker&&__gaTracker("send","event",c,n,t)),"undefined"!=typeof dataLayer&&dataLayer.push({event:"Click to Chat",type:"chat",number:e,title:a,url:o,event_category:c,event_label:t,event_action:n}),i.ads&&"undefined"!=typeof gtag_report_conversion&&gtag_report_conversion(),i.fb&&"undefined"!=typeof fbq&&fbq("trackCustom","Click to Chat by HoliThemes",{Category:"Click to Chat for WhatsApp",return_type:"chat",ID:e,Title:a,URL:o})}function p(t){document.dispatchEvent(new CustomEvent("ht_ctc_event_number",{detail:{ctc:i}}));var e=i.number,c=i.pre_filled;t.hasAttribute("data-number")&&(e=t.getAttribute("data-number")),t.hasAttribute("data-pre_filled")&&(c=t.getAttribute("data-pre_filled")),c=c.replace(/\[url]/gi,o),c=encodeURIComponent(c),""!=e?(i.web&&"yes"!==n?window.open("https://web.whatsapp.com/send?phone="+e+"&text="+c,"_blank","noopener"):window.open("https://wa.me/"+e+"?text="+c,"_blank","noopener"),v(t),m(e)):f(".ht-ctc-chat").html(_)}function m(t){var e,c;i.hook_url&&(e=i.hook_url,c={},i.hook_v&&(c=i.hook_v),document.dispatchEvent(new CustomEvent("ht_ctc_event_hook",{detail:{ctc:i,number:t}})),e=i.hook_url,c=i.hook_v,data=JSON.stringify(c),f.ajax({url:e,type:"POST",mode:"no-cors",data:data,success:function(t){}}))}})}(jQuery);
new/inc/assets/js/dev/app.dev.js CHANGED
@@ -106,8 +106,6 @@ $(function () {
106
  ht_ctc_chat.addEventListener('click', function () {
107
  // ht_ctc_chat_greetings_box (ht_ctc_chat_greetings_box_link) is not exists..
108
 
109
- console.log(!$('.ht_ctc_chat_greetings_box').length);
110
-
111
  if (!$('.ht_ctc_chat_greetings_box').length) {
112
  console.log('no greetings dialog');
113
  // link
@@ -120,6 +118,7 @@ $(function () {
120
 
121
  // greetings link click..
122
  $(document).on('click', '.ht_ctc_chat_greetings_box_link', function (e) {
 
123
  e.preventDefault();
124
  ht_ctc_link(ht_ctc_chat);
125
 
@@ -140,12 +139,6 @@ $(function () {
140
 
141
  if ($('.ht_ctc_chat_greetings_box').length) {
142
 
143
- // max screen width is 66% of inner height
144
- // var innerheight = window.innerHeight;
145
- var innerheight = $(window).height();
146
- innerheight = innerheight - (innerheight / 3);
147
- $('.ht_ctc_chat_greetings_box_layout').css({ maxHeight: innerheight + 'px'});
148
-
149
  $(document).on('click', '.ht_ctc_chat_style', function (e) {
150
  // ctc_greetings_opened / ctc_greetings_closed
151
  if ($('.ht_ctc_chat_greetings_box').hasClass('ctc_greetings_opened')) {
@@ -199,6 +192,7 @@ $(function () {
199
  */
200
  function greetings_open(message = 'user_opened') {
201
  console.log('open');
 
202
  $('.ht_ctc_chat_greetings_box').show(70);
203
  $('.ht_ctc_chat_greetings_box').addClass('ctc_greetings_opened').removeClass('ctc_greetings_closed');
204
  ctc_setItem( 'g_action', message);
@@ -550,6 +544,7 @@ $(function () {
550
  }
551
 
552
 
 
553
  });
554
 
555
  })(jQuery);
106
  ht_ctc_chat.addEventListener('click', function () {
107
  // ht_ctc_chat_greetings_box (ht_ctc_chat_greetings_box_link) is not exists..
108
 
 
 
109
  if (!$('.ht_ctc_chat_greetings_box').length) {
110
  console.log('no greetings dialog');
111
  // link
118
 
119
  // greetings link click..
120
  $(document).on('click', '.ht_ctc_chat_greetings_box_link', function (e) {
121
+ console.log('ht_ctc_chat_greetings_box_link');
122
  e.preventDefault();
123
  ht_ctc_link(ht_ctc_chat);
124
 
139
 
140
  if ($('.ht_ctc_chat_greetings_box').length) {
141
 
 
 
 
 
 
 
142
  $(document).on('click', '.ht_ctc_chat_style', function (e) {
143
  // ctc_greetings_opened / ctc_greetings_closed
144
  if ($('.ht_ctc_chat_greetings_box').hasClass('ctc_greetings_opened')) {
192
  */
193
  function greetings_open(message = 'user_opened') {
194
  console.log('open');
195
+ $('.ctc_cta_stick').remove();
196
  $('.ht_ctc_chat_greetings_box').show(70);
197
  $('.ht_ctc_chat_greetings_box').addClass('ctc_greetings_opened').removeClass('ctc_greetings_closed');
198
  ctc_setItem( 'g_action', message);
544
  }
545
 
546
 
547
+
548
  });
549
 
550
  })(jQuery);
new/inc/chat/class-ht-ctc-chat.php CHANGED
@@ -20,6 +20,8 @@ class HT_CTC_Chat {
20
 
21
  $options = get_option('ht_ctc_chat_options');
22
  $othersettings = get_option('ht_ctc_othersettings');
 
 
23
  $type = "chat";
24
 
25
  // If db values are not correct
@@ -270,6 +272,16 @@ class HT_CTC_Chat {
270
  wp_deregister_script( 'ht_ctc_app_js' );
271
  }
272
  }
 
 
 
 
 
 
 
 
 
 
273
 
274
  // webhook
275
  $hook_url = isset($othersettings['hook_url']) ? esc_attr( $othersettings['hook_url'] ) : '';
@@ -346,6 +358,18 @@ class HT_CTC_Chat {
346
  }
347
  }
348
 
 
 
 
 
 
 
 
 
 
 
 
 
349
  $ctc = apply_filters( 'ht_ctc_fh_ctc', $ctc );
350
 
351
  // data-attribute - data-settings
20
 
21
  $options = get_option('ht_ctc_chat_options');
22
  $othersettings = get_option('ht_ctc_othersettings');
23
+ $greetings = get_option('ht_ctc_greetings_options');
24
+ $greetings_settings = get_option('ht_ctc_greetings_settings');
25
  $type = "chat";
26
 
27
  // If db values are not correct
272
  wp_deregister_script( 'ht_ctc_app_js' );
273
  }
274
  }
275
+
276
+
277
+ /**
278
+ * greetings
279
+ *
280
+ * dont load if its an AMP page or if no greetings dialog selected
281
+ */
282
+ if ( false == $is_amp && isset($greetings['greetings_template']) && 'no' !== $greetings['greetings_template'] ) {
283
+ include HT_CTC_PLUGIN_DIR .'new/inc/greetings/class-ht-ctc-chat-greetings.php';
284
+ }
285
 
286
  // webhook
287
  $hook_url = isset($othersettings['hook_url']) ? esc_attr( $othersettings['hook_url'] ) : '';
358
  }
359
  }
360
 
361
+ // Greetings - init display ..
362
+ $g_init = isset($greetings_settings['g_init']) ? esc_attr( $greetings_settings['g_init'] ) : '';
363
+ if ('open' == $g_init) {
364
+ $ctc['g_init'] = $g_init;
365
+ }
366
+
367
+ // Greetings - display device based (if not all then add value)
368
+ $g_device = isset($greetings_settings['g_device']) ? esc_attr( $greetings_settings['g_device'] ) : 'all';
369
+ if ('all' !== $g_device) {
370
+ $ctc['g_device'] = $g_device;
371
+ }
372
+
373
  $ctc = apply_filters( 'ht_ctc_fh_ctc', $ctc );
374
 
375
  // data-attribute - data-settings
new/inc/class-ht-ctc-register.php CHANGED
@@ -63,6 +63,8 @@ class HT_CTC_Register {
63
 
64
  // deletes custom styles, ht_ctc_share, ht_ctc_switch
65
  $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE 'ht\_ctc\_s%';" );
 
 
66
 
67
  // deletes page level settings
68
  $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_key LIKE 'ht\_ctc\_page%';" );
63
 
64
  // deletes custom styles, ht_ctc_share, ht_ctc_switch
65
  $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE 'ht\_ctc\_s%';" );
66
+ // greetings
67
+ $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE 'ht\_ctc\_g%';" );
68
 
69
  // deletes page level settings
70
  $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_key LIKE 'ht\_ctc\_page%';" );
new/inc/commons/class-ht-ctc-scripts.php CHANGED
@@ -26,8 +26,8 @@ class HT_CTC_Scripts {
26
  $load_app_js_bottom = apply_filters( 'ht_ctc_fh_load_app_js_bottom', true );
27
 
28
  // js
29
- // $js = 'app.js';
30
- $js = '332.app.js';
31
  $woo_js = 'woo.js';
32
  $group_js = 'group.js';
33
  $share_js = 'share.js';
26
  $load_app_js_bottom = apply_filters( 'ht_ctc_fh_load_app_js_bottom', true );
27
 
28
  // js
29
+ $js = 'app.js';
30
+ // $js = '332.app.js';
31
  $woo_js = 'woo.js';
32
  $group_js = 'group.js';
33
  $share_js = 'share.js';
new/inc/greetings/class-ht-ctc-chat-greetings.php ADDED
@@ -0,0 +1,224 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WhatsApp Chat - main page ..
4
+ *
5
+ * @uses ht-ctc-chat if: 'no' !== $greetings['greetings_template']
6
+ *
7
+ * @subpackage chat
8
+ */
9
+
10
+ if ( ! defined( 'ABSPATH' ) ) exit;
11
+
12
+ if ( ! class_exists( 'HT_CTC_Chat_Greetings' ) ) :
13
+
14
+ class HT_CTC_Chat_Greetings {
15
+
16
+ public function __construct() {
17
+ $this->start();
18
+ }
19
+
20
+ public function start() {
21
+ add_action( 'ht_ctc_ah_in_fixed_position', [$this, 'greetings_dialog'] );
22
+ }
23
+
24
+
25
+ function greetings_dialog() {
26
+
27
+ $greetings = get_option('ht_ctc_greetings_options' );
28
+ $chat = get_option('ht_ctc_chat_options');
29
+
30
+ $ht_ctc_greetings = array();
31
+ $ht_ctc_greetings['greetings_template'] = ( isset( $greetings['greetings_template']) ) ? esc_attr( $greetings['greetings_template'] ) : '';
32
+
33
+ // return if template not set..
34
+ if ( '' == $ht_ctc_greetings['greetings_template'] ) {
35
+ return;
36
+ }
37
+
38
+ $page_id = get_the_ID();
39
+ // $page_id = get_queried_object_id();
40
+
41
+ // $object_id = get_queried_object_id();
42
+ // if (0 == $object_id || '' == $object_id) {
43
+ // $page_id = get_the_ID();
44
+ // } else {
45
+ // $page_id = $object_id;
46
+ // }
47
+
48
+
49
+ $page_url = get_permalink();
50
+ $post_title = esc_html( get_the_title() );
51
+
52
+ if ( is_home() || is_front_page() ) {
53
+ // is home page
54
+ $page_url = home_url('/');
55
+ // if home page is a loop then return site name.. (instead of getting the last post title in that loop)
56
+ $post_title = HT_CTC_BLOG_NAME;
57
+
58
+ // if home page is a page then return page title.. (if not {site} and {title} will be same )
59
+ if ( is_page() ) {
60
+ $post_title = esc_html( get_the_title() );
61
+ }
62
+ } elseif ( is_singular() ) {
63
+ // is singular
64
+ $page_url = get_permalink();
65
+ $post_title = esc_html( get_the_title() );
66
+ } elseif ( is_archive() ) {
67
+
68
+ if ( isset($_SERVER['HTTP_HOST']) && $_SERVER['REQUEST_URI'] ) {
69
+ $protocol = ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ) ? 'https' : 'http';
70
+ $page_url = $protocol . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
71
+ }
72
+
73
+ if ( is_category() ) {
74
+ $post_title = single_cat_title( '', false );
75
+ } elseif ( is_tag() ) {
76
+ $post_title = single_tag_title( '', false );
77
+ } elseif ( is_author() ) {
78
+ $post_title = get_the_author();
79
+ } elseif ( is_post_type_archive() ) {
80
+ $post_title = post_type_archive_title( '', false );
81
+ } elseif ( function_exists( 'is_tax') && function_exists( 'single_term_title') && is_tax() ) {
82
+ $post_title = single_term_title( '', false );
83
+ } else {
84
+ if ( function_exists('get_the_archive_title') ) {
85
+ $post_title = get_the_archive_title();
86
+ }
87
+ }
88
+
89
+ }
90
+
91
+ // is shop page
92
+ if ( class_exists( 'WooCommerce' ) && function_exists( 'is_shop') && function_exists( 'wc_get_page_id') && is_shop() ) {
93
+ $page_id = wc_get_page_id( 'shop' );
94
+ $post_title = esc_html( get_the_title( $page_id ) );
95
+ }
96
+
97
+
98
+ // greetings dialog position based on chat icon/button position
99
+ $g_position_r_l = ( isset( $chat['side_2']) ) ? esc_attr( $chat['side_2'] ) : 'right';
100
+
101
+ // page level
102
+ $ht_ctc_pagelevel = get_post_meta( $page_id, 'ht_ctc_pagelevel', true );
103
+
104
+ $ht_ctc_greetings['header_content'] = (isset($ht_ctc_pagelevel['header_content'])) ? esc_attr($ht_ctc_pagelevel['header_content']) : '';
105
+ if ( '' == $ht_ctc_greetings['header_content'] ) {
106
+ $ht_ctc_greetings['header_content'] = ( isset( $greetings['header_content']) ) ? esc_attr($greetings['header_content']) : '';
107
+ }
108
+ $ht_ctc_greetings['header_content'] = apply_filters( 'wpml_translate_single_string', $ht_ctc_greetings['header_content'], 'Click to Chat for WhatsApp', 'greetings_header_content' );
109
+
110
+ $ht_ctc_greetings['main_content'] = (isset($ht_ctc_pagelevel['main_content'])) ? esc_attr($ht_ctc_pagelevel['main_content']) : '';
111
+ if ( '' == $ht_ctc_greetings['main_content'] ) {
112
+ $ht_ctc_greetings['main_content'] = ( isset( $greetings['main_content']) ) ? esc_attr($greetings['main_content']) : '';
113
+ }
114
+ $ht_ctc_greetings['main_content'] = apply_filters( 'wpml_translate_single_string', $ht_ctc_greetings['main_content'], 'Click to Chat for WhatsApp', 'greetings_main_content' );
115
+
116
+ $ht_ctc_greetings['bottom_content'] = (isset($ht_ctc_pagelevel['bottom_content'])) ? esc_attr($ht_ctc_pagelevel['bottom_content']) : '';
117
+ if ( '' == $ht_ctc_greetings['bottom_content'] ) {
118
+ $ht_ctc_greetings['bottom_content'] = ( isset( $greetings['bottom_content']) ) ? esc_attr($greetings['bottom_content']) : '';
119
+ }
120
+ $ht_ctc_greetings['bottom_content'] = apply_filters( 'wpml_translate_single_string', $ht_ctc_greetings['bottom_content'], 'Click to Chat for WhatsApp', 'greetings_bottom_content' );
121
+
122
+ $allowed_html = wp_kses_allowed_html( 'post' );
123
+
124
+ // $allowed_html['iframe'] = array(
125
+ // 'src' => true,
126
+ // 'height' => true,
127
+ // 'width' => true,
128
+ // 'frameborder' => true,
129
+ // 'allowfullscreen' => true,
130
+ // 'title' => true,
131
+ // 'allow' => true,
132
+ // 'autoplay' => true,
133
+ // 'clipboard-write' => true,
134
+ // 'encrypted-media' => true,
135
+ // 'gyroscope' => true,
136
+ // 'picture-in-picture' => true,
137
+ // );
138
+
139
+ if ( '' !== $ht_ctc_greetings['header_content'] ) {
140
+ $ht_ctc_greetings['header_content'] = html_entity_decode(wp_kses($ht_ctc_greetings['header_content'], $allowed_html) );
141
+ $ht_ctc_greetings['header_content'] = str_replace( array('{url}', '{title}', '{site}' ), array( $page_url, $post_title, HT_CTC_BLOG_NAME ), $ht_ctc_greetings['header_content'] );
142
+ }
143
+ if ( '' !== $ht_ctc_greetings['main_content'] ) {
144
+ $ht_ctc_greetings['main_content'] = html_entity_decode(wp_kses($ht_ctc_greetings['main_content'], $allowed_html) );
145
+ $ht_ctc_greetings['main_content'] = str_replace( array('{url}', '{title}', '{site}' ), array( $page_url, $post_title, HT_CTC_BLOG_NAME ), $ht_ctc_greetings['main_content'] );
146
+ }
147
+ if ( '' !== $ht_ctc_greetings['bottom_content'] ) {
148
+ $ht_ctc_greetings['bottom_content'] = html_entity_decode(wp_kses($ht_ctc_greetings['bottom_content'], $allowed_html) );
149
+ $ht_ctc_greetings['bottom_content'] = str_replace( array('{url}', '{title}', '{site}' ), array( $page_url, $post_title, HT_CTC_BLOG_NAME ), $ht_ctc_greetings['bottom_content'] );
150
+ }
151
+
152
+
153
+ $ht_ctc_greetings['call_to_action'] = ( isset( $greetings['call_to_action']) ) ? esc_attr( $greetings['call_to_action'] ) : '';
154
+ if ('' == $ht_ctc_greetings['call_to_action']) {
155
+ $ht_ctc_greetings['call_to_action'] = 'WhatsApp';
156
+ }
157
+
158
+ $ht_ctc_greetings['path'] = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/greetings/' . $ht_ctc_greetings['greetings_template']. '.php';
159
+
160
+ // filter hook to update values...
161
+ $ht_ctc_greetings = apply_filters( 'ht_ctc_fh_greetings', $ht_ctc_greetings );
162
+
163
+ if ( is_file( $ht_ctc_greetings['path'] ) ) {
164
+
165
+ // $script = 'dev';
166
+ $script = '';
167
+ if('dev' == $script) {
168
+ ?>
169
+ <style>
170
+ .ctc_greetings_close_btn {
171
+ display: none;
172
+ }
173
+ .ht_ctc_chat_greetings_box:hover .ctc_greetings_close_btn {
174
+ display: block;
175
+ }
176
+ .ht_ctc_chat_greetings_box *:not(ul):not(ol) {
177
+ padding: 0px; margin: 0px;
178
+ }
179
+ .ht_ctc_chat_greetings_box ul, .ht_ctc_chat_greetings_box ol {
180
+ margin-top: 0px; margin-bottom: 0px;
181
+ }
182
+ @media only screen and (max-width: 1200px) {
183
+ .ctc_greetings_close_btn {
184
+ display: block;
185
+ }
186
+ }
187
+ </style>
188
+ <?php
189
+ } else {
190
+ ?>
191
+ <style>.ctc_greetings_close_btn{display:none}.ht_ctc_chat_greetings_box:hover .ctc_greetings_close_btn{display:block}.ht_ctc_chat_greetings_box :not(ul):not(ol){padding:0;margin:0}.ht_ctc_chat_greetings_box ul,.ht_ctc_chat_greetings_box ol{margin-top:0;margin-bottom:0}@media only screen and (max-width: 1200px){.ctc_greetings_close_btn{display:block}}</style>
192
+ <?php
193
+ }
194
+ ?>
195
+
196
+ <div style="position: relative; bottom: 18px; cursor: auto;" class="ht_ctc_greetings">
197
+
198
+ <div class="ht_ctc_chat_greetings_box" style="display: none; position: absolute; bottom: 0px; <?= $g_position_r_l ?>: 0px; min-width: 300px; max-width: 400px; ">
199
+
200
+ <span style=" cursor:pointer; float:right;" class="ctc_greetings_close_btn">
201
+ <svg style="color:#ffffff; background-color:lightgray; border-radius:50%;" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x" viewBox="0 0 16 16">
202
+ <path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"/>
203
+ </svg>
204
+ </span>
205
+ <br>
206
+ <div class="ht_ctc_chat_greetings_box_layout" style="max-height: 67vh; overflow-y:auto; background-color: #ffffff; box-shadow: 1px 1px 3px 1px rgba(0,0,0,.14); border-radius:8px;clear:both;">
207
+ <div class="ctc_greetings_template">
208
+ <?php include $ht_ctc_greetings['path']; ?>
209
+ </div>
210
+ </div>
211
+ </div>
212
+ </div>
213
+ <?php
214
+ }
215
+
216
+ }
217
+
218
+
219
+ }
220
+
221
+
222
+ new HT_CTC_Chat_Greetings();
223
+
224
+ endif; // END class_exists check
new/inc/greetings/greetings-1.php ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Greetings - template - 1
4
+ *
5
+ */
6
+
7
+ if ( ! defined( 'ABSPATH' ) ) exit;
8
+
9
+ $g1_options = get_option( 'ht_ctc_greetings_1' );
10
+ $g1_options = apply_filters( 'ht_ctc_fh_g1_options', $g1_options );
11
+ $greetings = get_option('ht_ctc_greetings_options');
12
+
13
+
14
+ // $ht_ctc_greetings['main_content'] = apply_filters( 'the_content', $ht_ctc_greetings['main_content'] );
15
+ $ht_ctc_greetings['main_content'] = do_shortcode( $ht_ctc_greetings['main_content'] );
16
+
17
+ // css
18
+ $header_css = 'padding: 12px 25px 12px 25px; line-height:1.4;';
19
+ $main_css = '';
20
+ $message_box_css = '';
21
+ $send_css = 'text-align:center; padding: 11px 25px 9px 25px; cursor:pointer;';
22
+ $bottom_css = 'padding: 2px 25px 2px 25px; text-align:center; font-size:12px;';
23
+
24
+ $header_bg_color = ( isset($g1_options['header_bg_color']) ) ? esc_attr( $g1_options['header_bg_color'] ) : '';
25
+ $main_bg_color = ( isset($g1_options['main_bg_color']) ) ? esc_attr( $g1_options['main_bg_color'] ) : '';
26
+ $message_box_bg_color = ( isset($g1_options['message_box_bg_color']) ) ? esc_attr( $g1_options['message_box_bg_color'] ) : '';
27
+
28
+ if ('' !== $header_bg_color) {
29
+ $header_css .= "background-color:$header_bg_color;";
30
+ }
31
+
32
+ if ('' !== $main_bg_color) {
33
+ $main_css .= "background-color:$main_bg_color;";
34
+ }
35
+
36
+ $rtl_page = "";
37
+ if ( function_exists('is_rtl') && is_rtl() ) {
38
+ $rtl_page = "yes";
39
+ }
40
+
41
+ if ('' !== $message_box_bg_color) {
42
+ $message_box_css .= "padding:5px;background-color:$message_box_bg_color;";
43
+ if ('yes' == $rtl_page) {
44
+ $main_css .= 'padding: 18px 18px 40px 24px;';
45
+ } else {
46
+ $main_css .= 'padding: 18px 24px 40px 18px;';
47
+ }
48
+ } else {
49
+ $main_css .= 'padding: 18px 19px 30px 19px;';
50
+ }
51
+
52
+ // call to action - style
53
+ $cta_style = ( isset($g1_options['cta_style']) ) ? esc_attr( $g1_options['cta_style'] ) : '7_1';
54
+ $g_cta_path = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/greetings/greetings_styles/g-cta-' . $cta_style. '.php';
55
+
56
+ $g_header_image = '';
57
+
58
+ ?>
59
+ <style>
60
+ <?php
61
+ if ('' !== $message_box_bg_color) {
62
+ if ('yes' == $rtl_page) {
63
+ ?>
64
+ .ctc_g_message_box {
65
+ position: relative;
66
+ border-radius: 7px 0px 7px 7px;
67
+ /* max-width: 70%; */
68
+ }
69
+ .ctc_g_message_box:before {
70
+ content: "";
71
+ position: absolute;
72
+ left: 100%;
73
+ top: 0px;
74
+ height: 20px;
75
+ width: 15px;
76
+ background-color: <?= $message_box_bg_color ?>;
77
+ clip-path: polygon(0% 0%, 0% 50%, 100% 0%);
78
+ }
79
+ <?php
80
+ } else {
81
+ ?>
82
+ .ctc_g_message_box {
83
+ position: relative;
84
+ border-radius: 0px 7px 7px 7px;
85
+ /* max-width: 70%; */
86
+ }
87
+ .ctc_g_message_box:before {
88
+ content: "";
89
+ position: absolute;
90
+ right: 100%;
91
+ top: 0px;
92
+ height: 20px;
93
+ width: 15px;
94
+ background-color: <?= $message_box_bg_color ?>;
95
+ clip-path: polygon(0% 0%, 100% 0%, 100% 50%);
96
+ }
97
+ <?php
98
+ }
99
+ }
100
+ ?>
101
+ </style>
102
+ <?php
103
+
104
+ if ( '' !== $ht_ctc_greetings['header_content'] ) {
105
+ if ('' !== $g_header_image) {
106
+ // if header image is added
107
+ ?>
108
+ <div class="ctc_g_heading" style="<?= $header_css ?>">
109
+ <div style="display: flex; align-items: center;">
110
+ <img style="border-radius:50%; margin-right:9px;" src="" alt="">
111
+ <div>
112
+ <?= wpautop($ht_ctc_greetings['header_content']) ?>
113
+ </div>
114
+ </div>
115
+ </div>
116
+ <?php
117
+ } else {
118
+ // if header image is not added
119
+ ?>
120
+ <div class="ctc_g_heading" style="<?= $header_css ?>">
121
+ <?= wpautop($ht_ctc_greetings['header_content']) ?>
122
+ </div>
123
+ <?php
124
+ }
125
+ }
126
+ ?>
127
+
128
+ <div class="ctc_g_content" style="<?= $main_css ?>">
129
+ <div class="ctc_g_message_box" style="<?= $message_box_css ?>"><?= wpautop( $ht_ctc_greetings['main_content'] ) ?></div>
130
+ </div>
131
+
132
+ <div class="ctc_g_sentbutton" style="<?= $send_css ?>">
133
+ <div class="ht_ctc_chat_greetings_box_link ctc-analytics">
134
+ <?php
135
+ if ( is_file( $g_cta_path ) ) {
136
+ include $g_cta_path;
137
+ }
138
+ ?>
139
+ </div>
140
+ </div>
141
+
142
+ <?php
143
+ if ( '' !== $ht_ctc_greetings['bottom_content'] ) {
144
+ ?>
145
+ <div class="ctc_g_bottom" style="<?= $bottom_css ?>">
146
+ <?= wpautop( $ht_ctc_greetings['bottom_content'] ) ?>
147
+ </div>
148
+ <?php
149
+ }
new/inc/greetings/greetings-2.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Greetings - template - 2
4
+ *
5
+ */
6
+
7
+ if ( ! defined( 'ABSPATH' ) ) exit;
8
+
9
+ $g2_options = get_option( 'ht_ctc_greetings_2' );
10
+ $g2_options = apply_filters( 'ht_ctc_fh_g2_options', $g2_options );
11
+ $greetings = get_option('ht_ctc_greetings_options');
12
+
13
+
14
+ // $ht_ctc_greetings['main_content'] = apply_filters( 'the_content', $ht_ctc_greetings['main_content'] );
15
+ $ht_ctc_greetings['main_content'] = do_shortcode( $ht_ctc_greetings['main_content'] );
16
+
17
+ // css
18
+ $main_css = 'padding: 18px 20px 15px 20px;';
19
+ $send_css = 'text-align:center; padding: 11px 20px 9px 20px; cursor:pointer;';
20
+ $bottom_css = 'padding: 2px 20px 2px 20px;text-align:center; font-size:12px;';
21
+
22
+ $bg_color = ( isset($g2_options['bg_color']) ) ? esc_attr( $g2_options['bg_color'] ) : '';
23
+
24
+ if ('' !== $bg_color) {
25
+ $main_css .= "background-color:$bg_color;";
26
+ $bottom_css .= "background-color:$bg_color;";
27
+ $send_css .= "background-color:$bg_color;";
28
+ }
29
+
30
+
31
+ // call to action - style
32
+ // $cta_style = ( isset($g2_options['cta_style']) ) ? esc_attr( $g2_options['cta_style'] ) : '7_1';
33
+ $cta_style = '1';
34
+ $g_cta_path = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/greetings/greetings_styles/g-cta-' . $cta_style. '.php';
35
+
36
+ ?>
37
+
38
+ <div class="ctc_g_content" style="<?= $main_css ?>">
39
+ <div class="ctc_g_message_box" style=""><?= wpautop( $ht_ctc_greetings['main_content'] ) ?></div>
40
+ </div>
41
+
42
+ <div class="ctc_g_sentbutton" style="<?= $send_css ?>">
43
+ <div class="ht_ctc_chat_greetings_box_link ctc-analytics">
44
+ <?php
45
+ if ( is_file( $g_cta_path ) ) {
46
+ include $g_cta_path;
47
+ }
48
+ ?>
49
+ </div>
50
+ </div>
51
+
52
+ <?php
53
+ if ( '' !== $ht_ctc_greetings['bottom_content'] ) {
54
+ ?>
55
+ <div class="ctc_g_bottom" style="<?= $bottom_css ?>">
56
+ <?= wpautop( $ht_ctc_greetings['bottom_content'] ) ?>
57
+ </div>
58
+ <?php
59
+ }
new/inc/greetings/greetings_styles/g-cta-1.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Greetings call to action - style - 1
4
+ *
5
+ */
6
+
7
+ if ( ! defined( 'ABSPATH' ) ) exit;
8
+
9
+ $s1_options = get_option( 'ht_ctc_s1' );
10
+
11
+ $s1_css = "padding:9px;width:100%;cursor:pointer; display:flex; align-items:center; justify-content:center;";
12
+ $s1_text_color = (isset( $s1_options['s1_text_color'])) ? esc_attr( $s1_options['s1_text_color'] ) : '';
13
+ $s1_css .= ('' !== $s1_text_color) ? "color:$s1_text_color;": "";
14
+ $s1_bg_color = (isset( $s1_options['s1_bg_color'])) ? esc_attr( $s1_options['s1_bg_color'] ) : '';
15
+ $s1_css .= ('' !== $s1_bg_color) ? "background-color:$s1_bg_color;": "";
16
+
17
+ $s1_add_icon = ( isset( $s1_options['s1_add_icon']) ) ? esc_attr( $s1_options['s1_add_icon'] ) : '';
18
+ $s1_icon_color = ( isset( $s1_options['s1_icon_color']) ) ? esc_attr( $s1_options['s1_icon_color'] ) : '';
19
+ $s1_icon_size = ( isset( $s1_options['s1_icon_size']) ) ? esc_attr( $s1_options['s1_icon_size'] ) : '';
20
+
21
+ if ('' == $s1_icon_size) {
22
+ $s1_icon_size = '15';
23
+ }
24
+
25
+ if ('' == $s1_icon_color) {
26
+ $s1_icon_color = '#ffffff';
27
+ }
28
+
29
+ $s1_style = ('' !== $s1_css) ? "style='$s1_css'": "";
30
+ ?>
31
+ <button <?= $s1_style; ?> class="ctc-analytics g_s1_cta_btn">
32
+ <?php
33
+ if ('' !== $s1_add_icon) {
34
+
35
+ $s1_svg_css = "margin-right:6px;";
36
+
37
+ $s1_svg_attrs = array(
38
+ 'color' => "$s1_icon_color",
39
+ 'icon_size' => "$s1_icon_size",
40
+ 'type' => "greetings_chat",
41
+ 'ht_ctc_svg_css' => "$s1_svg_css",
42
+ );
43
+ include_once HT_CTC_PLUGIN_DIR .'new/inc/assets/img/ht-ctc-svg-images.php';
44
+ echo ht_ctc_singlecolor( $s1_svg_attrs );
45
+ }
46
+ ?>
47
+ <?= $ht_ctc_greetings['call_to_action'] ?>
48
+ </button>
new/inc/greetings/greetings_styles/g-cta-7_1.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Greetings call to action - style - 7 Extend
4
+ *
5
+ * <input class="ht_ctc_chat_greetings_box_link" type="submit" style="" value="<?= $ht_ctc_greetings['call_to_action'] ?>">
6
+ */
7
+
8
+ if ( ! defined( 'ABSPATH' ) ) exit;
9
+
10
+ $s7_1_options = get_option( 'ht_ctc_s7_1' );
11
+ $s7_1_options = apply_filters( 'ht_ctc_fh_s7_1_options', $s7_1_options );
12
+
13
+ $s7_icon_size = esc_attr( $s7_1_options['s7_icon_size'] );
14
+ $s7_icon_color = esc_attr( $s7_1_options['s7_icon_color'] );
15
+ $s7_icon_color_hover = esc_attr( $s7_1_options['s7_icon_color_hover'] );
16
+ $s7_bgcolor = esc_attr( $s7_1_options['s7_bgcolor'] );
17
+ $s7_bgcolor_hover = esc_attr( $s7_1_options['s7_bgcolor_hover'] );
18
+ $s7_border_size = esc_attr( $s7_1_options['s7_border_size'] );
19
+
20
+ // Call to action
21
+ $s7_1_cta_font_size = (isset( $s7_1_options['cta_font_size'])) ? esc_attr( $s7_1_options['cta_font_size'] ) : '';
22
+
23
+ $s7_1_cta_font_size = ('' !== $s7_1_cta_font_size) ? "font-size: $s7_1_cta_font_size" : "";
24
+
25
+ // Call to action - Order
26
+ $s7_cta_order = "1";
27
+ $s7_show_cta_padding_css = "padding:5px;";
28
+
29
+
30
+ if ( isset($side_2) && 'right' == $side_2) {
31
+ // if side_2 is right then cta is left
32
+ $s7_cta_order = "0";
33
+ }
34
+
35
+ $rtl_css = "";
36
+ if ( function_exists('is_rtl') && is_rtl() ) {
37
+ $rtl_css = "flex-direction:row-reverse;";
38
+ }
39
+
40
+ $s7_n1_styles = "display:flex;justify-content:center;align-items:center;$rtl_css ";
41
+ $s7_cta_css = "$s7_1_cta_font_size; ";
42
+ $s7_icon_padding_css = "";
43
+ $s7_cta_class = "ht-ctc-cta ";
44
+ $s7_hover_styles = "";
45
+
46
+ $s7_n1_styles .= "$s7_show_cta_padding_css background-color:$s7_bgcolor;border-radius:25px; cursor: pointer;";
47
+ $s7_cta_css .= "padding:1px 0px; color:$s7_icon_color; border-radius:10px; margin:0 10px; order:$s7_cta_order; ";
48
+ $s7_icon_padding_css .= "";
49
+ $s7_hover_styles = ".ht-ctc .g_ctc_s_7_1:hover{background-color:$s7_bgcolor_hover !important;}.ht-ctc .g_ctc_s_7_1:hover .g_ctc_s_7_1_cta{color:$s7_icon_color_hover !important;}.ht-ctc .g_ctc_s_7_1:hover svg g path{fill:$s7_icon_color_hover !important;}";
50
+
51
+
52
+ $type = 'g_cta';
53
+ // svg values
54
+ $ht_ctc_svg_css = "pointer-events:none; display:block; height:$s7_icon_size; width:$s7_icon_size;";
55
+ $s7_svg_attrs = array(
56
+ 'color' => "$s7_icon_color",
57
+ 'icon_size' => "$s7_icon_size",
58
+ 'type' => "greetings_chat",
59
+ 'ht_ctc_svg_css' => "$ht_ctc_svg_css",
60
+ );
61
+
62
+
63
+ include_once HT_CTC_PLUGIN_DIR .'new/inc/assets/img/ht-ctc-svg-images.php';
64
+ ?>
65
+ <style id="ht-ctc-s7_1">
66
+ <?= $s7_hover_styles ?>
67
+ </style>
68
+
69
+ <div class="g_ctc_s_7_1 ctc-analytics" style="<?= $s7_n1_styles; ?>">
70
+ <p class="g_ctc_s_7_1_cta ctc-analytics ctc_cta <?= $s7_cta_class ?>" style="<?= $s7_cta_css ?>"><?= $ht_ctc_greetings['call_to_action'] ?></p>
71
+ <div class="g_ctc_s_7_icon_padding ctc-analytics " style="<?= $s7_icon_padding_css ?>">
72
+ <?= ht_ctc_singlecolor( $s7_svg_attrs ); ?>
73
+ </div>
74
+ </div>
new/inc/styles-shortcode/sc-style-7.php CHANGED
@@ -20,13 +20,16 @@ $s7_cta_type = (isset( $s7_options['cta_type'])) ? esc_attr( $s7_options['cta_ty
20
  $s7_cta_textcolor = (isset( $s7_options['cta_textcolor'])) ? esc_attr( $s7_options['cta_textcolor'] ) : '';
21
  $s7_cta_bgcolor = (isset( $s7_options['cta_bgcolor'])) ? esc_attr( $s7_options['cta_bgcolor'] ) : '#ffffff';
22
 
 
 
 
23
  $s7_n1_styles = "display:inline-flex;justify-content:center;align-items:center;";
24
  $s7_icon_css = "font-size: $s7_icon_size; color: $s7_icon_color; padding: $s7_border_size; background-color: $s7_border_color; border-radius: $s7_border_radius;";
25
 
26
  // Call to action
27
  $s7_cta_order = "1";
28
 
29
- $s7_cta_css = "padding: 0px 16px; color: $s7_cta_textcolor; background-color: $s7_cta_bgcolor; border-radius:10px; margin:0 10px; ";
30
  $s7_cta_class = "ht-ctc-cta ";
31
  $title = "";
32
  if ( 'hover' == $s7_cta_type ) {
20
  $s7_cta_textcolor = (isset( $s7_options['cta_textcolor'])) ? esc_attr( $s7_options['cta_textcolor'] ) : '';
21
  $s7_cta_bgcolor = (isset( $s7_options['cta_bgcolor'])) ? esc_attr( $s7_options['cta_bgcolor'] ) : '#ffffff';
22
 
23
+ $s7_cta_font_size = (isset( $s7_options['cta_font_size'])) ? esc_attr( $s7_options['cta_font_size'] ) : '';
24
+ $s7_cta_font_size = ('' !== $s7_cta_font_size) ? "font-size: $s7_cta_font_size;" : "";
25
+
26
  $s7_n1_styles = "display:inline-flex;justify-content:center;align-items:center;";
27
  $s7_icon_css = "font-size: $s7_icon_size; color: $s7_icon_color; padding: $s7_border_size; background-color: $s7_border_color; border-radius: $s7_border_radius;";
28
 
29
  // Call to action
30
  $s7_cta_order = "1";
31
 
32
+ $s7_cta_css = "padding: 0px 16px; $s7_cta_font_size color: $s7_cta_textcolor; background-color: $s7_cta_bgcolor; border-radius:10px; margin:0 10px; ";
33
  $s7_cta_class = "ht-ctc-cta ";
34
  $title = "";
35
  if ( 'hover' == $s7_cta_type ) {
new/inc/styles/style-2.php CHANGED
@@ -67,6 +67,6 @@ $ht_ctc_svg_css = "pointer-events:none; display:block; height:$img_size; width:$
67
  include_once HT_CTC_PLUGIN_DIR .'new/inc/assets/img/ht-ctc-svg-images.php';
68
  ?>
69
  <div <?= $title ?> style="<?= $s2_css; ?>" class="ctc-analytics">
70
- <p class="ctc-analytics ctc_cta <?= $s2_cta_class ?>" style="<?= $s2_cta_css ?>"><?= $call_to_action; ?></p>
71
  <?= ht_ctc_style_2_svg( $img_size, $type, $ht_ctc_svg_css ); ?>
72
  </div>
67
  include_once HT_CTC_PLUGIN_DIR .'new/inc/assets/img/ht-ctc-svg-images.php';
68
  ?>
69
  <div <?= $title ?> style="<?= $s2_css; ?>" class="ctc-analytics">
70
+ <p class="ctc-analytics ctc_cta ctc_cta_stick <?= $s2_cta_class ?>" style="<?= $s2_cta_css ?>"><?= $call_to_action; ?></p>
71
  <?= ht_ctc_style_2_svg( $img_size, $type, $ht_ctc_svg_css ); ?>
72
  </div>
new/inc/styles/style-3.php CHANGED
@@ -60,6 +60,6 @@ include_once HT_CTC_PLUGIN_DIR .'new/inc/assets/img/ht-ctc-svg-images.php';
60
 
61
  ?>
62
  <div <?= $title ?> style="<?= $s3_css ?>">
63
- <p class="ctc-analytics ctc_cta <?= $s3_cta_class ?>" style="<?= $s3_cta_css ?>"><?= $call_to_action; ?></p>
64
  <?= ht_ctc_style_3_svg( $img_size, $type, $ht_ctc_svg_css ); ?>
65
  </div>
60
 
61
  ?>
62
  <div <?= $title ?> style="<?= $s3_css ?>">
63
+ <p class="ctc-analytics ctc_cta ctc_cta_stick <?= $s3_cta_class ?>" style="<?= $s3_cta_css ?>"><?= $call_to_action; ?></p>
64
  <?= ht_ctc_style_3_svg( $img_size, $type, $ht_ctc_svg_css ); ?>
65
  </div>
new/inc/styles/style-3_1.php CHANGED
@@ -80,11 +80,11 @@ $others = array(
80
 
81
  ?>
82
  <style id="ht-ctc-s3">
83
- .ht-ctc:hover svg stop{stop-color:<?= $s3_1_bg_color_hover ?>;}.ht-ctc:hover .ht_ctc_padding{<?= $s3_1_hover_css ?>}
84
  </style>
85
 
86
- <div <?= $title ?> style="<?= $s3_1_css ?>">
87
- <p class="ctc-analytics ctc_cta <?= $s3_1_cta_class ?>" style="<?= $s3_1_cta_css ?>"><?= $call_to_action ?></p>
88
  <div class="ctc-analytics ht_ctc_padding" style="<?= $s3_1_extend_css ?>">
89
  <?= ht_ctc_style_3_1_svg( $img_size, $type, $ht_ctc_svg_css, $others ); ?>
90
  </div>
80
 
81
  ?>
82
  <style id="ht-ctc-s3">
83
+ .ht-ctc .ctc_s_3_1:hover svg stop{stop-color:<?= $s3_1_bg_color_hover ?>;}.ht-ctc .ctc_s_3_1:hover .ht_ctc_padding,.ht-ctc .ctc_s_3_1:hover .ctc_cta_stick{<?= $s3_1_hover_css ?>}
84
  </style>
85
 
86
+ <div <?= $title ?> style="<?= $s3_1_css ?>" class="ctc_s_3_1">
87
+ <p class="ctc-analytics ctc_cta ctc_cta_stick <?= $s3_1_cta_class ?>" style="<?= $s3_1_cta_css ?>"><?= $call_to_action ?></p>
88
  <div class="ctc-analytics ht_ctc_padding" style="<?= $s3_1_extend_css ?>">
89
  <?= ht_ctc_style_3_1_svg( $img_size, $type, $ht_ctc_svg_css, $others ); ?>
90
  </div>
new/inc/styles/style-5.php CHANGED
@@ -77,7 +77,7 @@ echo $o;
77
 
78
  <div class="s5_cta" style="<?= $s5_cta_style ?>" >
79
  <img class="s5_img ctc-analytics" src="<?= $s5_img ?>" style="<?= $s5_img_style ?>" alt="<?= $call_to_action ?>">
80
- <div class="s5_content ctc-analytics <?= $s5_img_position ?>" style="<?= $s5_content_style ?>" >
81
  <span class="heading ctc-analytics ctc_cta" style="color: <?= $s5_line_1_color ?>"><?= $s5_line_1 ?></span>
82
  <span class="description ctc-analytics" style="color: <?= $s5_line_2_color ?>"><?= $s5_line_2 ?></span>
83
  </div>
77
 
78
  <div class="s5_cta" style="<?= $s5_cta_style ?>" >
79
  <img class="s5_img ctc-analytics" src="<?= $s5_img ?>" style="<?= $s5_img_style ?>" alt="<?= $call_to_action ?>">
80
+ <div class="s5_content ctc-analytics ctc_cta_stick <?= $s5_img_position ?>" style="<?= $s5_content_style ?>" >
81
  <span class="heading ctc-analytics ctc_cta" style="color: <?= $s5_line_1_color ?>"><?= $s5_line_1 ?></span>
82
  <span class="description ctc-analytics" style="color: <?= $s5_line_2_color ?>"><?= $s5_line_2 ?></span>
83
  </div>
new/inc/styles/style-7.php CHANGED
@@ -23,7 +23,7 @@ $s7_cta_bgcolor = (isset( $s7_options['cta_bgcolor'])) ? esc_attr( $s7_options['
23
 
24
  $s7_cta_font_size = (isset( $s7_options['cta_font_size'])) ? esc_attr( $s7_options['cta_font_size'] ) : '';
25
 
26
- $s7_cta_font_size = ('' !== $s7_cta_font_size) ? "font-size: $s7_cta_font_size" : "";
27
 
28
  $rtl_css = "";
29
  if ( function_exists('is_rtl') && is_rtl() ) {
@@ -41,7 +41,7 @@ if ( isset($side_2) && 'right' == $side_2) {
41
  }
42
 
43
 
44
- $s7_cta_css = "padding: 0px 16px; $s7_cta_font_size; color: $s7_cta_textcolor; background-color: $s7_cta_bgcolor; border-radius:10px; margin:0 10px; ";
45
  $s7_cta_class = "ht-ctc-cta ";
46
  $title = "";
47
  if ( 'hover' == $s7_cta_type ) {
@@ -64,7 +64,7 @@ $s7_svg_attrs = array(
64
  );
65
 
66
  // hover
67
- $s7_hover_icon_styles = ".ht-ctc.style-7:hover .ctc_s_7_icon_padding{background-color:$s7_border_color_hover !important;}.ht-ctc.style-7:hover svg g path{fill:$s7_icon_color_hover !important;}";
68
 
69
  include_once HT_CTC_PLUGIN_DIR .'new/inc/assets/img/ht-ctc-svg-images.php';
70
  ?>
@@ -73,7 +73,7 @@ include_once HT_CTC_PLUGIN_DIR .'new/inc/assets/img/ht-ctc-svg-images.php';
73
  </style>
74
 
75
  <div <?= $title ?> class="ctc_s_7 ctc-analytics" style="<?= $s7_n1_styles; ?>">
76
- <p class="ctc_s_7_cta ctc_cta ctc-analytics <?= $s7_cta_class ?>" style="<?= $s7_cta_css ?>"><?= $call_to_action; ?></p>
77
  <div class="ctc_s_7_icon_padding ctc-analytics " style="<?= $s7_icon_css ?>">
78
  <?= ht_ctc_singlecolor( $s7_svg_attrs ); ?>
79
  </div>
23
 
24
  $s7_cta_font_size = (isset( $s7_options['cta_font_size'])) ? esc_attr( $s7_options['cta_font_size'] ) : '';
25
 
26
+ $s7_cta_font_size = ('' !== $s7_cta_font_size) ? "font-size: $s7_cta_font_size;" : "";
27
 
28
  $rtl_css = "";
29
  if ( function_exists('is_rtl') && is_rtl() ) {
41
  }
42
 
43
 
44
+ $s7_cta_css = "padding: 0px 16px; $s7_cta_font_size color: $s7_cta_textcolor; background-color: $s7_cta_bgcolor; border-radius:10px; margin:0 10px; ";
45
  $s7_cta_class = "ht-ctc-cta ";
46
  $title = "";
47
  if ( 'hover' == $s7_cta_type ) {
64
  );
65
 
66
  // hover
67
+ $s7_hover_icon_styles = ".ht-ctc .ctc_s_7:hover .ctc_s_7_icon_padding, .ht-ctc .ctc_s_7:hover .ctc_cta_stick{background-color:$s7_border_color_hover !important;}.ht-ctc .ctc_s_7:hover svg g path{fill:$s7_icon_color_hover !important;}";
68
 
69
  include_once HT_CTC_PLUGIN_DIR .'new/inc/assets/img/ht-ctc-svg-images.php';
70
  ?>
73
  </style>
74
 
75
  <div <?= $title ?> class="ctc_s_7 ctc-analytics" style="<?= $s7_n1_styles; ?>">
76
+ <p class="ctc_s_7_cta ctc_cta ctc_cta_stick ctc-analytics <?= $s7_cta_class ?>" style="<?= $s7_cta_css ?>"><?= $call_to_action; ?></p>
77
  <div class="ctc_s_7_icon_padding ctc-analytics " style="<?= $s7_icon_css ?>">
78
  <?= ht_ctc_singlecolor( $s7_svg_attrs ); ?>
79
  </div>
new/inc/styles/style-7_1.php CHANGED
@@ -49,7 +49,7 @@ $rtl_css = "";
49
  if ( function_exists('is_rtl') && is_rtl() ) {
50
  $rtl_css = "flex-direction:row-reverse;";
51
 
52
- if ('right' == $side_2) {
53
  $s7_show_cta_padding_css = "padding:5px 5px 5px 20px;";
54
  } else {
55
  $s7_show_cta_padding_css = "padding:5px 20px 5px 5px;";
@@ -64,14 +64,14 @@ $s7_hover_styles = "";
64
  if ( 'hover' == $s7_cta_type ) {
65
  $s7_n1_styles .= "background-color: $s7_bgcolor; border-radius:25px;";
66
  $s7_cta_css .= " display: none; order: $s7_cta_order; color: $s7_icon_color; $s7_hover_cta_padding_css margin:0 10px; border-radius: 25px; ";
67
- $s7_cta_class .= " ht-ctc-cta-hover ";
68
  $s7_icon_padding_css .= "padding: $s7_border_size;background-color: $s7_bgcolor;border-radius: 25px; ";
69
- $s7_hover_styles = ".ht-ctc.style-7_1:hover .ctc_s_7_icon_padding, .ht-ctc.style-7_1:hover .ctc_s_7_1{background-color:$s7_bgcolor_hover !important;border-radius: 25px;}.ht-ctc.style-7_1:hover .ctc_s_7_1_cta{color:$s7_icon_color_hover !important;}.ht-ctc.style-7_1:hover svg g path{fill:$s7_icon_color_hover !important;}";
70
  } elseif ( 'show' == $s7_cta_type ) {
71
  $s7_n1_styles .= "$s7_show_cta_padding_css background-color:$s7_bgcolor;border-radius:25px;";
72
  $s7_cta_css .= "padding: 1px 16px; color: $s7_icon_color; border-radius:10px; margin:0 10px; order: $s7_cta_order; ";
73
  $s7_icon_padding_css .= "";
74
- $s7_hover_styles = ".ht-ctc.style-7_1:hover .ctc_s_7_1{background-color:$s7_bgcolor_hover !important;}.ht-ctc.style-7_1:hover .ctc_s_7_1_cta{color:$s7_icon_color_hover !important;}.ht-ctc.style-7_1:hover svg g path{fill:$s7_icon_color_hover !important;}";
75
  }
76
 
77
 
49
  if ( function_exists('is_rtl') && is_rtl() ) {
50
  $rtl_css = "flex-direction:row-reverse;";
51
 
52
+ if ( isset($side_2) && 'right' == $side_2) {
53
  $s7_show_cta_padding_css = "padding:5px 5px 5px 20px;";
54
  } else {
55
  $s7_show_cta_padding_css = "padding:5px 20px 5px 5px;";
64
  if ( 'hover' == $s7_cta_type ) {
65
  $s7_n1_styles .= "background-color: $s7_bgcolor; border-radius:25px;";
66
  $s7_cta_css .= " display: none; order: $s7_cta_order; color: $s7_icon_color; $s7_hover_cta_padding_css margin:0 10px; border-radius: 25px; ";
67
+ $s7_cta_class .= " ht-ctc-cta-hover ctc_cta_stick ";
68
  $s7_icon_padding_css .= "padding: $s7_border_size;background-color: $s7_bgcolor;border-radius: 25px; ";
69
+ $s7_hover_styles = ".ht-ctc .ctc_s_7_1:hover .ctc_s_7_icon_padding, .ht-ctc .ctc_s_7_1:hover{background-color:$s7_bgcolor_hover !important;border-radius: 25px;}.ht-ctc .ctc_s_7_1:hover .ctc_s_7_1_cta{color:$s7_icon_color_hover !important;}.ht-ctc .ctc_s_7_1:hover svg g path{fill:$s7_icon_color_hover !important;}";
70
  } elseif ( 'show' == $s7_cta_type ) {
71
  $s7_n1_styles .= "$s7_show_cta_padding_css background-color:$s7_bgcolor;border-radius:25px;";
72
  $s7_cta_css .= "padding: 1px 16px; color: $s7_icon_color; border-radius:10px; margin:0 10px; order: $s7_cta_order; ";
73
  $s7_icon_padding_css .= "";
74
+ $s7_hover_styles = ".ht-ctc .ctc_s_7_1:hover{background-color:$s7_bgcolor_hover !important;}.ht-ctc .ctc_s_7_1:hover .ctc_s_7_1_cta{color:$s7_icon_color_hover !important;}.ht-ctc .ctc_s_7_1:hover svg g path{fill:$s7_icon_color_hover !important;}";
75
  }
76
 
77
 
new/inc/styles/style-8.php CHANGED
@@ -60,7 +60,7 @@ $s8_main_span_css = "display: flex; $rtl_css padding: 0 2rem;letter-spacing: .5p
60
  ?>
61
 
62
  <style id="ht-ctc-s8">
63
- .ht-ctc-style-8 .s_8 svg{<?= $s8_icon_css ?>;}.ht-ctc:hover svg g path{fill:<?= $s8_txt_color_on_hover ?> !important;}.ht-ctc:hover .ht-ctc-s8-text{color:<?= $s8_txt_color_on_hover ?> !important;}.ht-ctc:hover .ht-ctc-style-8 .s_8{box-shadow: 0 3px 3px 0 rgba(7,6,6,.14), 0 1px 7px 0 rgba(0,0,0,.12), 0 3px 1px -1px rgba(0,0,0,.2) !important; transition: .2s ease-out !important; background-color:<?= $s8_bg_color_on_hover ?> !important; }<?= $s8_fullwidth_css ?>
64
  </style>
65
 
66
  <div class = "ht-ctc-style-8 ctc-analytics" >
60
  ?>
61
 
62
  <style id="ht-ctc-s8">
63
+ .ht-ctc-style-8 .s_8 svg{<?= $s8_icon_css ?>;}.ht-ctc .ht-ctc-style-8:hover .s_8 svg g path{fill:<?= $s8_icon_color_on_hover ?> !important;}.ht-ctc .ht-ctc-style-8:hover .s_8 .ht-ctc-s8-text{color:<?= $s8_txt_color_on_hover ?> !important;}.ht-ctc .ht-ctc-style-8:hover .s_8{box-shadow: 0 3px 3px 0 rgba(7,6,6,.14), 0 1px 7px 0 rgba(0,0,0,.12), 0 3px 1px -1px rgba(0,0,0,.2) !important; transition: .2s ease-out !important; background-color:<?= $s8_bg_color_on_hover ?> !important; }<?= $s8_fullwidth_css ?>
64
  </style>
65
 
66
  <div class = "ht-ctc-style-8 ctc-analytics" >
new/tools/woo/class-ht-ctc-woo.php CHANGED
@@ -23,6 +23,7 @@ class HT_CTC_WOO_Pages {
23
 
24
  // chat - woo values
25
  add_filter( 'ht_ctc_fh_chat', array($this, 'chat') );
 
26
 
27
  // woo places
28
  $woo_position = ( isset( $woo['woo_position']) ) ? esc_attr( $woo['woo_position'] ) : 'select';
@@ -338,6 +339,61 @@ class HT_CTC_WOO_Pages {
338
 
339
 
340
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
341
 
342
 
343
 
23
 
24
  // chat - woo values
25
  add_filter( 'ht_ctc_fh_chat', array($this, 'chat') );
26
+ add_filter( 'ht_ctc_fh_greetings', array($this, 'greetings') );
27
 
28
  // woo places
29
  $woo_position = ( isset( $woo['woo_position']) ) ? esc_attr( $woo['woo_position'] ) : 'select';
339
 
340
 
341
 
342
+ function greetings( $ht_ctc_greetings ) {
343
+
344
+ $woo_greetings_options = get_option('ht_ctc_woo_greetings_options');
345
+
346
+ // if woocommerce single product page
347
+ if ( function_exists( 'is_product' ) && function_exists( 'wc_get_product' )) {
348
+ if ( is_product() ) {
349
+
350
+ $name = '';
351
+ $price = '';
352
+ $regular_price = '';
353
+ $sku = '';
354
+
355
+ $product = wc_get_product();
356
+
357
+ if ( is_object($product) && method_exists($product, 'get_name') ) {
358
+ $name = $product->get_name();
359
+ // $title = $product->get_title();
360
+ $price = $product->get_price();
361
+ $regular_price = $product->get_regular_price();
362
+ $sku = $product->get_sku();
363
+ }
364
+
365
+ $page_id = get_the_ID();
366
+ $ht_ctc_pagelevel = get_post_meta( $page_id, 'ht_ctc_pagelevel', true );
367
+
368
+
369
+ // header_content
370
+ if ( isset( $woo_greetings_options['header_content'] ) && '' !== $woo_greetings_options['header_content'] ) {
371
+ $ht_ctc_greetings['header_content'] = esc_attr( $woo_greetings_options['header_content'] );
372
+ $ht_ctc_greetings['header_content'] = apply_filters( 'wpml_translate_single_string', $ht_ctc_greetings['header_content'], 'Click to Chat for WhatsApp', 'woo_header_content' );
373
+ }
374
+
375
+ // header_content
376
+ if ( isset( $woo_greetings_options['main_content'] ) && '' !== $woo_greetings_options['main_content'] ) {
377
+ $ht_ctc_greetings['main_content'] = esc_attr( $woo_greetings_options['main_content'] );
378
+ $ht_ctc_greetings['main_content'] = apply_filters( 'wpml_translate_single_string', $ht_ctc_greetings['main_content'], 'Click to Chat for WhatsApp', 'woo_main_content' );
379
+ }
380
+
381
+ // header_content
382
+ if ( isset( $woo_greetings_options['bottom_content'] ) && '' !== $woo_greetings_options['bottom_content'] ) {
383
+ $ht_ctc_greetings['bottom_content'] = esc_attr( $woo_greetings_options['bottom_content'] );
384
+ $ht_ctc_greetings['bottom_content'] = apply_filters( 'wpml_translate_single_string', $ht_ctc_greetings['bottom_content'], 'Click to Chat for WhatsApp', 'woo_bottom_content' );
385
+ }
386
+
387
+ // variables works in default pre_filled also for woo pages.
388
+ $ht_ctc_greetings['header_content'] = str_replace( array('{product}', '{price}', '{regular_price}', '{sku}' ), array( $name, $price, $regular_price, $sku ), $ht_ctc_greetings['header_content'] );
389
+ $ht_ctc_greetings['main_content'] = str_replace( array('{product}', '{price}', '{regular_price}', '{sku}' ), array( $name, $price, $regular_price, $sku ), $ht_ctc_greetings['main_content'] );
390
+ $ht_ctc_greetings['bottom_content'] = str_replace( array('{product}', '{price}', '{regular_price}', '{sku}' ), array( $name, $price, $regular_price, $sku ), $ht_ctc_greetings['bottom_content'] );
391
+
392
+ }
393
+ }
394
+
395
+ return $ht_ctc_greetings;
396
+ }
397
 
398
 
399
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Requires at least: 4.6
3
  Tested up to: 5.9.2
4
  Requires PHP: 5.6
5
  Contributors: holithemes
6
- Stable tag: 3.8.1
7
  Tags: whatsapp, whatsapp business, click to chat, whatsapp chat, whatsapp support, whatsapp group, whatsapp message, WhatsApp WooCommerce, whatsapp wordpress, whatsapp floating button, whatsapp icon, holithemes
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -482,6 +482,11 @@ After Activate the plugin, add WhatsApp Number at plugin settings.
482
 
483
  == Changelog ==
484
 
 
 
 
 
 
485
  = 3.8.1 =
486
  * Enchantment: Pre-filled message, Call to Action settings
487
 
3
  Tested up to: 5.9.2
4
  Requires PHP: 5.6
5
  Contributors: holithemes
6
+ Stable tag: 3.9
7
  Tags: whatsapp, whatsapp business, click to chat, whatsapp chat, whatsapp support, whatsapp group, whatsapp message, WhatsApp WooCommerce, whatsapp wordpress, whatsapp floating button, whatsapp icon, holithemes
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
482
 
483
  == Changelog ==
484
 
485
+ = 3.9 =
486
+ * New: Greetings Dialogs
487
+ * Greetings 1: Customizable Design
488
+ * Greetings 2: Content Specific
489
+
490
  = 3.8.1 =
491
  * Enchantment: Pre-filled message, Call to Action settings
492