Click to Chat for WhatsApp Chat - Version 3.9.7

Version Description

  • New: opt-in - user consent before initiate the chat
  • Enchantment: Greetings Text Editor, can add background color to text.
Download this release

Release Info

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

Code changes from version 3.9.6 to 3.9.7

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.9.6
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.9.6' );
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
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.7' );
21
  }
22
 
23
  // define HT_CTC_PLUGIN_FILE
new/admin/admin_assets/js/greetings.js CHANGED
@@ -3,33 +3,31 @@
3
  // ready
4
  $(function () {
5
 
6
- try {
7
- if (document.querySelector('.pr_greetings_template')) {
8
  greetings_template();
9
- }
10
-
11
- // todo..
12
- if (document.querySelector('.pr_greetings_template')) {
13
  editor();
14
- }
15
- } catch (e) { }
16
 
17
  /**
18
  * display settings based on Greetings template selection
19
  */
20
  function greetings_template() {
21
 
22
-
23
  var greetings_template = $('.pr_greetings_template select').find(":selected").val();
24
 
25
- console.log(greetings_template);
26
-
27
  // greetings-1
28
  if (greetings_template == 'greetings-1') {
29
  $('.ctc_greetings_settings.ctc_g_1').show();
30
  $('.pr_ht_ctc_greetings_1').show();
31
  $('.pr_ht_ctc_greetings_settings').show();
32
  $('.ctc_greetings_notes').show();
 
33
  }
34
 
35
  // greetings-2
@@ -38,12 +36,12 @@
38
  $('.pr_ht_ctc_greetings_2').show();
39
  $('.pr_ht_ctc_greetings_settings').show();
40
  $('.ctc_greetings_notes').show();
 
41
  }
42
 
43
  // on change
44
  $('.pr_greetings_template select').on("change", function (e) {
45
  var greetings_template = e.target.value;
46
- console.log(greetings_template);
47
 
48
  // ctc_greetings_settings
49
  if (greetings_template == 'no') {
@@ -59,11 +57,13 @@
59
  if (greetings_template == 'greetings-1') {
60
  $('.ctc_greetings_settings.ctc_g_1').show(100);
61
  $('.pr_ht_ctc_greetings_1').show(100);
 
62
  }
63
  // greetings-2
64
  if (greetings_template == 'greetings-2') {
65
  $('.ctc_greetings_settings.ctc_g_2').show(100);
66
  $('.pr_ht_ctc_greetings_2').show(100);
 
67
  }
68
 
69
  $('.pr_ht_ctc_greetings_settings').show();
@@ -71,39 +71,55 @@
71
  }
72
  });
73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  }
75
 
76
 
 
 
 
 
 
77
  function editor() {
78
  // tinymce editor - bg color
79
  var check = 1;
80
  var check_interval = 1000;
81
  var check_times = 28; // ( check_times * check_interval = total milliseconds )
82
 
83
- if (document.getElementById("header_content_ifr")) {
84
- try {
85
- tiny_bg_color();
86
- } catch (e) { }
87
- } else {
88
- check++;
89
- if (check < check_times) {
90
- setTimeout(tiny_bg, check_interval);
 
 
91
  }
92
  }
 
 
93
 
94
  function tiny_bg_color() {
95
- // f0f0f1
96
- var header_content_ifr = document.getElementById("header_content_ifr");
97
- var elmnt = header_content_ifr.contentWindow.document.getElementsByTagName("body")[0];
98
- elmnt.style.backgroundColor = "#26a69a";
99
-
100
- var main_content_ifr = document.getElementById("main_content_ifr");
101
- var elmnt = main_content_ifr.contentWindow.document.getElementsByTagName("body")[0];
102
- elmnt.style.backgroundColor = "#26a69a";
103
-
104
- var bottom_content_ifr = document.getElementById("bottom_content_ifr");
105
- var elmnt = bottom_content_ifr.contentWindow.document.getElementsByTagName("body")[0];
106
- elmnt.style.backgroundColor = "#26a69a";
107
  }
108
  }
109
 
@@ -111,4 +127,4 @@
111
  });
112
 
113
 
114
- }) (jQuery);
3
  // ready
