Click to Chat for WhatsApp Chat - Version 3.2.2

Version Description

  • Font size settings for Call to Action - Style 2, 3, 3 Extend.
  • Fix: Facebook Pixel integration for Shortcodes
Download this release

Release Info

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

Code changes from version 3.1 to 3.2.2

Files changed (43) hide show
  1. click-to-chat.php +2 -3
  2. new/admin/admin_assets/css/admin.css +7 -0
  3. new/admin/admin_assets/js/admin.js +100 -72
  4. new/admin/admin_commons/admin-after-settings-page.php +11 -2
  5. new/admin/admin_commons/admin-desktop.php +6 -1
  6. new/admin/admin_commons/admin-mobile.php +5 -0
  7. new/admin/admin_commons/class-ht-ctc-admin-others.php +5 -0
  8. new/admin/admin_commons/class-ht-ctc-metabox.php +16 -6
  9. new/admin/class-ht-ctc-admin-customize-styles.php +71 -13
  10. new/admin/class-ht-ctc-admin-group-page.php +1 -0
  11. new/admin/class-ht-ctc-admin-main-page.php +2 -3
  12. new/admin/class-ht-ctc-admin-other-settings.php +85 -53
  13. new/admin/class-ht-ctc-admin-share-page.php +1 -0
  14. new/admin/class-ht-ctc-db.php +26 -147
  15. new/admin/class-ht-ctc-update-db.php +150 -0
  16. new/inc/assets/js/app.js +1 -1
  17. new/inc/assets/js/dev/app.dev.js +131 -146
  18. new/inc/assets/js/dev/group.dev.js +95 -68
  19. new/inc/assets/js/dev/group.new.js +107 -0
  20. new/inc/assets/js/dev/share.dev.js +85 -52
  21. new/inc/assets/js/group.js +1 -1
  22. new/inc/assets/js/share.js +1 -1
  23. new/inc/chat/class-ht-ctc-chat-shortcode.php +15 -19
  24. new/inc/chat/class-ht-ctc-chat.php +38 -25
  25. new/inc/commons/class-ht-ctc-hooks.php +0 -15
  26. new/inc/commons/class-ht-ctc-scripts.php +8 -11
  27. new/inc/commons/position-to-place.php +3 -4
  28. new/inc/group/class-ht-ctc-group-shortcode.php +9 -5
  29. new/inc/group/class-ht-ctc-group.php +15 -17
  30. new/inc/share/class-ht-ctc-share-shortcode.php +9 -5
  31. new/inc/share/class-ht-ctc-share.php +18 -14
  32. new/inc/styles-shortcode/sc-style-1.php +18 -1
  33. new/inc/styles-shortcode/sc-style-2.php +1 -1
  34. new/inc/styles-shortcode/sc-style-3.php +1 -1
  35. new/inc/styles-shortcode/sc-style-7.php +0 -3
  36. new/inc/styles-shortcode/sc-style-7_1.php +0 -1
  37. new/inc/styles-shortcode/sc-style-8.php +0 -4
  38. new/inc/styles/style-1.php +9 -1
  39. new/inc/styles/style-2.php +3 -1
  40. new/inc/styles/style-3.php +3 -1
  41. new/inc/styles/style-3_1.php +3 -1
  42. prev/assets/js/app.js +1 -49
  43. readme.txt +14 -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.1
7
  Author: HoliThemes
8
  Author URI: https://holithemes.com/plugins/click-to-chat/
9
  License: GPL2
@@ -17,14 +17,13 @@ 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.1' );
21
  }
22
 
23
  // environment - production, staging, development, test
24
  // define( 'HT_CTC_ENVIRONMENT', 'development' ); //todo
25
  if ( ! defined( 'HT_CTC_ENVIRONMENT' ) ) {
26
  define( 'HT_CTC_ENVIRONMENT', 'production' );
27
- // define( 'WP_ENVIRONMENT_TYPE', 'production' );
28
  }
29
 
30
  // 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.2.2
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.2.2' );
21
  }
22
 
23
  // environment - production, staging, development, test
24
  // define( 'HT_CTC_ENVIRONMENT', 'development' ); //todo
25
  if ( ! defined( 'HT_CTC_ENVIRONMENT' ) ) {
26
  define( 'HT_CTC_ENVIRONMENT', 'production' );
 
27
  }
28
 
29
  // define HT_CTC_PLUGIN_FILE
new/admin/admin_assets/css/admin.css CHANGED
@@ -34,6 +34,13 @@
34
  margin: 5px 0;
35
  }