4
  $(function () {
5
 
6
+ if (document.querySelector('.pr_greetings_template')) {
7
+ try {
8
  greetings_template();
9
+ } catch (e) { }
10
+ }
11
+ if (document.querySelector('.ctc-admin-greetings-page') || document.querySelector('.ctc-admin-woo-page')) {
12
+ try {
13
  editor();
14
+ } catch (e) { }
15
+ }
16
 
17
  /**
18
  * display settings based on Greetings template selection
19
  */
20
  function greetings_template() {
21
 
 
22
  var greetings_template = $('.pr_greetings_template select').find(":selected").val();
23
 
 
 
24
  // greetings-1
25
  if (greetings_template == 'greetings-1') {
26
  $('.ctc_greetings_settings.ctc_g_1').show();
27
  $('.pr_ht_ctc_greetings_1').show();
28
  $('.pr_ht_ctc_greetings_settings').show();
29
  $('.ctc_greetings_notes').show();
30
+ optin();
31
  }
32
 
33
  // greetings-2
36
  $('.pr_ht_ctc_greetings_2').show();
37
  $('.pr_ht_ctc_greetings_settings').show();
38
  $('.ctc_greetings_notes').show();
39
+ optin();
40
  }
41
 
42
  // on change
43
  $('.pr_greetings_template select').on("change", function (e) {
44
  var greetings_template = e.target.value;
 
45
 
46
  // ctc_greetings_settings
47
  if (greetings_template == 'no') {
57
  if (greetings_template == 'greetings-1') {
58
  $('.ctc_greetings_settings.ctc_g_1').show(100);
59
  $('.pr_ht_ctc_greetings_1').show(100);
60
+ optin();
61
  }
62
  // greetings-2
63
  if (greetings_template == 'greetings-2') {
64
  $('.ctc_greetings_settings.ctc_g_2').show(100);
65
  $('.pr_ht_ctc_greetings_2').show(100);
66
+ optin();
67
  }
68
 
69
  $('.pr_ht_ctc_greetings_settings').show();
71
  }
72
  });
73
 
74
+
75
+ // optin - show/hide
76
+ function optin() {
77
+ if ($('.is_opt_in').is(':checked')) {
78
+ $(".pr_opt_in ").show(200);
79
+ } else {
80
+ $(".pr_opt_in ").hide(200);
81
+ }
82
+ }
83
+ // optin change
84
+ $(".is_opt_in").on("change", function (e) {
85
+ optin();
86
+ });
87
+
88
  }
89
 
90
 
91
+
92
+
93
+ /**
94
+ * only on greetings, woo pages
95
+ */
96
  function editor() {
97
  // tinymce editor - bg color
98
  var check = 1;
99
  var check_interval = 1000;
100
  var check_times = 28; // ( check_times * check_interval = total milliseconds )
101
 
102
+ function tiny_bg() {
103
+ if (document.getElementById("header_content_ifr")) {
104
+ try {
105
+ tiny_bg_color();
106
+ } catch (e) { }
107
+ } else {
108
+ check++;
109
+ if (check < check_times) {
110
+ setTimeout(tiny_bg, check_interval);
111
+ }
112
  }
113
  }
114
+ // also calls from setTimeout....
115
+ tiny_bg();
116
 
117
  function tiny_bg_color() {
118
+ var i = document.querySelectorAll(".ctc_wp_editor iframe");
119
+ i.forEach(e => {
120
+ var elmnt = e.contentWindow.document.getElementsByTagName("body")[0];
121
+ elmnt.style.backgroundColor = "#26a69a";
122
+ });
 
 
 
 
 
 
 
123
  }
124
  }
125
 
127
  });
128
 
129
 
130
+ })(jQuery);
new/admin/class-ht-ctc-admin-greetings-page.php CHANGED
@@ -95,6 +95,7 @@ class HT_CTC_Admin_Greetings {
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 = [
@@ -128,7 +129,7 @@ class HT_CTC_Admin_Greetings {
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', 'click-to-chat-for-whatsapp'),
@@ -136,7 +137,7 @@ class HT_CTC_Admin_Greetings {
136
  'template' => 'editor',
137
  'label' => 'Main Content',
138
  'description' => "Variables: {site}, {title}, {url}",
139
- 'parent_class' => 'pr_main_content ctc_greetings_settings ctc_g_1 ctc_g_2',
140
  ],
141
  'bottom_content' => [
142
  'title' => __( 'Bottom Content', 'click-to-chat-for-whatsapp'),
@@ -145,7 +146,7 @@ class HT_CTC_Admin_Greetings {
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', 'click-to-chat-for-whatsapp'),
@@ -246,12 +247,38 @@ class HT_CTC_Admin_Greetings {
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',
@@ -515,7 +542,8 @@ class HT_CTC_Admin_Greetings {
515
  $editor = [
516
  'header_content',
517
  'main_content',
518
- 'bottom_content'
 
519
  ];
520
 
521
  // formatting api - emoji ..
@@ -559,7 +587,8 @@ class HT_CTC_Admin_Greetings {
559
  'header_content',
560
  'main_content',
561
  'bottom_content',
562
- 'call_to_action'
 
563
  ];
564
 
565
  $local = apply_filters( 'ht_ctc_fh_greetings_setting_local_values', $local );
95
  $greetings_fallback_values = $default_greetings->greetings;
96
  $g1_fallback_values = $default_greetings->g_1;
97
  $g2_fallback_values = $default_greetings->g_2;
98
+ $g_settings_fallback_values = $default_greetings->g_settings;
99
 
100
 
101
  $start_values = [
129
  'description' => '',
130
  'link_url' => '',
131
  'link_title' => 'more info',
132
+ 'parent_class' => 'pr_header_content ctc_greetings_settings ctc_g_1 ctc_wp_editor',
133
  ],
134
  'main_content' => [
135
  'title' => __( 'Main Content', 'click-to-chat-for-whatsapp'),
137
  'template' => 'editor',
138
  'label' => 'Main Content',
139
  'description' => "Variables: {site}, {title}, {url}",
140
+ 'parent_class' => 'pr_main_content ctc_greetings_settings ctc_g_1 ctc_g_2 ctc_wp_editor',
141
  ],
142
  'bottom_content' => [
143
  'title' => __( 'Bottom Content', 'click-to-chat-for-whatsapp'),
146
  'label' => 'Bottom Content',
147
  'description' => '',
148
  'parent_style' => "margin-bottom: 20px;",
149
+ 'parent_class' => 'pr_bottom_content ctc_greetings_settings ctc_g_1 ctc_g_2 ctc_wp_editor',
150
  ],
151
  [
152
  'title' => __( 'Call to Action', 'click-to-chat-for-whatsapp'),
247
  'id' => 'ht_ctc_greetings_settings',
248
  'title' => 'Additional Settings',
249
  'dbrow' => 'ht_ctc_greetings_settings',
250
+ 'fallback_values' => $g_settings_fallback_values,
251
  'class' => 'pr_ht_ctc_greetings_settings ctc_greetings_settings',
252
  'inputs' => [
253
  [
254
  'db' => 'empty',
255
  'template' => 'empty',
256
  ],
257
+ [
258
+ 'template' => 'collapsible_start',
259
+ 'title' => __( 'Opt-in', 'click-to-chat-for-whatsapp'),
260
+ ],
261
+ [
262
+ 'title' => __( 'Opt-in', 'click-to-chat-for-whatsapp'),
263
+ 'db' => 'is_opt_in',
264
+ 'template' => 'checkbox',
265
+ 'description' => __( "User consent before starting the chat ", 'click-to-chat-for-whatsapp') . "- <a href='https://holithemes.com/plugins/click-to-chat/opt-in/' target='_blank'>Opt-in</a> <br> " . __( "Once website visitor opt-in, it won't display again", 'click-to-chat-for-whatsapp'),
266
+ 'parent_class' => 'pr_is_opt_in',
267
+ ],
268
+ [
269
+ 'title' => '',
270
+ 'db' => 'opt_in',
271
+ 'template' => 'editor_lite',
272
+ 'label' => 'Opt-in',
273
+ 'description' => '',
274
+ 'parent_style' => "margin-bottom: 20px;",
275
+ 'parent_class' => 'pr_opt_in ctc_greetings_settings ctc_wp_editor',
276
+ ],
277
+ [
278
+ 'template' => 'collapsible_end',
279
+ 'description' => "Currenlty available with 'Greetings-1', 'Greetings-2'",
280
+
281
+ ],
282
  [
283
  'title' => __( 'Display', 'click-to-chat-for-whatsapp'),
284
  'db' => 'g_device',
542
  $editor = [
543
  'header_content',
544
  'main_content',
545
+ 'bottom_content',
546
+ 'opt_in'
547
  ];
548
 
549
  // formatting api - emoji ..
587
  'header_content',
588
  'main_content',
589
  'bottom_content',
590
+ 'call_to_action',
591
+ 'opt_in'
592
  ];
593
 
594
  $local = apply_filters( 'ht_ctc_fh_greetings_setting_local_values', $local );
new/admin/components/checkbox.php CHANGED
@@ -16,10 +16,16 @@ $description = (isset($input['description'])) ? $input['description'] : '';
16
  <div class="row ctc_component_checkbox <?= $parent_class ?>">
17
  <p>
18
  <label>
19
- <input name="<?= $dbrow ?>[<?= $db_key ?>]" type="checkbox" value="1" <?php checked( $db_value, 1 ); ?> />
20
  <span><?= $title ?></span>
21
  </label>
22
- <p class="description"><?= $description ?></p>
 
 
 
 
 
 
23
  </p>
24
  </div>
25
  <?php
16
  <div class="row ctc_component_checkbox <?= $parent_class ?>">
17
  <p>
18
  <label>
19
+ <input name="<?= $dbrow ?>[<?= $db_key ?>]" type="checkbox" class="<?= $db_key ?>" value="1" <?php checked( $db_value, 1 ); ?> />
20
  <span><?= $title ?></span>
21
  </label>
22
+ <?php
23
+ if ('' !== $description) {
24
+ ?>
25
+ <p class="description"><?= $description ?></p>
26
+ <?php
27
+ }
28
+ ?>
29
  </p>
30
  </div>
31
  <?php
new/admin/components/collapsible_end.php CHANGED
@@ -17,4 +17,4 @@ if ('' !== $description) {
17
 
18
  </div>
19
  </li>
20
- <ul>
17
 
18
  </div>
19
  </li>
20
+ </ul>
new/admin/components/editor.php CHANGED
@@ -23,22 +23,40 @@ $parent_class = (isset($input['parent_class'])) ? $input['parent_class'] : '';
23
  // }
24
  // add_filter( 'quicktags_settings', 'ctc_edit_quicktags', 10, 2 );
25
 
26
- if ( ! function_exists( 'ctc_tiny_mce_toolbar_settings' ) ) {
27
- function ctc_tiny_mce_toolbar_settings( $args ) {
28
- $args['fontsize_formats'] = "6px 8px 10px 12px 13px 14px 15px 16px 18px 20px 24px 28px 32px 36px";
29
- return $args;
30
- }
31
- }
32
- add_filter( 'tiny_mce_before_init', 'ctc_tiny_mce_toolbar_settings' );
 
 
 
 
 
 
 
33
 
34
- if ( ! function_exists( 'ctc_tinymce_add_font_sizes' ) ) {
35
- function ctc_tinymce_add_font_sizes( $buttons ) {
 
 
 
 
 
 
 
 
 
36
  array_unshift( $buttons, 'fontselect' );
37
  array_unshift( $buttons, 'fontsizeselect' );
 
 
38
  return $buttons;
39
  }
40
  }
41
- add_filter( 'mce_buttons_2', 'ctc_tinymce_add_font_sizes' );
42
 
43
  // db_value call again for editor. and santize using wp_kses
44
  $db_value = ( isset( $options[$db_key]) ) ? $options[$db_key] : '';
@@ -79,7 +97,7 @@ $args = [
79
  'drag_drop_upload' => true,
80
  'tinymce' => array(
81
  'textarea_rows'=> 10,
82
- 'fontsize_formats' => "8px 10px 12px 14px 18px 24px 36px",
83
  )
84
  ];
85
 
23
  // }
24
  // add_filter( 'quicktags_settings', 'ctc_edit_quicktags', 10, 2 );
25
 
26
+ // if ( ! function_exists( 'ctc_tiny_mce_toolbar_settings' ) ) {
27
+ // function ctc_tiny_mce_toolbar_settings( $args ) {
28
+ // $args['fontsize_formats'] = "6px 8px 10px 12px 13px 14px 15px 16px 18px 20px 24px 28px 32px 36px";
29
+ // return $args;
30
+ // }
31
+ // }
32
+ // add_filter( 'tiny_mce_before_init', 'ctc_tiny_mce_toolbar_settings' );
33
+
34
+ // if ( ! function_exists( 'ctc_tinymce_mce_buttons' ) ) {
35
+ // function ctc_tinymce_mce_buttons( $buttons ) {
36
+ // return $buttons;
37
+ // }
38
+ // }
39
+ // add_filter( 'mce_buttons', 'ctc_tinymce_mce_buttons' );
40
 
41
+ if ( ! function_exists( 'ctc_tinymce_mce_buttons_2' ) ) {
42
+ function ctc_tinymce_mce_buttons_2( $buttons ) {
43
+
44
+ $key = array_search( 'forecolor', $buttons );
45
+
46
+ // add after forecolor
47
+ if ( $key !== false && is_int( $key ) ) {
48
+ array_splice( $buttons, $key+1, 0, 'backcolor' );
49
+ }
50
+
51
+ // add at first
52
  array_unshift( $buttons, 'fontselect' );
53
  array_unshift( $buttons, 'fontsizeselect' );
54
+
55
+
56
  return $buttons;
57
  }
58
  }
59
+ add_filter( 'mce_buttons_2', 'ctc_tinymce_mce_buttons_2' );
60
 
61
  // db_value call again for editor. and santize using wp_kses
62
  $db_value = ( isset( $options[$db_key]) ) ? $options[$db_key] : '';
97
  'drag_drop_upload' => true,
98
  'tinymce' => array(
99
  'textarea_rows'=> 10,
100
+ 'fontsize_formats' => "6px 8px 10px 12px 13px 14px 15px 16px 18px 20px 24px 28px 32px 36px",
101
  )
102
  ];
103
 
new/admin/components/editor_lite.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <?php
3
+ /**
4
+ * editor
5
+ *
6
+ *
7
+ * $db_value is santized esc_attr - so call db again.. and reassing $db_value
8
+ */
9
+
10
+ if ( ! defined( 'ABSPATH' ) ) exit;
11
+
12
+ $title = (isset($input['title'])) ? $input['title'] : '';
13
+ $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
+ $parent_class = (isset($input['parent_class'])) ? $input['parent_class'] : '';
18
+
19
+ if ( ! function_exists( 'ctc_tinymce_add_font_sizes' ) ) {
20
+ function ctc_tinymce_add_font_sizes( $buttons ) {
21
+ array_unshift( $buttons, 'fontselect' );
22
+ array_unshift( $buttons, 'fontsizeselect' );
23
+ return $buttons;
24
+ }
25
+ }
26
+ add_filter( 'mce_buttons_2', 'ctc_tinymce_add_font_sizes' );
27
+
28
+
29
+ // db_value call again for editor. and santize using wp_kses
30
+ $db_value = ( isset( $options[$db_key]) ) ? $options[$db_key] : '';
31
+
32
+ if ( '' !== $db_value ) {
33
+ $allowed_html = wp_kses_allowed_html( 'post' );
34
+ $db_value = html_entity_decode(wp_kses($db_value, $allowed_html));
35
+ }
36
+
37
+ ?>
38
+ <div class="row ctc_component_editor <?= $parent_class ?>" style="<?= $parent_style ?>">
39
+ <?php
40
+ if ( '' !== $title ) {
41
+ ?>
42
+ <p class="description ht_ctc_subtitle" style="margin-top: 40px;"><?php _e( $title, 'click-to-chat-for-whatsapp' ); ?> </p>
43
+ <?php
44
+ }
45
+
46
+ ?>
47
+ <?php
48
+
49
+ $content = $db_value;
50
+ $editor_id = $db_key;
51
+ $args = [
52
+ 'textarea_name' => "$dbrow"."[$db_key]",
53
+ 'textarea_rows' => 10,
54
+ 'editor_height' => 150,
55
+ 'media_buttons' => false,
56
+ 'teeny' => false,
57
+ 'tinymce' => array(
58
+ 'toolbar1' => 'bold, link, italic, underline, forecolor, backcolor, fontsizeselect, fontselect, undo, redo, removeformat',
59
+ 'toolbar2' => false,
60
+ 'fontsize_formats' => "6px 8px 10px 12px 13px 14px 15px 16px 18px 20px 24px 28px 32px 36px",
61
+ )
62
+ ];
63
+
64
+ wp_editor( $content, $editor_id, $args );
65
+ ?>
66
+ <p class="description"><?= $description ?></p>
67
+ </div>
new/admin/db/defaults/class-ht-ctc-defaults-greetings.php CHANGED
@@ -13,6 +13,7 @@ class HT_CTC_Defaults_Greetings {
13
  public $greetings = '';
14
  public $g_1 = '';
15
  public $g_2 = '';
 
16
 
17
  public function __construct() {
18
  $this->defaults();
@@ -22,6 +23,7 @@ class HT_CTC_Defaults_Greetings {
22
  $this->greetings = $this->greetings();
23
  $this->g_1 = $this->g_1();
24
  $this->g_2 = $this->g_2();
 
25
  }
26
 
27
 
@@ -32,7 +34,7 @@ class HT_CTC_Defaults_Greetings {
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
  );
@@ -61,6 +63,16 @@ class HT_CTC_Defaults_Greetings {
61
  return $values;
62
  }
63
 
 
 
 
 
 
 
 
 
 
 
64
  }
65
 
66
  new HT_CTC_Defaults_Greetings();
13
  public $greetings = '';
14
  public $g_1 = '';
15
  public $g_2 = '';
16
+ public $g_settings = '';
17
 
18
  public function __construct() {
19
  $this->defaults();
23
  $this->greetings = $this->greetings();
24
  $this->g_1 = $this->g_1();
25
  $this->g_2 = $this->g_2();
26
+ $this->g_settings = $this->g_settings();
27
  }
28
 
29
 
34
  'header_content' => '<span style="color: #ffffff;">{site}</span>',
35
  'main_content' => 'Any questions related to {title}?',
36
  'bottom_content' => '<p style="text-align: center;"><span style="font-size: 12px;">🟢 we are online | privacy policy</span></p>',
37
+ 'call_to_action' => 'WhatsApp Us',
38
  'g_device' => 'all',
39
  'g_init' => 'open',
40
  );
63
  return $values;
64
  }
65
 
66
+ function g_settings() {
67
+
68
+ $values = array(
69
+ 'opt_in' => 'Accept Privacy Policy',
70
+ );
71
+
72
+ return $values;
73
+
74
+ }
75
+
76
  }
77
 
78
  new HT_CTC_Defaults_Greetings();
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)}),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("user_closed"):d("user_opened")}),f(document).on("click",".ctc_greetings_close_btn",function(t){u("user_closed")}),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"),f(document).on("click",".ctc_greetings, #ctc_greetings",function(t){u("element"),d("element")})}}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){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 i(t){return c[t]||!1}function s(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,r="";if("undefined"!=typeof ht_ctc_chat_var)r=ht_ctc_chat_var,e(),h();else{try{document.querySelector(".ht_ctc_chat_data")&&(t=f(".ht_ctc_chat_data").attr("data-settings"),r=JSON.parse(t))}catch(t){r={}}e(),h()}function e(){var t=document.querySelector(".ht_ctc_chat_data");t&&(_=f(".ht_ctc_chat_data").attr("data-no_number"),t.remove())}function h(){var e;document.dispatchEvent(new CustomEvent("ht_ctc_event_settings",{detail:{ctc:r}})),(e=document.querySelector(".ht-ctc-chat"))&&(document.dispatchEvent(new CustomEvent("ht_ctc_event_chat")),function(t){"yes"==r.schedule?document.dispatchEvent(new CustomEvent("ht_ctc_event_display",{detail:{ctc:r,display_chat:l,ht_ctc_chat:t}})):l(t)}(e),e.addEventListener("click",function(){f(".ht_ctc_chat_greetings_box").length||m(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("user_closed"):d("user_opened")}),f(document).on("click",".ctc_greetings_close_btn",function(t){u("user_closed")}),f(document).on("click",".ht_ctc_chat_greetings_box_link",function(t){t.preventDefault(),!document.querySelector("#ctc_opt")||f("#ctc_opt").is(":checked")||i("g_optin")?m(e):f(".ctc_opt_in").show(400).fadeOut("1").fadeIn("1"),document.dispatchEvent(new CustomEvent("ht_ctc_event_greetings"))}),document.querySelector("#ctc_opt")&&f("#ctc_opt").on("change",function(t){f("#ctc_opt").is(":checked")&&(f(".ctc_opt_in").hide(100),s("g_optin","y"),setTimeout(()=>{m(e)},500))})),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),r.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"),p(this),v(t)}),f(document).on("click",".ctc_chat, #ctc_chat",function(t){m(this),f(this).hasClass("ctc_woo_place")&&t.preventDefault()}),f(document).on("click",'[href="#ctc_chat"]',function(t){t.preventDefault(),m(this)})}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"),s("g_action",t),"user_opened"==t&&s("g_user_action",t)}function u(t){f(".ht_ctc_chat_greetings_box").hide(70),f(".ht_ctc_chat_greetings_box").addClass("ctc_greetings_closed").removeClass("ctc_greetings_opened"),s("g_action",t),"user_closed"==t&&s("g_user_action",t)}function l(t){var e;"yes"==n?"show"==r.dis_m&&((e=document.querySelector(".ht_ctc_desktop_chat"))&&e.remove(),t.style.cssText=r.pos_m+r.css,g(t)):"show"==r.dis_d&&((e=document.querySelector(".ht_ctc_mobile_chat"))&&e.remove(),t.style.cssText=r.pos_d+r.css,g(t))}function g(e){try{f(e).show(parseInt(r.se))}catch(t){e.style.display="block"}var t,c;!function(){if(f(".ht_ctc_chat_greetings_box").length){if(r.g_device){if("yes"!==n&&"mobile"==r.g_device)return f(".ht_ctc_chat_greetings_box").remove();if("yes"==n&&"desktop"==r.g_device)return f(".ht_ctc_chat_greetings_box").remove()}document.dispatchEvent(new CustomEvent("ht_ctc_event_after_chat_displayed",{detail:{ctc:r,greetings_open:d,greetings_close:u}})),r.g_init&&"open"==r.g_init&&"user_closed"!==i("g_user_action")&&d("init"),f(document).on("click",".ctc_greetings, #ctc_greetings",function(t){u("element"),d("element")})}}(),c=f(t=e).hasClass("ht_ctc_entry_animation")?1200:120,setTimeout(function(){t.classList.add("ht_ctc_animation",r.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 p(t){document.dispatchEvent(new CustomEvent("ht_ctc_event_analytics"));var e=r.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;(r.ga||r.ga4)&&("undefined"!=typeof gtag?r.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}),r.ads&&"undefined"!=typeof gtag_report_conversion&&gtag_report_conversion(),r.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 m(t){document.dispatchEvent(new CustomEvent("ht_ctc_event_number",{detail:{ctc:r}}));var e=r.number,c=r.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?(r.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"),p(t),v(e)):f(".ht-ctc-chat").html(_)}function v(t){var e,c;r.hook_url&&(e=r.hook_url,c={},r.hook_v&&(c=r.hook_v),document.dispatchEvent(new CustomEvent("ht_ctc_event_hook",{detail:{ctc:r,number:t}})),e=r.hook_url,c=r.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
@@ -116,13 +116,39 @@
116
  $(document).on('click', '.ht_ctc_chat_greetings_box_link', function (e) {
117
  console.log('ht_ctc_chat_greetings_box_link');
118
  e.preventDefault();
119
- ht_ctc_link(ht_ctc_chat);
120
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  document.dispatchEvent(
122
  new CustomEvent("ht_ctc_event_greetings")
123
  );
124
  });
125
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  }
127
 
128
  }