36
 
 
 
 
 
 
 
 
37
  @media only screen and (min-width: 1201px) {
38
  .sticky-sidebar {
39
  position: sticky !important;
34
  margin: 5px 0;
35
  }
36
 
37
+ .description.ht_ctc_pro_subtitle {
38
+ border-left: 5px solid darkseagreen;
39
+ /* padding: 5px 5px 5px 14px; */
40
+ padding-left: 0.9rem;
41
+ margin: 5px 0;
42
+ }
43
+
44
  @media only screen and (min-width: 1201px) {
45
  .sticky-sidebar {
46
  position: sticky !important;
new/admin/admin_assets/js/admin.js CHANGED
@@ -20,101 +20,129 @@ document.addEventListener('DOMContentLoaded', function() {
20
 
21
  });
22
 
 
23
 
24
- jQuery(document).ready(function ($) {
 
25
 
26
- $('select').formSelect();
27
- $('.collapsible').collapsible();
28
- $('.modal').modal();
29
- $('.tooltipped').tooltip();
30
-
31
- $('.ht-ctc-color').wpColorPicker();
32
 
33
- // show/hide settings
34
- function ht_ctc_show_hide_options () {
35
 
36
- // default display
37
- var val = $('.select_show_or_hide').find(":selected").val();
38
- if (val == 'show') {
39
- $(".showbased").show();
40
- } else if (val == 'hide') {
41
- $(".hidebased").show();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  }
 
43
 
44
- // on change
45
- $(".select_show_or_hide").on("change", function (e) {
46
-
47
- var change_val = e.target.value;
48
- $(".showbased").hide();
49
- $(".hidebased").hide();
50
 
51
- if (change_val == 'show') {
52
- $(".showbased").show(500);
53
- } else if (change_val == 'hide') {
54
- $(".hidebased").show(500);
55
- }
56
- });
57
 
 
 
 
 
 
58
  }
59
- ht_ctc_show_hide_options();
60
-
61
- // call to action
62
- var cta_styles = ['.ht_ctc_s2', '.ht_ctc_s3', '.ht_ctc_s3_1', '.ht_ctc_s7'];
63
- cta_styles.forEach(ht_ctc_admin_cta);
64
-
65
- function ht_ctc_admin_cta(style) {
66
- // default display
67
- var val = $(style + ' .select_cta_type').find(":selected").val();
68
- if (val == 'hide') {
69
- $(style + " .cta_textcolor").hide();
70
- $(style + " .cta_bgcolor").hide();
71
- }
72
 
73
- // on change
74
- $(style + " .select_cta_type").on("change", function (e) {
75
- var change_val = e.target.value;
76
- if (change_val == 'hide') {
77
- $(style + " .cta_textcolor").hide(100);
78
- $(style + " .cta_bgcolor").hide(100);
79
- } else {
80
- $(style + " .cta_textcolor").show(200);
81
- $(style + " .cta_bgcolor").show(400);
82
- }
83
- });
 
 
 
 
 
 
84
  }
85
 
 
 
 
 
 
 
86
 
87
- // on change - styles
88
- $(".chat_select_style").on("change", function (e) {
89
- $(".customize_styles_link").animate({ fontSize: '1.2em' }, "slow");
 
 
 
 
90
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
 
92
- // Deskop, Mobile
93
  if ($('#hideon_desktop').is(':checked')) {
94
  $(".ht_ctc_admin_desktop").hide();
 
 
95
  }
96
 
97
  if ($('#hideon_mobile').is(':checked')) {
98
  $(".ht_ctc_admin_mobile").hide();
 
 
99
  }
 
100
 
101
- $(".hidebasedondevice").on("change", function (e) {
102
- if ($('#hideon_desktop').is(':checked')) {
103
- $(".ht_ctc_admin_desktop").hide();
104
- } else {
105
- $(".ht_ctc_admin_desktop").show();
106
- }
107
 
108
- if ($('#hideon_mobile').is(':checked')) {
109
- $(".ht_ctc_admin_mobile").hide();
110
- } else {
111
- $(".ht_ctc_admin_mobile").show();
112
- }
113
- });
114
 
115
- // hide nothing or hide only on one device.
116
- $(document).on('click', '.hidebasedondevice', function () {
117
- $('.hidebasedondevice').not(this).prop('checked', false);
118
- });
119
 
120
- });
20
 
21
  });
22
 
23
+ (function($){
24
 
25
+ // ready
26
+ $(function(){
27
 
28
+ $('select').formSelect();
29
+ $('.collapsible').collapsible();
30
+ $('.modal').modal();
31
+ $('.tooltipped').tooltip();
 
 
32
 
33
+ $('.ht-ctc-color').wpColorPicker();
 
34
 
35
+ // show/hide settings
36
+ function ht_ctc_show_hide_options () {
37
+
38
+ // default display
39
+ var val = $('.select_show_or_hide').find(":selected").val();
40
+ if (val == 'show') {
41
+ $(".showbased").show();
42
+ } else if (val == 'hide') {
43
+ $(".hidebased").show();
44
+ }
45
+
46
+ // on change
47
+ $(".select_show_or_hide").on("change", function (e) {
48
+
49
+ var change_val = e.target.value;
50
+ $(".showbased").hide();
51
+ $(".hidebased").hide();
52
+
53
+ if (change_val == 'show') {
54
+ $(".showbased").show(500);
55
+ } else if (change_val == 'hide') {
56
+ $(".hidebased").show(500);
57
  }
58
+ });
59
 
60
+ }
61
+ ht_ctc_show_hide_options();
 
 
 
 
62
 
63
+ // call to action
64
+ var cta_styles = ['.ht_ctc_s2', '.ht_ctc_s3', '.ht_ctc_s3_1', '.ht_ctc_s7'];
65
+ cta_styles.forEach(ht_ctc_admin_cta);
 
 
 
66
 
67
+ function ht_ctc_admin_cta(style) {
68
+ // default display
69
+ var val = $(style + ' .select_cta_type').find(":selected").val();
70
+ if (val == 'hide') {
71
+ $(style + " .cta_stick").hide();
72
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
+ // on change
75
+ $(style + " .select_cta_type").on("change", function (e) {
76
+ var change_val = e.target.value;
77
+ if (change_val == 'hide') {
78
+ $(style + " .cta_stick").hide(100);
79
+ } else {
80
+ $(style + " .cta_stick").show(200);
81
+ }
82
+ });
83
+ }
84
+
85
+ function ht_ctc_admin_animations() {
86
+ // default display
87
+ var val = $('.select_an_type').find(":selected").val();
88
+ if (val == 'no-animation') {
89
+ $(".an_delay").hide();
90
+ $(".an_itr").hide();
91
  }
92
 
93
+ // on change
94
+ $(".select_an_type").on("change", function (e) {
95
+
96
+ var change_val = e.target.value;
97
+ // $(".showbased").hide();
98
+ // $(".hidebased").hide();
99
 
100
+ if (change_val == 'no-animation') {
101
+ $(".an_delay").hide();
102
+ $(".an_itr").hide();
103
+ } else {
104
+ $(".an_delay").show(500);
105
+ $(".an_itr").show(500);
106
+ }
107
  });
108
+ }
109
+ ht_ctc_admin_animations();
110
+
111
+ // on change - styles
112
+ $(".chat_select_style").on("change", function (e) {
113
+ $(".customize_styles_link").animate({ fontSize: '1.2em' }, "slow");
114
+ });
115
+
116
+ // Deskop, Mobile
117
+ if ($('#hideon_desktop').is(':checked')) {
118
+ $(".ht_ctc_admin_desktop").hide();
119
+ }
120
+
121
+ if ($('#hideon_mobile').is(':checked')) {
122
+ $(".ht_ctc_admin_mobile").hide();
123
+ }
124
 
125
+ $(".hidebasedondevice").on("change", function (e) {
126
  if ($('#hideon_desktop').is(':checked')) {
127
  $(".ht_ctc_admin_desktop").hide();
128
+ } else {
129
+ $(".ht_ctc_admin_desktop").show();
130
  }
131
 
132
  if ($('#hideon_mobile').is(':checked')) {
133
  $(".ht_ctc_admin_mobile").hide();
134
+ } else {
135
+ $(".ht_ctc_admin_mobile").show();
136
  }
137
+ });
138
 
139
+ // hide nothing or hide only on one device.
140
+ $(document).on('click', '.hidebasedondevice', function () {
141
+ $('.hidebasedondevice').not(this).prop('checked', false);
142
+ });
 
 
143
 
144
+
145
+ });
 
 
 
 
146
 
 
 
 
 
147
 
148
+ })(jQuery);
new/admin/admin_commons/admin-after-settings-page.php CHANGED
@@ -23,9 +23,10 @@ if ( ! defined( 'ABSPATH' ) ) exit;
23
  </li>
24
 
25
  <li>
26
- <div class="collapsible-header"><?php _e( 'Change Values(number) at page level', 'click-to-chat-for-whatsapp' ); ?></div>
27
  <div class="collapsible-body">
28
- <p class="description">We can <a target="_blank" href="https://holithemes.com/plugins/click-to-chat/change-values-at-page-level/"><?php _e( 'change the WhatsApp number, Call to Action' ) ?></a> <?php _e( 'while editing the post from the right side bar' ) ?></p>
 
29
  </div>
30
  </li>
31
 
@@ -49,6 +50,14 @@ if ( ! defined( 'ABSPATH' ) ) exit;
49
  </div>
50
  </li>
51
 
 
 
 
 
 
 
 
 
52
  <!-- <li>
53
  <div class="collapsible-header">Positon to place</div>
54
  <div class="collapsible-body">
23
  </li>
24
 
25
  <li>
26
+ <div class="collapsible-header"><?php _e( 'Change Values at page level', 'click-to-chat-for-whatsapp' ); ?> (number, ..)</div>
27
  <div class="collapsible-body">
28
+ <p class="description">We can change the WhatsApp number, Call to Action, prefilled message while editing the post from the right side bar' )</p>
29
+ <p class="description"><a target="_blank" href="https://holithemes.com/plugins/click-to-chat/change-values-at-page-level/"><?php _e( 'Change Settings at Page Level' ) ?></a></p>
30
  </div>
31
  </li>
32
 
50
  </div>
51
  </li>
52
 
53
+ <li>
54
+ <div class="collapsible-header"><?php _e( 'Phone number shared via url is invalid', 'click-to-chat-for-whatsapp' ); ?></div>
55
+ <div class="collapsible-body">
56
+ <p class="description"><?php _e( 'Add WhatsApp Number With country code', 'click-to-chat-for-whatsapp' ); ?></p>
57
+ <p class="description"><?php _e( 'If already added, clear the cache and check', 'click-to-chat-for-whatsapp' ); ?></p>
58
+ </div>
59
+ </li>
60
+
61
  <!-- <li>
62
  <div class="collapsible-header">Positon to place</div>
63
  <div class="collapsible-body">
new/admin/admin_commons/admin-desktop.php CHANGED
@@ -47,10 +47,15 @@ $side_2_value = ( isset( $options['side_2_value']) ) ? esc_attr( $options['side_
47
  </select>
48
  <p class="description"><a target="_blank" href="https://holithemes.com/plugins/click-to-chat/list-of-styles/"><?php _e( 'List of styles', 'click-to-chat-for-whatsapp' ); ?></a> &emsp; | &emsp; <span><?php _e( 'Customize the styles', 'click-to-chat-for-whatsapp' ); ?> <a target="_blank" class="customize_styles_link" href="<?php echo admin_url( 'admin.php?page=click-to-chat-customize-styles' ); ?>">( Click to Chat -> Customize )</a></span> </p>
49
  <p class="description"><span class="check_select_styles" style="font-size: 0.7em;"><?php _e( 'If Styles for desktop, mobile not selected as expected', 'click-to-chat-for-whatsapp' ); ?> <a target="_blank" href="<?php echo admin_url( 'admin.php?page=click-to-chat-other-settings#styles_issue:~:text=Check,cache)' ); ?>"><?php _e( 'Check this', 'click-to-chat-for-whatsapp' ); ?></a>, - <a target="_blank" href="https://holithemes.com/plugins/click-to-chat/select-styles/"><?php _e( 'more info', 'click-to-chat-for-whatsapp' ); ?></a></span></p>
50
- <!-- <span class="check_select_styles" style="font-size: 0.7em;">If Styles for desktop, mobile not selected as expected <a target="_blank" href="<?php echo admin_url( 'admin.php?page=click-to-chat-customize-styles#:~:text=check%20this, cache)' ); ?>">Check this</a>, - <a target="_blank" href="https://holithemes.com/plugins/click-to-chat/select-styles/">more info</a></span></p> -->
51
  </div>
52
  </div>
53
 
 
 
 
 
 
 
54
  <!-- Dekstop position -->
55
  <!-- side - 1 -->
56
  <p class="description ht_ctc_admin_desktop ht_ctc_subtitle"><?php _e( 'Position to Place (Desktop)', 'click-to-chat-for-whatsapp' ); ?>:</p>
47
  </select>
48
  <p class="description"><a target="_blank" href="https://holithemes.com/plugins/click-to-chat/list-of-styles/"><?php _e( 'List of styles', 'click-to-chat-for-whatsapp' ); ?></a> &emsp; | &emsp; <span><?php _e( 'Customize the styles', 'click-to-chat-for-whatsapp' ); ?> <a target="_blank" class="customize_styles_link" href="<?php echo admin_url( 'admin.php?page=click-to-chat-customize-styles' ); ?>">( Click to Chat -> Customize )</a></span> </p>
49
  <p class="description"><span class="check_select_styles" style="font-size: 0.7em;"><?php _e( 'If Styles for desktop, mobile not selected as expected', 'click-to-chat-for-whatsapp' ); ?> <a target="_blank" href="<?php echo admin_url( 'admin.php?page=click-to-chat-other-settings#styles_issue:~:text=Check,cache)' ); ?>"><?php _e( 'Check this', 'click-to-chat-for-whatsapp' ); ?></a>, - <a target="_blank" href="https://holithemes.com/plugins/click-to-chat/select-styles/"><?php _e( 'more info', 'click-to-chat-for-whatsapp' ); ?></a></span></p>
 
50
  </div>
51
  </div>
52
 
53
+
54
+ <?php
55
+ // Action hook - After select style - Desktop
56
+ do_action('ht_ctc_ah_admin_desktop_after_select_sytle', $options, $dbrow );
57
+ ?>
58
+
59
  <!-- Dekstop position -->
60
  <!-- side - 1 -->
61
  <p class="description ht_ctc_admin_desktop ht_ctc_subtitle"><?php _e( 'Position to Place (Desktop)', 'click-to-chat-for-whatsapp' ); ?>:</p>
new/admin/admin_commons/admin-mobile.php CHANGED
@@ -47,6 +47,11 @@ $mobile_side_2_value = ( isset( $options['mobile_side_2_value'])) ? esc_attr( $o
47
  </div>
48
  </div>
49
 
 
 
 
 
 
50
  <!-- Mobile position -->
51
  <!-- side - 1 -->
52
  <p class="description ht_ctc_admin_mobile ht_ctc_subtitle"><?php _e( 'Position to Place (Mobile)', 'click-to-chat-for-whatsapp' ); ?>:</p>
47
  </div>
48
  </div>
49
 
50
+ <?php
51
+ // Action hook - After select style - Mobile
52
+ do_action('ht_ctc_ah_admin_mobile_after_select_sytle', $options, $dbrow );
53
+ ?>
54
+
55
  <!-- Mobile position -->
56
  <!-- side - 1 -->
57
  <p class="description ht_ctc_admin_mobile ht_ctc_subtitle"><?php _e( 'Position to Place (Mobile)', 'click-to-chat-for-whatsapp' ); ?>:</p>
new/admin/admin_commons/class-ht-ctc-admin-others.php CHANGED
@@ -24,10 +24,15 @@ class HT_CTC_Admin_Others {
24
 
25
  // clear cache
26
  add_action( 'update_option_ht_ctc_chat_options', array( $this, 'clear_cache') );
 
27
  add_action( 'update_option_ht_ctc_group', array( $this, 'clear_cache') );
28
  add_action( 'update_option_ht_ctc_share', array( $this, 'clear_cache') );
29
  add_action( 'update_option_ht_ctc_s2', array( $this, 'clear_cache') ); //customize styles
 
30
  add_action( 'update_option_ht_ctc_s4', array( $this, 'clear_cache') );
 
 
 
31
  add_action( 'update_option_ht_ctc_s8', array( $this, 'clear_cache') );
32
  add_action( 'update_option_ht_ctc_s99', array( $this, 'clear_cache') );
33
 
24
 
25
  // clear cache
26
  add_action( 'update_option_ht_ctc_chat_options', array( $this, 'clear_cache') );
27
+ add_action( 'update_option_ht_ctc_othersettings', array( $this, 'clear_cache') );
28
  add_action( 'update_option_ht_ctc_group', array( $this, 'clear_cache') );
29
  add_action( 'update_option_ht_ctc_share', array( $this, 'clear_cache') );
30
  add_action( 'update_option_ht_ctc_s2', array( $this, 'clear_cache') ); //customize styles
31
+ add_action( 'update_option_ht_ctc_s3', array( $this, 'clear_cache') );
32
  add_action( 'update_option_ht_ctc_s4', array( $this, 'clear_cache') );
33
+ add_action( 'update_option_ht_ctc_s5', array( $this, 'clear_cache') );
34
+ add_action( 'update_option_ht_ctc_s7', array( $this, 'clear_cache') );
35
+ add_action( 'update_option_ht_ctc_s7_1', array( $this, 'clear_cache') );
36
  add_action( 'update_option_ht_ctc_s8', array( $this, 'clear_cache') );
37
  add_action( 'update_option_ht_ctc_s99', array( $this, 'clear_cache') );
38
 
new/admin/admin_commons/class-ht-ctc-metabox.php CHANGED
@@ -43,29 +43,37 @@ class HT_CTC_MetaBox {
43
  $ht_ctc_pagelevel = get_post_meta( $current_post->ID, 'ht_ctc_pagelevel', true );
44
 
45
  ?>
46
- <div class="row">
47
- <p class="description">Change values at <a target="_blank" href="https://holithemes.com/plugins/click-to-chat/change-values-at-page-level">Page level</a></p>
48
- </div>
49
  <?php
50
 
51
  // chat
52
  $number = ( isset($ht_ctc_pagelevel['number']) ) ? esc_attr($ht_ctc_pagelevel['number']) : '';
53
  $call_to_action = ( isset($ht_ctc_pagelevel['call_to_action']) ) ? esc_attr($ht_ctc_pagelevel['call_to_action']) : '';
 
 
 
54
  ?>
55
 
56
  <!-- number -->
57
  <div class="row">
58
- <label for="number">Chat - WhatsApp Number</label><br>
59
  <input name="ht_ctc_pagelevel[number]" value="<?php echo $number ?>" id="number" type="text">
60
  <p class="description"><a style="text-decoration: none" target="_blank" href="https://holithemes.com/plugins/click-to-chat/whatsapp-number/">WhatsApp Number</a> with country code</p>
61
  </div>
62
 
63
  <!-- call to action -->
64
  <div class="row">
65
- <label for="call_to_action">Chat - Call to Action</label><br>
66
  <input name="ht_ctc_pagelevel[call_to_action]" value="<?php echo $call_to_action ?>" id="call_to_action" type="text">
67
  </div>
68
 
 
 
 
 
 
 
69
  <?php
70
  do_action('ht_ctc_ah_admin_chat_bottom_meta_box', $current_post );
71
 
@@ -75,9 +83,11 @@ class HT_CTC_MetaBox {
75
  if ( isset( $options['enable_group'] ) ) {
76
  $group_id = ( isset($ht_ctc_pagelevel['group_id']) ) ? esc_attr($ht_ctc_pagelevel['group_id']) : '';
77
  ?>
 
 
78
  <!-- group id -->
79
  <div class="row">
80
- <label for="group_id">Group - Group ID</label><br>
81
  <input name="ht_ctc_pagelevel[group_id]" value="<?php echo $group_id ?>" id="group_id" type="text">
82
  <!-- <p class="description"><a style="text-decoration: none" target="_blank" href="https://holithemes.com/plugins/click-to-chat/whatsapp-number/">WhatsApp Number</a> with country code</p> -->
83
  </div>
43
  $ht_ctc_pagelevel = get_post_meta( $current_post->ID, 'ht_ctc_pagelevel', true );
44
 
45
  ?>
46
+ <p class="description">Change values at <a target="_blank" href="https://holithemes.com/plugins/click-to-chat/change-values-at-page-level">Page level</a></p>
47
+ <p class="description">Chat Settings:</p>
 
48
  <?php
49
 
50
  // chat
51
  $number = ( isset($ht_ctc_pagelevel['number']) ) ? esc_attr($ht_ctc_pagelevel['number']) : '';
52
  $call_to_action = ( isset($ht_ctc_pagelevel['call_to_action']) ) ? esc_attr($ht_ctc_pagelevel['call_to_action']) : '';
53
+ $pre_filled = ( isset($ht_ctc_pagelevel['pre_filled']) ) ? esc_attr($ht_ctc_pagelevel['pre_filled']) : '';
54
+ $blogname = HT_CTC_BLOG_NAME;
55
+ $placeholder = "Hello $blogname!! \n{url}, {title}";
56
  ?>
57
 
58
  <!-- number -->
59
  <div class="row">
60
+ <label for="number">WhatsApp Number</label><br>
61
  <input name="ht_ctc_pagelevel[number]" value="<?php echo $number ?>" id="number" type="text">
62
  <p class="description"><a style="text-decoration: none" target="_blank" href="https://holithemes.com/plugins/click-to-chat/whatsapp-number/">WhatsApp Number</a> with country code</p>
63
  </div>
64
 
65
  <!-- call to action -->
66
  <div class="row">
67
+ <label for="call_to_action">Call to Action</label><br>
68
  <input name="ht_ctc_pagelevel[call_to_action]" value="<?php echo $call_to_action ?>" id="call_to_action" type="text">
69
  </div>
70
 
71
+ <!-- pre-filled message -->
72
+ <div class="row">
73
+ <label for="pre_filled">Pre-filled Message</label><br>
74
+ <textarea style="min-height: 74px; min-width: 72%" placeholder="<?php echo $placeholder ?>" name="ht_ctc_pagelevel[pre_filled]" id="pre_filled" class="materialize-textarea input-margin"><?php echo $pre_filled ?></textarea>
75
+ </div>
76
+
77
  <?php
78
  do_action('ht_ctc_ah_admin_chat_bottom_meta_box', $current_post );
79
 
83
  if ( isset( $options['enable_group'] ) ) {
84
  $group_id = ( isset($ht_ctc_pagelevel['group_id']) ) ? esc_attr($ht_ctc_pagelevel['group_id']) : '';
85
  ?>
86
+ <br>
87
+ <p class="description">Group Settings:</p>
88
  <!-- group id -->
89
  <div class="row">
90
+ <label for="group_id">Group ID</label><br>
91
  <input name="ht_ctc_pagelevel[group_id]" value="<?php echo $group_id ?>" id="group_id" type="text">
92
  <!-- <p class="description"><a style="text-decoration: none" target="_blank" href="https://holithemes.com/plugins/click-to-chat/whatsapp-number/">WhatsApp Number</a> with country code</p> -->
93
  </div>
new/admin/class-ht-ctc-admin-customize-styles.php CHANGED
@@ -197,15 +197,16 @@ class HT_CTC_Admin_Customize_Styles {
197
 
198
  $options = get_option('ht_ctc_s1');
199
  $dbrow = 'ht_ctc_s1';
 
 
 
 
200
  ?>
201
  <ul class="collapsible ht_ctc_s1" data-collapsible="accordion">
202
  <li>
203
  <div class="collapsible-header"><?php _e( 'Style 1', 'click-to-chat-for-whatsapp' ); ?></div>
204
  <div class="collapsible-body">
205
 
206
- <!-- not make empty table -->
207
- <input name="ht_ctc_s1[hello]" value="hello" id="" type="text" class="hide" >
208
-
209
  <p class="description"><?php _e( 'Style-1 is a button that appears like themes button', 'click-to-chat-for-whatsapp' ); ?></p>
210
  <br><br>
211
 
@@ -240,6 +241,26 @@ class HT_CTC_Admin_Customize_Styles {
240
  </div>
241
  </div>
242
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
243
  <!-- <p class="description"><a target="_blank" href="https://holithemes.com/plugins/click-to-chat/style-1/"><?php _e( 'Style-1', 'click-to-chat-for-whatsapp' ); ?></a></p> -->
244
 
245
  </div>
@@ -283,6 +304,7 @@ class HT_CTC_Admin_Customize_Styles {
283
 
284
  $cta_textcolor = ( isset( $options['cta_textcolor']) ) ? esc_attr( $options['cta_textcolor'] ) : '';
285
  $cta_bgcolor = ( isset( $options['cta_bgcolor']) ) ? esc_attr( $options['cta_bgcolor'] ) : '';
 
286
 
287
  ?>
288
 
@@ -310,7 +332,7 @@ class HT_CTC_Admin_Customize_Styles {
310
  </div>
311
 
312
  <!-- call to action - Text color -->
313
- <div class="row cta_textcolor">
314
  <div class="col s6">
315
  <p><?php _e( 'Call to Action - Text Color', 'click-to-chat-for-whatsapp' ); ?></p>
316
  </div>
@@ -320,7 +342,7 @@ class HT_CTC_Admin_Customize_Styles {
320
  </div>
321
 
322
  <!-- call to action - background color -->
323
- <div class="row cta_bgcolor">
324
  <div class="col s6">
325
  <p><?php _e( 'Call to Action - Background Color', 'click-to-chat-for-whatsapp' ); ?></p>
326
  </div>
@@ -329,6 +351,16 @@ class HT_CTC_Admin_Customize_Styles {
329
  </div>
330
  </div>
331
 
 
 
 
 
 
 
 
 
 
 
332
 
333
 
334
  </div>
@@ -361,6 +393,7 @@ class HT_CTC_Admin_Customize_Styles {
361
  $select_cta_type = ( isset( $options['cta_type']) ) ? esc_attr( $options['cta_type'] ) : '';
362
  $cta_textcolor = ( isset( $options['cta_textcolor']) ) ? esc_attr( $options['cta_textcolor'] ) : '';
363
  $cta_bgcolor = ( isset( $options['cta_bgcolor']) ) ? esc_attr( $options['cta_bgcolor'] ) : '';
 
364
  ?>
365
  <ul class="collapsible ht_ctc_s3" data-collapsible="accordion">
366
  <li>
@@ -403,7 +436,7 @@ class HT_CTC_Admin_Customize_Styles {
403
  </div>
404
 
405
  <!-- call to action - Text color -->
406
- <div class="row cta_textcolor">
407
  <div class="col s6">
408
  <p><?php _e( 'Call to Action - Text Color', 'click-to-chat-for-whatsapp' ); ?></p>
409
  </div>
@@ -413,7 +446,7 @@ class HT_CTC_Admin_Customize_Styles {
413
  </div>
414
 
415
  <!-- call to action - background color -->
416
- <div class="row cta_bgcolor">
417
  <div class="col s6">
418
  <p><?php _e( 'Call to Action - Background Color', 'click-to-chat-for-whatsapp' ); ?></p>
419
  </div>
@@ -422,6 +455,17 @@ class HT_CTC_Admin_Customize_Styles {
422
  </div>
423
  </div>
424
 
 
 
 
 
 
 
 
 
 
 
 
425
  </div>
426
  </div>
427
  </li>
@@ -549,6 +593,7 @@ class HT_CTC_Admin_Customize_Styles {
549
 
550
  $cta_textcolor = ( isset( $options['cta_textcolor']) ) ? esc_attr( $options['cta_textcolor'] ) : '';
551
  $cta_bgcolor = ( isset( $options['cta_bgcolor']) ) ? esc_attr( $options['cta_bgcolor'] ) : '';
 
552
 
553
  ?>
554
 
@@ -576,7 +621,7 @@ class HT_CTC_Admin_Customize_Styles {
576
  </div>
577
 
578
  <!-- call to action - Text color -->
579
- <div class="row cta_textcolor">
580
  <div class="col s6">
581
  <p><?php _e( 'Call to Action - Text Color', 'click-to-chat-for-whatsapp' ); ?></p>
582
  </div>
@@ -586,7 +631,7 @@ class HT_CTC_Admin_Customize_Styles {
586
  </div>
587
 
588
  <!-- call to action - background color -->
589
- <div class="row cta_bgcolor">
590
  <div class="col s6">
591
  <p><?php _e( 'Call to Action - Background Color', 'click-to-chat-for-whatsapp' ); ?></p>
592
  </div>
@@ -595,6 +640,18 @@ class HT_CTC_Admin_Customize_Styles {
595
  </div>
596
  </div>
597
 
 
 
 
 
 
 
 
 
 
 
 
 
598
  </div>
599
  </div>
600
  </li>
@@ -1046,7 +1103,7 @@ class HT_CTC_Admin_Customize_Styles {
1046
  <p><?php _e( 'Display - Call to Action', 'click-to-chat-for-whatsapp' ); ?></p>
1047
  </div>
1048
  <div class="input-field col s6">
1049
- <select name="<?php echo $dbrow ?>[cta_type]" class="select_s7_cta_type">
1050
  <option value="hover" <?php echo $select_cta_type == 'hover' ? 'SELECTED' : ''; ?> >On Hover</option>
1051
  <option value="show" <?php echo $select_cta_type == 'show' ? 'SELECTED' : ''; ?> >Show</option>
1052
  <option value="hide" <?php echo $select_cta_type == 'hide' ? 'SELECTED' : ''; ?> >Hide</option>
@@ -1054,7 +1111,7 @@ class HT_CTC_Admin_Customize_Styles {
1054
  </div>
1055
  </div>
1056
  <!-- call to action - Text color -->
1057
- <div class="row cta_textcolor">
1058
  <div class="col s6">
1059
  <p><?php _e( 'Text Color', 'click-to-chat-for-whatsapp' ); ?></p>
1060
  </div>
@@ -1064,7 +1121,7 @@ class HT_CTC_Admin_Customize_Styles {
1064
  </div>
1065
 
1066
  <!-- call to action - background color -->
1067
- <div class="row cta_bgcolor">
1068
  <div class="col s6">
1069
  <p><?php _e( 'Background Color', 'click-to-chat-for-whatsapp' ); ?></p>
1070
  </div>
@@ -1110,7 +1167,7 @@ class HT_CTC_Admin_Customize_Styles {
1110
  <p><?php _e( 'Display - Call to Action', 'click-to-chat-for-whatsapp' ); ?></p>
1111
  </div>
1112
  <div class="input-field col s6">
1113
- <select name="<?php echo $dbrow ?>[cta_type]" class="select_s7_cta_type">
1114
  <option value="hover" <?php echo $select_cta_type == 'hover' ? 'SELECTED' : ''; ?> >On Hover</option>
1115
  <option value="show" <?php echo $select_cta_type == 'show' ? 'SELECTED' : ''; ?> >Show</option>
1116
  </select>
@@ -1513,6 +1570,7 @@ class HT_CTC_Admin_Customize_Styles {
1513
  's99_desktop_img_width',
1514
  's99_mobile_img_height',
1515
  's99_mobile_img_width',
 
1516
  );
1517
 
1518
  foreach ($input as $key => $value) {
197
 
198
  $options = get_option('ht_ctc_s1');
199
  $dbrow = 'ht_ctc_s1';
200
+
201
+ $s1_text_color = ( isset( $options['s1_text_color']) ) ? esc_attr( $options['s1_text_color'] ) : '';
202
+ $s1_bg_color = ( isset( $options['s1_bg_color']) ) ? esc_attr( $options['s1_bg_color'] ) : '';
203
+
204
  ?>
205
  <ul class="collapsible ht_ctc_s1" data-collapsible="accordion">
206
  <li>
207
  <div class="collapsible-header"><?php _e( 'Style 1', 'click-to-chat-for-whatsapp' ); ?></div>
208
  <div class="collapsible-body">
209
 
 
 
 
210
  <p class="description"><?php _e( 'Style-1 is a button that appears like themes button', 'click-to-chat-for-whatsapp' ); ?></p>
211
  <br><br>
212
 
241
  </div>
242
  </div>
243
 
244
+ <!-- Text color -->
245
+ <div class="row">
246
+ <div class="col s6">
247
+ <p><?php _e( 'Text Color', 'click-to-chat-for-whatsapp' ); ?></p>
248
+ </div>
249
+ <div class="input-field col s6">
250
+ <input class="ht-ctc-color" name="<?php echo $dbrow ?>[s1_text_color]" value="<?php echo $s1_text_color ?>" type="text">
251
+ </div>
252
+ </div>
253
+
254
+ <!-- background color -->
255
+ <div class="row">
256
+ <div class="col s6">
257
+ <p><?php _e( 'Background Color', 'click-to-chat-for-whatsapp' ); ?></p>
258
+ </div>
259
+ <div class="input-field col s6">
260
+ <input class="ht-ctc-color" name="<?php echo $dbrow ?>[s1_bg_color]" value="<?php echo $s1_bg_color ?>" type="text">
261
+ </div>
262
+ </div>
263
+
264
  <!-- <p class="description"><a target="_blank" href="https://holithemes.com/plugins/click-to-chat/style-1/"><?php _e( 'Style-1', 'click-to-chat-for-whatsapp' ); ?></a></p> -->
265
 
266
  </div>
304
 
305
  $cta_textcolor = ( isset( $options['cta_textcolor']) ) ? esc_attr( $options['cta_textcolor'] ) : '';
306
  $cta_bgcolor = ( isset( $options['cta_bgcolor']) ) ? esc_attr( $options['cta_bgcolor'] ) : '';
307
+ $cta_font_size = ( isset( $options['cta_font_size']) ) ? esc_attr( $options['cta_font_size'] ) : '';
308
 
309
  ?>
310
 
332
  </div>
333
 
334
  <!-- call to action - Text color -->
335
+ <div class="row cta_textcolor cta_stick">
336
  <div class="col s6">
337
  <p><?php _e( 'Call to Action - Text Color', 'click-to-chat-for-whatsapp' ); ?></p>
338
  </div>
342
  </div>
343
 
344
  <!-- call to action - background color -->
345
+ <div class="row cta_bgcolor cta_stick">
346
  <div class="col s6">
347
  <p><?php _e( 'Call to Action - Background Color', 'click-to-chat-for-whatsapp' ); ?></p>
348
  </div>
351
  </div>
352
  </div>
353
 
354
+ <!-- font size -->
355
+ <div class="row cta_font_size cta_stick">
356
+ <div class="col s6">
357
+ <p><?php _e( 'Font Size', 'click-to-chat-for-whatsapp' ); ?></p>
358
+ </div>
359
+ <div class="input-field col s6">
360
+ <input name="<?php echo $dbrow ?>[cta_font_size]" value="<?php echo $cta_font_size ?>" id="s2_cta_font_size" type="text" class="" >
361
+ <label for="s2_cta_font_size"><?php _e( 'Font Size (e.g. 15px)', 'click-to-chat-for-whatsapp' ); ?></label>
362
+ </div>
363
+ </div>
364
 
365
 
366
  </div>
393
  $select_cta_type = ( isset( $options['cta_type']) ) ? esc_attr( $options['cta_type'] ) : '';
394
  $cta_textcolor = ( isset( $options['cta_textcolor']) ) ? esc_attr( $options['cta_textcolor'] ) : '';
395
  $cta_bgcolor = ( isset( $options['cta_bgcolor']) ) ? esc_attr( $options['cta_bgcolor'] ) : '';
396
+ $cta_font_size = ( isset( $options['cta_font_size']) ) ? esc_attr( $options['cta_font_size'] ) : '';
397
  ?>
398
  <ul class="collapsible ht_ctc_s3" data-collapsible="accordion">
399
  <li>
436
  </div>
437
 
438
  <!-- call to action - Text color -->
439
+ <div class="row cta_textcolor cta_stick">
440
  <div class="col s6">
441
  <p><?php _e( 'Call to Action - Text Color', 'click-to-chat-for-whatsapp' ); ?></p>
442
  </div>
446
  </div>
447
 
448
  <!-- call to action - background color -->
449
+ <div class="row cta_bgcolor cta_stick">
450
  <div class="col s6">
451
  <p><?php _e( 'Call to Action - Background Color', 'click-to-chat-for-whatsapp' ); ?></p>
452
  </div>
455
  </div>
456
  </div>
457
 
458
+ <!-- font size -->
459
+ <div class="row cta_font_size cta_stick">
460
+ <div class="col s6">
461
+ <p><?php _e( 'Font Size', 'click-to-chat-for-whatsapp' ); ?></p>
462
+ </div>
463
+ <div class="input-field col s6">
464
+ <input name="<?php echo $dbrow ?>[cta_font_size]" value="<?php echo $cta_font_size ?>" id="s3_cta_font_size" type="text" class="" >
465
+ <label for="s3_cta_font_size"><?php _e( 'Font Size (e.g. 15px)', 'click-to-chat-for-whatsapp' ); ?></label>
466
+ </div>
467
+ </div>
468
+
469
  </div>
470
  </div>
471
  </li>
593
 
594
  $cta_textcolor = ( isset( $options['cta_textcolor']) ) ? esc_attr( $options['cta_textcolor'] ) : '';
595
  $cta_bgcolor = ( isset( $options['cta_bgcolor']) ) ? esc_attr( $options['cta_bgcolor'] ) : '';
596
+ $cta_font_size = ( isset( $options['cta_font_size']) ) ? esc_attr( $options['cta_font_size'] ) : '';
597
 
598
  ?>
599
 
621
  </div>
622
 
623
  <!-- call to action - Text color -->
624
+ <div class="row cta_textcolor cta_stick">
625
  <div class="col s6">
626
  <p><?php _e( 'Call to Action - Text Color', 'click-to-chat-for-whatsapp' ); ?></p>
627
  </div>
631
  </div>
632
 
633
  <!-- call to action - background color -->
634
+ <div class="row cta_bgcolor cta_stick">
635
  <div class="col s6">
636
  <p><?php _e( 'Call to Action - Background Color', 'click-to-chat-for-whatsapp' ); ?></p>
637
  </div>
640
  </div>
641
  </div>
642
 
643
+ <!-- font size -->
644
+ <div class="row cta_font_size cta_stick">
645
+ <div class="col s6">
646
+ <p><?php _e( 'Font Size', 'click-to-chat-for-whatsapp' ); ?></p>
647
+ </div>
648
+ <div class="input-field col s6">
649
+ <input name="<?php echo $dbrow ?>[cta_font_size]" value="<?php echo $cta_font_size ?>" id="s3_1_cta_font_size" type="text" class="" >
650
+ <label for="s3_1_cta_font_size"><?php _e( 'Font Size (e.g. 15px)', 'click-to-chat-for-whatsapp' ); ?></label>
651
+ </div>
652
+ </div>
653
+
654
+
655
  </div>
656
  </div>
657
  </li>
1103
  <p><?php _e( 'Display - Call to Action', 'click-to-chat-for-whatsapp' ); ?></p>
1104
  </div>
1105
  <div class="input-field col s6">
1106
+ <select name="<?php echo $dbrow ?>[cta_type]" class="select_cta_type">
1107
  <option value="hover" <?php echo $select_cta_type == 'hover' ? 'SELECTED' : ''; ?> >On Hover</option>
1108
  <option value="show" <?php echo $select_cta_type == 'show' ? 'SELECTED' : ''; ?> >Show</option>
1109
  <option value="hide" <?php echo $select_cta_type == 'hide' ? 'SELECTED' : ''; ?> >Hide</option>
1111
  </div>
1112
  </div>
1113
  <!-- call to action - Text color -->
1114
+ <div class="row cta_textcolor cta_stick">
1115
  <div class="col s6">
1116
  <p><?php _e( 'Text Color', 'click-to-chat-for-whatsapp' ); ?></p>
1117
  </div>
1121
  </div>
1122
 
1123
  <!-- call to action - background color -->
1124
+ <div class="row cta_bgcolor cta_stick">
1125
  <div class="col s6">
1126
  <p><?php _e( 'Background Color', 'click-to-chat-for-whatsapp' ); ?></p>
1127
  </div>
1167
  <p><?php _e( 'Display - Call to Action', 'click-to-chat-for-whatsapp' ); ?></p>
1168
  </div>
1169
  <div class="input-field col s6">
1170
+ <select name="<?php echo $dbrow ?>[cta_type]" class="select_cta_type">
1171
  <option value="hover" <?php echo $select_cta_type == 'hover' ? 'SELECTED' : ''; ?> >On Hover</option>
1172
  <option value="show" <?php echo $select_cta_type == 'show' ? 'SELECTED' : ''; ?> >Show</option>
1173
  </select>
1570
  's99_desktop_img_width',
1571
  's99_mobile_img_height',
1572
  's99_mobile_img_width',
1573
+ 'cta_font_size',
1574
  );
1575
 
1576
  foreach ($input as $key => $value) {
new/admin/class-ht-ctc-admin-group-page.php CHANGED
@@ -82,6 +82,7 @@ class HT_CTC_Admin_Group_Page {
82
  ?>
83
  <h1>Group Chat/Invite</h1>
84
  <?php
 
85
  }
86
 
87
 
82
  ?>
83
  <h1>Group Chat/Invite</h1>
84
  <?php
85
+ do_action('ht_ctc_ah_admin' );
86
  }
87
 
88
 
new/admin/class-ht-ctc-admin-main-page.php CHANGED
@@ -121,10 +121,9 @@ class HT_CTC_Admin_Main_Page {
121
 
122
  public function chat_settings_section_cb() {
123
  ?>
124
- <h1>Click to Chat ( New Interface )</h1>
125
- <br>
126
- <h1 id="chat_settings">Chat Settings</h1>
127
  <?php
 
128
  }
129
 
130
 
121
 
122
  public function chat_settings_section_cb() {
123
  ?>
124
+ <h1 id="chat_settings">Click to Chat - Chat Settings </h1>
 
 
125
  <?php
126
+ do_action('ht_ctc_ah_admin' );
127
  }
128
 
129
 
new/admin/class-ht-ctc-admin-other-settings.php CHANGED
@@ -75,6 +75,7 @@ class HT_CTC_Admin_Other_Settings {
75
  ?>
76
  <h1>Other Settings</h1>
77
  <?php
 
78
  }
79
 
80
  function ht_ctc_analytics_cb() {
@@ -178,10 +179,8 @@ class HT_CTC_Admin_Other_Settings {
178
  <div class="collapsible-header"><?php _e( 'Animations', 'click-to-chat-for-whatsapp' ); ?></div>
179
  <div class="collapsible-body">
180
 
181
- <!-- <p class="description"><?php _e( "Animations for floating styles", 'click-to-chat-for-whatsapp' ); ?> -->
182
- <p class="description"><?php _e( "We are planning to improve this feature. please contact us, for any suggestions.", 'click-to-chat-for-whatsapp' ); ?>
183
  <p class="description"><a target="_blank" href="https://holithemes.com/plugins/click-to-chat/animations/">Animations</a></p>
184
- <br><br><br><br>
185
 
186
 
187
  <!-- animation on load -->
@@ -190,7 +189,7 @@ class HT_CTC_Admin_Other_Settings {
190
  <p><?php _e( 'Animations', 'click-to-chat-for-whatsapp' ); ?></p>
191
  </div>
192
  <div class="input-field col s6">
193
- <select name="ht_ctc_othersettings[an_type]" class="an_type">
194
  <?php
195
 
196
  foreach ( $an_list as $value ) {
@@ -206,7 +205,7 @@ class HT_CTC_Admin_Other_Settings {
206
  </div>
207
 
208
  <!-- animation delay -->
209
- <div class="row">
210
  <div class="col s6">
211
  <p><?php _e( 'Animation Delay', 'click-to-chat-for-whatsapp' ); ?></p>
212
  </div>
@@ -218,7 +217,7 @@ class HT_CTC_Admin_Other_Settings {
218
  </div>
219
 
220
  <!-- animation iteration -->
221
- <div class="row">
222
  <div class="col s6">
223
  <p><?php _e( 'Animation Iteration', 'click-to-chat-for-whatsapp' ); ?></p>
224
  </div>
@@ -261,12 +260,13 @@ class HT_CTC_Admin_Other_Settings {
261
  }
262
 
263
  // Other settings
264
- // fb analytics
265
  // detect device
266
  function ht_ctc_othersettings_cb() {
267
 
268
  $options = get_option('ht_ctc_othersettings');
269
  $dbrow = 'ht_ctc_othersettings';
 
 
270
  ?>
271
 
272
  <ul class="collapsible" data-collapsible="accordion" id="ht_ctc_othersettings">
@@ -274,9 +274,6 @@ class HT_CTC_Admin_Other_Settings {
274
  <div class="collapsible-header"><?php _e( 'Other Settings', 'click-to-chat-for-whatsapp' ); ?></div>
275
  <div class="collapsible-body">
276
 
277
- <!-- not make empty table -->
278
- <input name="ht_ctc_othersettings[hello]" value="hello" id="" type="hidden" class="hide" >
279
-
280
  <?php
281
  // cache issue while selecting styles
282
  if ( isset( $options['select_styles_issue'] ) ) {
@@ -300,8 +297,21 @@ class HT_CTC_Admin_Other_Settings {
300
  <?php
301
  }
302
  ?>
303
- <p class="description"> - <a target="_blank" href="https://holithemes.com/plugins/click-to-chat/select-styles/"><?php _e( 'more info', 'click-to-chat-for-whatsapp' ); ?></a> </p>
304
  <br>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
305
  <?php
306
 
307
  // enable group
@@ -357,62 +367,84 @@ class HT_CTC_Admin_Other_Settings {
357
  <br>
358
 
359
  <!-- chat -->
360
- <p class="description"><?php _e( "Chat settings are enabled by default and can't disbale. If like to hide chat on all pages select", 'click-to-chat-for-whatsapp' ); ?> <a target="_blank" href="<?php echo admin_url( 'admin.php?page=click-to-chat#showhide_settings' ); ?>"><?php _e( 'show on selected pages', 'click-to-chat-for-whatsapp' ); ?></a> </p>
361
- <p class="description"> - <a target="_blank" href="<?php echo admin_url( 'admin.php?page=click-to-chat' ); ?>"><?php _e( 'Chat Settings page', 'click-to-chat-for-whatsapp' ); ?></a> <br> - <a target="_blank" href="https://holithemes.com/plugins/click-to-chat/enable-chat"><?php _e( 'more info', 'click-to-chat-for-whatsapp' ); ?></a> </p>
362
- </p>
 
 
 
 
 
363
  <br>
 
 
 
 
 
 
364
 
 
365
  <?php
366
- // Facebook Analytics
367
- if ( isset( $options['fb_analytics'] ) ) {
 
368
  ?>
369
  <p>
370
  <label>
371
- <input name="ht_ctc_othersettings[fb_analytics]" type="checkbox" value="1" <?php checked( $options['fb_analytics'], 1 ); ?> id="fb_analytics" />
372
- <span><?php _e( 'Facebook Analytics', 'click-to-chat-for-whatsapp' ); ?></span>
373
  </label>
374
  </p>
375
  <?php
376
- } else {
377
- ?>
378
- <p>
379
- <label>
380
- <input name="ht_ctc_othersettings[fb_analytics]" type="checkbox" value="1" id="fb_analytics" />
381
- <span><?php _e( 'Facebook Analytics', 'click-to-chat-for-whatsapp' ); ?></span>
382
- </label>
383
- </p>
384
- <?php
385
- }
386
  ?>
387
- <p class="description"> <?php _e( 'This feature is', 'click-to-chat-for-whatsapp' ); ?> <b><?php _e( 'depreacted', 'click-to-chat-for-whatsapp' ); ?></b> <?php _e( 'in the favor of Facebook Pixel', 'click-to-chat-for-whatsapp' ); ?></p>
388
- <p class="description"> <?php _e( 'If Facebook Analytics installed - creates an Event there', 'click-to-chat-for-whatsapp' ); ?> - <a target="_blank" href="https://holithemes.com/plugins/click-to-chat/facebook-analytics/"><?php _e( 'more info', 'click-to-chat-for-whatsapp' ); ?></a> </p>
389
- <br><br><br>
390
-
 
 
391
  <?php
 
392
 
393
- // delete options
394
- if ( isset( $options['delete_options'] ) ) {
395
- ?>
396
- <p>
397
- <label>
398
- <input name="ht_ctc_othersettings[delete_options]" type="checkbox" value="1" <?php checked( $options['delete_options'], 1 ); ?> id="delete_options" />
399
- <span><?php _e( 'Delete this plugin settings when uninstalls', 'click-to-chat-for-whatsapp' ); ?></span>
400
- </label>
401
- </p>
402
- <?php
403
- } else {
404
- ?>
405
- <p>
406
- <label>
407
- <input name="ht_ctc_othersettings[delete_options]" type="checkbox" value="1" id="delete_options" />
408
- <span><?php _e( 'Delete this plugin settings when uninstalls', 'click-to-chat-for-whatsapp' ); ?></span>
409
- </label>
410
- </p>
411
- <?php
412
- }
413
 
 
 
414
  ?>
415
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
416
 
417
 
418
 
75
  ?>
76
  <h1>Other Settings</h1>
77
  <?php
78
+ do_action('ht_ctc_ah_admin' );
79
  }
80
 
81
  function ht_ctc_analytics_cb() {
179
  <div class="collapsible-header"><?php _e( 'Animations', 'click-to-chat-for-whatsapp' ); ?></div>
180
  <div class="collapsible-body">
181
 
 
 
182
  <p class="description"><a target="_blank" href="https://holithemes.com/plugins/click-to-chat/animations/">Animations</a></p>
183
+ <br><br><br>
184
 
185
 
186
  <!-- animation on load -->
189
  <p><?php _e( 'Animations', 'click-to-chat-for-whatsapp' ); ?></p>
190
  </div>
191
  <div class="input-field col s6">
192
+ <select name="ht_ctc_othersettings[an_type]" class="select_an_type">
193
  <?php
194
 
195
  foreach ( $an_list as $value ) {
205
  </div>
206
 
207
  <!-- animation delay -->
208
+ <div class="row an_delay">
209
  <div class="col s6">
210
  <p><?php _e( 'Animation Delay', 'click-to-chat-for-whatsapp' ); ?></p>
211
  </div>
217
  </div>
218
 
219
  <!-- animation iteration -->
220
+ <div class="row an_itr">
221
  <div class="col s6">
222
  <p><?php _e( 'Animation Iteration', 'click-to-chat-for-whatsapp' ); ?></p>
223
  </div>
260
  }
261
 
262
  // Other settings
 
263
  // detect device
264
  function ht_ctc_othersettings_cb() {
265
 
266
  $options = get_option('ht_ctc_othersettings');
267
  $dbrow = 'ht_ctc_othersettings';
268
+
269
+ $li_active_gr_sh = ( isset( $options['enable_group'] ) || isset( $options['enable_share'] ) ) ? "class='active'" : '';
270
  ?>
271
 
272
  <ul class="collapsible" data-collapsible="accordion" id="ht_ctc_othersettings">
274
  <div class="collapsible-header"><?php _e( 'Other Settings', 'click-to-chat-for-whatsapp' ); ?></div>
275
  <div class="collapsible-body">
276
 
 
 
 
277
  <?php
278
  // cache issue while selecting styles
279
  if ( isset( $options['select_styles_issue'] ) ) {
297
  <?php
298
  }
299
  ?>
 
300
  <br>
301
+
302
+ </div>
303
+ </li>
304
+ </ul>
305
+
306
+
307
+ <br>
308
+
309
+ <!-- enable group, share features -->
310
+ <ul class="collapsible" data-collapsible="accordion" id="ht_ctc_enable_share_group">
311
+ <li <?php echo $li_active_gr_sh; ?>>
312
+ <div class="collapsible-header"><?php _e( 'Group, Share features', 'click-to-chat-for-whatsapp' ); ?></div>
313
+ <div class="collapsible-body">
314
+
315
  <?php
316
 
317
  // enable group
367
  <br>
368
 
369
  <!-- chat -->
370
+ <p class="description"><?php _e( "Chat settings are enabled by default. If like to hide chat on all pages select", 'click-to-chat-for-whatsapp' ); ?> <a target="_blank" href="<?php echo admin_url( 'admin.php?page=click-to-chat#showhide_settings' ); ?>"><?php _e( 'show on selected pages', 'click-to-chat-for-whatsapp' ); ?></a> - <a target="_blank" href="https://holithemes.com/plugins/click-to-chat/enable-chat"><?php _e( 'more info', 'click-to-chat-for-whatsapp' ); ?></a> </p>
371
+ <br>
372
+
373
+
374
+ </div>
375
+ </li>
376
+ </ul>
377
+
378
  <br>
379
+
380
+ <!-- Troubleshoot, Debug, .. -->
381
+ <ul class="collapsible" data-collapsible="accordion" id="ht_ctc_debug">
382
+ <li>
383
+ <div class="collapsible-header"><?php _e( 'Debug, Troubleshoot, ..', 'click-to-chat-for-whatsapp' ); ?></div>
384
+ <div class="collapsible-body">
385
 
386
+
387
  <?php
388
+
389
+ // debug mode
390
+ if ( isset( $options['debug_mode'] ) ) {
391
  ?>
392
  <p>
393
  <label>
394
+ <input name="ht_ctc_othersettings[debug_mode]" type="checkbox" value="1" <?php checked( $options['debug_mode'], 1 ); ?> id="debug_mode" />
395
+ <span><?php _e( 'Debug mode', 'click-to-chat-for-whatsapp' ); ?></span>
396
  </label>
397
  </p>
398
  <?php
399
+ } else {
 
 
 
 
 
 
 
 
 
400
  ?>
401
+ <p>
402
+ <label>
403
+ <input name="ht_ctc_othersettings[debug_mode]" type="checkbox" value="1" id="debug_mode" />
404
+ <span><?php _e( 'Debug mode', 'click-to-chat-for-whatsapp' ); ?></span>
405
+ </label>
406
+ </p>
407
  <?php
408
+ }
409
 
410
+ ?>
411
+
412
+ <br>
413
+ <p class="description">
414
+ <ul>
415
+ Troubleshoot
416
+ <ol>Clear Cache</ol>
417
+ <ol>Check Display Settings</ol>
418
+ </ul>
419
+ </p>
420
+ <!-- <p class="description">If still an issue: Plesae enable debug mode and Contact us</p> -->
421
+ <p class="description">If still an issue: Please Contact us. Mail: <a href="mailto:ctc@holithemes.com">ctc@holithemes.com</a>, <a target="_blank" href="http://api.whatsapp.com/send?phone=919494429789&text=Hi%20HoliThemes,%20I%20have%20a%20question">WhatsApp Us</a></p>
422
+ <br>
423
+
424
+ <?php
 
 
 
 
 
425
 
426
+ // delete options
427
+ if ( isset( $options['delete_options'] ) ) {
428
  ?>
429
+ <p>
430
+ <label>
431
+ <input name="ht_ctc_othersettings[delete_options]" type="checkbox" value="1" <?php checked( $options['delete_options'], 1 ); ?> id="delete_options" />
432
+ <span><?php _e( 'Delete this plugin settings when uninstalls', 'click-to-chat-for-whatsapp' ); ?></span>
433
+ </label>
434
+ </p>
435
+ <?php
436
+ } else {
437
+ ?>
438
+ <p>
439
+ <label>
440
+ <input name="ht_ctc_othersettings[delete_options]" type="checkbox" value="1" id="delete_options" />
441
+ <span><?php _e( 'Delete this plugin settings when uninstalls', 'click-to-chat-for-whatsapp' ); ?></span>
442
+ </label>
443
+ </p>
444
+ <?php
445
+ }
446
+
447
+ ?>
448
 
449
 
450
 
new/admin/class-ht-ctc-admin-share-page.php CHANGED
@@ -83,6 +83,7 @@ class HT_CTC_Admin_Share_Page {
83
  ?>
84
  <h1><?php _e( 'Share', 'click-to-chat-for-whatsapp' ); ?></h1>
85
  <?php
 
86
  }
87
 
88
 
83
  ?>
84
  <h1><?php _e( 'Share', 'click-to-chat-for-whatsapp' ); ?></h1>
85
  <?php
86
+ do_action('ht_ctc_ah_admin' );
87
  }
88
 
89
 
new/admin/class-ht-ctc-db.php CHANGED
@@ -17,6 +17,8 @@ if ( ! class_exists( 'HT_CTC_DB' ) ) :
17
  class HT_CTC_DB {
18
 
19
 
 
 
20
  public function __construct() {
21
  $this->db();
22
  }
@@ -27,9 +29,18 @@ class HT_CTC_DB {
27
  *
28
  */
29
  public function db() {
 
 
 
 
30
 
31
- // to update db value before
32
- $this->ht_ctc_updatedb();
 
 
 
 
 
33
 
34
  $this->ht_ctc_othersettings();
35
 
@@ -55,38 +66,9 @@ class HT_CTC_DB {
55
  $this->ht_ctc_plugin_details();
56
  $this->ht_ctc_one_time();
57
 
58
- // $this->ht_ctc_updatedb_last();
59
-
60
- }
61
-
62
-
63
- /**
64
- * update db - First
65
- *
66
- */
67
- public function ht_ctc_updatedb() {
68
-
69
- $ht_ctc_plugin_details = get_option('ht_ctc_plugin_details');
70
- $ht_ctc_chat_options = get_option('ht_ctc_chat_options');
71
- $ht_ctc_group = get_option('ht_ctc_group');
72
- $ht_ctc_share = get_option('ht_ctc_share');
73
-
74
- // only if already installed.
75
- if ( isset( $ht_ctc_plugin_details['version'] ) ) {
76
-
77
- // v3: if not yet updated to v3 or above (in v3 $ht_ctc_plugin_details['v3'] is added)
78
- if ( !isset( $ht_ctc_plugin_details['v3'] ) ) {
79
- $this->v3_update();
80
- }
81
-
82
- }
83
-
84
-
85
  }
86
 
87
 
88
-
89
-
90
  /**
91
  * table name: "ht_ctc_othersettings"
92
  *
@@ -98,7 +80,6 @@ class HT_CTC_DB {
98
  * enable_share enable_share
99
  * google_analytics
100
  * fb_pixel
101
- * fb_analytics facebook analytics using js sdk
102
  * delete options on plugin uninstall
103
  *
104
  */
@@ -111,10 +92,8 @@ class HT_CTC_DB {
111
  'show_effect' => 'no-show-effects',
112
  );
113
 
114
- $ht_ctc_plugin_details = get_option('ht_ctc_plugin_details');
115
-
116
  // enable by default for new installs.
117
- if ( !isset ( $ht_ctc_plugin_details['version'] ) ) {
118
  $values['google_analytics'] = '1';
119
  $values['fb_pixel'] = '1';
120
  $values['show_effect'] = 'From Corner';
@@ -331,7 +310,8 @@ class HT_CTC_DB {
331
 
332
  $style_1 = array(
333
 
334
- 'hello' => 'world',
 
335
 
336
  );
337
 
@@ -364,10 +344,10 @@ class HT_CTC_DB {
364
 
365
  );
366
 
367
- $ht_ctc_plugin_details = get_option('ht_ctc_plugin_details');
368
-
369
- if ( !isset ( $ht_ctc_plugin_details['version'] ) ) {
370
  $style_2['cta_type'] = 'hover';
 
371
  } else {
372
  $style_2['cta_type'] = 'hide';
373
  }
@@ -398,11 +378,10 @@ class HT_CTC_DB {
398
 
399
  );
400
 
401
- $ht_ctc_plugin_details = get_option('ht_ctc_plugin_details');
402
-
403
  // @since 3.0 cta
404
- if ( !isset ( $ht_ctc_plugin_details['version'] ) ) {
405
  $style_3['cta_type'] = 'hover';
 
406
  } else {
407
  $style_3['cta_type'] = 'hide';
408
  }
@@ -452,11 +431,10 @@ class HT_CTC_DB {
452
 
453
  );
454
 
455
- $ht_ctc_plugin_details = get_option('ht_ctc_plugin_details');
456
-
457
- // cta
458
- if ( !isset ( $ht_ctc_plugin_details['version'] ) ) {
459
  $style_3_1['cta_type'] = 'hover';
 
460
  }
461
 
462
  $db_values = get_option( 'ht_ctc_s3_1', array() );
@@ -576,10 +554,8 @@ class HT_CTC_DB {
576
  'cta_bgcolor' => '#25d366',
577
  );
578
 
579
- $ht_ctc_plugin_details = get_option('ht_ctc_plugin_details');
580
-
581
  // if new install
582
- if ( !isset ( $ht_ctc_plugin_details['version'] ) ) {
583
  $style_7['cta_type'] = 'hover';
584
  }
585
 
@@ -649,10 +625,8 @@ class HT_CTC_DB {
649
 
650
  );
651
 
652
- $ht_ctc_plugin_details = get_option('ht_ctc_plugin_details');
653
-
654
  // if new install
655
- if ( !isset ( $ht_ctc_plugin_details['version'] ) ) {
656
  $style_8['s8_text_size'] = '16px';
657
  $style_8['s8_icon_size'] = '16px';
658
  }
@@ -766,101 +740,6 @@ class HT_CTC_DB {
766
 
767
 
768
 
769
- /**
770
- * Database updates..
771
- */
772
-
773
- /**
774
- * updating to v3 or above.
775
- * - style 3 Extend to Style-3_1
776
- * - analytics, .. switch to other settings..
777
- */
778
- public function v3_update() {
779
-
780
- $ht_ctc_othersettings = get_option('ht_ctc_othersettings');
781
- $ht_ctc_plugin_details = get_option('ht_ctc_plugin_details');
782
- $ht_ctc_s3 = get_option('ht_ctc_s3');
783
-
784
- // ht_ctc_main_options to ht_ctc_othersettings
785
- $ht_ctc_main_options = get_option('ht_ctc_main_options');
786
-
787
- if ( $ht_ctc_main_options ) {
788
-
789
- $os = array(
790
- 'hello' => 'world',
791
- );
792
-
793
- if ( isset ( $ht_ctc_main_options['google_analytics'] ) ) {
794
- $os['google_analytics'] = '1';
795
- }
796
- if ( isset ( $ht_ctc_main_options['fb_pixel'] ) ) {
797
- $os['fb_pixel'] = '1';
798
- }
799
- if ( isset ( $ht_ctc_main_options['fb_analytics'] ) ) {
800
- $os['fb_analytics'] = '1';
801
- }
802
- if ( isset ( $ht_ctc_main_options['enable_group'] ) ) {
803
- $os['enable_group'] = '1';
804
- }
805
- if ( isset ( $ht_ctc_main_options['enable_share'] ) ) {
806
- $os['enable_share'] = '1';
807
- }
808
-
809
- $db_os = get_option( 'ht_ctc_othersettings', array() );
810
- $update_os = array_merge($os, $db_os);
811
- update_option('ht_ctc_othersettings', $update_os);
812
-
813
- // delete ht_ctc_main_options settings, as transfered to other settings
814
- delete_option( 'ht_ctc_main_options' );
815
- }
816
-
817
-
818
- // style-3 type extend is selected.. and if style 3 to 3_1
819
- if ( isset($ht_ctc_s3['s3_type']) && 'extend' == $ht_ctc_s3['s3_type'] ) {
820
-
821
- $ht_ctc_chat_options = get_option('ht_ctc_chat_options');
822
- $ht_ctc_group = get_option('ht_ctc_group');
823
- $ht_ctc_share = get_option('ht_ctc_share');
824
-
825
- // this works as s3 type extend came later version of select style dekstop, mobile.
826
- // chat
827
- if ( isset($ht_ctc_chat_options['style_desktop']) && isset($ht_ctc_chat_options['style_mobile']) ) {
828
- if ( '3' == $ht_ctc_chat_options['style_desktop']) {
829
- $ht_ctc_chat_options['style_desktop'] = '3_1';
830
- }
831
- if ( '3' == $ht_ctc_chat_options['style_mobile']) {
832
- $ht_ctc_chat_options['style_mobile'] = '3_1';
833
- }
834
- update_option( 'ht_ctc_chat_options', $ht_ctc_chat_options);
835
- }
836
-
837
- // group
838
- if (isset($ht_ctc_group['style_desktop'])) {
839
- if ( '3' == $ht_ctc_group['style_desktop']) {
840
- $ht_ctc_group['style_desktop'] = '3_1';
841
- }
842
- if ( '3' == $ht_ctc_group['style_mobile']) {
843
- $ht_ctc_group['style_mobile'] = '3_1';
844
- }
845
- update_option( 'ht_ctc_group', $ht_ctc_group);
846
- }
847
-
848
- // share
849
- if (isset($ht_ctc_share['style_desktop'])) {
850
- if ( '3' == $ht_ctc_share['style_desktop']) {
851
- $ht_ctc_share['style_desktop'] = '3_1';
852
- }
853
- if ( '3' == $ht_ctc_share['style_mobile']) {
854
- $ht_ctc_share['style_mobile'] = '3_1';
855
- }
856
- update_option( 'ht_ctc_share', $ht_ctc_share);
857
- }
858
-
859
- }
860
-
861
- }
862
-
863
-
864
 
865
  }
866
 
17
  class HT_CTC_DB {
18
 
19
 
20
+ public $os = '';
21
+
22
  public function __construct() {
23
  $this->db();
24
  }
29
  *
30
  */
31
  public function db() {
32
+
33
+ // @since 3.2.2
34
+ include_once HT_CTC_PLUGIN_DIR .'/new/admin/class-ht-ctc-update-db.php';
35
+
36
 
37
+ $this->os = array();
38
+ $ht_ctc_plugin_details = get_option('ht_ctc_plugin_details');
39
+
40
+ if ( is_array($ht_ctc_plugin_details) ) {
41
+ $this->os = $ht_ctc_plugin_details;
42
+ }
43
+
44
 
45
  $this->ht_ctc_othersettings();
46
 
66
  $this->ht_ctc_plugin_details();
67
  $this->ht_ctc_one_time();
68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  }
70
 
71
 
 
 
72
  /**
73
  * table name: "ht_ctc_othersettings"
74
  *
80
  * enable_share enable_share
81
  * google_analytics
82
  * fb_pixel
 
83
  * delete options on plugin uninstall
84
  *
85
  */
92
  'show_effect' => 'no-show-effects',
93
  );
94
 
 
 
95
  // enable by default for new installs.
96
+ if ( !isset ( $this->os['version'] ) ) {
97
  $values['google_analytics'] = '1';
98
  $values['fb_pixel'] = '1';
99
  $values['show_effect'] = 'From Corner';
310
 
311
  $style_1 = array(
312
 
313
+ 's1_text_color' => '',
314
+ 's1_bg_color' => '',
315
 
316
  );
317
 
344
 
345
  );
346
 
347
+ // new install
348
+ if ( !isset ( $this->os['version'] ) ) {
 
349
  $style_2['cta_type'] = 'hover';
350
+ $style_2['cta_font_size'] = '15px';
351
  } else {
352
  $style_2['cta_type'] = 'hide';
353
  }
378
 
379
  );
380
 
 
 
381
  // @since 3.0 cta
382
+ if ( !isset ( $this->os['version'] ) ) {
383
  $style_3['cta_type'] = 'hover';
384
+ $style_3['cta_font_size'] = '15px';
385
  } else {
386
  $style_3['cta_type'] = 'hide';
387
  }
431
 
432
  );
433
 
434
+ // new install
435
+ if ( !isset ( $this->os['version'] ) ) {
 
 
436
  $style_3_1['cta_type'] = 'hover';
437
+ $style_3_1['cta_font_size'] = '15px';
438
  }
439
 
440
  $db_values = get_option( 'ht_ctc_s3_1', array() );
554
  'cta_bgcolor' => '#25d366',
555
  );
556
 
 
 
557
  // if new install
558
+ if ( !isset ( $this->os['version'] ) ) {
559
  $style_7['cta_type'] = 'hover';
560
  }
561
 
625
 
626
  );
627
 
 
 
628
  // if new install
629
+ if ( !isset ( $this->os['version'] ) ) {
630
  $style_8['s8_text_size'] = '16px';
631
  $style_8['s8_icon_size'] = '16px';
632
  }
740
 
741
 
742
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
743
 
744
  }
745
 
new/admin/class-ht-ctc-update-db.php ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * When plugin upgrades
4
+ *
5
+ * update the db values to compatibile with in versions
6
+ *
7
+ * @package ctc
8
+ * @since 3.2.2
9
+ * @from ht-ctc-db.php -> db()
10
+ */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) exit;
13
+
14
+ if ( ! class_exists( 'HT_CTC_Update_DB' ) ) :
15
+
16
+ class HT_CTC_Update_DB {
17
+
18
+
19
+ public function __construct() {
20
+ $this->ht_ctc_updatedb();
21
+ }
22
+
23
+
24
+ /**
25
+ * update db - First
26
+ * @since 3.2.2 ( intiall 3.0, later 3.2.2 moved form class-ht-ctc-db.php )
27
+ */
28
+ public function ht_ctc_updatedb() {
29
+
30
+ $ht_ctc_plugin_details = get_option('ht_ctc_plugin_details');
31
+
32
+ // $ht_ctc_chat_options = get_option('ht_ctc_chat_options');
33
+ // $ht_ctc_group = get_option('ht_ctc_group');
34
+ // $ht_ctc_share = get_option('ht_ctc_share');
35
+
36
+ // only if already installed.
37
+ if ( isset( $ht_ctc_plugin_details['version'] ) ) {
38
+
39
+ // v3: if not yet updated to v3 or above (in v3 $ht_ctc_plugin_details['v3'] is added)
40
+ if ( !isset( $ht_ctc_plugin_details['v3'] ) ) {
41
+ $this->v3_update();
42
+ }
43
+
44
+ }
45
+
46
+
47
+ }
48
+
49
+
50
+ /**
51
+ * Database updates..
52
+ */
53
+
54
+ /**
55
+ * updating to v3 or above.
56
+ * - style 3 Extend to Style-3_1
57
+ * - analytics, .. switch to other settings..
58
+ */
59
+ public function v3_update() {
60
+
61
+ $ht_ctc_othersettings = get_option('ht_ctc_othersettings');
62
+ $ht_ctc_s3 = get_option('ht_ctc_s3');
63
+
64
+ // ht_ctc_main_options to ht_ctc_othersettings
65
+ $ht_ctc_main_options = get_option('ht_ctc_main_options');
66
+
67
+ if ( $ht_ctc_main_options ) {
68
+
69
+ $os = array(
70
+ 'hello' => 'world',
71
+ );
72
+
73
+ if ( isset ( $ht_ctc_main_options['google_analytics'] ) ) {
74
+ $os['google_analytics'] = '1';
75
+ }
76
+ if ( isset ( $ht_ctc_main_options['fb_pixel'] ) ) {
77
+ $os['fb_pixel'] = '1';
78
+ }
79
+ if ( isset ( $ht_ctc_main_options['enable_group'] ) ) {
80
+ $os['enable_group'] = '1';
81
+ }
82
+ if ( isset ( $ht_ctc_main_options['enable_share'] ) ) {
83
+ $os['enable_share'] = '1';
84
+ }
85
+
86
+ $db_os = get_option( 'ht_ctc_othersettings', array() );
87
+ $update_os = array_merge($os, $db_os);
88
+ update_option('ht_ctc_othersettings', $update_os);
89
+
90
+ // delete ht_ctc_main_options settings, as transfered to other settings
91
+ delete_option( 'ht_ctc_main_options' );
92
+ }
93
+
94
+
95
+ // style-3 type extend is selected.. and if style 3 to 3_1
96
+ if ( isset($ht_ctc_s3['s3_type']) && 'extend' == $ht_ctc_s3['s3_type'] ) {
97
+
98
+ $ht_ctc_chat_options = get_option('ht_ctc_chat_options');
99
+ $ht_ctc_group = get_option('ht_ctc_group');
100
+ $ht_ctc_share = get_option('ht_ctc_share');
101
+
102
+ // this works as s3 type extend came later version of select style dekstop, mobile.
103
+ // chat
104
+ if ( isset($ht_ctc_chat_options['style_desktop']) && isset($ht_ctc_chat_options['style_mobile']) ) {
105
+ if ( '3' == $ht_ctc_chat_options['style_desktop']) {
106
+ $ht_ctc_chat_options['style_desktop'] = '3_1';
107
+ }
108
+ if ( '3' == $ht_ctc_chat_options['style_mobile']) {
109
+ $ht_ctc_chat_options['style_mobile'] = '3_1';
110
+ }
111
+ update_option( 'ht_ctc_chat_options', $ht_ctc_chat_options);
112
+ }
113
+
114
+ // group
115
+ if (isset($ht_ctc_group['style_desktop'])) {
116
+ if ( '3' == $ht_ctc_group['style_desktop']) {
117
+ $ht_ctc_group['style_desktop'] = '3_1';
118
+ }
119
+ if ( '3' == $ht_ctc_group['style_mobile']) {
120
+ $ht_ctc_group['style_mobile'] = '3_1';
121
+ }
122
+ update_option( 'ht_ctc_group', $ht_ctc_group);
123
+ }
124
+
125
+ // share
126
+ if (isset($ht_ctc_share['style_desktop'])) {
127
+ if ( '3' == $ht_ctc_share['style_desktop']) {
128
+ $ht_ctc_share['style_desktop'] = '3_1';
129
+ }
130
+ if ( '3' == $ht_ctc_share['style_mobile']) {
131
+ $ht_ctc_share['style_mobile'] = '3_1';
132
+ }
133
+ update_option( 'ht_ctc_share', $ht_ctc_share);
134
+ }
135
+
136
+ }
137
+
138
+ }
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+ }
147
+
148
+ new HT_CTC_Update_DB();
149
+
150
+ endif; // END class_exists check
new/inc/assets/js/app.js CHANGED
@@ -1 +1 @@
1
- var ht_ctc_v="3.0.3",url=window.location.href,is_mobile="yes";void 0!==screen.width&&(is_mobile=1024<screen.width?"no":"yes");var post_title=void 0!==document.title?document.title:"";function afterdom_loaded(){"complete"==document.readyState||"interactive"==document.readyState?ht_ctc():document.addEventListener("DOMContentLoaded",ht_ctc)}function ht_ctc_loaded(){afterdom_loaded()}function ht_ctc(){var t=document.querySelector(".ht-ctc-chat");t&&hide_basedon_device(t)}function hide_basedon_device(t){var e,a,c,n;"yes"==is_mobile?"show"==t.getAttribute("data-display_mobile")&&((a=document.querySelector(".ht_ctc_desktop_"+t.getAttribute("data-return_type")))&&a.remove(),c=t.getAttribute("data-css"),e=t.getAttribute("data-position_mobile"),t.style.cssText=e+c,display(t)):"show"==t.getAttribute("data-display_desktop")&&((a=document.querySelector(".ht_ctc_mobile_"+t.getAttribute("data-return_type")))&&a.remove(),c=t.getAttribute("data-css"),n=t.getAttribute("data-position"),t.style.cssText=n+c,display(t))}function display(e){try{var t=parseInt(e.getAttribute("data-show_effect"));jQuery(e).show(t)}catch(t){e.style.display="block"}try{ht_ctc_things(e)}catch(t){}}function ht_ctc_things(t){var e=t.getAttribute("data-an_type");setTimeout(function(){t.classList.add("ht_ctc_animation",e)},120),jQuery(".ht-ctc-chat").hover(function(){jQuery(".ht-ctc-chat .ht-ctc-cta-hover").show(120)},function(){jQuery(".ht-ctc-chat .ht-ctc-cta-hover").hide(100)})}function ht_ctc_shortcode_click(t){data_link=t.getAttribute("data-ctc-link"),data_link=encodeURI(data_link),window.open(data_link,"_blank","noopener"),ht_ctc_analytics(t)}function ht_ctc_click(t){ht_ctc_link(t),ht_ctc_analytics(t)}function ht_ctc_link(t){var e=t.getAttribute("data-number"),a=(a=t.getAttribute("data-pre_filled")).replace(/\[url]/gi,url);a=encodeURIComponent(a);var c,n=t.getAttribute("data-webandapi");""!=e?"webapi"==n?(c="yes"==is_mobile?"https://api.whatsapp.com/send":"https://web.whatsapp.com/send",window.open(c+"?phone="+e+"&text="+a,"_blank","noopener")):(c="https://wa.me/",window.open(c+e+"?text="+a,"_blank","noopener")):t.innerHTML=t.getAttribute("data-no_number")}function ht_ctc_analytics(t){var e=t.getAttribute("data-return_type"),a="";"chat"==e?a=t.getAttribute("data-number"):"group"==e?a=t.getAttribute("data-group_id"):"share"==e&&(a=t.getAttribute("data-share_text")),ht_ctc_ga(e,a,t),"yes"==t.getAttribute("data-is_fb_pixel")&&ht_ctc_fb_pixel(e,a),"yes"==t.getAttribute("data-is_fb_an_enable")&&ht_ctc_fb_an(e,a)}function ht_ctc_ga(t,e,a){var c="Click to Chat for WhatsApp",n=t+": "+e,i=post_title+", "+url;"yes"==a.getAttribute("data-is_ga_enable")&&("undefined"!=typeof gtag?gtag("event",n,{event_category:c,event_label:i}):"undefined"!=typeof ga&&void 0!==ga.getAll?ga.getAll()[0].send("event",c,n,i):"undefined"!=typeof __gaTracker&&__gaTracker("send","event",c,n,i)),"undefined"!=typeof dataLayer&&dataLayer.push({event:"Click to Chat",event_category:c,event_label:i,event_action:n})}function ht_ctc_fb_pixel(t,e){"undefined"!=typeof fbq&&fbq("trackCustom","Click to Chat by HoliThemes",{Category:"Click to Chat for WhatsApp",return_type:t,ID:e,Title:post_title,URL:url})}function ht_ctc_fb_an(t,e){var a={Category:"Click to Chat for WhatsApp"};a.return_type=t,a.ID=e,a.Label=post_title+", "+url,"undefined"!=typeof FB&&FB.AppEvents.logEvent("Click to Chat for WhatsApp",null,a)}afterdom_loaded();
1
+ function ht_ctc_click(t){}function ht_ctc_shortcode_click(t){}!function(o){var c=window.location.href,i=void 0!==document.title?document.title:"",r=void 0!==screen.width&&1024<screen.width?"no":"yes";function t(){var t=document.querySelector(".ht-ctc-chat");t&&(function(t){{var e,a,n,o;"yes"==r?"show"==t.getAttribute("data-display_mobile")&&((a=document.querySelector(".ht_ctc_desktop_chat"))&&a.remove(),n=t.getAttribute("data-css"),e=t.getAttribute("data-position_mobile"),t.style.cssText=e+n,d(t)):"show"==t.getAttribute("data-display_desktop")&&((a=document.querySelector(".ht_ctc_mobile_chat"))&&a.remove(),n=t.getAttribute("data-css"),o=t.getAttribute("data-position"),t.style.cssText=o+n,d(t))}}(t),t.addEventListener("click",function(){!function(t){var e=t.getAttribute("data-number"),a=t.getAttribute("data-pre_filled");a=a.replace(/\[url]/gi,c),a=encodeURIComponent(a);var n=t.getAttribute("data-webandapi");if(""==e)return t.innerHTML=t.getAttribute("data-no_number");{var o;"webapi"==n?(o="yes"==r?"https://api.whatsapp.com/send":"https://web.whatsapp.com/send",window.open(o+"?phone="+e+"&text="+a,"_blank","noopener")):(o="https://wa.me/",window.open(o+e+"?text="+a,"_blank","noopener"))}}(t),n(t)})),o(".ht-ctc-sc-chat").click(function(){var t,e=this.getAttribute("data-number"),a=(a=this.getAttribute("data-pre_filled")).replace(/\[url]/gi,c);a=encodeURIComponent(a),"webapi"==this.getAttribute("data-webandapi")?(t="yes"==r?"https://api.whatsapp.com/send":"https://web.whatsapp.com/send",window.open(t+"?phone="+e+"&text="+a,"_blank","noopener")):(t="https://wa.me/",window.open(t+e+"?text="+a,"_blank","noopener")),n(this)})}function d(e){try{var t=parseInt(e.getAttribute("data-show_effect"));o(e).show(t)}catch(t){e.style.display="block"}try{n=(a=e).getAttribute("data-an_type"),setTimeout(function(){a.classList.add("ht_ctc_animation",n)},120),o(".ht-ctc-chat").hover(function(){o(".ht-ctc-chat .ht-ctc-cta-hover").show(120)},function(){o(".ht-ctc-chat .ht-ctc-cta-hover").hide(100)})}catch(t){}var a,n}function n(t){var e=t.getAttribute("data-number"),a="Click to Chat for WhatsApp",n="chat: "+e,o=i+", "+c;"yes"==t.getAttribute("data-is_ga_enable")&&("undefined"!=typeof gtag?gtag("event",n,{event_category:a,event_label:o}):"undefined"!=typeof ga&&void 0!==ga.getAll?ga.getAll()[0].send("event",a,n,o):"undefined"!=typeof __gaTracker&&__gaTracker("send","event",a,n,o)),"undefined"!=typeof dataLayer&&dataLayer.push({event:"Click to Chat",event_category:a,event_label:o,event_action:n}),"yes"==t.getAttribute("data-is_fb_pixel")&&"undefined"!=typeof fbq&&fbq("trackCustom","Click to Chat by HoliThemes",{Category:"Click to Chat for WhatsApp",return_type:"chat",ID:e,Title:i,URL:c})}"complete"==document.readyState||"interactive"==document.readyState?t():document.addEventListener("DOMContentLoaded",t)}(jQuery);
new/inc/assets/js/dev/app.dev.js CHANGED
@@ -1,43 +1,84 @@
1
  // Click to Chat
2
- var ht_ctc_v = '3.0';
3
- var url = window.location.href;
4
-
5
- // is_mobile yes/no, desktop > 1024
6
- var is_mobile = 'yes';
7
- if (typeof screen.width !== "undefined" ) {
8
- is_mobile = ( screen.width > 1024 ) ? "no" : "yes";
9
- }
10
 
11
- // post title
 
12
  var post_title = (typeof document.title !== "undefined" ) ? document.title : '';
 
 
13
 
14
  function afterdom_loaded() {
15
- if ( 'complete' == document.readyState || 'interactive' == document.readyState ) {
 
16
  // call direclty
17
  ht_ctc();
18
  } else {
 
19
  document.addEventListener('DOMContentLoaded', ht_ctc);
20
  }
21
  }
22
  afterdom_loaded();
23
 
24
- function ht_ctc_loaded() {
25
- afterdom_loaded();
26
- }
27
-
28
  function ht_ctc() {
 
29
  var ht_ctc_chat = document.querySelector('.ht-ctc-chat');
30
- (ht_ctc_chat) ? hide_basedon_device(ht_ctc_chat) : '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  }
32
 
33
- // Hide based on device
34
- function hide_basedon_device(p) {
35
  if (is_mobile == 'yes') {
36
  var display_mobile = p.getAttribute('data-display_mobile');
37
  if ( 'show' == display_mobile ) {
38
 
39
  // remove desktop style
40
- var rm = document.querySelector('.ht_ctc_desktop_' + p.getAttribute('data-return_type'));
41
  (rm) ? rm.remove() : '';
42
 
43
  var css = p.getAttribute('data-css');
@@ -50,7 +91,7 @@ function hide_basedon_device(p) {
50
  if ( 'show' == display_desktop ) {
51
 
52
  // remove mobile style
53
- var rm = document.querySelector('.ht_ctc_mobile_' + p.getAttribute('data-return_type'));
54
  (rm) ? rm.remove() : '';
55
 
56
  var css = p.getAttribute('data-css');
@@ -67,13 +108,13 @@ function display(p) {
67
  // p.style.display = "block";
68
  try {
69
  var dt = parseInt(p.getAttribute('data-show_effect'));
70
- jQuery(p).show(dt);
71
- // jQuery(p).fadeIn(1000);
72
  } catch (e) {
73
  p.style.display = "block";
74
  }
75
- // jQuery(".ht-ctc-chat").show(120);
76
- // jQuery(".ht-ctc-chat").fadeIn();
77
 
78
  try {
79
  ht_ctc_things(p);
@@ -82,35 +123,74 @@ function display(p) {
82
  }
83
 
84
  function ht_ctc_things(p) {
85
-
86
  // animations
87
  var animateclass = p.getAttribute('data-an_type')
88
  setTimeout(function () {
89
  p.classList.add('ht_ctc_animation', animateclass);
90
  }, 120);
91
 
92
- // hover effects
93
- jQuery(".ht-ctc-chat").hover(function () {
94
- jQuery('.ht-ctc-chat .ht-ctc-cta-hover').show(120);
95
  }, function () {
96
- jQuery('.ht-ctc-chat .ht-ctc-cta-hover').hide(100);
97
  });
98
  }
99
 
100
- // shortcode link
101
- function ht_ctc_shortcode_click(values) {
102
- data_link = values.getAttribute("data-ctc-link");
103
- data_link = encodeURI(data_link);
104
- window.open(data_link, '_blank', 'noopener');
105
- ht_ctc_analytics(values);
106
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
 
108
- // floating style - click
109
- function ht_ctc_click(values) {
110
- // link
111
- ht_ctc_link(values);
112
- // analytics
113
- ht_ctc_analytics(values);
114
  }
115
 
116
  // link - chat
@@ -145,111 +225,16 @@ function ht_ctc_link(values) {
145
 
146
 
147
 
 
148
 
149
 
150
-
151
- /**
152
- * Global
153
- */
154
-
155
- // Analytics
156
- function ht_ctc_analytics(values) {
157
- var return_type = values.getAttribute('data-return_type');
158
- var id = '';
159
- if ( 'chat' == return_type ) {
160
- id = values.getAttribute('data-number');
161
- } else if ( 'group' == return_type ) {
162
- id = values.getAttribute('data-group_id');
163
- } else if ( 'share' == return_type ) {
164
- id = values.getAttribute('data-share_text');
165
- }
166
- // Google Analytics
167
- ht_ctc_ga( return_type, id, values );
168
- // FB Pixel
169
- var is_fb_pixel = values.getAttribute('data-is_fb_pixel');
170
- if ( 'yes' == is_fb_pixel ) {
171
- ht_ctc_fb_pixel( return_type, id );
172
- }
173
- // FB Analytics
174
- var is_fb_an_enable = values.getAttribute('data-is_fb_an_enable');
175
- if ( 'yes' == is_fb_an_enable ) {
176
- ht_ctc_fb_an( return_type, id );
177
- }
178
- }
179
-
180
- // Google Analytics - have to improve
181
- function ht_ctc_ga( return_type, id, values ) {
182
- var ga_category = 'Click to Chat for WhatsApp';
183
- var ga_action = return_type + ': ' + id ;
184
- var ga_label = post_title + ', ' + url ;
185
- // if ga_enabled
186
- var is_ga_enable = values.getAttribute('data-is_ga_enable');
187
- if ( 'yes' == is_ga_enable ) {
188
- if (typeof gtag !== "undefined") {
189
- gtag('event', ga_action, {
190
- 'event_category': ga_category,
191
- 'event_label': ga_label,
192
- });
193
- } else if (typeof ga !== "undefined" && typeof ga.getAll !== "undefined" ) {
194
- var tracker = ga.getAll();
195
- tracker[0].send("event", ga_category, ga_action, ga_label );
196
- // ga('send', 'event', ga_category, ga_action, ga_label);
197
- } else if (typeof __gaTracker !== "undefined") {
198
- __gaTracker('send', 'event', ga_category, ga_action, ga_label);
199
- }
200
- }
201
- // dataLayer
202
- if (typeof dataLayer !== "undefined") {
203
- dataLayer.push({
204
- 'event': 'Click to Chat',
205
- 'event_category': ga_category,
206
- 'event_label': ga_label,
207
- 'event_action': ga_action
208
- });
209
- }
210
-
211
- }
212
-
213
- // FB Pixel
214
- function ht_ctc_fb_pixel( return_type, id ) {
215
-
216
- if (typeof fbq !== "undefined") {
217
- fbq('trackCustom', 'Click to Chat by HoliThemes', {
218
- 'Category': 'Click to Chat for WhatsApp',
219
- 'return_type': return_type,
220
- 'ID': id,
221
- 'Title': post_title,
222
- 'URL': url
223
- });
224
- }
225
-
226
- // if (typeof fbq !== "undefined") {
227
- // fbq('track', 'Lead', {
228
- // 'Category': 'Click to Chat for WhatsApp',
229
- // 'return_type': 'Chat',
230
- // 'Title': post_title,
231
- // 'url': url,
232
- // });
233
- // }
234
-
235
-
236
-
237
- }
238
-
239
- // FB Analytics
240
- function ht_ctc_fb_an( return_type, id ) {
241
- var fb_event_name = 'Click to Chat for WhatsApp';
242
- var params = {};
243
- params['Category'] = 'Click to Chat for WhatsApp';
244
- params['return_type'] = return_type;
245
- params['ID'] = id;
246
- params['Label'] = post_title + ', ' + url ;
247
- if (typeof FB !== "undefined") {
248
- FB.AppEvents.logEvent( fb_event_name, null, params);
249
- }
250
  }
251
-
252
-
253
- // function test_customevent() {
254
- // console.log('custome event');
255
- // }
1
  // Click to Chat
2
+ (function ($) {
 
 
 
 
 
 
 
3
 
4
+ var v = '3.2';
5
+ var url = window.location.href;
6
  var post_title = (typeof document.title !== "undefined" ) ? document.title : '';
7
+ // is_mobile yes/no, desktop > 1024
8
+ var is_mobile = (typeof screen.width !== "undefined" && screen.width > 1024) ? "no" : "yes";
9
 
10
  function afterdom_loaded() {
11
+ if ('complete' == document.readyState || 'interactive' == document.readyState) {
12
+ console.log('call ht_ctc direclty');
13
  // call direclty
14
  ht_ctc();
15
  } else {
16
+ console.log('call ht_ctc event listener');
17
  document.addEventListener('DOMContentLoaded', ht_ctc);
18
  }
19
  }
20
  afterdom_loaded();
21
 
 
 
 
 
22
  function ht_ctc() {
23
+ console.log('ht_ctc');
24
  var ht_ctc_chat = document.querySelector('.ht-ctc-chat');
25
+ if (ht_ctc_chat) {
26
+
27
+ // display
28
+ display_chat(ht_ctc_chat);
29
+
30
+ // click
31
+ ht_ctc_chat.addEventListener('click', function () {
32
+ console.log('click event listener');
33
+
34
+ // link
35
+ ht_ctc_link(ht_ctc_chat);
36
+
37
+ // analytics
38
+ ht_ctc_chat_analytics(ht_ctc_chat);
39
+ });
40
+
41
+ }
42
+
43
+ // shortcode - click
44
+ $('.ht-ctc-sc-chat').click(function () {
45
+ console.log('shortcode click');
46
+
47
+ var number = this.getAttribute('data-number');
48
+ var pre_filled = this.getAttribute('data-pre_filled');
49
+ pre_filled = pre_filled.replace(/\[url]/gi, url);
50
+ pre_filled = encodeURIComponent(pre_filled);
51
+ var webandapi = this.getAttribute('data-webandapi');
52
+
53
+ // web/api.whatsapp or wa.me
54
+ if ('webapi' == webandapi) {
55
+ if (is_mobile == 'yes') {
56
+ var base_link = 'https://api.whatsapp.com/send';
57
+ } else {
58
+ var base_link = 'https://web.whatsapp.com/send';
59
+ }
60
+ window.open(base_link + '?phone=' + number + '&text=' + pre_filled, '_blank', 'noopener');
61
+ } else {
62
+ // wa.me
63
+ var base_link = 'https://wa.me/';
64
+ window.open(base_link + number + '?text=' + pre_filled, '_blank', 'noopener');
65
+ }
66
+
67
+ // analytics
68
+ ht_ctc_chat_analytics(this);
69
+ });
70
+
71
+
72
  }
73
 
74
+ // display based on device
75
+ function display_chat(p) {
76
  if (is_mobile == 'yes') {
77
  var display_mobile = p.getAttribute('data-display_mobile');
78
  if ( 'show' == display_mobile ) {
79
 
80
  // remove desktop style
81
+ var rm = document.querySelector('.ht_ctc_desktop_chat');
82
  (rm) ? rm.remove() : '';
83
 
84
  var css = p.getAttribute('data-css');
91
  if ( 'show' == display_desktop ) {
92
 
93
  // remove mobile style
94
+ var rm = document.querySelector('.ht_ctc_mobile_chat');
95
  (rm) ? rm.remove() : '';
96
 
97
  var css = p.getAttribute('data-css');
108
  // p.style.display = "block";
109
  try {
110
  var dt = parseInt(p.getAttribute('data-show_effect'));
111
+ $(p).show(dt);
112
+ // $(p).fadeIn(1000);
113
  } catch (e) {
114
  p.style.display = "block";
115
  }
116
+ // $(".ht-ctc-chat").show(120);
117
+ // $(".ht-ctc-chat").fadeIn();
118
 
119
  try {
120
  ht_ctc_things(p);
123
  }
124
 
125
  function ht_ctc_things(p) {
126
+ console.log('animations');
127
  // animations
128
  var animateclass = p.getAttribute('data-an_type')
129
  setTimeout(function () {
130
  p.classList.add('ht_ctc_animation', animateclass);
131
  }, 120);
132
 
133
+ // cta hover effects
134
+ $(".ht-ctc-chat").hover(function () {
135
+ $('.ht-ctc-chat .ht-ctc-cta-hover').show(120);
136
  }, function () {
137
+ $('.ht-ctc-chat .ht-ctc-cta-hover').hide(100);
138
  });
139
  }
140
 
141
+ // analytics
142
+ function ht_ctc_chat_analytics(values) {
143
+ console.log('analytics');
144
+
145
+ var id = values.getAttribute('data-number');
146
+
147
+ // Google Analytics
148
+ var ga_category = 'Click to Chat for WhatsApp';
149
+ var ga_action = 'chat: ' + id;
150
+ var ga_label = post_title + ', ' + url;
151
+ // if ga_enabled
152
+ if ( 'yes' == values.getAttribute('data-is_ga_enable') ) {
153
+ if (typeof gtag !== "undefined") {
154
+ console.log('gtag');
155
+ gtag('event', ga_action, {
156
+ 'event_category': ga_category,
157
+ 'event_label': ga_label,
158
+ });
159
+ } else if (typeof ga !== "undefined" && typeof ga.getAll !== "undefined") {
160
+ console.log('ga');
161
+ var tracker = ga.getAll();
162
+ tracker[0].send("event", ga_category, ga_action, ga_label);
163
+ // ga('send', 'event', ga_category, ga_action, ga_label);
164
+ } else if (typeof __gaTracker !== "undefined") {
165
+ __gaTracker('send', 'event', ga_category, ga_action, ga_label);
166
+ }
167
+ }
168
+
169
+ // dataLayer
170
+ if (typeof dataLayer !== "undefined") {
171
+ console.log('dataLayer');
172
+ dataLayer.push({
173
+ 'event': 'Click to Chat',
174
+ 'event_category': ga_category,
175
+ 'event_label': ga_label,
176
+ 'event_action': ga_action
177
+ });
178
+ }
179
+
180
+ // FB Pixel
181
+ if ( 'yes' == values.getAttribute('data-is_fb_pixel') ) {
182
+ console.log('fb pixel');
183
+ if (typeof fbq !== "undefined") {
184
+ fbq('trackCustom', 'Click to Chat by HoliThemes', {
185
+ 'Category': 'Click to Chat for WhatsApp',
186
+ 'return_type': 'chat',
187
+ 'ID': id,
188
+ 'Title': post_title,
189
+ 'URL': url
190
+ });
191
+ }
192
+ }
193
 
 
 
 
 
 
 
194
  }
195
 
196
  // link - chat
225
 
226
 
227
 
228
+ })(jQuery);
229
 
230
 
231
+ // todo: 3.3
232
+ // if app.js file is not updated in the user website - due to cache - later version remove onclick attribute at html.
233
+ function ht_ctc_click(values) {
234
+ console.log(values);
235
+ return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
236
  }
237
+ function ht_ctc_shortcode_click(values) {
238
+ console.log(values);
239
+ return;
240
+ }
 
new/inc/assets/js/dev/group.dev.js CHANGED
@@ -1,79 +1,86 @@
1
  // Click to Chat - Group
2
  (function ($) {
3
 
4
- var is_mobile = 'yes';
5
- if (typeof screen.width !== "undefined") {
6
- is_mobile = (screen.width > 1024) ? "no" : "yes";
 
 
 
 
 
 
7
  }
8
 
9
- function group_afterdom_loaded() {
10
- if ('complete' == document.readyState || 'interactive' == document.readyState) {
11
- // call direclty
12
- group_ht_ctc();
13
- } else {
14
- document.addEventListener('DOMContentLoaded', group_ht_ctc);
15
- }
16
- }
17
- group_afterdom_loaded();
18
-
19
- // function group_ht_ctc_loaded() {
20
- // group_afterdom_loaded();
21
- // }
22
-
23
  function group_ht_ctc() {
24
  var ht_ctc_group = document.querySelector('.ht-ctc-group');
25
  if (ht_ctc_group) {
26
- group_hide_basedon_device(ht_ctc_group);
 
 
 
27
  ht_ctc_group.addEventListener('click', function () {
28
- ht_ctc_group_click(ht_ctc_group);
 
 
 
 
 
 
 
29
  });
30
  }
31
 
32
- // var ht_ctc_group_sc = document.querySelector('.ht-ctc-sc-group');
33
- // if (ht_ctc_group_sc) {
34
- // ht_ctc_group_sc.addEventListener('click', function () {
35
- // ht_ctc_group_sc_click(ht_ctc_group_sc);
36
- // });
37
- // }
38
-
39
  $('.ht-ctc-sc-group').click(function () {
40
- ht_ctc_group_sc_click(this);
 
 
 
 
 
 
41
  });
42
 
43
  }
44
 
45
  // Hide based on device
46
- function group_hide_basedon_device(p) {
47
  if (is_mobile == 'yes') {
48
  var display_mobile = p.getAttribute('data-display_mobile');
49
  if ('show' == display_mobile) {
50
 
51
  // remove desktop style
52
- var rm = document.querySelector('.ht_ctc_desktop_' + p.getAttribute('data-return_type'));
53
  (rm) ? rm.remove() : '';
54
 
55
  var css = p.getAttribute('data-css');
56
  var position_mobile = p.getAttribute('data-position_mobile');
57
  p.style.cssText = position_mobile + css;
58
- group_display(p)
59
  }
60
  } else {
61
  var display_desktop = p.getAttribute('data-display_desktop');
62
  if ('show' == display_desktop) {
63
 
64
  // remove mobile style
65
- var rm = document.querySelector('.ht_ctc_mobile_' + p.getAttribute('data-return_type'));
66
  (rm) ? rm.remove() : '';
67
 
68
  var css = p.getAttribute('data-css');
69
  var position = p.getAttribute('data-position');
70
  p.style.cssText = position + css;
71
- group_display(p)
72
  }
73
  }
74
  }
75
 
76
- function group_display(p) {
 
 
 
 
 
77
  // p.style.display = "block";
78
  try {
79
  var dt = parseInt(p.getAttribute('data-show_effect'));
@@ -82,57 +89,77 @@ function group_display(p) {
82
  p.style.display = "block";
83
  }
84
 
85
- // hover effect
86
- ht_ctc_group_things(p);
87
- }
88
-
89
- function ht_ctc_group_things(p) {
90
-
91
  // animations
92
  var animateclass = p.getAttribute('data-an_type')
93
  setTimeout(function () {
94
  p.classList.add('ht_ctc_animation', animateclass);
95
  }, 120);
96
 
97
- // hover effects
98
  $(".ht-ctc-group").hover(function () {
99
  $('.ht-ctc-group .ht-ctc-cta-hover').show(220);
100
  }, function () {
101
  $('.ht-ctc-group .ht-ctc-cta-hover').hide(100);
102
  });
103
- }
104
-
105
- // group shortcode link
106
- function ht_ctc_group_sc_click(values) {
107
-
108
- data_link = values.getAttribute("data-ctc-link");
109
- data_link = encodeURI(data_link);
110
- window.open(data_link, '_blank', 'noopener');
111
 
112
- try {
113
- // (app.js fn)
114
- ht_ctc_analytics(values);
115
- } catch (e) { }
116
  }
117
 
118
- // group floating style - click
119
- function ht_ctc_group_click(values) {
120
- // link
121
- ht_ctc_group_link(values);
122
-
123
- // analytics
124
- try {
125
- // (app.js fn)
126
- ht_ctc_analytics(values);
127
- } catch(e){}
128
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
 
130
- // link - chat, share, group
131
- function ht_ctc_group_link(values) {
 
 
 
 
 
 
 
 
132
 
133
- var base_link = 'https://chat.whatsapp.com/';
134
- var group_id = values.getAttribute('data-group_id');
135
- window.open(base_link + group_id, '_blank', 'noopener');
 
 
 
 
 
 
 
 
 
 
136
  }
137
 
138
  })(jQuery);
1
  // Click to Chat - Group
2
  (function ($) {
3
 
4
+ var url = window.location.href;
5
+ var is_mobile = (typeof screen.width !== "undefined" && screen.width > 1024) ? "no" : "yes";
6
+ var post_title = (typeof document.title !== "undefined" ) ? document.title : '';
7
+
8
+ if ('complete' == document.readyState || 'interactive' == document.readyState) {
9
+ // call direclty
10
+ group_ht_ctc();
11
+ } else {
12
+ document.addEventListener('DOMContentLoaded', group_ht_ctc);
13
  }
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  function group_ht_ctc() {
16
  var ht_ctc_group = document.querySelector('.ht-ctc-group');
17
  if (ht_ctc_group) {
18
+
19
+ group_display(ht_ctc_group);
20
+
21
+ // click
22
  ht_ctc_group.addEventListener('click', function () {
23
+
24
+ // link
25
+ var base_link = 'https://chat.whatsapp.com/';
26
+ var group_id = ht_ctc_group.getAttribute('data-group_id');
27
+ window.open(base_link + group_id, '_blank', 'noopener');
28
+
29
+ // analytics
30
+ group_analytics(ht_ctc_group);
31
  });
32
  }
33
 
34
+ // shortcode - click
 
 
 
 
 
 
35
  $('.ht-ctc-sc-group').click(function () {
36
+
37
+ data_link = this.getAttribute("data-ctc-link");
38
+ data_link = encodeURI(data_link);
39
+ window.open(data_link, '_blank', 'noopener');
40
+
41
+ group_analytics(this);
42
+
43
  });
44
 
45
  }
46
 
47
  // Hide based on device
48
+ function group_display(p) {
49
  if (is_mobile == 'yes') {
50
  var display_mobile = p.getAttribute('data-display_mobile');
51
  if ('show' == display_mobile) {
52
 
53
  // remove desktop style
54
+ var rm = document.querySelector('.ht_ctc_desktop_group');
55
  (rm) ? rm.remove() : '';
56
 
57
  var css = p.getAttribute('data-css');
58
  var position_mobile = p.getAttribute('data-position_mobile');
59
  p.style.cssText = position_mobile + css;
60
+ display(p)
61
  }
62
  } else {
63
  var display_desktop = p.getAttribute('data-display_desktop');
64
  if ('show' == display_desktop) {
65
 
66
  // remove mobile style
67
+ var rm = document.querySelector('.ht_ctc_mobile_group');
68
  (rm) ? rm.remove() : '';
69
 
70
  var css = p.getAttribute('data-css');
71
  var position = p.getAttribute('data-position');
72
  p.style.cssText = position + css;
73
+ display(p)
74
  }
75
  }
76
  }
77
 
78
+ /**
79
+ * display
80
+ * animations
81
+ * cta hover effects
82
+ */
83
+ function display(p) {
84
  // p.style.display = "block";
85
  try {
86
  var dt = parseInt(p.getAttribute('data-show_effect'));
89
  p.style.display = "block";
90
  }
91
 
 
 
 
 
 
 
92
  // animations
93
  var animateclass = p.getAttribute('data-an_type')
94
  setTimeout(function () {
95
  p.classList.add('ht_ctc_animation', animateclass);
96
  }, 120);
97
 
98
+ // cta hover effects
99
  $(".ht-ctc-group").hover(function () {
100
  $('.ht-ctc-group .ht-ctc-cta-hover').show(220);
101
  }, function () {
102
  $('.ht-ctc-group .ht-ctc-cta-hover').hide(100);
103
  });
 
 
 
 
 
 
 
 
104
 
 
 
 
 
105
  }
106
 
107
+ // analytics
108
+ function group_analytics(values) {
109
+
110
+ console.log('group analytics');
111
+
112
+ var id = values.getAttribute('data-group_id');
113
+
114
+ // Google Analytics
115
+ var ga_category = 'Click to Chat for WhatsApp';
116
+ var ga_action = 'group: ' + id;
117
+ var ga_label = post_title + ', ' + url;
118
+
119
+ // if ga_enabled
120
+ if ('yes' == values.getAttribute('data-is_ga_enable')) {
121
+ console.log('google analytics');
122
+ if (typeof gtag !== "undefined") {
123
+ console.log('gtag');
124
+ gtag('event', ga_action, {
125
+ 'event_category': ga_category,
126
+ 'event_label': ga_label,
127
+ });
128
+ } else if (typeof ga !== "undefined" && typeof ga.getAll !== "undefined") {
129
+ console.log('ga');
130
+ var tracker = ga.getAll();
131
+ tracker[0].send("event", ga_category, ga_action, ga_label);
132
+ // ga('send', 'event', ga_category, ga_action, ga_label);
133
+ } else if (typeof __gaTracker !== "undefined") {
134
+ console.log('__gaTracker');
135
+ __gaTracker('send', 'event', ga_category, ga_action, ga_label);
136
+ }
137
+ }
138
 
139
+ // dataLayer
140
+ if (typeof dataLayer !== "undefined") {
141
+ console.log('dataLayer');
142
+ dataLayer.push({
143
+ 'event': 'Click to Chat',
144
+ 'event_category': ga_category,
145
+ 'event_label': ga_label,
146
+ 'event_action': ga_action
147
+ });
148
+ }
149
 
150
+ // FB Pixel
151
+ if ('yes' == values.getAttribute('data-is_fb_pixel')) {
152
+ console.log('fb pixel');
153
+ if (typeof fbq !== "undefined") {
154
+ fbq('trackCustom', 'Click to Chat by HoliThemes', {
155
+ 'Category': 'Click to Chat for WhatsApp',
156
+ 'return_type': 'group',
157
+ 'ID': id,
158
+ 'Title': post_title,
159
+ 'URL': url
160
+ });
161
+ }
162
+ }
163
  }
164
 
165
  })(jQuery);
new/inc/assets/js/dev/group.new.js ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Click to Chat - Group
2
+ (function ($) {
3
+
4
+ var is_mobile = (screen.width > 1024) ? "no" : "yes";
5
+
6
+ // ready
7
+ $(function () {
8
+
9
+ var ht_ctc_group = document.querySelector('.ht-ctc-group');
10
+
11
+ // display, click
12
+ if (ht_ctc_group) {
13
+ display(ht_ctc_group);
14
+
15
+ ht_ctc_group.addEventListener('click', function () {
16
+
17
+ // link
18
+ var base_link = 'https://chat.whatsapp.com/';
19
+ var group_id = ht_ctc_group.getAttribute('data-group_id');
20
+ window.open(base_link + group_id, '_blank', 'noopener');
21
+
22
+ ht_ctc_group_analytics(values);
23
+
24
+ });
25
+ }
26
+
27
+ // click shortcode
28
+ $('.ht-ctc-sc-group').click(function () {
29
+
30
+ data_link = this.getAttribute("data-ctc-link");
31
+ data_link = encodeURI(data_link);
32
+ window.open(data_link, '_blank', 'noopener');
33
+
34
+ analytics(this);
35
+
36
+ });
37
+
38
+ function analytics(values) {
39
+ // analytics
40
+ try {
41
+ // (app.js fn)
42
+ id = values.getAttribute('data-group_id');
43
+ ht_ctc_analytics(values, id);
44
+ } catch (e) { }
45
+ }
46
+
47
+
48
+ // Hide based on device
49
+ function display(p) {
50
+ if (is_mobile == 'yes') {
51
+ var display_mobile = p.getAttribute('data-display_mobile');
52
+ if ('show' == display_mobile) {
53
+
54
+ // remove desktop style
55
+ var rm = document.querySelector('.ht_ctc_desktop_' + p.getAttribute('data-return_type'));
56
+ (rm) ? rm.remove() : '';
57
+
58
+ var css = p.getAttribute('data-css');
59
+ var position_mobile = p.getAttribute('data-position_mobile');
60
+ p.style.cssText = position_mobile + css;
61
+ group_display(p)
62
+ }
63
+ } else {
64
+ var display_desktop = p.getAttribute('data-display_desktop');
65
+ if ('show' == display_desktop) {
66
+
67
+ // remove mobile style
68
+ var rm = document.querySelector('.ht_ctc_mobile_' + p.getAttribute('data-return_type'));
69
+ (rm) ? rm.remove() : '';
70
+
71
+ var css = p.getAttribute('data-css');
72
+ var position = p.getAttribute('data-position');
73
+ p.style.cssText = position + css;
74
+ group_display(p)
75
+ }
76
+ }
77
+ }
78
+
79
+
80
+ function group_display(p) {
81
+
82
+ try {
83
+ var dt = parseInt(p.getAttribute('data-show_effect'));
84
+ $(p).show(dt);
85
+ } catch (e) {
86
+ p.style.display = "block";
87
+ }
88
+
89
+ // animations
90
+ var animateclass = p.getAttribute('data-an_type')
91
+ setTimeout(function () {
92
+ p.classList.add('ht_ctc_animation', animateclass);
93
+ }, 120);
94
+
95
+ // hover effects
96
+ $(".ht-ctc-group").hover(function () {
97
+ $('.ht-ctc-group .ht-ctc-cta-hover').show(220);
98
+ }, function () {
99
+ $('.ht-ctc-group .ht-ctc-cta-hover').hide(100);
100
+ });
101
+
102
+ }
103
+
104
+
105
+ });
106
+
107
+ })(jQuery);
new/inc/assets/js/dev/share.dev.js CHANGED
@@ -1,56 +1,48 @@
1
  // Click to Chat - Share
2
  (function ($) {
3
 
4
- var is_mobile = 'yes';
5
- if (typeof screen.width !== "undefined") {
6
- is_mobile = (screen.width > 1024) ? "no" : "yes";
 
 
 
 
 
 
7
  }
8
 
9
- function share_afterdom_loaded() {
10
- if ('complete' == document.readyState || 'interactive' == document.readyState) {
11
- // call direclty
12
- share_ht_ctc();
13
- } else {
14
- document.addEventListener('DOMContentLoaded', share_ht_ctc);
15
- }
16
- }
17
- share_afterdom_loaded();
18
-
19
- // function share_ht_ctc_loaded() {
20
- // share_afterdom_loaded();
21
- // }
22
-
23
  function share_ht_ctc() {
24
  var ht_ctc_share = document.querySelector('.ht-ctc-share');
25
  if (ht_ctc_share) {
26
- share_hide_basedon_device(ht_ctc_share);
27
  ht_ctc_share.addEventListener('click', function () {
28
  ht_ctc_share_click(ht_ctc_share);
29
  });
30
  }
31
 
32
- // ht_ctc_share_sc = document.querySelector('.ht-ctc-sc-share');
33
- // if (ht_ctc_share_sc) {
34
- // ht_ctc_share_sc.addEventListener('click', function () {
35
- // ht_ctc_share_sc_click(ht_ctc_share_sc);
36
- // });
37
- // }
38
-
39
  $('.ht-ctc-sc-share').click(function () {
40
- ht_ctc_share_sc_click(this);
 
 
 
 
 
 
41
  });
42
 
43
 
44
  }
45
 
46
  // Hide based on device
47
- function share_hide_basedon_device(p) {
48
  if (is_mobile == 'yes') {
49
  var display_mobile = p.getAttribute('data-display_mobile');
50
  if ('show' == display_mobile) {
51
 
52
  // remove desktop style
53
- var rm = document.querySelector('.ht_ctc_desktop_' + p.getAttribute('data-return_type'));
54
  (rm) ? rm.remove() : '';
55
 
56
  var css = p.getAttribute('data-css');
@@ -63,7 +55,7 @@ function share_hide_basedon_device(p) {
63
  if ('show' == display_desktop) {
64
 
65
  // remove mobile style
66
- var rm = document.querySelector('.ht_ctc_mobile_' + p.getAttribute('data-return_type'));
67
  (rm) ? rm.remove() : '';
68
 
69
  var css = p.getAttribute('data-css');
@@ -104,34 +96,75 @@ function ht_ctc_share_things(p) {
104
  }
105
 
106
 
107
-
108
- // shortcode link
109
- function ht_ctc_share_sc_click(values) {
110
-
111
- data_link = values.getAttribute("data-ctc-link");
112
- data_link = encodeURI(data_link);
113
- window.open(data_link, '_blank', 'noopener');
114
-
115
- try {
116
- // (app.js fn)
117
- ht_ctc_analytics(values);
118
- } catch(e){}
119
- }
120
-
121
  // floating style - click
122
  function ht_ctc_share_click(values) {
123
- console.log('ht_ctc_share_click');
124
  // link
125
- ht_ctc_share_link(values);
126
  // analytics
127
- try {
128
- // (app.js fn)
129
- ht_ctc_analytics(values);
130
- } catch(e){}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  }
132
 
133
- // link - chat, share, group
134
- function ht_ctc_share_link(values) {
135
 
136
  var share_text = values.getAttribute('data-share_text');
137
  var webandapi = values.getAttribute('data-webandapi');
@@ -142,6 +175,6 @@ function ht_ctc_share_link(values) {
142
  }
143
  var base_link = 'https://' + share_nav + '.whatsapp.com/send';
144
  window.open(base_link + '?text=' + share_text, '_blank', 'noopener');
145
- }
146
 
147
  })(jQuery);
1
  // Click to Chat - Share
2
  (function ($) {
3
 
4
+ var url = window.location.href;
5
+ var is_mobile = (typeof screen.width !== "undefined" && screen.width > 1024) ? "no" : "yes";
6
+ var post_title = (typeof document.title !== "undefined" ) ? document.title : '';
7
+
8
+ if ('complete' == document.readyState || 'interactive' == document.readyState) {
9
+ // call direclty
10
+ share_ht_ctc();
11
+ } else {
12
+ document.addEventListener('DOMContentLoaded', share_ht_ctc);
13
  }
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  function share_ht_ctc() {
16
  var ht_ctc_share = document.querySelector('.ht-ctc-share');
17
  if (ht_ctc_share) {
18
+ share_display(ht_ctc_share);
19
  ht_ctc_share.addEventListener('click', function () {
20
  ht_ctc_share_click(ht_ctc_share);
21
  });
22
  }
23
 
24
+ // shortcode
 
 
 
 
 
 
25
  $('.ht-ctc-sc-share').click(function () {
26
+
27
+ data_link = this.getAttribute("data-ctc-link");
28
+ data_link = encodeURI(data_link);
29
+ window.open(data_link, '_blank', 'noopener');
30
+ // analytics
31
+ share_analytics(this);
32
+
33
  });
34
 
35
 
36
  }
37
 
38
  // Hide based on device
39
+ function share_display(p) {
40
  if (is_mobile == 'yes') {
41
  var display_mobile = p.getAttribute('data-display_mobile');
42
  if ('show' == display_mobile) {
43
 
44
  // remove desktop style
45
+ var rm = document.querySelector('.ht_ctc_desktop_share');
46
  (rm) ? rm.remove() : '';
47
 
48
  var css = p.getAttribute('data-css');
55
  if ('show' == display_desktop) {
56
 
57
  // remove mobile style
58
+ var rm = document.querySelector('.ht_ctc_mobile_share');
59
  (rm) ? rm.remove() : '';
60
 
61
  var css = p.getAttribute('data-css');
96
  }
97
 
98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  // floating style - click
100
  function ht_ctc_share_click(values) {
 
101
  // link
102
+ share_link(values);
103
  // analytics
104
+ share_analytics(values)
105
+ }
106
+
107
+ // analytics
108
+ function share_analytics(values) {
109
+
110
+ console.log('share analytics');
111
+
112
+ var id = values.getAttribute('data-share_text');
113
+
114
+ // Google Analytics
115
+ var ga_category = 'Click to Chat for WhatsApp';
116
+ var ga_action = 'share: ' + id;
117
+ var ga_label = post_title + ', ' + url;
118
+
119
+ // if ga_enabled
120
+ if ( 'yes' == values.getAttribute('data-is_ga_enable') ) {
121
+ console.log('google analytics');
122
+ if (typeof gtag !== "undefined") {
123
+ console.log('gtag');
124
+ gtag('event', ga_action, {
125
+ 'event_category': ga_category,
126
+ 'event_label': ga_label,
127
+ });
128
+ } else if (typeof ga !== "undefined" && typeof ga.getAll !== "undefined") {
129
+ console.log('ga');
130
+ var tracker = ga.getAll();
131
+ tracker[0].send("event", ga_category, ga_action, ga_label);
132
+ // ga('send', 'event', ga_category, ga_action, ga_label);
133
+ } else if (typeof __gaTracker !== "undefined") {
134
+ console.log('__gaTracker');
135
+ __gaTracker('send', 'event', ga_category, ga_action, ga_label);
136
+ }
137
+ }
138
+
139
+ // dataLayer
140
+ if (typeof dataLayer !== "undefined") {
141
+ console.log('dataLayer');
142
+ dataLayer.push({
143
+ 'event': 'Click to Chat',
144
+ 'event_category': ga_category,
145
+ 'event_label': ga_label,
146
+ 'event_action': ga_action
147
+ });
148
+ }
149
+
150
+ // FB Pixel
151
+ if ( 'yes' == values.getAttribute('data-is_fb_pixel') ) {
152
+ console.log('fb pixel');
153
+ if (typeof fbq !== "undefined") {
154
+ fbq('trackCustom', 'Click to Chat by HoliThemes', {
155
+ 'Category': 'Click to Chat for WhatsApp',
156
+ 'return_type': 'share',
157
+ 'ID': id,
158
+ 'Title': post_title,
159
+ 'URL': url
160
+ });
161
+ }
162
+ }
163
+
164
  }
165
 
166
+ // link share
167
+ function share_link(values) {
168
 
169
  var share_text = values.getAttribute('data-share_text');
170
  var webandapi = values.getAttribute('data-webandapi');
175
  }
176
  var base_link = 'https://' + share_nav + '.whatsapp.com/send';
177
  window.open(base_link + '?text=' + share_text, '_blank', 'noopener');
178
+ }
179
 
180
  })(jQuery);
new/inc/assets/js/group.js CHANGED
@@ -1 +1 @@
1
- !function(n){var o="yes";function t(){var t=document.querySelector(".ht-ctc-group");t&&(function(t){{var e,c,a,n;"yes"==o?"show"==t.getAttribute("data-display_mobile")&&((c=document.querySelector(".ht_ctc_desktop_"+t.getAttribute("data-return_type")))&&c.remove(),a=t.getAttribute("data-css"),e=t.getAttribute("data-position_mobile"),t.style.cssText=e+a,i(t)):"show"==t.getAttribute("data-display_desktop")&&((c=document.querySelector(".ht_ctc_mobile_"+t.getAttribute("data-return_type")))&&c.remove(),a=t.getAttribute("data-css"),n=t.getAttribute("data-position"),t.style.cssText=n+a,i(t))}}(t),t.addEventListener("click",function(){!function(t){!function(t){var e=t.getAttribute("data-group_id");window.open("https://chat.whatsapp.com/"+e,"_blank","noopener")}(t);try{ht_ctc_analytics(t)}catch(t){}}(t)})),n(".ht-ctc-sc-group").click(function(){!function(t){data_link=t.getAttribute("data-ctc-link"),data_link=encodeURI(data_link),window.open(data_link,"_blank","noopener");try{ht_ctc_analytics(t)}catch(t){}}(this)})}function i(e){try{var t=parseInt(e.getAttribute("data-show_effect"));n(e).show(t)}catch(t){e.style.display="block"}var c,a;a=(c=e).getAttribute("data-an_type"),setTimeout(function(){c.classList.add("ht_ctc_animation",a)},120),n(".ht-ctc-group").hover(function(){n(".ht-ctc-group .ht-ctc-cta-hover").show(220)},function(){n(".ht-ctc-group .ht-ctc-cta-hover").hide(100)})}void 0!==screen.width&&(o=1024<screen.width?"no":"yes"),"complete"==document.readyState||"interactive"==document.readyState?t():document.addEventListener("DOMContentLoaded",t)}(jQuery);
1
+ !function(o){var i=window.location.href,c=void 0!==screen.width&&1024<screen.width?"no":"yes",r=void 0!==document.title?document.title:"";function t(){var e=document.querySelector(".ht-ctc-group");e&&(function(t){{var e,a,o,n;"yes"==c?"show"==t.getAttribute("data-display_mobile")&&((a=document.querySelector(".ht_ctc_desktop_group"))&&a.remove(),o=t.getAttribute("data-css"),e=t.getAttribute("data-position_mobile"),t.style.cssText=e+o,d(t)):"show"==t.getAttribute("data-display_desktop")&&((a=document.querySelector(".ht_ctc_mobile_group"))&&a.remove(),o=t.getAttribute("data-css"),n=t.getAttribute("data-position"),t.style.cssText=n+o,d(t))}}(e),e.addEventListener("click",function(){var t=e.getAttribute("data-group_id");window.open("https://chat.whatsapp.com/"+t,"_blank","noopener"),a(e)})),o(".ht-ctc-sc-group").click(function(){data_link=this.getAttribute("data-ctc-link"),data_link=encodeURI(data_link),window.open(data_link,"_blank","noopener"),a(this)})}function d(e){try{var t=parseInt(e.getAttribute("data-show_effect"));o(e).show(t)}catch(t){e.style.display="block"}var a=e.getAttribute("data-an_type");setTimeout(function(){e.classList.add("ht_ctc_animation",a)},120),o(".ht-ctc-group").hover(function(){o(".ht-ctc-group .ht-ctc-cta-hover").show(220)},function(){o(".ht-ctc-group .ht-ctc-cta-hover").hide(100)})}function a(t){var e=t.getAttribute("data-group_id"),a="Click to Chat for WhatsApp",o="group: "+e,n=r+", "+i;"yes"==t.getAttribute("data-is_ga_enable")&&("undefined"!=typeof gtag?gtag("event",o,{event_category:a,event_label:n}):"undefined"!=typeof ga&&void 0!==ga.getAll?ga.getAll()[0].send("event",a,o,n):"undefined"!=typeof __gaTracker&&__gaTracker("send","event",a,o,n)),"undefined"!=typeof dataLayer&&dataLayer.push({event:"Click to Chat",event_category:a,event_label:n,event_action:o}),"yes"==t.getAttribute("data-is_fb_pixel")&&"undefined"!=typeof fbq&&fbq("trackCustom","Click to Chat by HoliThemes",{Category:"Click to Chat for WhatsApp",return_type:"group",ID:e,Title:r,URL:i})}"complete"==document.readyState||"interactive"==document.readyState?t():document.addEventListener("DOMContentLoaded",t)}(jQuery);
new/inc/assets/js/share.js CHANGED
@@ -1 +1 @@
1
- !function(n){var i="yes";function t(){var t=document.querySelector(".ht-ctc-share");t&&(function(t){{var e,a,c,n;"yes"==i?"show"==t.getAttribute("data-display_mobile")&&((a=document.querySelector(".ht_ctc_desktop_"+t.getAttribute("data-return_type")))&&a.remove(),c=t.getAttribute("data-css"),e=t.getAttribute("data-position_mobile"),t.style.cssText=e+c,o(t)):"show"==t.getAttribute("data-display_desktop")&&((a=document.querySelector(".ht_ctc_mobile_"+t.getAttribute("data-return_type")))&&a.remove(),c=t.getAttribute("data-css"),n=t.getAttribute("data-position"),t.style.cssText=n+c,o(t))}}(t),t.addEventListener("click",function(){!function(t){console.log("ht_ctc_share_click"),function(t){var e=t.getAttribute("data-share_text"),a=t.getAttribute("data-webandapi"),c="api";"webapi"==a&&(c="yes"==i?"api":"web");var n="https://"+c+".whatsapp.com/send";window.open(n+"?text="+e,"_blank","noopener")}(t);try{ht_ctc_analytics(t)}catch(t){}}(t)})),n(".ht-ctc-sc-share").click(function(){!function(t){data_link=t.getAttribute("data-ctc-link"),data_link=encodeURI(data_link),window.open(data_link,"_blank","noopener");try{ht_ctc_analytics(t)}catch(t){}}(this)})}function o(e){try{var t=parseInt(e.getAttribute("data-show_effect"));n(e).show(t)}catch(t){e.style.display="block"}var a,c;c=(a=e).getAttribute("data-an_type"),setTimeout(function(){a.classList.add("ht_ctc_animation",c)},120),n(".ht-ctc-share").hover(function(){n(".ht-ctc-share .ht-ctc-cta-hover").show(220)},function(){n(".ht-ctc-share .ht-ctc-cta-hover").hide(100)})}void 0!==screen.width&&(i=1024<screen.width?"no":"yes"),"complete"==document.readyState||"interactive"==document.readyState?t():document.addEventListener("DOMContentLoaded",t)}(jQuery);
1
+ !function(i){var o=window.location.href,c=void 0!==screen.width&&1024<screen.width?"no":"yes",r=void 0!==document.title?document.title:"";function t(){var e=document.querySelector(".ht-ctc-share");e&&(function(t){{var e,a,n,i;"yes"==c?"show"==t.getAttribute("data-display_mobile")&&((a=document.querySelector(".ht_ctc_desktop_share"))&&a.remove(),n=t.getAttribute("data-css"),e=t.getAttribute("data-position_mobile"),t.style.cssText=e+n,d(t)):"show"==t.getAttribute("data-display_desktop")&&((a=document.querySelector(".ht_ctc_mobile_share"))&&a.remove(),n=t.getAttribute("data-css"),i=t.getAttribute("data-position"),t.style.cssText=i+n,d(t))}}(e),e.addEventListener("click",function(){var t;(function(t){var e=t.getAttribute("data-share_text"),a=t.getAttribute("data-webandapi"),n="api";"webapi"==a&&(n="yes"==c?"api":"web");var i="https://"+n+".whatsapp.com/send";window.open(i+"?text="+e,"_blank","noopener")})(t=e),a(t)})),i(".ht-ctc-sc-share").click(function(){data_link=this.getAttribute("data-ctc-link"),data_link=encodeURI(data_link),window.open(data_link,"_blank","noopener"),a(this)})}function d(e){try{var t=parseInt(e.getAttribute("data-show_effect"));i(e).show(t)}catch(t){e.style.display="block"}var a,n;n=(a=e).getAttribute("data-an_type"),setTimeout(function(){a.classList.add("ht_ctc_animation",n)},120),i(".ht-ctc-share").hover(function(){i(".ht-ctc-share .ht-ctc-cta-hover").show(220)},function(){i(".ht-ctc-share .ht-ctc-cta-hover").hide(100)})}function a(t){var e=t.getAttribute("data-share_text"),a="Click to Chat for WhatsApp",n="share: "+e,i=r+", "+o;"yes"==t.getAttribute("data-is_ga_enable")&&("undefined"!=typeof gtag?gtag("event",n,{event_category:a,event_label:i}):"undefined"!=typeof ga&&void 0!==ga.getAll?ga.getAll()[0].send("event",a,n,i):"undefined"!=typeof __gaTracker&&__gaTracker("send","event",a,n,i)),"undefined"!=typeof dataLayer&&dataLayer.push({event:"Click to Chat",event_category:a,event_label:i,event_action:n}),"yes"==t.getAttribute("data-is_fb_pixel")&&"undefined"!=typeof fbq&&fbq("trackCustom","Click to Chat by HoliThemes",{Category:"Click to Chat for WhatsApp",return_type:"share",ID:e,Title:r,URL:o})}"complete"==document.readyState||"interactive"==document.readyState?t():document.addEventListener("DOMContentLoaded",t)}(jQuery);
new/inc/chat/class-ht-ctc-chat-shortcode.php CHANGED
@@ -22,6 +22,7 @@ class HT_CTC_Chat_Shortcode {
22
  public function shortcode( $atts = [], $content = null, $shortcode = '' ) {
23
 
24
  $options = get_option( 'ht_ctc_chat_options' );
 
25
 
26
  $number_db = esc_attr( $options['number'] );
27
  $call_to_action_db = esc_attr( $options['call_to_action'] );
@@ -129,33 +130,23 @@ class HT_CTC_Chat_Shortcode {
129
  $css .= 'left:'.$left.';';
130
  }
131
 
132
- // to hide styles in home page
133
  $home = $a["home"];
134
-
135
  // $position !== 'fixed' why !== to avoid double time adding display: none ..
136
  if ( 'fixed' !== $position && 'hide' == $home && ( is_home() || is_category() || is_archive() ) ) {
137
  $css .= 'display:none;';
138
  }
139
-
140
  // By default position: fixed style hide on home screen,
141
  // if plan to show, then add hide='show' ( actually something not equal to 'hide' )
142
  if ( 'fixed' == $position && 'show' !== $home && ( is_home() || is_category() || is_archive() ) ) {
143
  $css .= 'display:none;';
144
  }
145
 
146
- $web_api = 'api';
147
-
148
- // if web.whatsapp checked
149
- if ( isset ( $options['webandapi'] ) ) {
150
- // mobile
151
- if ( 'yes' == $is_mobile ) {
152
- $web_api = 'api';
153
- } else {
154
- $web_api = 'web';
155
- }
156
  }
157
 
158
- $link = "https://$web_api.whatsapp.com/send?phone=$number&text=$pre_filled";
159
  $return_type = "chat";
160
 
161
  $style = $a["style"];
@@ -173,9 +164,12 @@ class HT_CTC_Chat_Shortcode {
173
  $class_names = "ht-ctc-sc ht-ctc-sc-chat sc-style-$style";
174
 
175
  // analytics
176
- $is_ga_enable = apply_filters( 'ht_ctc_fh_is_ga_enable', 'no' );
177
- $is_fb_pixel = apply_filters( 'ht_ctc_fh_is_fb_pixel', 'no' );
178
- $is_fb_an_enable = apply_filters( 'ht_ctc_fh_is_fb_an_enable', 'no' );
 
 
 
179
 
180
 
181
  $o = '';
@@ -183,14 +177,16 @@ class HT_CTC_Chat_Shortcode {
183
  // shortcode template file path
184
  $sc_path = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/styles-shortcode/sc-style-' . $style. '.php';
185
 
 
 
186
  if ( is_file( $sc_path ) ) {
187
- $o .= '<div onclick="ht_ctc_shortcode_click(this);" data-ctc-link="'.$link.'" data-return_type="'.$return_type.'" data-number="'.$number.'" data-style="'.$style.'" data-is_ga_enable="'.$is_ga_enable.'" data-is_fb_an_enable="'.$is_fb_an_enable.'" data-is_fb_pixel="'.$is_fb_pixel.'" style="display: inline; cursor: pointer; z-index: 99999999; '.$css.'" class="'.$class_names.' ht-ctc-inline">';
188
  include $sc_path;
189
  $o .= '</div>';
190
  } else {
191
  // if style is not in the list..
192
  $img_link = plugins_url("./new/inc/assets/img/whatsapp-logo.svg", HT_CTC_PLUGIN_FILE );
193
- $o .= '<div onclick="ht_ctc_shortcode_click(this);" data-ctc-link="'.$link.'" data-return_type="'.$return_type.'" data-number="'.$number.'" data-is_ga_enable="'.$is_ga_enable.'" data-is_fb_an_enable="'.$is_fb_an_enable.'" data-is_fb_pixel="'.$is_fb_pixel.'" style="display: inline; cursor: pointer; z-index: 99999999; '.$css.'" class="'.$class_names.' ht-ctc-inline">';
194
  $o .= '<img class="img-icon-sc sc_item pointer style-3-sc" src="'.$img_link.'" alt="'.$call_to_action.'" style="height: 50px; '.$css.' " >';
195
  $o .= '</div>';
196
  }
22
  public function shortcode( $atts = [], $content = null, $shortcode = '' ) {
23
 
24
  $options = get_option( 'ht_ctc_chat_options' );
25
+ $ht_ctc_os = array();
26
 
27
  $number_db = esc_attr( $options['number'] );
28
  $call_to_action_db = esc_attr( $options['call_to_action'] );
130
  $css .= 'left:'.$left.';';
131
  }
132
 
133
+ // to hide styles in home, archive, category pages
134
  $home = $a["home"];
 
135
  // $position !== 'fixed' why !== to avoid double time adding display: none ..
136
  if ( 'fixed' !== $position && 'hide' == $home && ( is_home() || is_category() || is_archive() ) ) {
137
  $css .= 'display:none;';
138
  }
 
139
  // By default position: fixed style hide on home screen,
140
  // if plan to show, then add hide='show' ( actually something not equal to 'hide' )
141
  if ( 'fixed' == $position && 'show' !== $home && ( is_home() || is_category() || is_archive() ) ) {
142
  $css .= 'display:none;';
143
  }
144
 
145
+ $webandapi = 'wa';
146
+ if ( isset( $options['webandapi'] ) ) {
147
+ $webandapi = 'webapi';
 
 
 
 
 
 
 
148
  }
149
 
 
150
  $return_type = "chat";
151
 
152
  $style = $a["style"];
164
  $class_names = "ht-ctc-sc ht-ctc-sc-chat sc-style-$style";
165
 
166
  // analytics
167
+ $ht_ctc_os['is_ga_enable'] = 'yes';
168
+ $ht_ctc_os['is_fb_pixel'] = 'yes';
169
+ $ht_ctc_os['is_fb_an_enable'] = 'yes';
170
+
171
+ // Hooks
172
+ $ht_ctc_os = apply_filters( 'ht_ctc_fh_os', $ht_ctc_os );
173
 
174
 
175
  $o = '';
177
  // shortcode template file path
178
  $sc_path = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/styles-shortcode/sc-style-' . $style. '.php';
179
 
180
+ // todo: 3.3 - later have to remove onclick attribute
181
+
182
  if ( is_file( $sc_path ) ) {
183
+ $o .= '<div onclick="ht_ctc_shortcode_click(this);" data-webandapi="'.$webandapi.'" data-number="'.$number.'" data-pre_filled="'.$pre_filled.'" data-return_type="'.$return_type.'" data-style="'.$style.'" data-is_ga_enable="'.$ht_ctc_os['is_ga_enable'].'" data-is_fb_an_enable="'.$ht_ctc_os['is_fb_an_enable'].'" data-is_fb_pixel="'.$ht_ctc_os['is_fb_pixel'].'" style="display: inline; cursor: pointer; z-index: 99999999; '.$css.'" class="'.$class_names.' ht-ctc-inline">';
184
  include $sc_path;
185
  $o .= '</div>';
186
  } else {
187
  // if style is not in the list..
188
  $img_link = plugins_url("./new/inc/assets/img/whatsapp-logo.svg", HT_CTC_PLUGIN_FILE );
189
+ $o .= '<div onclick="ht_ctc_shortcode_click(this);" data-webandapi="'.$webandapi.'" data-number="'.$number.'" data-pre_filled="'.$pre_filled.'" data-return_type="'.$return_type.'" data-is_ga_enable="'.$ht_ctc_os['is_ga_enable'].'" data-is_fb_an_enable="'.$ht_ctc_os['is_fb_an_enable'].'" data-is_fb_pixel="'.$ht_ctc_os['is_fb_pixel'].'" style="display: inline; cursor: pointer; z-index: 99999999; '.$css.'" class="'.$class_names.' ht-ctc-inline">';
190
  $o .= '<img class="img-icon-sc sc_item pointer style-3-sc" src="'.$img_link.'" alt="'.$call_to_action.'" style="height: 50px; '.$css.' " >';
191
  $o .= '</div>';
192
  }
new/inc/chat/class-ht-ctc-chat.php CHANGED
@@ -15,6 +15,22 @@ class HT_CTC_Chat {
15
 
16
  $options = get_option('ht_ctc_chat_options');
17
  $othersettings = get_option('ht_ctc_othersettings');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
  $ht_ctc_chat = array();
20
  $ht_ctc_os = array();
@@ -26,7 +42,6 @@ class HT_CTC_Chat {
26
  return;
27
  }
28
 
29
- $type = "chat";
30
 
31
  // position
32
  include HT_CTC_PLUGIN_DIR .'new/inc/commons/position-to-place.php';
@@ -35,20 +50,9 @@ class HT_CTC_Chat {
35
 
36
  // is mobile
37
  $is_mobile = ht_ctc()->device_type->is_mobile();
38
-
39
- $wp_device = '';
40
-
41
  // style
42
- $ht_ctc_chat['style_d'] = esc_attr( $options['style_desktop'] );
43
- $ht_ctc_chat['style_m'] = esc_attr( $options['style_mobile'] );
44
- if ( 'yes' == $is_mobile ) {
45
- $ht_ctc_chat['style'] = $ht_ctc_chat['style_m'];
46
- $wp_device = 'ctc_wp_mobile';
47
- } else {
48
- $ht_ctc_chat['style'] = $ht_ctc_chat['style_d'];
49
- $wp_device = 'ctc_wp_desktop';
50
- }
51
-
52
 
53
  $page_id = get_the_ID();
54
  $page_url = get_permalink();
@@ -68,10 +72,10 @@ class HT_CTC_Chat {
68
  $ht_ctc_chat['call_to_action'] = apply_filters( 'wpml_translate_single_string', $ht_ctc_chat['call_to_action'], 'Click to Chat for WhatsApp', 'call_to_action' );
69
 
70
  // prefilled text
71
- $ht_ctc_chat['pre_filled'] = esc_attr( $options['pre_filled'] );
72
  $ht_ctc_chat['pre_filled'] = apply_filters( 'wpml_translate_single_string', $ht_ctc_chat['pre_filled'], 'Click to Chat for WhatsApp', 'pre_filled' );
73
 
74
- // webapi: web/api.whatsapp, wa: wa.me
75
  $ht_ctc_chat['webandapi'] = 'wa';
76
  if ( isset( $options['webandapi'] ) ) {
77
  $ht_ctc_chat['webandapi'] = 'webapi';
@@ -94,7 +98,7 @@ class HT_CTC_Chat {
94
  }
95
 
96
  // class names
97
- $ht_ctc_chat['class_names'] = "ht-ctc ht-ctc-chat $wp_device ctc-analytics ";
98
 
99
  $ht_ctc_chat['css'] = "display: none; cursor: pointer; z-index: 99999999;";
100
 
@@ -116,19 +120,28 @@ class HT_CTC_Chat {
116
  // Fallback support - js will override this css
117
  $backend_position = $ht_ctc_chat['position'];
118
 
 
 
 
 
 
 
 
 
 
119
  // @uses at styles / easy call (after filter hook)
120
  $style = $ht_ctc_chat['style'];
121
- $style_d = $ht_ctc_chat['style_d'];
122
- $style_m = $ht_ctc_chat['style_m'];
123
  $call_to_action = $ht_ctc_chat['call_to_action'];
124
 
125
- $ht_ctc_chat['class_names'] .= " style-$style ";
126
 
127
  // call style
128
  $path = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/styles/style-' . $style. '.php';
129
 
130
- $path_d = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/styles/style-' . $style_d. '.php';
131
- $path_m = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/styles/style-' . $style_m. '.php';
132
 
133
 
134
  if ( '' == $call_to_action ) {
@@ -138,13 +151,13 @@ class HT_CTC_Chat {
138
  }
139
 
140
 
141
-
142
  if ( is_file( $path ) ) {
143
  do_action('ht_ctc_ah_before_fixed_position');
 
144
  ?>
145
  <div onclick="ht_ctc_click(this);" class="<?php echo $ht_ctc_chat['class_names'] ?>"
146
- style="display: none; <?php echo $backend_position ?>"
147
- data-return_type="<?php echo $type ?>"
148
  data-style="<?php echo $ht_ctc_chat['style'] ?>"
149
  data-number="<?php echo $ht_ctc_chat['number'] ?>"
150
  data-pre_filled="<?php echo $ht_ctc_chat['pre_filled'] ?>"
15
 
16
  $options = get_option('ht_ctc_chat_options');
17
  $othersettings = get_option('ht_ctc_othersettings');
18
+ $type = "chat";
19
+
20
+ // If db values are not correct
21
+ if ( !is_array($options) || !isset($options['number']) ) {
22
+
23
+ // in debug mode
24
+ if ( isset($othersettings['debug_mode']) ) {
25
+ ?>
26
+ <script>console.log('please check plugin settings and save changes')</script>
27
+ <?php
28
+ }
29
+
30
+ return;
31
+ }
32
+
33
+
34
 
35
  $ht_ctc_chat = array();
36
  $ht_ctc_os = array();
42
  return;
43
  }
44
 
 
45
 
46
  // position
47
  include HT_CTC_PLUGIN_DIR .'new/inc/commons/position-to-place.php';
50
 
51
  // is mobile
52
  $is_mobile = ht_ctc()->device_type->is_mobile();
 
 
 
53
  // style
54
+ $ht_ctc_chat['style_desktop'] = esc_attr( $options['style_desktop'] );
55
+ $ht_ctc_chat['style_mobile'] = esc_attr( $options['style_mobile'] );
 
 
 
 
 
 
 
 
56
 
57
  $page_id = get_the_ID();
58
  $page_url = get_permalink();
72
  $ht_ctc_chat['call_to_action'] = apply_filters( 'wpml_translate_single_string', $ht_ctc_chat['call_to_action'], 'Click to Chat for WhatsApp', 'call_to_action' );
73
 
74
  // prefilled text
75
+ $ht_ctc_chat['pre_filled'] = (isset($ht_ctc_pagelevel['pre_filled'])) ? esc_attr($ht_ctc_pagelevel['pre_filled']) : __( esc_attr( $options['pre_filled'] ) , 'click-to-chat-for-whatsapp' );
76
  $ht_ctc_chat['pre_filled'] = apply_filters( 'wpml_translate_single_string', $ht_ctc_chat['pre_filled'], 'Click to Chat for WhatsApp', 'pre_filled' );
77
 
78
+ // wa: wa.me / webapi: web/api.whatsapp,
79
  $ht_ctc_chat['webandapi'] = 'wa';
80
  if ( isset( $options['webandapi'] ) ) {
81
  $ht_ctc_chat['webandapi'] = 'webapi';
98
  }
99
 
100
  // class names
101
+ $ht_ctc_chat['class_names'] = "ht-ctc ht-ctc-chat ctc-analytics ";
102
 
103
  $ht_ctc_chat['css'] = "display: none; cursor: pointer; z-index: 99999999;";
104
 
120
  // Fallback support - js will override this css
121
  $backend_position = $ht_ctc_chat['position'];
122
 
123
+ // style for desktop, mobile
124
+ if ( 'yes' == $is_mobile ) {
125
+ $ht_ctc_chat['style'] = $ht_ctc_chat['style_mobile'];
126
+ $wp_device = 'ctc_wp_mobile';
127
+ } else {
128
+ $ht_ctc_chat['style'] = $ht_ctc_chat['style_desktop'];
129
+ $wp_device = 'ctc_wp_desktop';
130
+ }
131
+
132
  // @uses at styles / easy call (after filter hook)
133
  $style = $ht_ctc_chat['style'];
134
+ $style_desktop = $ht_ctc_chat['style_desktop'];
135
+ $style_mobile = $ht_ctc_chat['style_mobile'];
136
  $call_to_action = $ht_ctc_chat['call_to_action'];
137
 
138
+ $ht_ctc_chat['class_names'] .= " $wp_device style-$style ";
139
 
140
  // call style
141
  $path = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/styles/style-' . $style. '.php';
142
 
143
+ $path_d = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/styles/style-' . $style_desktop. '.php';
144
+ $path_m = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/styles/style-' . $style_mobile. '.php';
145
 
146
 
147
  if ( '' == $call_to_action ) {
151
  }
152
 
153
 
 
154
  if ( is_file( $path ) ) {
155
  do_action('ht_ctc_ah_before_fixed_position');
156
+ // todo: 3.3 - later have to remove onclick attribute
157
  ?>
158
  <div onclick="ht_ctc_click(this);" class="<?php echo $ht_ctc_chat['class_names'] ?>"
159
+ style="display: none; <?php echo $backend_position ?>"
160
+ data-return_type="<?php echo $type ?>"
161
  data-style="<?php echo $ht_ctc_chat['style'] ?>"
162
  data-number="<?php echo $ht_ctc_chat['number'] ?>"
163
  data-pre_filled="<?php echo $ht_ctc_chat['pre_filled'] ?>"
new/inc/commons/class-ht-ctc-hooks.php CHANGED
@@ -26,8 +26,6 @@ class HT_CTC_Hooks {
26
  add_action( 'ht_ctc_ah_before_fixed_position', array($this, 'comment') );
27
  add_action( 'ht_ctc_ah_before_fixed_position', array($this, 'css_styles') );
28
 
29
- // if an issue with cache plugin
30
- // add_action( 'ht_ctc_ah_after_fixed_position', array($this, 'scripts') );
31
 
32
  // ## Filter Hooks ##
33
  add_filter( 'ht_ctc_fh_chat', array($this, 'chat_settings') );
@@ -80,18 +78,6 @@ class HT_CTC_Hooks {
80
  echo $comment;
81
  }
82
 
83
- // scripts - after fixed position
84
- function scripts() {
85
-
86
- // autoptimize cache plugin
87
- // as some plugin/theme js have errors and blocks the other scripts. so added like this.
88
- if( class_exists('autoptimizeCache') ) {
89
- ?>
90
- <script>setTimeout(function(){try{ht_ctc_loaded();}catch(e){}},3000);</script>
91
- <?php
92
- }
93
- }
94
-
95
 
96
  /**
97
  * Filter Hooks
@@ -120,7 +106,6 @@ class HT_CTC_Hooks {
120
  $ht_ctc_os['show_effect'] = (isset($othersettings['show_effect'])) ? esc_attr($othersettings['show_effect']) : '';
121
  $ht_ctc_os['is_ga_enable'] = (isset( $othersettings['google_analytics'] )) ? 'yes' : 'no';
122
  $ht_ctc_os['is_fb_pixel'] = (isset( $othersettings['fb_pixel'] )) ? 'yes' : 'no';
123
- $ht_ctc_os['is_fb_an_enable'] = (isset( $othersettings['fb_analytics'] )) ? 'yes' : 'no';
124
 
125
  // show effect ? if 'From Corner' - then return time (from center - this->css_styles() handles)
126
  if ( 'From Corner' == $ht_ctc_os['show_effect'] ) {
26
  add_action( 'ht_ctc_ah_before_fixed_position', array($this, 'comment') );
27
  add_action( 'ht_ctc_ah_before_fixed_position', array($this, 'css_styles') );
28
 
 
 
29
 
30
  // ## Filter Hooks ##
31
  add_filter( 'ht_ctc_fh_chat', array($this, 'chat_settings') );
78
  echo $comment;
79
  }
80
 
 
 
 
 
 
 
 
 
 
 
 
 
81
 
82
  /**
83
  * Filter Hooks
106
  $ht_ctc_os['show_effect'] = (isset($othersettings['show_effect'])) ? esc_attr($othersettings['show_effect']) : '';
107
  $ht_ctc_os['is_ga_enable'] = (isset( $othersettings['google_analytics'] )) ? 'yes' : 'no';
108
  $ht_ctc_os['is_fb_pixel'] = (isset( $othersettings['fb_pixel'] )) ? 'yes' : 'no';
 
109
 
110
  // show effect ? if 'From Corner' - then return time (from center - this->css_styles() handles)
111
  if ( 'From Corner' == $ht_ctc_os['show_effect'] ) {
new/inc/commons/class-ht-ctc-scripts.php CHANGED
@@ -20,23 +20,20 @@ class HT_CTC_Scripts {
20
  */
21
  function register_scripts() {
22
 
23
- $ht_ctc_othersettings = get_option('ht_ctc_othersettings');
24
 
25
  // true/false
26
  $load_app_js_bottom = apply_filters( 'ht_ctc_fh_load_app_js_bottom', true );
27
 
28
- // s7, s8 - fonts - enqueue at style page
29
- wp_register_style('ht_ctc_font_css', plugins_url( 'new/inc/assets/css/font.css', HT_CTC_PLUGIN_FILE ), '', HT_CTC_VERSION );
30
-
31
  // style-8 - enqueue at style page
32
  wp_register_style('ht_ctc_mdstyle8_css', plugins_url( 'new/inc/assets/css/mdstyle8.css', HT_CTC_PLUGIN_FILE ) , '', HT_CTC_VERSION );
33
 
34
  // js
35
- if ('production' == HT_CTC_ENVIRONMENT ) {
36
- $js = 'app.js';
37
- $group_js = 'group.js';
38
- $share_js = 'share.js';
39
- } else {
40
  $js = 'dev/app.dev.js';
41
  $group_js = 'dev/group.dev.js';
42
  $share_js = 'dev/share.dev.js';
@@ -47,12 +44,12 @@ class HT_CTC_Scripts {
47
 
48
 
49
  // group.js
50
- if ( isset ( $ht_ctc_othersettings['enable_group'] ) ) {
51
  wp_enqueue_script( 'ht_ctc_group_js', plugins_url( "new/inc/assets/js/$group_js", HT_CTC_PLUGIN_FILE ), array ( 'jquery', 'ht_ctc_app_js' ), HT_CTC_VERSION, $load_app_js_bottom );
52
  }
53
 
54
  // share.js
55
- if ( isset ( $ht_ctc_othersettings['enable_share'] ) ) {
56
  wp_enqueue_script( 'ht_ctc_share_js', plugins_url( "new/inc/assets/js/$share_js", HT_CTC_PLUGIN_FILE ), array ( 'jquery', 'ht_ctc_app_js' ), HT_CTC_VERSION, $load_app_js_bottom );
57
  }
58
 
20
  */
21
  function register_scripts() {
22
 
23
+ $os = get_option('ht_ctc_othersettings');
24
 
25
  // true/false
26
  $load_app_js_bottom = apply_filters( 'ht_ctc_fh_load_app_js_bottom', true );
27
 
 
 
 
28
  // style-8 - enqueue at style page
29
  wp_register_style('ht_ctc_mdstyle8_css', plugins_url( 'new/inc/assets/css/mdstyle8.css', HT_CTC_PLUGIN_FILE ) , '', HT_CTC_VERSION );
30
 
31
  // js
32
+ $js = 'app.js';
33
+ $group_js = 'group.js';
34
+ $share_js = 'share.js';
35
+
36
+ if ( isset($os['debug_mode']) || 'production' !== HT_CTC_ENVIRONMENT ) {
37
  $js = 'dev/app.dev.js';
38
  $group_js = 'dev/group.dev.js';
39
  $share_js = 'dev/share.dev.js';
44
 
45
 
46
  // group.js
47
+ if ( isset ( $os['enable_group'] ) ) {
48
  wp_enqueue_script( 'ht_ctc_group_js', plugins_url( "new/inc/assets/js/$group_js", HT_CTC_PLUGIN_FILE ), array ( 'jquery', 'ht_ctc_app_js' ), HT_CTC_VERSION, $load_app_js_bottom );
49
  }
50
 
51
  // share.js
52
+ if ( isset ( $os['enable_share'] ) ) {
53
  wp_enqueue_script( 'ht_ctc_share_js', plugins_url( "new/inc/assets/js/$share_js", HT_CTC_PLUGIN_FILE ), array ( 'jquery', 'ht_ctc_app_js' ), HT_CTC_VERSION, $load_app_js_bottom );
54
  }
55
 
new/inc/commons/position-to-place.php CHANGED
@@ -4,10 +4,9 @@
4
  * @included from - class-ht-ctc-chat/group/share.php
5
  */
6
 
7
-
8
- // later fixed / absolute
9
- $position_type = 'fixed';
10
- $position_type_mobile = 'fixed';
11
 
12
  // Dekstop position
13
  $side_1 = esc_attr( $options['side_1'] );
4
  * @included from - class-ht-ctc-chat/group/share.php
5
  */
6
 
7
+ // position hooks
8
+ $position_type = apply_filters( 'ht_ctc_fh_position_type', 'fixed', $options );
9
+ $position_type_mobile = apply_filters( 'ht_ctc_fh_position_type_mobile', 'fixed', $options );
 
10
 
11
  // Dekstop position
12
  $side_1 = esc_attr( $options['side_1'] );
new/inc/group/class-ht-ctc-group-shortcode.php CHANGED
@@ -23,6 +23,7 @@ class HT_CTC_Group_Shortcode {
23
  public function shortcode( $atts = [], $content = null, $shortcode = '' ) {
24
 
25
  $options = get_option('ht_ctc_group');
 
26
 
27
  $group_id = esc_attr( $options['group_id'] );
28
  $call_to_action_db = esc_attr( $options['call_to_action'] );
@@ -139,9 +140,12 @@ class HT_CTC_Group_Shortcode {
139
  $class_names = "ht-ctc-sc ht-ctc-sc-group sc-style-$style";
140
 
141
  // analytics
142
- $is_ga_enable = apply_filters( 'ht_ctc_fh_is_ga_enable', 'no' );
143
- $is_fb_pixel = apply_filters( 'ht_ctc_fh_is_fb_pixel', 'no' );
144
- $is_fb_an_enable = apply_filters( 'ht_ctc_fh_is_fb_an_enable', 'no' );
 
 
 
145
 
146
 
147
  $o = '';
@@ -150,13 +154,13 @@ class HT_CTC_Group_Shortcode {
150
  $sc_path = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/styles-shortcode/sc-style-' . $style. '.php';
151
 
152
  if ( is_file( $sc_path ) ) {
153
- $o .= '<div data-ctc-link="'.$link.'" data-return_type="'.$return_type.'" data-group_id="'.$group_id.'" data-is_ga_enable="'.$is_ga_enable.'" data-is_fb_pixel="'.$is_fb_pixel.'" data-is_fb_an_enable="'.$is_fb_an_enable.'" style="display: inline; cursor: pointer; z-index: 99999999; '.$css.'" class="'.$class_names.' ht-ctc-inline">';
154
  include $sc_path;
155
  $o .= '</div>';
156
  } else {
157
  // if style is not in the list..
158
  $img_link = plugins_url("./new/inc/assets/img/whatsapp-logo.svg", HT_CTC_PLUGIN_FILE );
159
- $o .= '<div data-ctc-link="'.$link.'" data-return_type="'.$return_type.'" data-is_ga_enable="'.$is_ga_enable.'" data-is_fb_pixel="'.$is_fb_pixel.'" data-is_fb_an_enable="'.$is_fb_an_enable.'" style="display: inline; cursor: pointer; z-index: 99999999; '.$css.'" class="'.$class_names.' ht-ctc-inline">';
160
  $o .= '<img class="img-icon-sc sc_item pointer style-3-sc" src="'.$img_link.'" alt="'.$call_to_action.'" style="height: 50px; '.$css.' " >';
161
  $o .= '</div>';
162
  }
23
  public function shortcode( $atts = [], $content = null, $shortcode = '' ) {
24
 
25
  $options = get_option('ht_ctc_group');
26
+ $ht_ctc_os = array();
27
 
28
  $group_id = esc_attr( $options['group_id'] );
29
  $call_to_action_db = esc_attr( $options['call_to_action'] );
140
  $class_names = "ht-ctc-sc ht-ctc-sc-group sc-style-$style";
141
 
142
  // analytics
143
+ $ht_ctc_os['is_ga_enable'] = 'yes';
144
+ $ht_ctc_os['is_fb_pixel'] = 'yes';
145
+ $ht_ctc_os['is_fb_an_enable'] = 'yes';
146
+
147
+ // Hooks
148
+ $ht_ctc_os = apply_filters( 'ht_ctc_fh_os', $ht_ctc_os );
149
 
150
 
151
  $o = '';
154
  $sc_path = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/styles-shortcode/sc-style-' . $style. '.php';
155
 
156
  if ( is_file( $sc_path ) ) {
157
+ $o .= '<div data-ctc-link="'.$link.'" data-return_type="'.$return_type.'" data-group_id="'.$group_id.'" data-is_ga_enable="'.$ht_ctc_os['is_ga_enable'].'" data-is_fb_pixel="'.$ht_ctc_os['is_fb_pixel'].'" data-is_fb_an_enable="'.$ht_ctc_os['is_fb_an_enable'].'" style="display: inline; cursor: pointer; z-index: 99999999; '.$css.'" class="'.$class_names.' ht-ctc-inline">';
158
  include $sc_path;
159
  $o .= '</div>';
160
  } else {
161
  // if style is not in the list..
162
  $img_link = plugins_url("./new/inc/assets/img/whatsapp-logo.svg", HT_CTC_PLUGIN_FILE );
163
+ $o .= '<div data-ctc-link="'.$link.'" data-return_type="'.$return_type.'" data-is_ga_enable="'.$ht_ctc_os['is_ga_enable'].'" data-is_fb_pixel="'.$ht_ctc_os['is_fb_pixel'].'" data-is_fb_an_enable="'.$ht_ctc_os['is_fb_an_enable'].'" style="display: inline; cursor: pointer; z-index: 99999999; '.$css.'" class="'.$class_names.' ht-ctc-inline">';
164
  $o .= '<img class="img-icon-sc sc_item pointer style-3-sc" src="'.$img_link.'" alt="'.$call_to_action.'" style="height: 50px; '.$css.' " >';
165
  $o .= '</div>';
166
  }
new/inc/group/class-ht-ctc-group.php CHANGED
@@ -20,6 +20,9 @@ class HT_CTC_Group {
20
 
21
  $options = get_option('ht_ctc_group');
22
  $othersettings = get_option('ht_ctc_othersettings');
 
 
 
23
 
24
  $ht_ctc_group = array();
25
  $ht_ctc_os = array();
@@ -31,7 +34,6 @@ class HT_CTC_Group {
31
  return;
32
  }
33
 
34
- $type = "group";
35
 
36
  // position
37
  include HT_CTC_PLUGIN_DIR .'new/inc/commons/position-to-place.php';
@@ -42,14 +44,8 @@ class HT_CTC_Group {
42
  $is_mobile = ht_ctc()->device_type->is_mobile();
43
 
44
  // style
45
- $ht_ctc_group['style_d'] = esc_attr( $options['style_desktop'] );
46
- $ht_ctc_group['style_m'] = esc_attr( $options['style_mobile'] );
47
- if ( 'yes' == $is_mobile ) {
48
- $ht_ctc_group['style'] = $ht_ctc_group['style_m'];
49
- } else {
50
- $ht_ctc_group['style'] = $ht_ctc_group['style_d'];
51
- }
52
-
53
 
54
  // call to action
55
  $ht_ctc_group['call_to_action'] = esc_attr( $options['call_to_action'] );
@@ -69,10 +65,6 @@ class HT_CTC_Group {
69
  $ht_ctc_group['group_id'] = (isset($ht_ctc_pagelevel['group_id'])) ? esc_attr($ht_ctc_pagelevel['group_id']) : esc_attr( $options['group_id'] );
70
  $ht_ctc_group['group_id'] = apply_filters( 'wpml_translate_single_string', $ht_ctc_group['group_id'], 'Click to Chat for WhatsApp', 'group_id__group' );
71
 
72
- // analytics
73
- $is_ga_enable = apply_filters( 'ht_ctc_fh_is_ga_enable', 'no' );
74
- $is_fb_pixel = apply_filters( 'ht_ctc_fh_is_fb_pixel', 'no' );
75
- $is_fb_an_enable = apply_filters( 'ht_ctc_fh_is_fb_an_enable', 'no' );
76
 
77
  $ht_ctc_group['display_mobile'] = (isset($options['hideon_mobile'])) ? 'hide' : 'show';
78
  $ht_ctc_group['display_desktop'] = (isset($options['hideon_desktop'])) ? 'hide' : 'show';
@@ -93,11 +85,17 @@ class HT_CTC_Group {
93
  $ht_ctc_group = apply_filters( 'ht_ctc_fh_group', $ht_ctc_group );
94
  $ht_ctc_os = apply_filters( 'ht_ctc_fh_os', $ht_ctc_os );
95
 
 
 
 
 
 
 
96
 
97
  // @uses at styles / easy call (after filter hook)
98
  $style = $ht_ctc_group['style'];
99
- $style_d = $ht_ctc_group['style_d'];
100
- $style_m = $ht_ctc_group['style_m'];
101
  $call_to_action = $ht_ctc_group['call_to_action'];
102
 
103
  $ht_ctc_group['class_names'] .= " style-$style ";
@@ -111,8 +109,8 @@ class HT_CTC_Group {
111
  // call style
112
  $path = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/styles/style-' . $style. '.php';
113
 
114
- $path_d = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/styles/style-' . $style_d. '.php';
115
- $path_m = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/styles/style-' . $style_m. '.php';
116
 
117
 
118
  if ( is_file( $path ) ) {
20
 
21
  $options = get_option('ht_ctc_group');
22
  $othersettings = get_option('ht_ctc_othersettings');
23
+ $type = "group";
24
+
25
+ // TODO: If db values are not correct - similar to chat
26
 
27
  $ht_ctc_group = array();
28
  $ht_ctc_os = array();
34
  return;
35
  }
36
 
 
37
 
38
  // position
39
  include HT_CTC_PLUGIN_DIR .'new/inc/commons/position-to-place.php';
44
  $is_mobile = ht_ctc()->device_type->is_mobile();
45
 
46
  // style
47
+ $ht_ctc_group['style_desktop'] = esc_attr( $options['style_desktop'] );
48
+ $ht_ctc_group['style_mobile'] = esc_attr( $options['style_mobile'] );
 
 
 
 
 
 
49
 
50
  // call to action
51
  $ht_ctc_group['call_to_action'] = esc_attr( $options['call_to_action'] );
65
  $ht_ctc_group['group_id'] = (isset($ht_ctc_pagelevel['group_id'])) ? esc_attr($ht_ctc_pagelevel['group_id']) : esc_attr( $options['group_id'] );
66
  $ht_ctc_group['group_id'] = apply_filters( 'wpml_translate_single_string', $ht_ctc_group['group_id'], 'Click to Chat for WhatsApp', 'group_id__group' );
67
 
 
 
 
 
68
 
69
  $ht_ctc_group['display_mobile'] = (isset($options['hideon_mobile'])) ? 'hide' : 'show';
70
  $ht_ctc_group['display_desktop'] = (isset($options['hideon_desktop'])) ? 'hide' : 'show';
85
  $ht_ctc_group = apply_filters( 'ht_ctc_fh_group', $ht_ctc_group );
86
  $ht_ctc_os = apply_filters( 'ht_ctc_fh_os', $ht_ctc_os );
87
 
88
+ // style for desktop, mobile
89
+ if ( 'yes' == $is_mobile ) {
90
+ $ht_ctc_group['style'] = $ht_ctc_group['style_mobile'];
91
+ } else {
92
+ $ht_ctc_group['style'] = $ht_ctc_group['style_desktop'];
93
+ }
94
 
95
  // @uses at styles / easy call (after filter hook)
96
  $style = $ht_ctc_group['style'];
97
+ $style_desktop = $ht_ctc_group['style_desktop'];
98
+ $style_mobile = $ht_ctc_group['style_mobile'];
99
  $call_to_action = $ht_ctc_group['call_to_action'];
100
 
101
  $ht_ctc_group['class_names'] .= " style-$style ";
109
  // call style
110
  $path = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/styles/style-' . $style. '.php';
111
 
112
+ $path_d = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/styles/style-' . $style_desktop. '.php';
113
+ $path_m = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/styles/style-' . $style_mobile. '.php';
114
 
115
 
116
  if ( is_file( $path ) ) {
new/inc/share/class-ht-ctc-share-shortcode.php CHANGED
@@ -23,6 +23,7 @@ class HT_CTC_Share_Shortcode {
23
  public function shortcode( $atts = [], $content = null, $shortcode = '' ) {
24
 
25
  $options = get_option('ht_ctc_share');
 
26
 
27
  $share_text_db = esc_attr( $options['share_text'] );
28
  $call_to_action_db = esc_attr( $options['call_to_action'] );
@@ -160,9 +161,12 @@ class HT_CTC_Share_Shortcode {
160
  $class_names = "ht-ctc-sc ht-ctc-sc-share sc-style-$style";
161
 
162
  // analytics
163
- $is_ga_enable = apply_filters( 'ht_ctc_fh_is_ga_enable', 'no' );
164
- $is_fb_pixel = apply_filters( 'ht_ctc_fh_is_fb_pixel', 'no' );
165
- $is_fb_an_enable = apply_filters( 'ht_ctc_fh_is_fb_an_enable', 'no' );
 
 
 
166
 
167
 
168
  $o = '';
@@ -171,13 +175,13 @@ class HT_CTC_Share_Shortcode {
171
  $sc_path = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/styles-shortcode/sc-style-' . $style. '.php';
172
 
173
  if ( is_file( $sc_path ) ) {
174
- $o .= '<div data-ctc-link="'.$link.'" data-return_type="'.$return_type.'" data-share_text="'.$share_text.'" data-is_ga_enable="'.$is_ga_enable.'" data-is_fb_pixel="'.$is_fb_pixel.'" data-is_fb_an_enable="'.$is_fb_an_enable.'" style="display: inline; cursor: pointer; z-index: 99999999; '.$css.'" class="'.$class_names.' ht-ctc-inline">';
175
  include $sc_path;
176
  $o .= '</div>';
177
  } else {
178
  // if style is not in the list..
179
  $img_link = plugins_url("./new/inc/assets/img/whatsapp-logo.svg", HT_CTC_PLUGIN_FILE );
180
- $o .= '<div data-ctc-link="'.$link.'" data-return_type="'.$return_type.'" data-is_ga_enable="'.$is_ga_enable.'" data-is_fb_pixel="'.$is_fb_pixel.'" data-is_fb_an_enable="'.$is_fb_an_enable.'" style="display: inline; cursor: pointer; z-index: 99999999; '.$css.'" class="'.$class_names.' ht-ctc-inline">';
181
  $o .= '<img class="img-icon-sc sc_item pointer style-3-sc" src="'.$img_link.'" alt="'.$call_to_action.'" style="height: 50px; '.$css.' " >';
182
  $o .= '</div>';
183
  }
23
  public function shortcode( $atts = [], $content = null, $shortcode = '' ) {
24
 
25
  $options = get_option('ht_ctc_share');
26
+ $ht_ctc_os = array();
27
 
28
  $share_text_db = esc_attr( $options['share_text'] );
29
  $call_to_action_db = esc_attr( $options['call_to_action'] );
161
  $class_names = "ht-ctc-sc ht-ctc-sc-share sc-style-$style";
162
 
163
  // analytics
164
+ $ht_ctc_os['is_ga_enable'] = 'yes';
165
+ $ht_ctc_os['is_fb_pixel'] = 'yes';
166
+ $ht_ctc_os['is_fb_an_enable'] = 'yes';
167
+
168
+ // Hooks
169
+ $ht_ctc_os = apply_filters( 'ht_ctc_fh_os', $ht_ctc_os );
170
 
171
 
172
  $o = '';
175
  $sc_path = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/styles-shortcode/sc-style-' . $style. '.php';
176
 
177
  if ( is_file( $sc_path ) ) {
178
+ $o .= '<div data-ctc-link="'.$link.'" data-return_type="'.$return_type.'" data-share_text="'.$share_text.'" data-is_ga_enable="'.$ht_ctc_os['is_ga_enable'].'" data-is_fb_pixel="'.$ht_ctc_os['is_fb_pixel'].'" data-is_fb_an_enable="'.$ht_ctc_os['is_fb_an_enable'].'" style="display: inline; cursor: pointer; z-index: 99999999; '.$css.'" class="'.$class_names.' ht-ctc-inline">';
179
  include $sc_path;
180
  $o .= '</div>';
181
  } else {
182
  // if style is not in the list..
183
  $img_link = plugins_url("./new/inc/assets/img/whatsapp-logo.svg", HT_CTC_PLUGIN_FILE );
184
+ $o .= '<div data-ctc-link="'.$link.'" data-return_type="'.$return_type.'" data-is_ga_enable="'.$ht_ctc_os['is_ga_enable'].'" data-is_fb_pixel="'.$ht_ctc_os['is_fb_pixel'].'" data-is_fb_an_enable="'.$ht_ctc_os['is_fb_an_enable'].'" style="display: inline; cursor: pointer; z-index: 99999999; '.$css.'" class="'.$class_names.' ht-ctc-inline">';
185
  $o .= '<img class="img-icon-sc sc_item pointer style-3-sc" src="'.$img_link.'" alt="'.$call_to_action.'" style="height: 50px; '.$css.' " >';
186
  $o .= '</div>';
187
  }
new/inc/share/class-ht-ctc-share.php CHANGED
@@ -20,6 +20,9 @@ class HT_CTC_Share {
20
 
21
  $options = get_option('ht_ctc_share');
22
  $othersettings = get_option('ht_ctc_othersettings');
 
 
 
23
 
24
  $ht_ctc_share = array();
25
  $ht_ctc_os = array();
@@ -40,7 +43,6 @@ class HT_CTC_Share {
40
  return;
41
  }
42
 
43
- $type = "share";
44
 
45
  // position
46
  include HT_CTC_PLUGIN_DIR .'new/inc/commons/position-to-place.php';
@@ -51,13 +53,8 @@ class HT_CTC_Share {
51
  $is_mobile = ht_ctc()->device_type->is_mobile();
52
 
53
  // style
54
- $ht_ctc_share['style_d'] = esc_attr( $options['style_desktop'] );
55
- $ht_ctc_share['style_m'] = esc_attr( $options['style_mobile'] );
56
- if ( 'yes' == $is_mobile ) {
57
- $ht_ctc_share['style'] = $ht_ctc_share['style_m'];
58
- } else {
59
- $ht_ctc_share['style'] = $ht_ctc_share['style_d'];
60
- }
61
 
62
  // call to action
63
  $ht_ctc_share['call_to_action'] = esc_html( $options['call_to_action'] );
@@ -69,8 +66,8 @@ class HT_CTC_Share {
69
  $page_url = get_permalink();
70
  $post_title = esc_html( get_the_title() );
71
 
72
- // if ( is_home() || is_front_page() ) {
73
- if ( is_home() ) {
74
  $page_url = get_bloginfo('url');
75
  $post_title = HT_CTC_BLOG_NAME;
76
  }
@@ -100,10 +97,17 @@ class HT_CTC_Share {
100
  $ht_ctc_share = apply_filters( 'ht_ctc_fh_share', $ht_ctc_share );
101
  $ht_ctc_os = apply_filters( 'ht_ctc_fh_os', $ht_ctc_os );
102
 
 
 
 
 
 
 
 
103
  // @uses at styles / easy call (after filter hook)
104
  $style = $ht_ctc_share['style'];
105
- $style_d = $ht_ctc_share['style_d'];
106
- $style_m = $ht_ctc_share['style_m'];
107
  $call_to_action = $ht_ctc_share['call_to_action'];
108
 
109
  $ht_ctc_share['class_names'] .= " style-$style ";
@@ -117,8 +121,8 @@ class HT_CTC_Share {
117
  // call style
118
  $path = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/styles/style-' . $style. '.php';
119
 
120
- $path_d = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/styles/style-' . $style_d. '.php';
121
- $path_m = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/styles/style-' . $style_m. '.php';
122
 
123
 
124
  if ( is_file( $path ) ) {
20
 
21
  $options = get_option('ht_ctc_share');
22
  $othersettings = get_option('ht_ctc_othersettings');
23
+ $type = "share";
24
+
25
+ // TODO: If db values are not correct - similar to chat
26
 
27
  $ht_ctc_share = array();
28
  $ht_ctc_os = array();
43
  return;
44
  }
45
 
 
46
 
47
  // position
48
  include HT_CTC_PLUGIN_DIR .'new/inc/commons/position-to-place.php';
53
  $is_mobile = ht_ctc()->device_type->is_mobile();
54
 
55
  // style
56
+ $ht_ctc_share['style_desktop'] = esc_attr( $options['style_desktop'] );
57
+ $ht_ctc_share['style_mobile'] = esc_attr( $options['style_mobile'] );
 
 
 
 
 
58
 
59
  // call to action
60
  $ht_ctc_share['call_to_action'] = esc_html( $options['call_to_action'] );
66
  $page_url = get_permalink();
67
  $post_title = esc_html( get_the_title() );
68
 
69
+ // not singular posts in the loop, return the last post url
70
+ if ( is_home() || !is_singular() ) {
71
  $page_url = get_bloginfo('url');
72
  $post_title = HT_CTC_BLOG_NAME;
73
  }
97
  $ht_ctc_share = apply_filters( 'ht_ctc_fh_share', $ht_ctc_share );
98
  $ht_ctc_os = apply_filters( 'ht_ctc_fh_os', $ht_ctc_os );
99
 
100
+ // style for desktop, mobile
101
+ if ( 'yes' == $is_mobile ) {
102
+ $ht_ctc_share['style'] = $ht_ctc_share['style_mobile'];
103
+ } else {
104
+ $ht_ctc_share['style'] = $ht_ctc_share['style_desktop'];
105
+ }
106
+
107
  // @uses at styles / easy call (after filter hook)
108
  $style = $ht_ctc_share['style'];
109
+ $style_desktop = $ht_ctc_share['style_desktop'];
110
+ $style_mobile = $ht_ctc_share['style_mobile'];
111
  $call_to_action = $ht_ctc_share['call_to_action'];
112
 
113
  $ht_ctc_share['class_names'] .= " style-$style ";
121
  // call style
122
  $path = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/styles/style-' . $style. '.php';
123
 
124
+ $path_d = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/styles/style-' . $style_desktop. '.php';
125
+ $path_m = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/styles/style-' . $style_mobile. '.php';
126
 
127
 
128
  if ( is_file( $path ) ) {
new/inc/styles-shortcode/sc-style-1.php CHANGED
@@ -10,6 +10,23 @@ if ( ! defined( 'ABSPATH' ) ) exit;
10
  // $s1_img_size = esc_attr( $s1_options['s1_img_size'] );
11
 
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  $o .= '
14
- <button class="ctc-analytics">'.$call_to_action.'</button>
15
  ';
10
  // $s1_img_size = esc_attr( $s1_options['s1_img_size'] );
11
 
12
 
13
+ $s1_options = get_option( 'ht_ctc_s1' );
14
+
15
+ $s1_css = "";
16
+ $s1_text_color = (isset( $s1_options['s1_text_color'])) ? esc_attr( $s1_options['s1_text_color'] ) : '';
17
+ $s1_css .= ('' !== $s1_text_color) ? "color:$s1_text_color;": "";
18
+ $s1_bg_color = (isset( $s1_options['s1_bg_color'])) ? esc_attr( $s1_options['s1_bg_color'] ) : '';
19
+ $s1_css .= ('' !== $s1_bg_color) ? "background-color:$s1_bg_color;": "";
20
+
21
+ $s1_style = ('' !== $s1_css) ? "style='$s1_css'": "";
22
+
23
+ $s1_fullwidth_css = "";
24
+
25
+ if ( '' == $call_to_action ) {
26
+ $call_to_action = "WhatsApp us";
27
+ }
28
+
29
+
30
  $o .= '
31
+ <button '.$s1_style.' class="ctc-analytics">'.$call_to_action.'</button>
32
  ';
new/inc/styles-shortcode/sc-style-2.php CHANGED
@@ -14,5 +14,5 @@ $s2_img_link = plugins_url( './new/inc/assets/img/whatsapp-icon-square.svg', HT_
14
 
15
 
16
  $o .= '
17
- <img class="img-icon ctc-analytics" title="'.$call_to_action.'" style="height: '.$s2_img_size.';" src="'.$s2_img_link.'" alt="'.$call_to_action.'">
18
  ';
14
 
15
 
16
  $o .= '
17
+ <img class="img-icon ctc-analytics" title="'.$call_to_action.'" style="height: '.$s2_img_size.';" src="'.$s2_img_link.'" alt="'.$call_to_action.'">
18
  ';
new/inc/styles-shortcode/sc-style-3.php CHANGED
@@ -21,7 +21,7 @@ include_once HT_CTC_PLUGIN_DIR .'new/inc/assets/img/ht-ctc-svg-images.php';
21
 
22
  $s3_simple = '';
23
  $s3_simple .= '
24
- <img class="img-icon ctc-analytics" title="'.$call_to_action.'" style="display: inline-block; height: '.$img_size.';" src="'.$s3_img_link.'" alt="'.$call_to_action.'">
25
  ';
26
 
27
  $o .= $s3_simple;
21
 
22
  $s3_simple = '';
23
  $s3_simple .= '
24
+ <img class="img-icon ctc-analytics" title="'.$call_to_action.'" style="display: inline-block; height: '.$img_size.';" src="'.$s3_img_link.'" alt="'.$call_to_action.'">
25
  ';
26
 
27
  $o .= $s3_simple;
new/inc/styles-shortcode/sc-style-7.php CHANGED
@@ -56,14 +56,11 @@ $s7_hover_icon_styles = ".ht-ctc-sc.sc-style-7:hover .ctc_s_7_icon_padding{backg
56
  include_once HT_CTC_PLUGIN_DIR .'new/inc/assets/img/ht-ctc-svg-images.php';
57
 
58
  $style_7_svg = ht_ctc_singlecolor( $s7_svg_attrs );
59
-
60
  ?>
61
  <style id="ht-ctc-sc-s7">
62
  <?php echo $s7_hover_icon_styles ?>
63
  </style>
64
-
65
  <?php
66
-
67
  $o .= '
68
  <div '.$title.' class="ctc_s_7" style="'.$s7_n1_styles.'">
69
  <p class="ctc_s_7_cta ctc-analytics '.$s7_cta_class.'" style="'.$s7_cta_css.'">'.$call_to_action.'</p>
56
  include_once HT_CTC_PLUGIN_DIR .'new/inc/assets/img/ht-ctc-svg-images.php';
57
 
58
  $style_7_svg = ht_ctc_singlecolor( $s7_svg_attrs );
 
59
  ?>
60
  <style id="ht-ctc-sc-s7">
61
  <?php echo $s7_hover_icon_styles ?>
62
  </style>
 
63
  <?php
 
64
  $o .= '
65
  <div '.$title.' class="ctc_s_7" style="'.$s7_n1_styles.'">
66
  <p class="ctc_s_7_cta ctc-analytics '.$s7_cta_class.'" style="'.$s7_cta_css.'">'.$call_to_action.'</p>
new/inc/styles-shortcode/sc-style-7_1.php CHANGED
@@ -51,7 +51,6 @@ $style_7_1_svg = ht_ctc_singlecolor( $s7_svg_attrs );
51
  <style id="ht-ctc-sc-s7_1">
52
  <?php echo $s7_hover_styles ?>
53
  </style>
54
-
55
  <?php
56
 
57
  $o .= '
51
  <style id="ht-ctc-sc-s7_1">
52
  <?php echo $s7_hover_styles ?>
53
  </style>
 
54
  <?php
55
 
56
  $o .= '
new/inc/styles-shortcode/sc-style-8.php CHANGED
@@ -60,15 +60,11 @@ if ('hide' !== $s8_icon_position) {
60
  include_once HT_CTC_PLUGIN_DIR .'new/inc/assets/img/ht-ctc-svg-images.php';
61
  $style_8_svg = ht_ctc_singlecolor( $s8_svg_attrs );
62
  }
63
-
64
  ?>
65
-
66
  <style id="ht-ctc-sc-s8">
67
  .ht-ctc-sc .ht-ctc-style-8 .s_8 svg{<?php echo $s8_icon_css ?>;}.ht-ctc-sc:hover svg g path{fill:<?php echo $s8_txt_color_on_hover ?> !important;}.ht-ctc-sc:hover .ht-ctc-s8-text{color:<?php echo $s8_txt_color_on_hover ?> !important;}.ht-ctc-sc: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:<?php echo $s8_bg_color_on_hover ?> !important; }
68
  </style>
69
-
70
  <?php
71
-
72
  $o .= '
73
  <div class="ht-ctc-style-8 ctc-analytics" style="display: inline-block; '.$s8_width_css.' " >
74
  <span class="s_8 waves-effect waves-light ctc-analytics" style="'.$s8_main_span_css.' ">
60
  include_once HT_CTC_PLUGIN_DIR .'new/inc/assets/img/ht-ctc-svg-images.php';
61
  $style_8_svg = ht_ctc_singlecolor( $s8_svg_attrs );
62
  }
 
63
  ?>
 
64
  <style id="ht-ctc-sc-s8">
65
  .ht-ctc-sc .ht-ctc-style-8 .s_8 svg{<?php echo $s8_icon_css ?>;}.ht-ctc-sc:hover svg g path{fill:<?php echo $s8_txt_color_on_hover ?> !important;}.ht-ctc-sc:hover .ht-ctc-s8-text{color:<?php echo $s8_txt_color_on_hover ?> !important;}.ht-ctc-sc: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:<?php echo $s8_bg_color_on_hover ?> !important; }
66
  </style>
 
67
  <?php
 
68
  $o .= '
69
  <div class="ht-ctc-style-8 ctc-analytics" style="display: inline-block; '.$s8_width_css.' " >
70
  <span class="s_8 waves-effect waves-light ctc-analytics" style="'.$s8_main_span_css.' ">
new/inc/styles/style-1.php CHANGED
@@ -11,6 +11,14 @@ if ( ! defined( 'ABSPATH' ) ) exit;
11
  $s1_options = get_option( 'ht_ctc_s1' );
12
  $s1_options = apply_filters( 'ht_ctc_fh_s1_options', $s1_options );
13
 
 
 
 
 
 
 
 
 
14
  $s1_fullwidth_css = "";
15
 
16
  if ( '' == $call_to_action ) {
@@ -26,4 +34,4 @@ if ( isset( $s1_options['s1_m_fullwidth'] ) ) {
26
  }
27
 
28
  ?>
29
- <button class="ctc-analytics s1_btn"><?php echo $call_to_action ?></button>
11
  $s1_options = get_option( 'ht_ctc_s1' );
12
  $s1_options = apply_filters( 'ht_ctc_fh_s1_options', $s1_options );
13
 
14
+ $s1_css = "";
15
+ $s1_text_color = (isset( $s1_options['s1_text_color'])) ? esc_attr( $s1_options['s1_text_color'] ) : '';
16
+ $s1_css .= ('' !== $s1_text_color) ? "color:$s1_text_color;": "";
17
+ $s1_bg_color = (isset( $s1_options['s1_bg_color'])) ? esc_attr( $s1_options['s1_bg_color'] ) : '';
18
+ $s1_css .= ('' !== $s1_bg_color) ? "background-color:$s1_bg_color;": "";
19
+
20
+ $s1_style = ('' !== $s1_css) ? "style='$s1_css'": "";
21
+
22
  $s1_fullwidth_css = "";
23
 
24
  if ( '' == $call_to_action ) {
34
  }
35
 
36
  ?>
37
+ <button <?php echo $s1_style; ?> class="ctc-analytics s1_btn"><?php echo $call_to_action ?></button>
new/inc/styles/style-2.php CHANGED
@@ -33,12 +33,14 @@ if ( function_exists('is_rtl') && is_rtl() ) {
33
 
34
  $s2_cta_textcolor = (isset( $s2_options['cta_textcolor'])) ? esc_attr( $s2_options['cta_textcolor'] ) : '';
35
  $s2_cta_bgcolor = (isset( $s2_options['cta_bgcolor'])) ? esc_attr( $s2_options['cta_bgcolor'] ) : '#ffffff';
 
36
 
37
  $s2_cta_textcolor = ('' !== $s2_cta_textcolor) ? "color: $s2_cta_textcolor" : "";
38
  $s2_cta_bgcolor = ('' !== $s2_cta_bgcolor) ? "background-color: $s2_cta_bgcolor" : "";
 
39
 
40
  $s2_css = "display: flex; justify-content: center; align-items: center; $rtl_css ";
41
- $s2_cta_css = "padding: 0px 16px; $s2_cta_bgcolor; $s2_cta_textcolor; border-radius:10px; margin:0 10px; ";
42
  $s2_cta_class = "ht-ctc-cta ";
43
  $title = "";
44
  if ( 'hover' == $s2_cta_type ) {
33
 
34
  $s2_cta_textcolor = (isset( $s2_options['cta_textcolor'])) ? esc_attr( $s2_options['cta_textcolor'] ) : '';
35
  $s2_cta_bgcolor = (isset( $s2_options['cta_bgcolor'])) ? esc_attr( $s2_options['cta_bgcolor'] ) : '#ffffff';
36
+ $s2_cta_font_size = (isset( $s2_options['cta_font_size'])) ? esc_attr( $s2_options['cta_font_size'] ) : '';
37
 
38
  $s2_cta_textcolor = ('' !== $s2_cta_textcolor) ? "color: $s2_cta_textcolor" : "";
39
  $s2_cta_bgcolor = ('' !== $s2_cta_bgcolor) ? "background-color: $s2_cta_bgcolor" : "";
40
+ $s2_cta_font_size = ('' !== $s2_cta_font_size) ? "font-size: $s2_cta_font_size" : "";
41
 
42
  $s2_css = "display: flex; justify-content: center; align-items: center; $rtl_css ";
43
+ $s2_cta_css = "padding: 0px 16px; line-height: 1.6; $s2_cta_font_size; $s2_cta_bgcolor; $s2_cta_textcolor; border-radius:10px; margin:0 10px; ";
44
  $s2_cta_class = "ht-ctc-cta ";
45
  $title = "";
46
  if ( 'hover' == $s2_cta_type ) {
new/inc/styles/style-3.php CHANGED
@@ -35,11 +35,13 @@ if ('right' == $side_2) {
35
  $s3_css = "display:flex;justify-content:center;align-items:center;$rtl_css ";
36
  $s3_cta_textcolor = (isset( $s3_options['cta_textcolor'])) ? esc_attr( $s3_options['cta_textcolor'] ) : '';
37
  $s3_cta_bgcolor = (isset( $s3_options['cta_bgcolor'])) ? esc_attr( $s3_options['cta_bgcolor'] ) : '#ffffff';
 
38
 
39
  $s3_cta_textcolor = ('' !== $s3_cta_textcolor) ? "color: $s3_cta_textcolor" : "";
40
  $s3_cta_bgcolor = ('' !== $s3_cta_bgcolor) ? "background-color: $s3_cta_bgcolor" : "";
 
41
 
42
- $s3_cta_css = "padding: 0px 16px; $s3_cta_bgcolor; $s3_cta_textcolor; border-radius:10px; margin:0 10px; ";
43
  $s3_cta_class = "ht-ctc-cta ";
44
  $title = "";
45
  if ( 'hover' == $s3_cta_type ) {
35
  $s3_css = "display:flex;justify-content:center;align-items:center;$rtl_css ";
36
  $s3_cta_textcolor = (isset( $s3_options['cta_textcolor'])) ? esc_attr( $s3_options['cta_textcolor'] ) : '';
37
  $s3_cta_bgcolor = (isset( $s3_options['cta_bgcolor'])) ? esc_attr( $s3_options['cta_bgcolor'] ) : '#ffffff';
38
+ $s3_cta_font_size = (isset( $s3_options['cta_font_size'])) ? esc_attr( $s3_options['cta_font_size'] ) : '';
39
 
40
  $s3_cta_textcolor = ('' !== $s3_cta_textcolor) ? "color: $s3_cta_textcolor" : "";
41
  $s3_cta_bgcolor = ('' !== $s3_cta_bgcolor) ? "background-color: $s3_cta_bgcolor" : "";
42
+ $s3_cta_font_size = ('' !== $s3_cta_font_size) ? "font-size: $s3_cta_font_size" : "";
43
 
44
+ $s3_cta_css = "padding: 0px 16px; line-height: 1.6; $s3_cta_font_size; $s3_cta_bgcolor; $s3_cta_textcolor; border-radius:10px; margin:0 10px; ";
45
  $s3_cta_class = "ht-ctc-cta ";
46
  $title = "";
47
  if ( 'hover' == $s3_cta_type ) {
new/inc/styles/style-3_1.php CHANGED
@@ -25,11 +25,13 @@ if ('right' == $side_2) {
25
 
26
  $s3_1_cta_textcolor = (isset( $s3_1_options['cta_textcolor'])) ? esc_attr( $s3_1_options['cta_textcolor'] ) : '';
27
  $s3_1_cta_bgcolor = (isset( $s3_1_options['cta_bgcolor'])) ? esc_attr( $s3_1_options['cta_bgcolor'] ) : '#ffffff';
 
28
 
29
  $s3_1_cta_textcolor = ('' !== $s3_1_cta_textcolor) ? "color: $s3_1_cta_textcolor" : "";
30
  $s3_1_cta_bgcolor = ('' !== $s3_1_cta_bgcolor) ? "background-color: $s3_1_cta_bgcolor" : "";
 
31
 
32
- $s3_1_cta_css = "padding: 0px 16px; $s3_1_cta_bgcolor; $s3_1_cta_textcolor; border-radius:10px; margin:0 10px; ";
33
  $s3_1_cta_class = "ht-ctc-cta ";
34
  $title = "";
35
  if ( 'hover' == $s3_1_cta_type ) {
25
 
26
  $s3_1_cta_textcolor = (isset( $s3_1_options['cta_textcolor'])) ? esc_attr( $s3_1_options['cta_textcolor'] ) : '';
27
  $s3_1_cta_bgcolor = (isset( $s3_1_options['cta_bgcolor'])) ? esc_attr( $s3_1_options['cta_bgcolor'] ) : '#ffffff';
28
+ $s3_1_cta_font_size = (isset( $s3_1_options['cta_font_size'])) ? esc_attr( $s3_1_options['cta_font_size'] ) : '';
29
 
30
  $s3_1_cta_textcolor = ('' !== $s3_1_cta_textcolor) ? "color: $s3_1_cta_textcolor" : "";
31
  $s3_1_cta_bgcolor = ('' !== $s3_1_cta_bgcolor) ? "background-color: $s3_1_cta_bgcolor" : "";
32
+ $s3_1_cta_font_size = ('' !== $s3_1_cta_font_size) ? "font-size: $s3_1_cta_font_size" : "";
33
 
34
+ $s3_1_cta_css = "padding: 0px 16px; line-height: 1.6; $s3_1_cta_font_size; $s3_1_cta_bgcolor; $s3_1_cta_textcolor; border-radius:10px; margin:0 10px; ";
35
  $s3_1_cta_class = "ht-ctc-cta ";
36
  $title = "";
37
  if ( 'hover' == $s3_1_cta_type ) {
prev/assets/js/app.js CHANGED
@@ -1,65 +1,37 @@
1
- // jQuery(document).ready(function ($) {
2
  jQuery(document).ready(function () {
3
-
4
- // to solve autop issue, when added shortcode in same line.
5
  jQuery(".inline_issue").prev("p").css("display", "inline");
6
-
7
- // animations ..
8
  jQuery('.ccw-an').hover(add, remove);
9
-
10
  function add() {
11
- // jQuery(this).addClass('animated bounce infinite');
12
  jQuery(this).addClass('animated infinite');
13
  }
14
-
15
  function remove() {
16
  jQuery(this).removeClass('animated infinite');
17
  }
18
  });
19
-
20
-
21
  var url = window.location.href;
22
-
23
  var google_analytics = ht_ccw_var.google_analytics;
24
  var fb_analytics = ht_ccw_var.fb_analytics;
25
-
26
  var title = ht_ccw_var.page_title;
27
-
28
- // Analytics
29
  ht_ccw_clickevent();
30
-
31
  function ht_ccw_clickevent() {
32
-
33
  var ccw_plugin = document.querySelector('.ccw_plugin');
34
-
35
  if ( ccw_plugin ) {
36
  ccw_plugin.addEventListener('click', ht_ccw_clicked);
37
  }
38
-
39
  }
40
-
41
- // when cliced on sytle - source ht_ccw_clickevent() click event
42
  function ht_ccw_clicked() {
43
-
44
  if ( 'true' == google_analytics ) {
45
  google_analytics_event();
46
  }
47
-
48
  if ( 'true' == fb_analytics ) {
49
  fb_analytics_event();
50
  }
51
-
52
  }
53
-
54
- // google analytics - source - ht_ccw_clicked
55
  function google_analytics_event() {
56
-
57
  var ga_category = ht_ccw_var.ga_category.replace('{{url}}', url).replace('{{title}}', title);
58
  var ga_action = ht_ccw_var.ga_action.replace('{{url}}', url).replace('{{title}}', title);
59
  var ga_label = ht_ccw_var.ga_label.replace('{{url}}', url).replace('{{title}}', title);
60
-
61
  // ga('send', 'event', 'Contact', 'Call Now Button', 'Phone');
62
-
63
  if ("ga" in window) {
64
  tracker = ga.getAll()[0];
65
  if (tracker) tracker.send("event", ga_category, ga_action, ga_label );
@@ -69,39 +41,19 @@ function google_analytics_event() {
69
  'event_label': ga_label,
70
  });
71
  }
72
-
73
  }
74
-
75
- // fb analytics - source - ht_ccw_clicked
76
  function fb_analytics_event() {
77
-
78
  var p1_value = ht_ccw_var.p1_value.replace('{{url}}', url).replace('{{title}}', title);
79
  var p2_value = ht_ccw_var.p2_value.replace('{{url}}', url).replace('{{title}}', title);
80
  var p3_value = ht_ccw_var.p3_value.replace('{{url}}', url).replace('{{title}}', title);
81
-
82
- logFb_analyticsEvent(p1_value, p2_value, p3_value)
83
- }
84
-
85
-
86
- /**
87
- * fb analytics
88
- * This function will log custom App Event
89
- * @param {string} dynamic_name_value
90
- * @param {string} dynamic_name_value
91
- * @param {string} dynamic_name_value
92
- */
93
- function logFb_analyticsEvent(p1_value, p2_value, p3_value) {
94
-
95
  var p1_name = ht_ccw_var.p1_name;
96
  var p2_name = ht_ccw_var.p2_name;
97
  var p3_name = ht_ccw_var.p3_name;
98
-
99
  var fb_event_name = ht_ccw_var.fb_event_name;
100
-
101
  var params = {};
102
  params[p1_name] = p1_value;
103
  params[p2_name] = p2_value;
104
  params[p3_name] = p3_value;
105
  // if fb analytics is not installed - uncheck the fb analytics option from plugin settings
106
- FB.AppEvents.logEvent( fb_event_name, null, params);
107
  }
 
1
  jQuery(document).ready(function () {
 
 
2
  jQuery(".inline_issue").prev("p").css("display", "inline");
 
 
3
  jQuery('.ccw-an').hover(add, remove);
 
4
  function add() {
 
5
  jQuery(this).addClass('animated infinite');
6
  }
 
7
  function remove() {
8
  jQuery(this).removeClass('animated infinite');
9
  }
10
  });
 
 
11
  var url = window.location.href;
 
12
  var google_analytics = ht_ccw_var.google_analytics;
13
  var fb_analytics = ht_ccw_var.fb_analytics;
 
14
  var title = ht_ccw_var.page_title;
 
 
15
  ht_ccw_clickevent();
 
16
  function ht_ccw_clickevent() {
 
17
  var ccw_plugin = document.querySelector('.ccw_plugin');
 
18
  if ( ccw_plugin ) {
19
  ccw_plugin.addEventListener('click', ht_ccw_clicked);
20
  }
 
21
  }
 
 
22
  function ht_ccw_clicked() {
 
23
  if ( 'true' == google_analytics ) {
24
  google_analytics_event();
25
  }
 
26
  if ( 'true' == fb_analytics ) {
27
  fb_analytics_event();
28
  }
 
29
  }
 
 
30
  function google_analytics_event() {
 
31
  var ga_category = ht_ccw_var.ga_category.replace('{{url}}', url).replace('{{title}}', title);
32
  var ga_action = ht_ccw_var.ga_action.replace('{{url}}', url).replace('{{title}}', title);
33
  var ga_label = ht_ccw_var.ga_label.replace('{{url}}', url).replace('{{title}}', title);
 
34
  // ga('send', 'event', 'Contact', 'Call Now Button', 'Phone');
 
35
  if ("ga" in window) {
36
  tracker = ga.getAll()[0];
37
  if (tracker) tracker.send("event", ga_category, ga_action, ga_label );
41
  'event_label': ga_label,
42
  });
43
  }
 
44
  }
 
 
45
  function fb_analytics_event() {
 
46
  var p1_value = ht_ccw_var.p1_value.replace('{{url}}', url).replace('{{title}}', title);
47
  var p2_value = ht_ccw_var.p2_value.replace('{{url}}', url).replace('{{title}}', title);
48
  var p3_value = ht_ccw_var.p3_value.replace('{{url}}', url).replace('{{title}}', title);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  var p1_name = ht_ccw_var.p1_name;
50
  var p2_name = ht_ccw_var.p2_name;
51
  var p3_name = ht_ccw_var.p3_name;
 
52
  var fb_event_name = ht_ccw_var.fb_event_name;
 
53
  var params = {};
54
  params[p1_name] = p1_value;
55
  params[p2_name] = p2_value;
56
  params[p3_name] = p3_value;
57
  // if fb analytics is not installed - uncheck the fb analytics option from plugin settings
58
+ FB.AppEvents.logEvent(fb_event_name, null, params);
59
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Requires at least: 4.6
3
  Tested up to: 5.6
4
  Requires PHP: 5.6
5
  Contributors: holithemes
6
- Stable tag: 3.1
7
  Tags: whatsapp, whatsapp business, click to chat, whatsapp chat, whatsapp support, whatsapp group, whatsapp message, social chat, 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
@@ -395,6 +395,19 @@ After Activate the plugin, add WhatsApp Number at plugin settings.
395
 
396
  == Changelog ==
397
 
 
 
 
 
 
 
 
 
 
 
 
 
 
398
  = 3.1 =
399
  * Updated: Full Width Style-1, Style-8 for mobile.
400
  * Add Animation Delay, Animation Iteration
3
  Tested up to: 5.6
4
  Requires PHP: 5.6
5
  Contributors: holithemes
6
+ Stable tag: 3.2.2
7
  Tags: whatsapp, whatsapp business, click to chat, whatsapp chat, whatsapp support, whatsapp group, whatsapp message, social chat, 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
395
 
396
  == Changelog ==
397
 
398
+ = 3.2.2 =
399
+ * Font size settings for Call to Action - Style 2, 3, 3 Extend.
400
+ * Fix: Facebook Pixel integration for Shortcodes
401
+
402
+ = 3.2.1 =
403
+ * Fixed: Shortcode click action,
404
+ * Fixed: Share feature variable {url} on loop pages
405
+
406
+ = 3.2 =
407
+ * prefilled message at page level
408
+ * Style-1 customize text and background color
409
+ * Updated User Interface
410
+
411
  = 3.1 =
412
  * Updated: Full Width Style-1, Style-8 for mobile.
413
  * Add Animation Delay, Animation Iteration