116
  $(document).on('click', '.ht_ctc_chat_greetings_box_link', function (e) {
117
  console.log('ht_ctc_chat_greetings_box_link');
118
  e.preventDefault();
 
119
 
120
+ // optin
121
+ if (document.querySelector('#ctc_opt')) {
122
+ // if (ctc_getItem('g_optin')) {
123
+ // $('#ctc_opt').prop('checked', true);
124
+ // }
125
+ if ($('#ctc_opt').is(':checked') || ctc_getItem('g_optin')) {
126
+ ht_ctc_link(ht_ctc_chat);
127
+ } else {
128
+ $('.ctc_opt_in').show(400).fadeOut('1').fadeIn('1');
129
+ }
130
+ } else {
131
+ ht_ctc_link(ht_ctc_chat);
132
+ }
133
+
134
  document.dispatchEvent(
135
  new CustomEvent("ht_ctc_event_greetings")
136
  );
137
  });
138
 
139
+ // optin - checkbox on change
140
+ if (document.querySelector('#ctc_opt')) {
141
+ $("#ctc_opt").on("change", function (e) {
142
+ if ($('#ctc_opt').is(':checked')) {
143
+ $('.ctc_opt_in').hide(100);
144
+ ctc_setItem('g_optin', 'y');
145
+ setTimeout(() => {
146
+ ht_ctc_link(ht_ctc_chat);
147
+ }, 500);
148
+ }
149
+ });
150
+ }
151
+
152
  }
153
 
154
  }
new/inc/greetings/class-ht-ctc-chat-greetings.php CHANGED
@@ -26,6 +26,7 @@ class HT_CTC_Chat_Greetings {
26
 
27
  $greetings = get_option('ht_ctc_greetings_options' );
28
  $chat = get_option('ht_ctc_chat_options');
 
29
 
30
  $ht_ctc_greetings = array();
31
 
@@ -95,6 +96,9 @@ class HT_CTC_Chat_Greetings {
95
  $ht_ctc_greetings['bottom_content'] = ( isset( $greetings['bottom_content']) ) ? esc_attr($greetings['bottom_content']) : '';
96
  $ht_ctc_greetings['call_to_action'] = ( isset( $greetings['call_to_action']) ) ? esc_attr( $greetings['call_to_action'] ) : '';
97
 
 
 
 
98
  if ('' == $ht_ctc_greetings['call_to_action']) {
99
  $ht_ctc_greetings['call_to_action'] = 'WhatsApp';
100
  }
@@ -110,6 +114,7 @@ class HT_CTC_Chat_Greetings {
110
  $ht_ctc_greetings['main_content'] = apply_filters( 'wpml_translate_single_string', $ht_ctc_greetings['main_content'], 'Click to Chat for WhatsApp', 'greetings_main_content' );
111
  $ht_ctc_greetings['bottom_content'] = apply_filters( 'wpml_translate_single_string', $ht_ctc_greetings['bottom_content'], 'Click to Chat for WhatsApp', 'greetings_bottom_content' );
112
  $ht_ctc_greetings['call_to_action'] = apply_filters( 'wpml_translate_single_string', $ht_ctc_greetings['call_to_action'], 'Click to Chat for WhatsApp', 'greetings_call_to_action' );
 
113
 
114
 
115
  $allowed_html = wp_kses_allowed_html( 'post' );
@@ -151,6 +156,10 @@ class HT_CTC_Chat_Greetings {
151
  $ht_ctc_greetings['bottom_content'] = html_entity_decode(wp_kses($ht_ctc_greetings['bottom_content'], $allowed_html) );
152
  $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'] );
153
  }
 
 
 
 
154
 
155
  $box_shadow = '1px 1px 3px 1px rgba(0,0,0,.14)';
156
  if ( 'greetings-2' == $ht_ctc_greetings['greetings_template'] ) {
26
 
27
  $greetings = get_option('ht_ctc_greetings_options' );
28
  $chat = get_option('ht_ctc_chat_options');
29
+ $greetings_settings = get_option('ht_ctc_greetings_settings');
30
 
31
  $ht_ctc_greetings = array();
32
 
96
  $ht_ctc_greetings['bottom_content'] = ( isset( $greetings['bottom_content']) ) ? esc_attr($greetings['bottom_content']) : '';
97
  $ht_ctc_greetings['call_to_action'] = ( isset( $greetings['call_to_action']) ) ? esc_attr( $greetings['call_to_action'] ) : '';
98
 
99
+ $ht_ctc_greetings['is_opt_in'] = ( isset( $greetings_settings['is_opt_in']) ) ? esc_attr( $greetings_settings['is_opt_in'] ) : '';
100
+ $ht_ctc_greetings['opt_in'] = ( isset( $greetings_settings['opt_in']) ) ? esc_attr( $greetings_settings['opt_in'] ) : '';
101
+
102
  if ('' == $ht_ctc_greetings['call_to_action']) {
103
  $ht_ctc_greetings['call_to_action'] = 'WhatsApp';
104
  }
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
  $ht_ctc_greetings['bottom_content'] = apply_filters( 'wpml_translate_single_string', $ht_ctc_greetings['bottom_content'], 'Click to Chat for WhatsApp', 'greetings_bottom_content' );
116
  $ht_ctc_greetings['call_to_action'] = apply_filters( 'wpml_translate_single_string', $ht_ctc_greetings['call_to_action'], 'Click to Chat for WhatsApp', 'greetings_call_to_action' );
117
+ $ht_ctc_greetings['opt_in'] = apply_filters( 'wpml_translate_single_string', $ht_ctc_greetings['opt_in'], 'Click to Chat for WhatsApp', 'greetings_opt_in' );
118
 
119
 
120
  $allowed_html = wp_kses_allowed_html( 'post' );
156
  $ht_ctc_greetings['bottom_content'] = html_entity_decode(wp_kses($ht_ctc_greetings['bottom_content'], $allowed_html) );
157
  $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'] );
158
  }
159
+ if ( '' !== $ht_ctc_greetings['is_opt_in'] && '' !== $ht_ctc_greetings['opt_in'] ) {
160
+ $ht_ctc_greetings['opt_in'] = html_entity_decode(wp_kses($ht_ctc_greetings['opt_in'], $allowed_html) );
161
+ $ht_ctc_greetings['opt_in'] = str_replace( array('{url}', '{title}', '{site}' ), array( $page_url, $post_title, HT_CTC_BLOG_NAME ), $ht_ctc_greetings['opt_in'] );
162
+ }
163
 
164
  $box_shadow = '1px 1px 3px 1px rgba(0,0,0,.14)';
165
  if ( 'greetings-2' == $ht_ctc_greetings['greetings_template'] ) {
new/inc/greetings/greetings-1.php CHANGED
@@ -52,6 +52,8 @@ if ('' !== $message_box_bg_color) {
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
 
@@ -130,6 +132,11 @@ if ( '' !== $ht_ctc_greetings['header_content'] ) {
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 ) ) {
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
+ $g_optin_path = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/greetings/greetings_styles/opt-in.php';
56
+
57
 
58
  $g_header_image = '';
59
 
132
  </div>
133
 
134
  <div class="ctc_g_sentbutton" style="<?= $send_css ?>">
135
+ <?php
136
+ if ( isset($ht_ctc_greetings['is_opt_in']) && '' !== $ht_ctc_greetings['is_opt_in'] && is_file( $g_optin_path ) ) {
137
+ include $g_optin_path;
138
+ }
139
+ ?>
140
  <div class="ht_ctc_chat_greetings_box_link ctc-analytics">
141
  <?php
142
  if ( is_file( $g_cta_path ) ) {
new/inc/greetings/greetings-2.php CHANGED
@@ -32,6 +32,7 @@ if ('' !== $bg_color) {
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
 
@@ -40,6 +41,11 @@ $g_cta_path = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/greetings/greetin
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 ) ) {
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
+ $g_optin_path = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/greetings/greetings_styles/opt-in.php';
36
 
37
  ?>
38
 
41
  </div>
42
 
43
  <div class="ctc_g_sentbutton" style="<?= $send_css ?>">
44
+ <?php
45
+ if ( isset($ht_ctc_greetings['is_opt_in']) && '' !== $ht_ctc_greetings['is_opt_in'] && is_file( $g_optin_path ) ) {
46
+ include $g_optin_path;
47
+ }
48
+ ?>
49
  <div class="ht_ctc_chat_greetings_box_link ctc-analytics">
50
  <?php
51
  if ( is_file( $g_cta_path ) ) {
new/inc/greetings/greetings_styles/opt-in.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Greetings call to action - style - 1
4
+ *
5
+ */
6
+
7
+ if ( ! defined( 'ABSPATH' ) ) exit;
8
+
9
+ $opt_in = 'Privacy Policy';
10
+
11
+ if (isset( $ht_ctc_greetings) && isset( $ht_ctc_greetings['opt_in'])) {
12
+ $opt_in = $ht_ctc_greetings['opt_in'];
13
+ }
14
+
15
+ ?>
16
+ <div class="ctc_opt_in" style="display:none;">
17
+ <div class="ctc_opt" style="display:inline-flex;justify-content:center;align-items:center;padding:0 4px;">
18
+ <input type="checkbox" name="" id="ctc_opt" style="margin: 0 5px;">
19
+ <label for="ctc_opt"><?= $opt_in ?></label>
20
+ </div>
21
+ </div>
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Click to Chat ===
2
  Requires at least: 4.6
3
- Tested up to: 6.0
4
  Requires PHP: 5.6
5
  Contributors: holithemes
6
- Stable tag: 3.9.6
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
@@ -503,6 +503,10 @@ After Activate the plugin, add WhatsApp Number at plugin settings.
503
 
504
  == Changelog ==
505
 
 
 
 
 
506
  = 3.9.6 =
507
  * Enchantment: click to chat admin page for WooCommerce
508
 
1
  === Click to Chat ===
2
  Requires at least: 4.6
3
+ Tested up to: 6.0.1
4
  Requires PHP: 5.6
5
  Contributors: holithemes
6
+ Stable tag: 3.9.7
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
503
 
504
  == Changelog ==
505
 
506
+ = 3.9.7 =
507
+ * New: opt-in - user consent before initiate the chat
508
+ * Enchantment: Greetings Text Editor, can add background color to text.
509
+
510
  = 3.9.6 =
511
  * Enchantment: click to chat admin page for WooCommerce
512