Version Description
New interface
Download this release
Release Info
Developer | bhvreddy |
Plugin | Click to Chat for WhatsApp Chat |
Version | 2.0 |
Comparing to | |
See all releases |
Code changes from version 1.7.2 to 2.0
- class-ht-ctc-switch.php +107 -0
- click-to-chat.php +15 -13
- new/admin/admin.php +47 -0
- new/admin/admin_assets/css/admin.css +17 -0
- new/admin/admin_assets/js/admin.js +146 -0
- new/admin/class-ht-ctc-admin-chat-page.php +821 -0
- new/admin/class-ht-ctc-admin-customize-styles.php +910 -0
- new/admin/class-ht-ctc-admin-group-page.php +747 -0
- new/admin/class-ht-ctc-admin-main-page.php +375 -0
- new/admin/class-ht-ctc-admin-scripts.php +45 -0
- new/admin/class-ht-ctc-admin-share-page.php +748 -0
- new/admin/class-ht-ctc-db.php +563 -0
- new/admin/class-ht-ctc-metabox.php +141 -0
- new/class-ht-ctc.php +218 -0
- new/inc/assets/css/main.css +35 -0
- new/inc/assets/fonts/ccw.eot +0 -0
- new/inc/assets/fonts/ccw.svg +14 -0
- new/inc/assets/fonts/ccw.ttf +0 -0
- new/inc/assets/fonts/ccw.woff +0 -0
- new/inc/assets/js/app.js +227 -0
- new/inc/chat/chat-position.php +17 -0
- new/inc/chat/chat-show-hide.php +200 -0
- new/inc/chat/class-ht-ctc-chat-shortcode.php +194 -0
- new/inc/chat/class-ht-ctc-chat.php +80 -0
- new/inc/class-ht-ctc-main.php +69 -0
- new/inc/class-ht-ctc-register.php +64 -0
- new/inc/commons/class-ht-ctc-ismobile.php +70 -0
- new/inc/commons/class-ht-ctc-scripts.php +42 -0
- new/inc/commons/class-ht-ctc-values.php +56 -0
- new/inc/commons/ht-ctc-variables.php +149 -0
- new/inc/group/class-ht-ctc-group-shortcode.php +177 -0
- new/inc/group/class-ht-ctc-group.php +72 -0
- new/inc/group/group-position.php +17 -0
- new/inc/group/group-show-hide.php +212 -0
- new/inc/share/class-ht-ctc-share-shortcode.php +191 -0
- new/inc/share/class-ht-ctc-share.php +72 -0
- new/inc/share/share-position.php +17 -0
- new/inc/share/share-show-hide.php +211 -0
- new/inc/styles-shortcode/sc-style-1.php +20 -0
- new/inc/styles-shortcode/sc-style-2.php +26 -0
- new/inc/styles-shortcode/sc-style-3.php +26 -0
- new/inc/styles-shortcode/sc-style-4.php +62 -0
- new/inc/styles-shortcode/sc-style-5.php +134 -0
- new/inc/styles-shortcode/sc-style-6.php +31 -0
- new/inc/styles-shortcode/sc-style-7.php +33 -0
- new/inc/styles-shortcode/sc-style-8.php +57 -0
- new/inc/styles-shortcode/sc-style-99.php +68 -0
- new/inc/styles/style-1.php +18 -0
- new/inc/styles/style-2.php +26 -0
- new/inc/styles/style-3.php +27 -0
- new/inc/styles/style-4.php +61 -0
- new/inc/styles/style-5.php +125 -0
- new/inc/styles/style-6.php +29 -0
- new/inc/styles/style-7.php +27 -0
- new/inc/styles/style-8.php +57 -0
- new/inc/styles/style-99.php +74 -0
- prev/admin/class-ccw-admin-page.php +99 -4
- prev/admin/commons/admin-sidebar.php +0 -1
- prev/admin/default-values.php +37 -1
- prev/admin/settings_page.php +16 -2
- prev/assets/css/mdstyle8.css +18 -0
- prev/assets/img/new_style8.jpg +0 -0
- readme.txt +34 -53
class-ht-ctc-switch.php
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Switch .. new or previous - user inerface
|
4 |
+
* new user default to new interface
|
5 |
+
* prev user - default to prev interface if not switched.
|
6 |
+
*
|
7 |
+
* @since 2.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
11 |
+
|
12 |
+
if ( ! class_exists( 'HT_CTC_Swift' ) ) :
|
13 |
+
|
14 |
+
class HT_CTC_Swift {
|
15 |
+
|
16 |
+
public function __construct() {
|
17 |
+
$this->to_switch();
|
18 |
+
}
|
19 |
+
|
20 |
+
public function to_switch() {
|
21 |
+
|
22 |
+
// new interface yes/no
|
23 |
+
$is_new = '';
|
24 |
+
|
25 |
+
// user new/prev
|
26 |
+
$user = '';
|
27 |
+
|
28 |
+
|
29 |
+
// if first time user - new interface .. $is_new = 'yes';
|
30 |
+
// if user swifted to new interface .. $is_new = 'yes';
|
31 |
+
|
32 |
+
// if user swifted to prev interface .. $is_new = 'no';
|
33 |
+
// if prev user / update .. $is_new = 'no';
|
34 |
+
|
35 |
+
$ccw_options = get_option('ccw_options');
|
36 |
+
|
37 |
+
if ( isset( $ccw_options['number'] ) ) {
|
38 |
+
$user = 'prev';
|
39 |
+
$is_new = 'no';
|
40 |
+
} else {
|
41 |
+
// new user - new interface
|
42 |
+
$user = 'new';
|
43 |
+
$is_new = 'yes';
|
44 |
+
}
|
45 |
+
|
46 |
+
// prev user and if switched ( checkbox option at admin )
|
47 |
+
if ( 'prev' == $user ) {
|
48 |
+
|
49 |
+
$ht_ctc_switch = get_option('ht_ctc_switch');
|
50 |
+
|
51 |
+
if ( 'yes' == $ht_ctc_switch['interface'] ) {
|
52 |
+
$is_new = 'yes';
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
|
57 |
+
// todo
|
58 |
+
// $is_new = 'yes';
|
59 |
+
|
60 |
+
// define HT_CTC_IS_NEW
|
61 |
+
if ( ! defined( 'HT_CTC_IS_NEW' ) ) {
|
62 |
+
define( 'HT_CTC_IS_NEW', $is_new );
|
63 |
+
}
|
64 |
+
|
65 |
+
|
66 |
+
// include related files ..
|
67 |
+
if ( 'yes' == HT_CTC_IS_NEW ) {
|
68 |
+
// new interface
|
69 |
+
|
70 |
+
// include main file - prev
|
71 |
+
include_once 'new/class-ht-ctc.php';
|
72 |
+
|
73 |
+
// create instance for the main file - HT_CTC
|
74 |
+
function ht_ctc() {
|
75 |
+
return HT_CTC::instance();
|
76 |
+
}
|
77 |
+
|
78 |
+
ht_ctc();
|
79 |
+
|
80 |
+
} else {
|
81 |
+
// prev interface
|
82 |
+
|
83 |
+
// include main file - prev
|
84 |
+
include_once 'prev/inc/class-ht-ccw.php';
|
85 |
+
|
86 |
+
// create instance for the main file - HT_CCW
|
87 |
+
function ht_ccw() {
|
88 |
+
return HT_CCW::instance();
|
89 |
+
}
|
90 |
+
|
91 |
+
ht_ccw();
|
92 |
+
}
|
93 |
+
|
94 |
+
|
95 |
+
}
|
96 |
+
|
97 |
+
|
98 |
+
|
99 |
+
|
100 |
+
|
101 |
+
}
|
102 |
+
|
103 |
+
new HT_CTC_Swift();
|
104 |
+
|
105 |
+
endif; // END class_exists check
|
106 |
+
|
107 |
+
|
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 visitor contact you through WhatsApp with a single click/tap
|
6 |
-
Version:
|
7 |
Author: HoliThemes
|
8 |
Author URI: https://holithemes.com/whatsapp-chat/
|
9 |
License: GPL2
|
@@ -15,22 +15,24 @@ if ( ! defined( 'WPINC' ) ) {
|
|
15 |
die('dont try to call this directly');
|
16 |
}
|
17 |
|
18 |
-
//
|
19 |
-
if ( ! defined( '
|
20 |
-
define( '
|
21 |
}
|
22 |
|
23 |
-
// define
|
24 |
-
if ( ! defined( '
|
25 |
-
define( '
|
26 |
}
|
27 |
|
28 |
-
//
|
29 |
-
|
|
|
|
|
30 |
|
31 |
-
//
|
32 |
-
|
33 |
-
|
34 |
}
|
35 |
|
36 |
-
|
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 visitor contact you through WhatsApp with a single click/tap
|
6 |
+
Version: 2.0
|
7 |
Author: HoliThemes
|
8 |
Author URI: https://holithemes.com/whatsapp-chat/
|
9 |
License: GPL2
|
15 |
die('dont try to call this directly');
|
16 |
}
|
17 |
|
18 |
+
// new interface - ctc - Version
|
19 |
+
if ( ! defined( 'HT_CTC_VERSION' ) ) {
|
20 |
+
define( 'HT_CTC_VERSION', '2.0' );
|
21 |
}
|
22 |
|
23 |
+
// for previous interface - define HT_CCW_VERSION
|
24 |
+
if ( ! defined( 'HT_CCW_VERSION' ) ) {
|
25 |
+
define( 'HT_CCW_VERSION', '1.7.4' );
|
26 |
}
|
27 |
|
28 |
+
// define HT_CTC_PLUGIN_FILE
|
29 |
+
if ( ! defined( 'HT_CTC_PLUGIN_FILE' ) ) {
|
30 |
+
define( 'HT_CTC_PLUGIN_FILE', __FILE__ );
|
31 |
+
}
|
32 |
|
33 |
+
// prev compatibility - define HT_CCW_PLUGIN_FILE
|
34 |
+
if ( ! defined( 'HT_CCW_PLUGIN_FILE' ) ) {
|
35 |
+
define( 'HT_CCW_PLUGIN_FILE', __FILE__ );
|
36 |
}
|
37 |
|
38 |
+
include_once 'class-ht-ctc-switch.php';
|
new/admin/admin.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* starting point for the admin side of this plugin.
|
4 |
+
*
|
5 |
+
* include other file here .. which need in admin side.
|
6 |
+
*
|
7 |
+
* In click-to-chat.php this file will be loaded as is_admin
|
8 |
+
*
|
9 |
+
* @package ctc
|
10 |
+
* @subpackage Administration
|
11 |
+
* @since 1.0
|
12 |
+
*/
|
13 |
+
|
14 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
15 |
+
|
16 |
+
|
17 |
+
$ht_ctc_main_options = get_option('ht_ctc_main_options');
|
18 |
+
|
19 |
+
|
20 |
+
/*************** includes ***********/
|
21 |
+
|
22 |
+
// add scripts
|
23 |
+
include_once HT_CTC_PLUGIN_DIR .'new/admin/class-ht-ctc-admin-scripts.php';
|
24 |
+
|
25 |
+
// Main admin page - enable options ..
|
26 |
+
include_once HT_CTC_PLUGIN_DIR .'new/admin/class-ht-ctc-admin-main-page.php';
|
27 |
+
|
28 |
+
// Chat admin page
|
29 |
+
if ( isset ( $ht_ctc_main_options['enable_chat'] ) ) {
|
30 |
+
include_once HT_CTC_PLUGIN_DIR .'new/admin/class-ht-ctc-admin-chat-page.php';
|
31 |
+
}
|
32 |
+
|
33 |
+
// group admin page
|
34 |
+
if ( isset ( $ht_ctc_main_options['enable_group'] ) ) {
|
35 |
+
include_once HT_CTC_PLUGIN_DIR .'new/admin/class-ht-ctc-admin-group-page.php';
|
36 |
+
}
|
37 |
+
|
38 |
+
// share admin page
|
39 |
+
if ( isset ( $ht_ctc_main_options['enable_share'] ) ) {
|
40 |
+
include_once HT_CTC_PLUGIN_DIR .'new/admin/class-ht-ctc-admin-share-page.php';
|
41 |
+
}
|
42 |
+
|
43 |
+
// customize styles
|
44 |
+
include_once HT_CTC_PLUGIN_DIR .'new/admin/class-ht-ctc-admin-customize-styles.php';
|
45 |
+
|
46 |
+
// meta boxes - change values at page level
|
47 |
+
include_once HT_CTC_PLUGIN_DIR .'new/admin/class-ht-ctc-metabox.php';
|
new/admin/admin_assets/css/admin.css
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* Admin CSS */
|
2 |
+
|
3 |
+
.show-hide_display-none {
|
4 |
+
display: none;
|
5 |
+
}
|
6 |
+
|
7 |
+
.show-hide_display-block {
|
8 |
+
display: block;
|
9 |
+
}
|
10 |
+
|
11 |
+
|
12 |
+
|
13 |
+
.options .submit {
|
14 |
+
position: sticky !important;
|
15 |
+
bottom: 1px;
|
16 |
+
float: right;
|
17 |
+
}
|
new/admin/admin_assets/js/admin.js
ADDED
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
|
3 |
+
|
4 |
+
|
5 |
+
|
6 |
+
// custom code
|
7 |
+
|
8 |
+
|
9 |
+
|
10 |
+
|
11 |
+
// select option ..
|
12 |
+
|
13 |
+
// initialize materialize function ..
|
14 |
+
document.addEventListener('DOMContentLoaded', function() {
|
15 |
+
|
16 |
+
// select
|
17 |
+
var elems = document.querySelectorAll('select');
|
18 |
+
var instances = M.FormSelect.init(elems, {});
|
19 |
+
|
20 |
+
// Collapsible
|
21 |
+
var elems = document.querySelectorAll('.collapsible');
|
22 |
+
var instances = M.Collapsible.init(elems, {});
|
23 |
+
|
24 |
+
});
|
25 |
+
|
26 |
+
|
27 |
+
// // $(document).ready(function(){
|
28 |
+
// jQuery(document).ready(function($){
|
29 |
+
// $('select').formSelect();
|
30 |
+
// });
|
31 |
+
|
32 |
+
// $(document).ready(function(){
|
33 |
+
// // jQuery(document).ready(function($){
|
34 |
+
// $('select').formSelect();
|
35 |
+
// });
|
36 |
+
|
37 |
+
// console.log(typeof $);
|
38 |
+
// if (typeof $ == 'undefined' ) {
|
39 |
+
// console.log('exist..');
|
40 |
+
// }
|
41 |
+
|
42 |
+
|
43 |
+
jQuery(document).ready(function ($) {
|
44 |
+
|
45 |
+
$('select').formSelect();
|
46 |
+
$('.collapsible').collapsible();
|
47 |
+
|
48 |
+
});
|
49 |
+
|
50 |
+
|
51 |
+
|
52 |
+
|
53 |
+
|
54 |
+
jQuery(document).ready(function ($) {
|
55 |
+
|
56 |
+
|
57 |
+
// $('.color-wp').wpColorPicker();
|
58 |
+
$('.ht-ctc-color').wpColorPicker();
|
59 |
+
|
60 |
+
|
61 |
+
// ##### show/Hide - chat option #####
|
62 |
+
|
63 |
+
// show_hide option - other settings page
|
64 |
+
var ctc_show_hide_display = document.querySelectorAll('.ctc_show_hide_display');
|
65 |
+
|
66 |
+
// var hidebased = document.querySelector('.hidebased');
|
67 |
+
var hidebased = document.querySelectorAll('.hidebased');
|
68 |
+
var showbased = document.querySelectorAll('.showbased');
|
69 |
+
|
70 |
+
// default display
|
71 |
+
function ctc_show_hide_default_display() {
|
72 |
+
|
73 |
+
var val = $('.select_show_or_hide').find(":selected").val();
|
74 |
+
|
75 |
+
if (val == 'show') {
|
76 |
+
// showbased.classList.add('show-hide_display-block');
|
77 |
+
showbased.forEach(function (e) {
|
78 |
+
e.classList.add('show-hide_display-block');
|
79 |
+
});
|
80 |
+
} else if (val == 'hide') {
|
81 |
+
// hidebased.classList.add('show-hide_display-block');
|
82 |
+
hidebased.forEach(function (e) {
|
83 |
+
e.classList.add('show-hide_display-block');
|
84 |
+
});
|
85 |
+
}
|
86 |
+
};
|
87 |
+
|
88 |
+
ctc_show_hide_default_display();
|
89 |
+
|
90 |
+
|
91 |
+
// incase display-block is added remove it .. onchange
|
92 |
+
function ctc_show_hide_display_remove() {
|
93 |
+
ctc_show_hide_display.forEach(function (e) {
|
94 |
+
e.classList.remove('show-hide_display-block');
|
95 |
+
});
|
96 |
+
};
|
97 |
+
|
98 |
+
|
99 |
+
$(".select_show_or_hide").on("change", function (e) {
|
100 |
+
|
101 |
+
// var x = e.target;
|
102 |
+
var val = e.target.value;
|
103 |
+
|
104 |
+
if (val == 'show') {
|
105 |
+
ctc_show_hide_display_remove();
|
106 |
+
|
107 |
+
// showbased.classList.add('show-hide_display-block');
|
108 |
+
showbased.forEach(function (e) {
|
109 |
+
e.classList.add('show-hide_display-block');
|
110 |
+
});
|
111 |
+
|
112 |
+
} else if (val == 'hide') {
|
113 |
+
ctc_show_hide_display_remove();
|
114 |
+
|
115 |
+
// hidebased.classList.add('show-hide_display-block');
|
116 |
+
hidebased.forEach(function (e) {
|
117 |
+
e.classList.add('show-hide_display-block');
|
118 |
+
});
|
119 |
+
}
|
120 |
+
});
|
121 |
+
|
122 |
+
// ##### show/Hide - chat option #####
|
123 |
+
|
124 |
+
|
125 |
+
|
126 |
+
|
127 |
+
// color ..
|
128 |
+
|
129 |
+
if ( $(".ht-ctc-color") ) {
|
130 |
+
if ( $(".ht-ctc-color").spectrum ) {
|
131 |
+
$(".ht-ctc-color").spectrum({
|
132 |
+
preferredFormat: "hex",
|
133 |
+
showInput: true,
|
134 |
+
allowEmpty:true,
|
135 |
+
chooseText:'Select',
|
136 |
+
// showPalette: true,
|
137 |
+
// showSelectionPalette: true,
|
138 |
+
// palette: [ 'red', 'green', 'blue' ],
|
139 |
+
// localStorageKey: "spectrum.homepage",
|
140 |
+
});
|
141 |
+
}
|
142 |
+
}
|
143 |
+
|
144 |
+
|
145 |
+
|
146 |
+
});
|
new/admin/class-ht-ctc-admin-chat-page.php
ADDED
@@ -0,0 +1,821 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Chat settings page - admin
|
4 |
+
*
|
5 |
+
* chat options ..
|
6 |
+
*
|
7 |
+
* @package ctc
|
8 |
+
* @subpackage admin
|
9 |
+
* @since 2.0
|
10 |
+
*/
|
11 |
+
|
12 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
13 |
+
|
14 |
+
if ( ! class_exists( 'HT_CTC_Admin_Chat_Page' ) ) :
|
15 |
+
|
16 |
+
class HT_CTC_Admin_Chat_Page {
|
17 |
+
|
18 |
+
public function menu() {
|
19 |
+
|
20 |
+
add_submenu_page(
|
21 |
+
'click-to-chat',
|
22 |
+
'WhatsApp Chat',
|
23 |
+
'WhatsApp Chat',
|
24 |
+
'manage_options',
|
25 |
+
'click-to-chat-chat-feature',
|
26 |
+
array( $this, 'settings_page' )
|
27 |
+
);
|
28 |
+
}
|
29 |
+
|
30 |
+
public function settings_page() {
|
31 |
+
|
32 |
+
if ( ! current_user_can('manage_options') ) {
|
33 |
+
return;
|
34 |
+
}
|
35 |
+
|
36 |
+
?>
|
37 |
+
|
38 |
+
<div class="wrap">
|
39 |
+
|
40 |
+
<?php settings_errors(); ?>
|
41 |
+
|
42 |
+
<div class="row">
|
43 |
+
<div class="col s12 m12 xl7 options">
|
44 |
+
<form action="options.php" method="post" class="">
|
45 |
+
<?php settings_fields( 'ht_ctc_chat_page_settings_fields' ); ?>
|
46 |
+
<?php do_settings_sections( 'ht_ctc_chat_page_settings_sections_do' ) ?>
|
47 |
+
<?php submit_button() ?>
|
48 |
+
</form>
|
49 |
+
</div>
|
50 |
+
<!-- sidebar content -->
|
51 |
+
<div class="col s12 m12 xl4 ht-cc-admin-sidebar">
|
52 |
+
<div style="margin-top: 100px; margin-left: 40px;">
|
53 |
+
<p>
|
54 |
+
Please let us know if you have any suggestions or feedback!! <br>
|
55 |
+
<a href="http://api.whatsapp.com/send?phone=919494429789&text=Hi HoliThemes, I have a Suggestion/Feedback:" target="_blank">WhatsApp</a> <br>
|
56 |
+
mail: wp@holithemes.com
|
57 |
+
</p>
|
58 |
+
|
59 |
+
</div>
|
60 |
+
</div>
|
61 |
+
</div>
|
62 |
+
|
63 |
+
<!-- social links -->
|
64 |
+
<div class="row">
|
65 |
+
<div class="col s12 m12 l12 xl9">
|
66 |
+
<div class="row">
|
67 |
+
|
68 |
+
<div class="col s12 m6">
|
69 |
+
<div class="collection with-header">
|
70 |
+
<div class="collection-header"><bold>HoliThemes On</bold></div>
|
71 |
+
<a target="_blank" href="https://www.facebook.com/holithemes/" class="collection-item">Facebook</a>
|
72 |
+
<a target="_blank" href="https://twitter.com/holithemes" class="collection-item">Twitter</a>
|
73 |
+
<a target="_blank" href="https://www.instagram.com/holithemes/" class="collection-item">Instagram</a>
|
74 |
+
<a target="_blank" href="https://www.youtube.com/channel/UC2Tf_WB9PWffO2B3tswWCGw" class="collection-item">YouTube</a>
|
75 |
+
<a target="_blank" href="https://www.linkedin.com/company/holithemes" class="collection-item">LinkedIn</a>
|
76 |
+
</div>
|
77 |
+
</div>
|
78 |
+
|
79 |
+
</div>
|
80 |
+
</div>
|
81 |
+
</div>
|
82 |
+
|
83 |
+
</div>
|
84 |
+
|
85 |
+
<?php
|
86 |
+
|
87 |
+
}
|
88 |
+
|
89 |
+
|
90 |
+
public function settings() {
|
91 |
+
|
92 |
+
// chat options
|
93 |
+
// register_setting( 'ht_ctc_chat_page_settings_fields', 'ht_ctc_options' , array( $this, 'options_sanitize' ) );
|
94 |
+
register_setting( 'ht_ctc_chat_page_settings_fields', 'ht_ctc_chat_options' , array( $this, 'options_sanitize' ) );
|
95 |
+
|
96 |
+
add_settings_section( 'ht_ctc_chat_page_settings_sections_add', '', array( $this, 'chat_settings_section_cb' ), 'ht_ctc_chat_page_settings_sections_do' );
|
97 |
+
|
98 |
+
add_settings_field( 'number', 'WhatsApp Number', array( $this, 'number_cb' ), 'ht_ctc_chat_page_settings_sections_do', 'ht_ctc_chat_page_settings_sections_add' );
|
99 |
+
add_settings_field( 'prefilled', 'Pre-Filled Message', array( $this, 'prefilled_cb' ), 'ht_ctc_chat_page_settings_sections_do', 'ht_ctc_chat_page_settings_sections_add' );
|
100 |
+
add_settings_field( 'cta', 'Call to Action', array( $this, 'cta_cb' ), 'ht_ctc_chat_page_settings_sections_do', 'ht_ctc_chat_page_settings_sections_add' );
|
101 |
+
add_settings_field( 'ctc_desktop_style', 'Style for Desktop', array( $this, 'ctc_desktop_style_cb' ), 'ht_ctc_chat_page_settings_sections_do', 'ht_ctc_chat_page_settings_sections_add' );
|
102 |
+
add_settings_field( 'ctc_mobile_style', 'Style for Mobile', array( $this, 'ctc_mobile_style_cb' ), 'ht_ctc_chat_page_settings_sections_do', 'ht_ctc_chat_page_settings_sections_add' );
|
103 |
+
add_settings_field( 'ctc_position', 'Position to place', array( $this, 'ctc_position_cb' ), 'ht_ctc_chat_page_settings_sections_do', 'ht_ctc_chat_page_settings_sections_add' );
|
104 |
+
add_settings_field( 'ctc_webandapi', 'Web WhatsApp', array( $this, 'ctc_webandapi_cb' ), 'ht_ctc_chat_page_settings_sections_do', 'ht_ctc_chat_page_settings_sections_add' );
|
105 |
+
add_settings_field( 'ctc_show_hide', 'Show/Hide', array( $this, 'ctc_show_hide_cb' ), 'ht_ctc_chat_page_settings_sections_do', 'ht_ctc_chat_page_settings_sections_add' );
|
106 |
+
add_settings_field( 'chat_shortcode', '', array( $this, 'chat_shortcode_cb' ), 'ht_ctc_chat_page_settings_sections_do', 'ht_ctc_chat_page_settings_sections_add' );
|
107 |
+
|
108 |
+
}
|
109 |
+
|
110 |
+
public function chat_settings_section_cb() {
|
111 |
+
?>
|
112 |
+
<h1>Chat</h1>
|
113 |
+
<?php
|
114 |
+
}
|
115 |
+
|
116 |
+
|
117 |
+
// WhatsApp number
|
118 |
+
function number_cb() {
|
119 |
+
$options = get_option('ht_ctc_chat_options');
|
120 |
+
?>
|
121 |
+
<div class="row">
|
122 |
+
<div class="input-field col s12">
|
123 |
+
<input name="ht_ctc_chat_options[number]" value="<?php echo esc_attr( $options['number'] ) ?>" id="whatsapp_number" type="text" class="input-margin">
|
124 |
+
<label for="whatsapp_number">Enter WhatsApp number </label>
|
125 |
+
<p class="description">Enter 'WhatsApp' or 'WhatsApp business' number with country code ( No need to add any prefix "+" )
|
126 |
+
<br> ( e.g. 916123456789 - herein e.g. 91 is country code, 6123456789 is the mobile number ) - <a target="_blank" href="https://www.holithemes.com/plugins/click-to-chat/whatsapp-number/">more info</a> ) </p>
|
127 |
+
</div>
|
128 |
+
</div>
|
129 |
+
<?php
|
130 |
+
}
|
131 |
+
|
132 |
+
// pre-filled - message
|
133 |
+
function prefilled_cb() {
|
134 |
+
$options = get_option('ht_ctc_chat_options');
|
135 |
+
?>
|
136 |
+
<div class="row">
|
137 |
+
<div class="input-field col s12">
|
138 |
+
<input name="ht_ctc_chat_options[pre_filled]" value="<?php echo esc_attr( $options['pre_filled'] ) ?>" id="pre_filled" type="text" class="input-margin">
|
139 |
+
<label for="pre_filled">Pre-filled message</label>
|
140 |
+
<p class="description">Text that appears in the WhatsApp Chat window. Add placeholders {{url}}, {{title}} to replace current webpage URL, Post title - <a target="_blank" href="https://www.holithemes.com/plugins/click-to-chat/pre-filled-message/">more info</a> </p>
|
141 |
+
</div>
|
142 |
+
</div>
|
143 |
+
<?php
|
144 |
+
}
|
145 |
+
|
146 |
+
// call to action
|
147 |
+
function cta_cb() {
|
148 |
+
$options = get_option('ht_ctc_chat_options');
|
149 |
+
?>
|
150 |
+
<div class="row">
|
151 |
+
<div class="input-field col s12">
|
152 |
+
<input name="ht_ctc_chat_options[call_to_action]" value="<?php echo esc_attr( $options['call_to_action'] ) ?>" id="call_to_action" type="text" class="input-margin">
|
153 |
+
<label for="call_to_action">Call to Action</label>
|
154 |
+
<p class="description"> Text that appears along with WhatsApp icon/button - <a target="_blank" href="https://www.holithemes.com/plugins/click-to-chat/call-to-action/">more info</a> </p>
|
155 |
+
</div>
|
156 |
+
</div>
|
157 |
+
<?php
|
158 |
+
}
|
159 |
+
|
160 |
+
|
161 |
+
// Desktop - select style
|
162 |
+
function ctc_desktop_style_cb() {
|
163 |
+
$options = get_option('ht_ctc_chat_options');
|
164 |
+
$style_value = esc_attr( $options['style_desktop'] );
|
165 |
+
?>
|
166 |
+
<div class="row">
|
167 |
+
<div class="input-field col s12" style="margin-bottom: 0px;">
|
168 |
+
<select name="ht_ctc_chat_options[style_desktop]" class="select-2">
|
169 |
+
<option value="1" <?php echo $style_value == 1 ? 'SELECTED' : ''; ?> >Style-1</option>
|
170 |
+
<option value="2" <?php echo $style_value == 2 ? 'SELECTED' : ''; ?> >Style-2</option>
|
171 |
+
<option value="3" <?php echo $style_value == 3 ? 'SELECTED' : ''; ?> >Style-3</option>
|
172 |
+
<option value="4" <?php echo $style_value == 4 ? 'SELECTED' : ''; ?> >Style-4</option>
|
173 |
+
<option value="5" <?php echo $style_value == 5 ? 'SELECTED' : ''; ?> >Style-5</option>
|
174 |
+
<option value="6" <?php echo $style_value == 6 ? 'SELECTED' : ''; ?> >Style-6</option>
|
175 |
+
<option value="7" <?php echo $style_value == 7 ? 'SELECTED' : ''; ?> >Style-7</option>
|
176 |
+
<option value="8" <?php echo $style_value == 8 ? 'SELECTED' : ''; ?> >Style-8</option>
|
177 |
+
<option value="99" <?php echo $style_value == 99 ? 'SELECTED' : ''; ?> >Style-99 (Add your own image / GIF)</option>
|
178 |
+
</select>
|
179 |
+
<label>Select Style for Desktop</label>
|
180 |
+
</div>
|
181 |
+
</div>
|
182 |
+
|
183 |
+
<p class="description"> - <a target="_blank" href="https://www.holithemes.com/plugins/click-to-chat/list-of-styles/">List of syles</a> </p>
|
184 |
+
<p class="description"> Can customize each style - <a target="_blank" href="<?php echo admin_url( 'admin.php?page=click-to-chat-customize-styles' ); ?>">Customize Styles</a> </p>
|
185 |
+
<?php
|
186 |
+
}
|
187 |
+
|
188 |
+
|
189 |
+
// Mobile - select style
|
190 |
+
function ctc_mobile_style_cb() {
|
191 |
+
$options = get_option('ht_ctc_chat_options');
|
192 |
+
$style_value = esc_attr( $options['style_mobile'] );
|
193 |
+
?>
|
194 |
+
<div class="row" style="margin-bottom: 0px;">
|
195 |
+
<div class="input-field col s12">
|
196 |
+
<select name="ht_ctc_chat_options[style_mobile]" class="select-2">
|
197 |
+
<option value="1" <?php echo $style_value == 1 ? 'SELECTED' : ''; ?> >Style-1</option>
|
198 |
+
<option value="2" <?php echo $style_value == 2 ? 'SELECTED' : ''; ?> >Style-2</option>
|
199 |
+
<option value="3" <?php echo $style_value == 3 ? 'SELECTED' : ''; ?> >Style-3</option>
|
200 |
+
<option value="4" <?php echo $style_value == 4 ? 'SELECTED' : ''; ?> >Style-4</option>
|
201 |
+
<option value="5" <?php echo $style_value == 5 ? 'SELECTED' : ''; ?> >Style-5</option>
|
202 |
+
<option value="6" <?php echo $style_value == 6 ? 'SELECTED' : ''; ?> >Style-6</option>
|
203 |
+
<option value="7" <?php echo $style_value == 7 ? 'SELECTED' : ''; ?> >Style-7</option>
|
204 |
+
<option value="8" <?php echo $style_value == 8 ? 'SELECTED' : ''; ?> >Style-8</option>
|
205 |
+
<option value="99" <?php echo $style_value == 99 ? 'SELECTED' : ''; ?> >Style-99 (Add your own image / GIF)</option>
|
206 |
+
</select>
|
207 |
+
<label>Select Style for Mobile</label>
|
208 |
+
</div>
|
209 |
+
</div>
|
210 |
+
|
211 |
+
<!-- <p class="description"> - <a target="_blank" href="https://www.holithemes.com/plugins/click-to-chat/list-of-styles/">List of syles</a> </p>
|
212 |
+
<p class="description"> Can customize each style - <a target="_blank" href="<?php echo admin_url( 'admin.php?page=click-to-chat-customize-styles' ); ?>">Customize Styles</a> </p> -->
|
213 |
+
<?php
|
214 |
+
}
|
215 |
+
|
216 |
+
|
217 |
+
// position to place
|
218 |
+
function ctc_position_cb() {
|
219 |
+
$options = get_option('ht_ctc_chat_options');
|
220 |
+
|
221 |
+
$side_1 = esc_attr( $options['side_1'] );
|
222 |
+
$side_1_value = esc_attr( $options['side_1_value'] );
|
223 |
+
$side_2 = esc_attr( $options['side_2'] );
|
224 |
+
?>
|
225 |
+
<!-- side - 1 -->
|
226 |
+
<div class="row">
|
227 |
+
<div class="input-field col s6">
|
228 |
+
<select name="ht_ctc_chat_options[side_1]" class="select-2">
|
229 |
+
<option value="bottom" <?php echo $side_1 == 'bottom' ? 'SELECTED' : ''; ?> >bottom</option>
|
230 |
+
<option value="top" <?php echo $side_1 == 'top' ? 'SELECTED' : ''; ?> >top</option>
|
231 |
+
</select>
|
232 |
+
<label>top / bottom </label>
|
233 |
+
</div>
|
234 |
+
<div class="input-field col s6">
|
235 |
+
<input name="ht_ctc_chat_options[side_1_value]" value="<?php echo esc_attr( $options['side_1_value'] ) ?>" id="side_1_value" type="text" class="input-margin">
|
236 |
+
<label for="side_1_value">e.g. 10px</label>
|
237 |
+
</div>
|
238 |
+
</div>
|
239 |
+
|
240 |
+
|
241 |
+
<!-- side - 2 -->
|
242 |
+
<div class="row">
|
243 |
+
<div class="input-field col s6">
|
244 |
+
<select name="ht_ctc_chat_options[side_2]" class="select-2">
|
245 |
+
<option value="right" <?php echo $side_2 == 'right' ? 'SELECTED' : ''; ?> >right</option>
|
246 |
+
<option value="left" <?php echo $side_2 == 'left' ? 'SELECTED' : ''; ?> >left</option>
|
247 |
+
</select>
|
248 |
+
<label>right / left</label>
|
249 |
+
</div>
|
250 |
+
|
251 |
+
<div class="input-field col s6">
|
252 |
+
<input name="ht_ctc_chat_options[side_2_value]" value="<?php echo esc_attr( $options['side_2_value'] ) ?>" id="side_2_value" type="text" class="input-margin">
|
253 |
+
<label for="side_2_value">e.g. 10px</label>
|
254 |
+
</div>
|
255 |
+
</div>
|
256 |
+
|
257 |
+
<p class="description">Add css units as suffix - e.g. 10px, 50% - <a target="_blank" href="https://www.holithemes.com/plugins/click-to-chat/position-to-place/">more info</a> </p>
|
258 |
+
<?php
|
259 |
+
}
|
260 |
+
|
261 |
+
|
262 |
+
// If checked web / api whatsapp link. If unchecked wa.me links
|
263 |
+
function ctc_webandapi_cb() {
|
264 |
+
$options = get_option('ht_ctc_chat_options');
|
265 |
+
|
266 |
+
|
267 |
+
if ( isset( $options['webandapi'] ) ) {
|
268 |
+
?>
|
269 |
+
<p>
|
270 |
+
<label>
|
271 |
+
<input name="ht_ctc_chat_options[webandapi]" type="checkbox" value="1" <?php checked( $options['webandapi'], 1 ); ?> id="webandapi" />
|
272 |
+
<span>Web WhatsApp on Desktop</span>
|
273 |
+
</label>
|
274 |
+
</p>
|
275 |
+
<?php
|
276 |
+
} else {
|
277 |
+
?>
|
278 |
+
<p>
|
279 |
+
<label>
|
280 |
+
<input name="ht_ctc_chat_options[webandapi]" type="checkbox" value="1" id="webandapi" />
|
281 |
+
<span>Web WhatsApp on Desktop</span>
|
282 |
+
</label>
|
283 |
+
</p>
|
284 |
+
<?php
|
285 |
+
}
|
286 |
+
?>
|
287 |
+
<p class="description">Open Web.WhatsApp directly on Desktop - <a target="_blank" href="https://www.holithemes.com/plugins/click-to-chat/web-whatsapp/">more info</a> </p>
|
288 |
+
<p class="description">if cache plugins, not detecting the device uncheck this option</p>
|
289 |
+
<p class="description"></p>
|
290 |
+
<?php
|
291 |
+
}
|
292 |
+
|
293 |
+
|
294 |
+
// show/hide
|
295 |
+
function ctc_show_hide_cb() {
|
296 |
+
|
297 |
+
|
298 |
+
$options = get_option('ht_ctc_chat_options');
|
299 |
+
|
300 |
+
$show_or_hide = esc_attr( $options['show_or_hide'] );
|
301 |
+
?>
|
302 |
+
|
303 |
+
<ul class="collapsible">
|
304 |
+
<li>
|
305 |
+
<div class="collapsible-header">Show/Hide</div>
|
306 |
+
<div class="collapsible-body">
|
307 |
+
|
308 |
+
<?php
|
309 |
+
|
310 |
+
|
311 |
+
// Hide on Mobile Devices
|
312 |
+
if ( isset( $options['hideon_mobile'] ) ) {
|
313 |
+
?>
|
314 |
+
<p>
|
315 |
+
<label>
|
316 |
+
<input name="ht_ctc_chat_options[hideon_mobile]" type="checkbox" value="1" <?php checked( $options['hideon_mobile'], 1 ); ?> id="hideon_mobile" />
|
317 |
+
<span>Hide on - Mobile Devices</span>
|
318 |
+
</label>
|
319 |
+
</p>
|
320 |
+
<?php
|
321 |
+
} else {
|
322 |
+
?>
|
323 |
+
<p>
|
324 |
+
<label>
|
325 |
+
<input name="ht_ctc_chat_options[hideon_mobile]" type="checkbox" value="1" id="hideon_mobile" />
|
326 |
+
<span>Hide on - Mobile Devices</span>
|
327 |
+
</label>
|
328 |
+
</p>
|
329 |
+
<?php
|
330 |
+
}
|
331 |
+
|
332 |
+
// Hide on Desktop Devices
|
333 |
+
if ( isset( $options['hideon_desktop'] ) ) {
|
334 |
+
?>
|
335 |
+
<p>
|
336 |
+
<label>
|
337 |
+
<input name="ht_ctc_chat_options[hideon_desktop]" type="checkbox" value="1" <?php checked( $options['hideon_desktop'], 1 ); ?> id="hideon_desktop" />
|
338 |
+
<span>Hide on - Desktop Devices</span>
|
339 |
+
</label>
|
340 |
+
</p>
|
341 |
+
<?php
|
342 |
+
} else {
|
343 |
+
?>
|
344 |
+
<p>
|
345 |
+
<label>
|
346 |
+
<input name="ht_ctc_chat_options[hideon_desktop]" type="checkbox" value="1" id="hideon_desktop" />
|
347 |
+
<span>Hide on - Desktop Devices</span>
|
348 |
+
</label>
|
349 |
+
</p>
|
350 |
+
<?php
|
351 |
+
}
|
352 |
+
?>
|
353 |
+
<!-- <p class="description">plugin detects device based on HTTP User agent </p> -->
|
354 |
+
<p class="description">If working in reverse it might be the cache plugin not detecting the devices - <a target="_blank" href="https://www.holithemes.com/plugins/click-to-chat/hide-based-on-device/">more info</a> </p>
|
355 |
+
|
356 |
+
|
357 |
+
<div class="row" style="margin-bottom: 0px;">
|
358 |
+
<div class="input-field col s12">
|
359 |
+
<select name="ht_ctc_chat_options[show_or_hide]" class="select_show_or_hide">
|
360 |
+
<option value="hide" <?php echo $show_or_hide == "hide" ? 'SELECTED' : ''; ?> >Hide on selected pages</option>
|
361 |
+
<option value="show" <?php echo $show_or_hide == "show" ? 'SELECTED' : ''; ?> >Show on selected pages</option>
|
362 |
+
</select>
|
363 |
+
<!-- <label><?php _e( 'enable' , 'click-to-chat-for-whatsapp' ) ?></label> -->
|
364 |
+
</div>
|
365 |
+
</div>
|
366 |
+
<?php
|
367 |
+
|
368 |
+
// ######### Hide #########
|
369 |
+
|
370 |
+
?>
|
371 |
+
<p class="description ctc_show_hide_display show-hide_display-none hidebased" style="margin-bottom: 15px">
|
372 |
+
<?php echo 'Select pages to Hide styles <span style="color: green;"> ( Default Shows on all page ) ' ?>
|
373 |
+
</p>
|
374 |
+
<!-- <br><br> -->
|
375 |
+
<?php
|
376 |
+
|
377 |
+
// checkboxes - Hide based on Type of posts
|
378 |
+
|
379 |
+
// Single Posts
|
380 |
+
if ( isset( $options['hideon_posts'] ) ) {
|
381 |
+
?>
|
382 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
383 |
+
<label>
|
384 |
+
<input name="ht_ctc_chat_options[hideon_posts]" type="checkbox" value="1" <?php checked( $options['hideon_posts'], 1 ); ?> id="filled-in-box1" />
|
385 |
+
<span>Hide on - Posts</span>
|
386 |
+
</label>
|
387 |
+
</p>
|
388 |
+
<?php
|
389 |
+
} else {
|
390 |
+
?>
|
391 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
392 |
+
<label>
|
393 |
+
<input name="ht_ctc_chat_options[hideon_posts]" type="checkbox" value="1" id="filled-in-box1" />
|
394 |
+
<span>Hide on - Posts</span>
|
395 |
+
</label>
|
396 |
+
</p>
|
397 |
+
<?php
|
398 |
+
}
|
399 |
+
|
400 |
+
|
401 |
+
// Page
|
402 |
+
if ( isset( $options['hideon_page'] ) ) {
|
403 |
+
?>
|
404 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
405 |
+
<label>
|
406 |
+
<input name="ht_ctc_chat_options[hideon_page]" type="checkbox" value="1" <?php checked( $options['hideon_page'], 1 ); ?> id="filled-in-box2" />
|
407 |
+
<span>Hide on - Pages</span>
|
408 |
+
</label>
|
409 |
+
</p>
|
410 |
+
<?php
|
411 |
+
} else {
|
412 |
+
?>
|
413 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
414 |
+
<label>
|
415 |
+
<input name="ht_ctc_chat_options[hideon_page]" type="checkbox" value="1" id="filled-in-box2" />
|
416 |
+
<span>Hide on - Pages</span>
|
417 |
+
</label>
|
418 |
+
</p>
|
419 |
+
<?php
|
420 |
+
}
|
421 |
+
|
422 |
+
|
423 |
+
|
424 |
+
|
425 |
+
// Home Page
|
426 |
+
// is_home and is_front_page - combined. calling as home/front page
|
427 |
+
if ( isset( $options['hideon_homepage'] ) ) {
|
428 |
+
?>
|
429 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
430 |
+
<label>
|
431 |
+
<input name="ht_ctc_chat_options[hideon_homepage]" type="checkbox" value="1" <?php checked( $options['hideon_homepage'], 1 ); ?> id="filled-in-box3" />
|
432 |
+
<span>Hide on - Home/Front Page</span>
|
433 |
+
</label>
|
434 |
+
</p>
|
435 |
+
<?php
|
436 |
+
} else {
|
437 |
+
?>
|
438 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
439 |
+
<label>
|
440 |
+
<input name="ht_ctc_chat_options[hideon_homepage]" type="checkbox" value="1" id="filled-in-box3" />
|
441 |
+
<span>Hide on - Home/Front Page</span>
|
442 |
+
</label>
|
443 |
+
</p>
|
444 |
+
<?php
|
445 |
+
}
|
446 |
+
|
447 |
+
|
448 |
+
// Category
|
449 |
+
if ( isset( $options['hideon_category'] ) ) {
|
450 |
+
?>
|
451 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
452 |
+
<label>
|
453 |
+
<input name="ht_ctc_chat_options[hideon_category]" type="checkbox" value="1" <?php checked( $options['hideon_category'], 1 ); ?> id="filled-in-box5" />
|
454 |
+
<span>Hide on - Category</span>
|
455 |
+
</label>
|
456 |
+
</p>
|
457 |
+
<?php
|
458 |
+
} else {
|
459 |
+
?>
|
460 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
461 |
+
<label>
|
462 |
+
<input name="ht_ctc_chat_options[hideon_category]" type="checkbox" value="1" id="filled-in-box5" />
|
463 |
+
<span>Hide on - Category</span>
|
464 |
+
</label>
|
465 |
+
</p>
|
466 |
+
<?php
|
467 |
+
}
|
468 |
+
|
469 |
+
|
470 |
+
|
471 |
+
// Archive
|
472 |
+
if ( isset( $options['hideon_archive'] ) ) {
|
473 |
+
?>
|
474 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
475 |
+
<label>
|
476 |
+
<input name="ht_ctc_chat_options[hideon_archive]" type="checkbox" value="1" <?php checked( $options['hideon_archive'], 1 ); ?> id="filled-in-box6" />
|
477 |
+
<span>Hide on - Archive</span>
|
478 |
+
</label>
|
479 |
+
</p>
|
480 |
+
<?php
|
481 |
+
} else {
|
482 |
+
?>
|
483 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
484 |
+
<label>
|
485 |
+
<input name="ht_ctc_chat_options[hideon_archive]" type="checkbox" value="1" id="filled-in-box6" />
|
486 |
+
<span>Hide on - Archive</span>
|
487 |
+
</label>
|
488 |
+
</p>
|
489 |
+
<?php
|
490 |
+
}
|
491 |
+
|
492 |
+
|
493 |
+
// 404 Page
|
494 |
+
if ( isset( $options['hideon_404'] ) ) {
|
495 |
+
?>
|
496 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
497 |
+
<label>
|
498 |
+
<input name="ht_ctc_chat_options[hideon_404]" type="checkbox" value="1" <?php checked( $options['hideon_404'], 1 ); ?> id="filled-in-box7" />
|
499 |
+
<span>Hide on - 404 Page</span>
|
500 |
+
</label>
|
501 |
+
</p>
|
502 |
+
<?php
|
503 |
+
} else {
|
504 |
+
?>
|
505 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
506 |
+
<label>
|
507 |
+
<input name="ht_ctc_chat_options[hideon_404]" type="checkbox" value="1" id="filled-in-box7" />
|
508 |
+
<span>Hide on - 404 Page</span>
|
509 |
+
</label>
|
510 |
+
</p>
|
511 |
+
<?php
|
512 |
+
}
|
513 |
+
|
514 |
+
|
515 |
+
// WooCommerce single product pages
|
516 |
+
if ( isset( $options['hideon_wooproduct'] ) ) {
|
517 |
+
?>
|
518 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
519 |
+
<label>
|
520 |
+
<input name="ht_ctc_chat_options[hideon_wooproduct]" type="checkbox" value="1" <?php checked( $options['hideon_wooproduct'], 1 ); ?> id="filled-in-box7" />
|
521 |
+
<span>Hide on - WooCommerce single product pages</span>
|
522 |
+
</label>
|
523 |
+
</p>
|
524 |
+
<?php
|
525 |
+
} else {
|
526 |
+
?>
|
527 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
528 |
+
<label>
|
529 |
+
<input name="ht_ctc_chat_options[hideon_wooproduct]" type="checkbox" value="1" id="filled-in-box7" />
|
530 |
+
<span>Hide on - WooCommerce single product pages</span>
|
531 |
+
</label>
|
532 |
+
</p>
|
533 |
+
<?php
|
534 |
+
}
|
535 |
+
|
536 |
+
|
537 |
+
?>
|
538 |
+
<p class="description ctc_show_hide_display show-hide_display-none hidebased">Check to hide Styles based on the type of pages</p>
|
539 |
+
<?php
|
540 |
+
|
541 |
+
|
542 |
+
|
543 |
+
|
544 |
+
// ID's list to hide styles
|
545 |
+
|
546 |
+
?>
|
547 |
+
<div class="row ctc_show_hide_display show-hide_display-none hidebased">
|
548 |
+
<div class="input-field col s12">
|
549 |
+
<input name="ht_ctc_chat_options[list_hideon_pages]" value="<?php echo esc_attr( $options['list_hideon_pages'] ) ?>" id="ccw_list_id_tohide" type="text" class="input-margin">
|
550 |
+
<label for="ccw_list_id_tohide">Id's list to Hide - add ',' after each id </label>
|
551 |
+
<p class="description"> Add Post, Page, Media - ID's to hide, can add multiple id's by separating with a comma ( , ) </p>
|
552 |
+
</div>
|
553 |
+
</div>
|
554 |
+
<?php
|
555 |
+
|
556 |
+
|
557 |
+
// Categorys list - to hide
|
558 |
+
|
559 |
+
?>
|
560 |
+
<div class="row ctc_show_hide_display show-hide_display-none hidebased">
|
561 |
+
<div class="input-field col s12">
|
562 |
+
<input name="ht_ctc_chat_options[list_hideon_cat]" value="<?php echo esc_attr( $options['list_hideon_cat'] ) ?>" id="ccw_list_cat_tohide" type="text" class="input-margin">
|
563 |
+
<label for="ccw_list_cat_tohide"><?php _e( 'Category name\'s to Hide - add \',\' after each category name' , 'click-to-chat-for-whatsapp' ) ?> </label>
|
564 |
+
<p class="description">Add Categories name to hide, can add multiple Categories by separating with a comma ( , ) </p>
|
565 |
+
</div>
|
566 |
+
</div>
|
567 |
+
<?php
|
568 |
+
|
569 |
+
|
570 |
+
// ######### Show #########
|
571 |
+
|
572 |
+
|
573 |
+
?>
|
574 |
+
<p class="description ctc_show_hide_display show-hide_display-none showbased" style="margin-bottom: 15px">
|
575 |
+
<?php echo 'Select pages to display styles <span style="background-color: #dddddd; color: red;"> ( Default hides on all page ) ' ?>
|
576 |
+
</p>
|
577 |
+
<?php
|
578 |
+
|
579 |
+
// checkboxes - Show based on Type of posts
|
580 |
+
|
581 |
+
// Single Posts
|
582 |
+
if ( isset( $options['showon_posts'] ) ) {
|
583 |
+
?>
|
584 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
585 |
+
<label>
|
586 |
+
<input name="ht_ctc_chat_options[showon_posts]" type="checkbox" value="1" <?php checked( $options['showon_posts'], 1 ); ?> id="show_filled-in-box1" />
|
587 |
+
<span>Show on - Posts</span>
|
588 |
+
</label>
|
589 |
+
</p>
|
590 |
+
<?php
|
591 |
+
} else {
|
592 |
+
?>
|
593 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
594 |
+
<label>
|
595 |
+
<input name="ht_ctc_chat_options[showon_posts]" type="checkbox" value="1" id="show_filled-in-box1" />
|
596 |
+
<span>Show on - Posts</span>
|
597 |
+
</label>
|
598 |
+
</p>
|
599 |
+
<?php
|
600 |
+
}
|
601 |
+
|
602 |
+
|
603 |
+
// Page
|
604 |
+
if ( isset( $options['showon_page'] ) ) {
|
605 |
+
?>
|
606 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
607 |
+
<label>
|
608 |
+
<input name="ht_ctc_chat_options[showon_page]" type="checkbox" value="1" <?php checked( $options['showon_page'], 1 ); ?> id="show_filled-in-box2" />
|
609 |
+
<span>Show on - Pages</span>
|
610 |
+
</label>
|
611 |
+
</p>
|
612 |
+
<?php
|
613 |
+
} else {
|
614 |
+
?>
|
615 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
616 |
+
<label>
|
617 |
+
<input name="ht_ctc_chat_options[showon_page]" type="checkbox" value="1" id="show_filled-in-box2" />
|
618 |
+
<span>Show on - Pages</span>
|
619 |
+
</label>
|
620 |
+
</p>
|
621 |
+
<?php
|
622 |
+
}
|
623 |
+
|
624 |
+
|
625 |
+
// Home Page
|
626 |
+
// is_home and is_front_page - combined. calling as home/front page
|
627 |
+
if ( isset( $options['showon_homepage'] ) ) {
|
628 |
+
?>
|
629 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
630 |
+
<label>
|
631 |
+
<input name="ht_ctc_chat_options[showon_homepage]" type="checkbox" value="1" <?php checked( $options['showon_homepage'], 1 ); ?> id="show_filled-in-box3" />
|
632 |
+
<span>Show on - Home/Front Page</span>
|
633 |
+
</label>
|
634 |
+
</p>
|
635 |
+
<?php
|
636 |
+
} else {
|
637 |
+
?>
|
638 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
639 |
+
<label>
|
640 |
+
<input name="ht_ctc_chat_options[showon_homepage]" type="checkbox" value="1" id="show_filled-in-box3" />
|
641 |
+
<span>Show on - Home/Front Page</span>
|
642 |
+
</label>
|
643 |
+
</p>
|
644 |
+
<?php
|
645 |
+
}
|
646 |
+
|
647 |
+
|
648 |
+
// Category
|
649 |
+
if ( isset( $options['showon_category'] ) ) {
|
650 |
+
?>
|
651 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
652 |
+
<label>
|
653 |
+
<input name="ht_ctc_chat_options[showon_category]" type="checkbox" value="1" <?php checked( $options['showon_category'], 1 ); ?> id="show_filled-in-box5" />
|
654 |
+
<span>Show on - Category</span>
|
655 |
+
</label>
|
656 |
+
</p>
|
657 |
+
<?php
|
658 |
+
} else {
|
659 |
+
?>
|
660 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
661 |
+
<label>
|
662 |
+
<input name="ht_ctc_chat_options[showon_category]" type="checkbox" value="1" id="show_filled-in-box5" />
|
663 |
+
<span>Show on - Category</span>
|
664 |
+
</label>
|
665 |
+
</p>
|
666 |
+
<?php
|
667 |
+
}
|
668 |
+
|
669 |
+
// Archive
|
670 |
+
if ( isset( $options['showon_archive'] ) ) {
|
671 |
+
?>
|
672 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
673 |
+
<label>
|
674 |
+
<input name="ht_ctc_chat_options[showon_archive]" type="checkbox" value="1" <?php checked( $options['showon_archive'], 1 ); ?> id="show_filled-in-box6" />
|
675 |
+
<span>Show on - Archive</span>
|
676 |
+
</label>
|
677 |
+
</p>
|
678 |
+
<?php
|
679 |
+
} else {
|
680 |
+
?>
|
681 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
682 |
+
<label>
|
683 |
+
<input name="ht_ctc_chat_options[showon_archive]" type="checkbox" value="1" id="show_filled-in-box6" />
|
684 |
+
<span>Show on - Archive</span>
|
685 |
+
</label>
|
686 |
+
</p>
|
687 |
+
<?php
|
688 |
+
}
|
689 |
+
|
690 |
+
|
691 |
+
// 404 Page
|
692 |
+
if ( isset( $options['showon_404'] ) ) {
|
693 |
+
?>
|
694 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
695 |
+
<label>
|
696 |
+
<input name="ht_ctc_chat_options[showon_404]" type="checkbox" value="1" <?php checked( $options['showon_404'], 1 ); ?> id="show_filled-in-box7" />
|
697 |
+
<span>Show on - 404 Page</span>
|
698 |
+
</label>
|
699 |
+
</p>
|
700 |
+
<?php
|
701 |
+
} else {
|
702 |
+
?>
|
703 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
704 |
+
<label>
|
705 |
+
<input name="ht_ctc_chat_options[showon_404]" type="checkbox" value="1" id="show_filled-in-box7" />
|
706 |
+
<span>Show on - 404 Page</span>
|
707 |
+
</label>
|
708 |
+
</p>
|
709 |
+
<?php
|
710 |
+
}
|
711 |
+
|
712 |
+
|
713 |
+
// WooCommerce single product pages
|
714 |
+
if ( isset( $options['showon_wooproduct'] ) ) {
|
715 |
+
?>
|
716 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
717 |
+
<label>
|
718 |
+
<input name="ht_ctc_chat_options[showon_wooproduct]" type="checkbox" value="1" <?php checked( $options['showon_wooproduct'], 1 ); ?> id="show_filled-in-box7" />
|
719 |
+
<span>Show on - WooCommerce Single product pages</span>
|
720 |
+
</label>
|
721 |
+
</p>
|
722 |
+
<?php
|
723 |
+
} else {
|
724 |
+
?>
|
725 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
726 |
+
<label>
|
727 |
+
<input name="ht_ctc_chat_options[showon_wooproduct]" type="checkbox" value="1" id="show_filled-in-box7" />
|
728 |
+
<span>Show on - WooCommerce Single product pages</span>
|
729 |
+
</label>
|
730 |
+
</p>
|
731 |
+
<?php
|
732 |
+
}
|
733 |
+
|
734 |
+
|
735 |
+
?>
|
736 |
+
<p class="description ctc_show_hide_display show-hide_display-none showbased">Check to display Styles based on type of the page</p>
|
737 |
+
<?php
|
738 |
+
|
739 |
+
|
740 |
+
// ID's list to show styles
|
741 |
+
|
742 |
+
?>
|
743 |
+
<div class="row ctc_show_hide_display show-hide_display-none showbased">
|
744 |
+
<div class="input-field col s12">
|
745 |
+
<input name="ht_ctc_chat_options[list_showon_pages]" value="<?php echo esc_attr( $options['list_showon_pages'] ) ?>" id="ccw_list_id_toshow" type="text" class="input-margin">
|
746 |
+
<label for="ccw_list_id_toshow">Id's list to show - add ',' after each id </label>
|
747 |
+
<p class="description"> Add Post, Page, Media - ID's to show styles, can add multiple id's by separating with a comma ( , ) </p>
|
748 |
+
</div>
|
749 |
+
</div>
|
750 |
+
<?php
|
751 |
+
|
752 |
+
|
753 |
+
// Categorys list - to show
|
754 |
+
|
755 |
+
// $ccw_list_cat_toshow = get_option('ht_ctc_chat_options');
|
756 |
+
|
757 |
+
?>
|
758 |
+
<div class="row ctc_show_hide_display show-hide_display-none showbased">
|
759 |
+
<div class="input-field col s12">
|
760 |
+
<input name="ht_ctc_chat_options[list_showon_cat]" value="<?php echo esc_attr( $options['list_showon_cat'] ) ?>" id="ccw_list_cat_toshow" type="text" class="input-margin">
|
761 |
+
<label for="ccw_list_cat_toshow"><?php _e( 'Category name\'s to Show - add \',\' after each category name' , 'click-to-chat-for-whatsapp' ) ?> </label>
|
762 |
+
<p class="description">Add Categories name to show styles, can add multiple Categories by separating with a comma ( , ) </p>
|
763 |
+
</div>
|
764 |
+
</div>
|
765 |
+
|
766 |
+
|
767 |
+
<p class="description"><a target="_blank" href="https://www.holithemes.com/plugins/click-to-chat/show-hide-styles/">more info</a> </p>
|
768 |
+
|
769 |
+
|
770 |
+
|
771 |
+
</div>
|
772 |
+
</li>
|
773 |
+
<ul>
|
774 |
+
|
775 |
+
|
776 |
+
<?php
|
777 |
+
|
778 |
+
}
|
779 |
+
|
780 |
+
|
781 |
+
|
782 |
+
function chat_shortcode_cb() {
|
783 |
+
?>
|
784 |
+
<p class="description">Shorcodes for Chat: [ht-ctc-chat] - <a target="_blank" href="https://www.holithemes.com/plugins/click-to-chat/shortcodes-chat">more info</a></p>
|
785 |
+
<?php
|
786 |
+
}
|
787 |
+
|
788 |
+
|
789 |
+
/**
|
790 |
+
* Sanitize each setting field as needed
|
791 |
+
*
|
792 |
+
* @since 2.0
|
793 |
+
* @param array $input Contains all settings fields as array keys
|
794 |
+
*/
|
795 |
+
public function options_sanitize( $input ) {
|
796 |
+
|
797 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
798 |
+
wp_die( 'not allowed to modify - please contact admin ' );
|
799 |
+
}
|
800 |
+
|
801 |
+
$new_input = array();
|
802 |
+
|
803 |
+
foreach ($input as $key => $value) {
|
804 |
+
if( isset( $input[$key] ) ) {
|
805 |
+
$new_input[$key] = sanitize_text_field( $input[$key] );
|
806 |
+
}
|
807 |
+
}
|
808 |
+
|
809 |
+
|
810 |
+
return $new_input;
|
811 |
+
}
|
812 |
+
|
813 |
+
|
814 |
+
}
|
815 |
+
|
816 |
+
$ht_ctc_admin_chat_page = new HT_CTC_Admin_Chat_Page();
|
817 |
+
|
818 |
+
add_action('admin_menu', array($ht_ctc_admin_chat_page, 'menu') );
|
819 |
+
add_action('admin_init', array($ht_ctc_admin_chat_page, 'settings') );
|
820 |
+
|
821 |
+
endif; // END class_exists check
|
new/admin/class-ht-ctc-admin-customize-styles.php
ADDED
@@ -0,0 +1,910 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Customize Styles ( cs )
|
4 |
+
*
|
5 |
+
* @package Admin
|
6 |
+
* @since 2.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
10 |
+
|
11 |
+
if ( ! class_exists( 'HT_CTC_Admin_Customize_Styles' ) ) :
|
12 |
+
|
13 |
+
class HT_CTC_Admin_Customize_Styles {
|
14 |
+
|
15 |
+
public function menu() {
|
16 |
+
|
17 |
+
add_submenu_page(
|
18 |
+
'click-to-chat',
|
19 |
+
'Customize Styles',
|
20 |
+
'Customize Styles',
|
21 |
+
'manage_options',
|
22 |
+
'click-to-chat-customize-styles',
|
23 |
+
array( $this, 'settings_page' )
|
24 |
+
);
|
25 |
+
}
|
26 |
+
|
27 |
+
public function settings_page() {
|
28 |
+
|
29 |
+
if ( ! current_user_can('manage_options') ) {
|
30 |
+
return;
|
31 |
+
}
|
32 |
+
|
33 |
+
?>
|
34 |
+
|
35 |
+
<div class="wrap">
|
36 |
+
|
37 |
+
<?php settings_errors(); ?>
|
38 |
+
|
39 |
+
<div class="row">
|
40 |
+
<div class="col s12 m12 xl8 options">
|
41 |
+
<form action="options.php" method="post" class="">
|
42 |
+
<?php settings_fields( 'ht_ctc_cs_page_settings_fields' ); ?>
|
43 |
+
<?php do_settings_sections( 'ht_ctc_cs_page_settings_sections_do' ) ?>
|
44 |
+
<?php submit_button() ?>
|
45 |
+
</form>
|
46 |
+
</div>
|
47 |
+
<!-- <div class="col s12 m12 xl6 ht-cc-admin-sidebar">
|
48 |
+
</div> -->
|
49 |
+
</div>
|
50 |
+
|
51 |
+
</div>
|
52 |
+
|
53 |
+
<?php
|
54 |
+
|
55 |
+
}
|
56 |
+
|
57 |
+
|
58 |
+
|
59 |
+
public function settings() {
|
60 |
+
|
61 |
+
register_setting( 'ht_ctc_cs_page_settings_fields', 'ht_ctc_s1' , array( $this, 'options_sanitize' ) );
|
62 |
+
register_setting( 'ht_ctc_cs_page_settings_fields', 'ht_ctc_s2' , array( $this, 'options_sanitize' ) );
|
63 |
+
register_setting( 'ht_ctc_cs_page_settings_fields', 'ht_ctc_s3' , array( $this, 'options_sanitize' ) );
|
64 |
+
register_setting( 'ht_ctc_cs_page_settings_fields', 'ht_ctc_s4' , array( $this, 'options_sanitize' ) );
|
65 |
+
register_setting( 'ht_ctc_cs_page_settings_fields', 'ht_ctc_s5' , array( $this, 'options_sanitize' ) );
|
66 |
+
register_setting( 'ht_ctc_cs_page_settings_fields', 'ht_ctc_s6' , array( $this, 'options_sanitize' ) );
|
67 |
+
register_setting( 'ht_ctc_cs_page_settings_fields', 'ht_ctc_s7' , array( $this, 'options_sanitize' ) );
|
68 |
+
register_setting( 'ht_ctc_cs_page_settings_fields', 'ht_ctc_s8' , array( $this, 'options_sanitize' ) );
|
69 |
+
register_setting( 'ht_ctc_cs_page_settings_fields', 'ht_ctc_s99' , array( $this, 'options_sanitize' ) );
|
70 |
+
|
71 |
+
add_settings_section( 'ht_ctc_cs_settings_sections_add', '', array( $this, 'main_settings_section_cb' ), 'ht_ctc_cs_page_settings_sections_do' );
|
72 |
+
|
73 |
+
add_settings_field( 'ht_ctc_s1', 'Style-1', array( $this, 'ht_ctc_s1_cb' ), 'ht_ctc_cs_page_settings_sections_do', 'ht_ctc_cs_settings_sections_add' );
|
74 |
+
add_settings_field( 'ht_ctc_s2', 'Style-2', array( $this, 'ht_ctc_s2_cb' ), 'ht_ctc_cs_page_settings_sections_do', 'ht_ctc_cs_settings_sections_add' );
|
75 |
+
add_settings_field( 'ht_ctc_s3', 'Style-3', array( $this, 'ht_ctc_s3_cb' ), 'ht_ctc_cs_page_settings_sections_do', 'ht_ctc_cs_settings_sections_add' );
|
76 |
+
add_settings_field( 'ht_ctc_s4', 'Style-4', array( $this, 'ht_ctc_s4_cb' ), 'ht_ctc_cs_page_settings_sections_do', 'ht_ctc_cs_settings_sections_add' );
|
77 |
+
add_settings_field( 'ht_ctc_s5', 'Style-5', array( $this, 'ht_ctc_s5_cb' ), 'ht_ctc_cs_page_settings_sections_do', 'ht_ctc_cs_settings_sections_add' );
|
78 |
+
add_settings_field( 'ht_ctc_s6', 'Style-6', array( $this, 'ht_ctc_s6_cb' ), 'ht_ctc_cs_page_settings_sections_do', 'ht_ctc_cs_settings_sections_add' );
|
79 |
+
add_settings_field( 'ht_ctc_s7', 'Style-7', array( $this, 'ht_ctc_s7_cb' ), 'ht_ctc_cs_page_settings_sections_do', 'ht_ctc_cs_settings_sections_add' );
|
80 |
+
add_settings_field( 'ht_ctc_s8', 'Style-8', array( $this, 'ht_ctc_s8_cb' ), 'ht_ctc_cs_page_settings_sections_do', 'ht_ctc_cs_settings_sections_add' );
|
81 |
+
add_settings_field( 'ht_ctc_s99', 'Style-99', array( $this, 'ht_ctc_s99_cb' ), 'ht_ctc_cs_page_settings_sections_do', 'ht_ctc_cs_settings_sections_add' );
|
82 |
+
|
83 |
+
|
84 |
+
}
|
85 |
+
|
86 |
+
public function main_settings_section_cb() {
|
87 |
+
?>
|
88 |
+
<h1>Customize Styles</h1>
|
89 |
+
<?php
|
90 |
+
}
|
91 |
+
|
92 |
+
|
93 |
+
// style-1 - default theme button
|
94 |
+
function ht_ctc_s1_cb() {
|
95 |
+
|
96 |
+
$options = get_option('ht_ctc_s1');
|
97 |
+
?>
|
98 |
+
<ul class="collapsible" data-collapsible="accordion">
|
99 |
+
<li>
|
100 |
+
<div class="collapsible-header">Style 1</div>
|
101 |
+
<div class="collapsible-body">
|
102 |
+
|
103 |
+
<p class="description">Style-1 is a button that appears like themes button</p>
|
104 |
+
|
105 |
+
</div>
|
106 |
+
</div>
|
107 |
+
</li>
|
108 |
+
</ul>
|
109 |
+
|
110 |
+
<?php
|
111 |
+
}
|
112 |
+
|
113 |
+
|
114 |
+
|
115 |
+
// style-2 - ht_ctc_s2 - whatsapp ios style icon
|
116 |
+
function ht_ctc_s2_cb() {
|
117 |
+
|
118 |
+
$options = get_option('ht_ctc_s2');
|
119 |
+
?>
|
120 |
+
<ul class="collapsible" data-collapsible="accordion">
|
121 |
+
<li>
|
122 |
+
<div class="collapsible-header">Style 2</div>
|
123 |
+
<div class="collapsible-body">
|
124 |
+
|
125 |
+
|
126 |
+
<!-- img size -->
|
127 |
+
<div class="row">
|
128 |
+
<div class="col s6">
|
129 |
+
<p>Image Size</p>
|
130 |
+
</div>
|
131 |
+
<div class="input-field col s6">
|
132 |
+
<input name="ht_ctc_s2[s2_img_size]" value="<?php echo esc_attr( $options['s2_img_size'] ) ?>" id="s2_img_size" type="text" class="" >
|
133 |
+
<label for="s2_img_size">Image Size</label>
|
134 |
+
</div>
|
135 |
+
</div>
|
136 |
+
|
137 |
+
<!-- call to action on hover - title -->
|
138 |
+
<div class="row">
|
139 |
+
<div class="col s6">
|
140 |
+
<p>Call to action on hover</p>
|
141 |
+
</div>
|
142 |
+
<div class="input-field col s6">
|
143 |
+
<?php
|
144 |
+
if ( isset( $options['cta_on_hover'] ) ) {
|
145 |
+
?>
|
146 |
+
<p>
|
147 |
+
<label>
|
148 |
+
<input name="ht_ctc_s2[cta_on_hover]" type="checkbox" value="1" <?php checked( $options['cta_on_hover'], 1 ); ?> id="cta_on_hover_s2" />
|
149 |
+
<span>Display Call to action on hover</span>
|
150 |
+
</label>
|
151 |
+
</p>
|
152 |
+
<?php
|
153 |
+
} else {
|
154 |
+
?>
|
155 |
+
<p>
|
156 |
+
<label>
|
157 |
+
<input name="ht_ctc_s2[cta_on_hover]" type="checkbox" value="1" id="cta_on_hover_s2" />
|
158 |
+
<span>Display Call to action on hover</span>
|
159 |
+
</label>
|
160 |
+
</p>
|
161 |
+
<?php
|
162 |
+
}
|
163 |
+
?>
|
164 |
+
</div>
|
165 |
+
</div>
|
166 |
+
|
167 |
+
|
168 |
+
</div>
|
169 |
+
</div>
|
170 |
+
</li>
|
171 |
+
</ul>
|
172 |
+
|
173 |
+
<?php
|
174 |
+
}
|
175 |
+
|
176 |
+
|
177 |
+
|
178 |
+
// style-3 - ht_ctc_s3 - whatsapp andriod style icon
|
179 |
+
function ht_ctc_s3_cb() {
|
180 |
+
|
181 |
+
$options = get_option('ht_ctc_s3');
|
182 |
+
?>
|
183 |
+
<ul class="collapsible" data-collapsible="accordion">
|
184 |
+
<li>
|
185 |
+
<div class="collapsible-header">Style 3</div>
|
186 |
+
<div class="collapsible-body">
|
187 |
+
|
188 |
+
<!-- img size -->
|
189 |
+
<div class="row">
|
190 |
+
<div class="col s6">
|
191 |
+
<p>Image Size</p>
|
192 |
+
</div>
|
193 |
+
<div class="input-field col s6">
|
194 |
+
<input name="ht_ctc_s3[s3_img_size]" value="<?php echo esc_attr( $options['s3_img_size'] ) ?>" id="s3_img_size" type="text" class="" >
|
195 |
+
<label for="s3_img_size">Image Size</label>
|
196 |
+
</div>
|
197 |
+
</div>
|
198 |
+
|
199 |
+
<!-- call to action on hover - title -->
|
200 |
+
<div class="row">
|
201 |
+
<div class="col s6">
|
202 |
+
<p>Call to action on hover</p>
|
203 |
+
</div>
|
204 |
+
<div class="input-field col s6">
|
205 |
+
<?php
|
206 |
+
if ( isset( $options['cta_on_hover'] ) ) {
|
207 |
+
?>
|
208 |
+
<p>
|
209 |
+
<label>
|
210 |
+
<input name="ht_ctc_s3[cta_on_hover]" type="checkbox" value="1" <?php checked( $options['cta_on_hover'], 1 ); ?> id="cta_on_hover_s3" />
|
211 |
+
<span>Display Call to action on hover</span>
|
212 |
+
</label>
|
213 |
+
</p>
|
214 |
+
<?php
|
215 |
+
} else {
|
216 |
+
?>
|
217 |
+
<p>
|
218 |
+
<label>
|
219 |
+
<input name="ht_ctc_s3[cta_on_hover]" type="checkbox" value="1" id="cta_on_hover_s3" />
|
220 |
+
<span>Display Call to action on hover</span>
|
221 |
+
</label>
|
222 |
+
</p>
|
223 |
+
<?php
|
224 |
+
}
|
225 |
+
?>
|
226 |
+
</div>
|
227 |
+
</div>
|
228 |
+
|
229 |
+
</div>
|
230 |
+
</div>
|
231 |
+
</li>
|
232 |
+
</ul>
|
233 |
+
|
234 |
+
<?php
|
235 |
+
}
|
236 |
+
|
237 |
+
|
238 |
+
|
239 |
+
// style-4 - ht_ctc_s4 - chip
|
240 |
+
function ht_ctc_s4_cb() {
|
241 |
+
|
242 |
+
$options = get_option('ht_ctc_s4');
|
243 |
+
?>
|
244 |
+
<ul class="collapsible" data-collapsible="accordion">
|
245 |
+
<li>
|
246 |
+
<div class="collapsible-header">Style 4</div>
|
247 |
+
<div class="collapsible-body">
|
248 |
+
|
249 |
+
<!-- text color -->
|
250 |
+
<div class="row">
|
251 |
+
<div class="col s6">
|
252 |
+
<p>Text Color</p>
|
253 |
+
</div>
|
254 |
+
<div class="input-field col s6">
|
255 |
+
<input class="ht-ctc-color" name="ht_ctc_s4[s4_text_color]" data-default-color="#7f7d7d" value="<?php echo esc_attr( $options['s4_text_color'] ) ?>" id="s4_text_color" type="text">
|
256 |
+
</div>
|
257 |
+
</div>
|
258 |
+
|
259 |
+
<!-- background color -->
|
260 |
+
<div class="row">
|
261 |
+
<div class="col s6">
|
262 |
+
<p>Background Color</p>
|
263 |
+
</div>
|
264 |
+
<div class="input-field col s6">
|
265 |
+
<input id="s4_bg_color" class="ht-ctc-color" data-default-color="#e4e4e4" name="ht_ctc_s4[s4_bg_color]" value="<?php echo esc_attr( $options['s4_bg_color'] ) ?>" type="text" style="height: 1.375rem;" >
|
266 |
+
</div>
|
267 |
+
</div>
|
268 |
+
|
269 |
+
<!-- image url -->
|
270 |
+
<div class="row">
|
271 |
+
<div class="col s6">
|
272 |
+
<p>Image URL</p>
|
273 |
+
</div>
|
274 |
+
<div class="input-field col s6">
|
275 |
+
<input name="ht_ctc_s4[s4_img_url]" value="<?php echo esc_attr( $options['s4_img_url'] ) ?>" id="s4_img_url" type="text" class="" >
|
276 |
+
<label for="s4_img_url">Image URL</label>
|
277 |
+
</div>
|
278 |
+
</div>
|
279 |
+
|
280 |
+
|
281 |
+
|
282 |
+
</div>
|
283 |
+
</div>
|
284 |
+
</li>
|
285 |
+
</ul>
|
286 |
+
|
287 |
+
<?php
|
288 |
+
}
|
289 |
+
|
290 |
+
|
291 |
+
|
292 |
+
// style-5 - ht_ctc_s5 - chip
|
293 |
+
function ht_ctc_s5_cb() {
|
294 |
+
|
295 |
+
$options = get_option('ht_ctc_s5');
|
296 |
+
?>
|
297 |
+
<ul class="collapsible" data-collapsible="accordion">
|
298 |
+
<li>
|
299 |
+
<div class="collapsible-header">Style 5 ( Beta )</div>
|
300 |
+
<div class="collapsible-body">
|
301 |
+
|
302 |
+
<!-- s5_line_1 -->
|
303 |
+
<div class="row">
|
304 |
+
<div class="col s6">
|
305 |
+
<p>Line 1</p>
|
306 |
+
</div>
|
307 |
+
<div class="input-field col s6">
|
308 |
+
<input name="ht_ctc_s5[s5_line_1]" value="<?php echo esc_attr( $options['s5_line_1'] ) ?>" id="s5_line_1" type="text" class="" >
|
309 |
+
<label for="s5_line_1">Line 1</label>
|
310 |
+
</div>
|
311 |
+
</div>
|
312 |
+
|
313 |
+
<!-- s5_line_2 -->
|
314 |
+
<div class="row">
|
315 |
+
<div class="col s6">
|
316 |
+
<p>Line 2</p>
|
317 |
+
</div>
|
318 |
+
<div class="input-field col s6">
|
319 |
+
<input name="ht_ctc_s5[s5_line_2]" value="<?php echo esc_attr( $options['s5_line_2'] ) ?>" id="s5_line_2" type="text" class="" >
|
320 |
+
<label for="s5_line_2">Line 2</label>
|
321 |
+
</div>
|
322 |
+
</div>
|
323 |
+
|
324 |
+
<!-- s5_line_1_color -->
|
325 |
+
<div class="row">
|
326 |
+
<div class="col s6">
|
327 |
+
<p>Line 1 - Text Color</p>
|
328 |
+
</div>
|
329 |
+
<div class="input-field col s6">
|
330 |
+
<input class="ht-ctc-color" name="ht_ctc_s5[s5_line_1_color]" data-default-color="#000000" value="<?php echo esc_attr( $options['s5_line_1_color'] ) ?>" id="s5_line_1_color" type="text">
|
331 |
+
</div>
|
332 |
+
</div>
|
333 |
+
|
334 |
+
<!-- s5_line_2_color -->
|
335 |
+
<div class="row">
|
336 |
+
<div class="col s6">
|
337 |
+
<p>Line 2 - Text Color</p>
|
338 |
+
</div>
|
339 |
+
<div class="input-field col s6">
|
340 |
+
<input class="ht-ctc-color" name="ht_ctc_s5[s5_line_2_color]" data-default-color="#000000" value="<?php echo esc_attr( $options['s5_line_2_color'] ) ?>" id="s5_line_2_color" type="text">
|
341 |
+
</div>
|
342 |
+
</div>
|
343 |
+
|
344 |
+
<!-- s5_background_color -->
|
345 |
+
<div class="row">
|
346 |
+
<div class="col s6">
|
347 |
+
<p>Content Box Background Color</p>
|
348 |
+
</div>
|
349 |
+
<div class="input-field col s6">
|
350 |
+
<input class="ht-ctc-color" name="ht_ctc_s5[s5_background_color]" data-default-color="#ffffff" value="<?php echo esc_attr( $options['s5_background_color'] ) ?>" id="s5_background_color" type="text">
|
351 |
+
</div>
|
352 |
+
</div>
|
353 |
+
|
354 |
+
<!-- s5_border_color -->
|
355 |
+
<div class="row">
|
356 |
+
<div class="col s6">
|
357 |
+
<p>Content Box Border Color</p>
|
358 |
+
</div>
|
359 |
+
<div class="input-field col s6">
|
360 |
+
<input class="ht-ctc-color" name="ht_ctc_s5[s5_border_color]" data-default-color="#dddddd" value="<?php echo esc_attr( $options['s5_border_color'] ) ?>" id="s5_border_color" type="text">
|
361 |
+
</div>
|
362 |
+
</div>
|
363 |
+
|
364 |
+
<!-- s5_img -->
|
365 |
+
<div class="row">
|
366 |
+
<div class="col s6">
|
367 |
+
<p>Image URL</p>
|
368 |
+
</div>
|
369 |
+
<div class="input-field col s6">
|
370 |
+
<input name="ht_ctc_s5[s5_img]" value="<?php echo esc_attr( $options['s5_img'] ) ?>" id="s5_img" type="text" class="" >
|
371 |
+
<label for="s5_img">Leave blank for default image</label>
|
372 |
+
</div>
|
373 |
+
</div>
|
374 |
+
|
375 |
+
<!-- s5_img_height -->
|
376 |
+
<div class="row">
|
377 |
+
<div class="col s6">
|
378 |
+
<p>Image Height</p>
|
379 |
+
</div>
|
380 |
+
<div class="input-field col s6">
|
381 |
+
<input name="ht_ctc_s5[s5_img_height]" value="<?php echo esc_attr( $options['s5_img_height'] ) ?>" id="s5_img_height" type="text" class="" >
|
382 |
+
<label for="s5_img_height">Image Height</label>
|
383 |
+
</div>
|
384 |
+
</div>
|
385 |
+
|
386 |
+
<!-- s5_img_width -->
|
387 |
+
<div class="row">
|
388 |
+
<div class="col s6">
|
389 |
+
<p>Image Width</p>
|
390 |
+
</div>
|
391 |
+
<div class="input-field col s6">
|
392 |
+
<input name="ht_ctc_s5[s5_img_width]" value="<?php echo esc_attr( $options['s5_img_width'] ) ?>" id="s5_img_width" type="text" class="" >
|
393 |
+
<label for="s5_img_width">Image Width</label>
|
394 |
+
</div>
|
395 |
+
</div>
|
396 |
+
|
397 |
+
<!-- s5_content_height -->
|
398 |
+
<div class="row">
|
399 |
+
<div class="col s6">
|
400 |
+
<p>Content Box Height</p>
|
401 |
+
</div>
|
402 |
+
<div class="input-field col s6">
|
403 |
+
<input name="ht_ctc_s5[s5_content_height]" value="<?php echo esc_attr( $options['s5_content_height'] ) ?>" id="s5_content_height" type="text" class="" >
|
404 |
+
<label for="s5_content_height">Content Box Height</label>
|
405 |
+
</div>
|
406 |
+
</div>
|
407 |
+
|
408 |
+
<!-- s5_content_width -->
|
409 |
+
<div class="row">
|
410 |
+
<div class="col s6">
|
411 |
+
<p>Content Box Width</p>
|
412 |
+
</div>
|
413 |
+
<div class="input-field col s6">
|
414 |
+
<input name="ht_ctc_s5[s5_content_width]" value="<?php echo esc_attr( $options['s5_content_width'] ) ?>" id="s5_content_width" type="text" class="" >
|
415 |
+
<label for="s5_content_width">Content Box Width</label>
|
416 |
+
</div>
|
417 |
+
</div>
|
418 |
+
|
419 |
+
<!-- s5_img_position -->
|
420 |
+
<?php
|
421 |
+
$select_s5_img_position = esc_attr( $options['s5_img_position'] );
|
422 |
+
?>
|
423 |
+
|
424 |
+
<div class="row">
|
425 |
+
<div class="col s6">
|
426 |
+
<p>Image Position</p>
|
427 |
+
</div>
|
428 |
+
<div class="input-field col s6">
|
429 |
+
<select name="ht_ctc_s5[s5_img_position]" class="select-2">
|
430 |
+
<option value="right" <?php echo $select_s5_img_position == 'right' ? 'SELECTED' : ''; ?> >Right</option>
|
431 |
+
<option value="left" <?php echo $select_s5_img_position == 'left' ? 'SELECTED' : ''; ?> >Left</option>
|
432 |
+
</select>
|
433 |
+
<p class="description">If style position/located: Right to screen then select Right, if Left to screen then select Left</p>
|
434 |
+
</div>
|
435 |
+
</div>
|
436 |
+
|
437 |
+
|
438 |
+
|
439 |
+
|
440 |
+
</div>
|
441 |
+
</div>
|
442 |
+
</li>
|
443 |
+
</ul>
|
444 |
+
|
445 |
+
<?php
|
446 |
+
}
|
447 |
+
|
448 |
+
|
449 |
+
|
450 |
+
|
451 |
+
// style-6 - ht_ctc_s6 - plain link
|
452 |
+
function ht_ctc_s6_cb() {
|
453 |
+
|
454 |
+
$options = get_option('ht_ctc_s6');
|
455 |
+
?>
|
456 |
+
<ul class="collapsible" data-collapsible="accordion">
|
457 |
+
<li>
|
458 |
+
<div class="collapsible-header">Style 6</div>
|
459 |
+
<div class="collapsible-body">
|
460 |
+
|
461 |
+
<!-- text color -->
|
462 |
+
<div class="row">
|
463 |
+
<div class="col s6">
|
464 |
+
<p>Text Color</p>
|
465 |
+
</div>
|
466 |
+
<div class="input-field col s6">
|
467 |
+
<!-- <input id="s6_txt_color" class="ht-ctc-color" data-default-color="#006ccc" name="ht_ctc_s6[s6_txt_color]" value="<?php echo esc_attr( $options['s6_txt_color'] ) ?>" type="text" style="height: 1.375rem;" > -->
|
468 |
+
<input id="s6_txt_color" class="ht-ctc-color" name="ht_ctc_s6[s6_txt_color]" value="<?php echo esc_attr( $options['s6_txt_color'] ) ?>" type="text" style="height: 1.375rem;" >
|
469 |
+
</div>
|
470 |
+
</div>
|
471 |
+
|
472 |
+
|
473 |
+
<!-- text color on hover -->
|
474 |
+
<div class="row">
|
475 |
+
<div class="col s6">
|
476 |
+
<p>Text Color on Hover</p>
|
477 |
+
</div>
|
478 |
+
<div class="input-field col s6">
|
479 |
+
<!-- <input id="s6_txt_color_on_hover" class="ht-ctc-color" data-default-color="#006ccc" name="ht_ctc_s6[s6_txt_color_on_hover]" value="<?php echo esc_attr( $options['s6_txt_color_on_hover'] ) ?>" type="text" style="height: 1.375rem;" > -->
|
480 |
+
<input id="s6_txt_color_on_hover" class="ht-ctc-color" name="ht_ctc_s6[s6_txt_color_on_hover]" value="<?php echo esc_attr( $options['s6_txt_color_on_hover'] ) ?>" type="text" style="height: 1.375rem;" >
|
481 |
+
</div>
|
482 |
+
</div>
|
483 |
+
|
484 |
+
<!-- Text Decoration - none/initial/underline/overline/... -->
|
485 |
+
<?php
|
486 |
+
$text_decoration_value = esc_attr( $options['s6_txt_decoration'] );
|
487 |
+
?>
|
488 |
+
|
489 |
+
<div class="row">
|
490 |
+
<div class="col s6">
|
491 |
+
<p>Text Decoration</p>
|
492 |
+
</div>
|
493 |
+
<div class="input-field col s6">
|
494 |
+
<select name="ht_ctc_s6[s6_txt_decoration]" class="select-2">
|
495 |
+
<option value="initial" <?php echo $text_decoration_value == 'initial' ? 'SELECTED' : ''; ?> >initial</option>
|
496 |
+
<option value="underline" <?php echo $text_decoration_value == 'underline' ? 'SELECTED' : ''; ?> >underline</option>
|
497 |
+
<option value="overline" <?php echo $text_decoration_value == 'overline' ? 'SELECTED' : ''; ?> >overline</option>
|
498 |
+
<option value="line-through" <?php echo $text_decoration_value == 'line-through' ? 'SELECTED' : ''; ?> >line-through</option>
|
499 |
+
<option value="inherit" <?php echo $text_decoration_value == 'inherit' ? 'SELECTED' : ''; ?> >inherit</option>
|
500 |
+
</select>
|
501 |
+
<!-- <label>Text Decoration</label> -->
|
502 |
+
</div>
|
503 |
+
</div>
|
504 |
+
|
505 |
+
<!-- Text Decoration when hover - none/initial/underline/overline/... -->
|
506 |
+
<?php
|
507 |
+
$text_decoration_hover_value = $options['s6_txt_decoration_on_hover'];
|
508 |
+
?>
|
509 |
+
|
510 |
+
<div class="row">
|
511 |
+
<div class="col s6">
|
512 |
+
<p>Text Decoration when Hover</p>
|
513 |
+
</div>
|
514 |
+
<div class="input-field col s6">
|
515 |
+
<select name="ht_ctc_s6[s6_txt_decoration_on_hover]" class="select-2">
|
516 |
+
<option value="initial" <?php echo $text_decoration_hover_value == 'initial' ? 'SELECTED' : ''; ?> >initial</option>
|
517 |
+
<option value="underline" <?php echo $text_decoration_hover_value == 'underline' ? 'SELECTED' : ''; ?> >underline</option>
|
518 |
+
<option value="overline" <?php echo $text_decoration_hover_value == 'overline' ? 'SELECTED' : ''; ?> >overline</option>
|
519 |
+
<option value="line-through" <?php echo $text_decoration_hover_value == 'line-through' ? 'SELECTED' : ''; ?> >line-through</option>
|
520 |
+
<option value="inherit" <?php echo $text_decoration_hover_value == 'inherit' ? 'SELECTED' : ''; ?> >inherit</option>
|
521 |
+
</select>
|
522 |
+
<!-- <label>Text Decoration when Hover</label> -->
|
523 |
+
</div>
|
524 |
+
</div>
|
525 |
+
|
526 |
+
|
527 |
+
|
528 |
+
</div>
|
529 |
+
</div>
|
530 |
+
</li>
|
531 |
+
</ul>
|
532 |
+
|
533 |
+
<?php
|
534 |
+
}
|
535 |
+
|
536 |
+
|
537 |
+
// style-7 - ht_ctc_s7 - plain link
|
538 |
+
function ht_ctc_s7_cb() {
|
539 |
+
|
540 |
+
$options = get_option('ht_ctc_s7');
|
541 |
+
?>
|
542 |
+
<ul class="collapsible" data-collapsible="accordion">
|
543 |
+
<li>
|
544 |
+
<div class="collapsible-header">Style 7</div>
|
545 |
+
<div class="collapsible-body">
|
546 |
+
|
547 |
+
|
548 |
+
<!-- call to action on hover - title -->
|
549 |
+
<div class="row">
|
550 |
+
<div class="col s6">
|
551 |
+
<p>Call to action on hover</p>
|
552 |
+
</div>
|
553 |
+
<div class="input-field col s6">
|
554 |
+
<?php
|
555 |
+
if ( isset( $options['cta_on_hover'] ) ) {
|
556 |
+
?>
|
557 |
+
<p>
|
558 |
+
<label>
|
559 |
+
<input name="ht_ctc_s7[cta_on_hover]" type="checkbox" value="1" <?php checked( $options['cta_on_hover'], 1 ); ?> id="cta_on_hover_s99" />
|
560 |
+
<span>Display Call to action on hover</span>
|
561 |
+
</label>
|
562 |
+
</p>
|
563 |
+
<?php
|
564 |
+
} else {
|
565 |
+
?>
|
566 |
+
<p>
|
567 |
+
<label>
|
568 |
+
<input name="ht_ctc_s7[cta_on_hover]" type="checkbox" value="1" id="cta_on_hover_s99" />
|
569 |
+
<span>Display Call to action on hover</span>
|
570 |
+
</label>
|
571 |
+
</p>
|
572 |
+
<?php
|
573 |
+
}
|
574 |
+
?>
|
575 |
+
</div>
|
576 |
+
</div>
|
577 |
+
|
578 |
+
|
579 |
+
<!-- s7_icon_size -->
|
580 |
+
<div class="row">
|
581 |
+
<div class="col s6">
|
582 |
+
<p>Icon Size</p>
|
583 |
+
</div>
|
584 |
+
<div class="input-field col s6">
|
585 |
+
<input name="ht_ctc_s7[s7_icon_size]" value="<?php echo esc_attr( $options['s7_icon_size'] ) ?>" id="s7_icon_size" type="text" class="" >
|
586 |
+
<label for="s7_icon_size">Icon Size</label>
|
587 |
+
</div>
|
588 |
+
</div>
|
589 |
+
|
590 |
+
<!-- s7_icon_color -->
|
591 |
+
<div class="row">
|
592 |
+
<div class="col s6">
|
593 |
+
<p>Icon Color</p>
|
594 |
+
</div>
|
595 |
+
<div class="input-field col s6">
|
596 |
+
<input id="s7_icon_color" class="ht-ctc-color" data-default-color="#ffffff" name="ht_ctc_s7[s7_icon_color]" value="<?php echo esc_attr( $options['s7_icon_color'] ) ?>" type="text" style="height: 1.375rem;" >
|
597 |
+
</div>
|
598 |
+
</div>
|
599 |
+
|
600 |
+
<!-- s7_icon_color_hover -->
|
601 |
+
<div class="row">
|
602 |
+
<div class="col s6">
|
603 |
+
<p>Icon Color on Hover</p>
|
604 |
+
</div>
|
605 |
+
<div class="input-field col s6">
|
606 |
+
<input id="s7_icon_color_hover" class="ht-ctc-color" data-default-color="#6b6b6b" name="ht_ctc_s7[s7_icon_color_hover]" value="<?php echo esc_attr( $options['s7_icon_color_hover'] ) ?>" type="text" style="height: 1.375rem;" >
|
607 |
+
</div>
|
608 |
+
</div>
|
609 |
+
|
610 |
+
<!-- s7_border_size -->
|
611 |
+
<div class="row">
|
612 |
+
<div class="col s6">
|
613 |
+
<p>Border Padding Size</p>
|
614 |
+
</div>
|
615 |
+
<div class="input-field col s6">
|
616 |
+
<input name="ht_ctc_s7[s7_border_size]" value="<?php echo esc_attr( $options['s7_border_size'] ) ?>" id="s7_border_size" type="text" class="" >
|
617 |
+
<label for="s7_border_size">Border Padding Size</label>
|
618 |
+
<p class="description">E.g. 12px</p>
|
619 |
+
</div>
|
620 |
+
</div>
|
621 |
+
|
622 |
+
<!-- s7_border_color -->
|
623 |
+
<div class="row">
|
624 |
+
<div class="col s6">
|
625 |
+
<p>Border Padding Color</p>
|
626 |
+
</div>
|
627 |
+
<div class="input-field col s6">
|
628 |
+
<input id="s7_border_color" class="ht-ctc-color" data-default-color="#25D366" name="ht_ctc_s7[s7_border_color]" value="<?php echo esc_attr( $options['s7_border_color'] ) ?>" type="text" style="height: 1.375rem;" >
|
629 |
+
</div>
|
630 |
+
</div>
|
631 |
+
|
632 |
+
<!-- s7_border_color_hover -->
|
633 |
+
<div class="row">
|
634 |
+
<div class="col s6">
|
635 |
+
<p>Border Padding Color on Hover</p>
|
636 |
+
</div>
|
637 |
+
<div class="input-field col s6">
|
638 |
+
<input id="s7_border_color_hover" class="ht-ctc-color" data-default-color="#25D366" name="ht_ctc_s7[s7_border_color_hover]" value="<?php echo esc_attr( $options['s7_border_color_hover'] ) ?>" type="text" style="height: 1.375rem;" >
|
639 |
+
</div>
|
640 |
+
</div>
|
641 |
+
|
642 |
+
<!-- s7_border_radius -->
|
643 |
+
<div class="row">
|
644 |
+
<div class="col s6">
|
645 |
+
<p>Border radius</p>
|
646 |
+
</div>
|
647 |
+
<div class="input-field col s6">
|
648 |
+
<input name="ht_ctc_s7[s7_border_radius]" value="<?php echo esc_attr( $options['s7_border_radius'] ) ?>" id="s7_border_radius" type="text" class="" >
|
649 |
+
<label for="s7_border_radius">Border radius</label>
|
650 |
+
<p class="description">E.g. 10px, 50% ( for round border add 50% )</p>
|
651 |
+
</div>
|
652 |
+
</div>
|
653 |
+
|
654 |
+
|
655 |
+
|
656 |
+
</div>
|
657 |
+
</div>
|
658 |
+
</li>
|
659 |
+
</ul>
|
660 |
+
|
661 |
+
<?php
|
662 |
+
}
|
663 |
+
|
664 |
+
|
665 |
+
|
666 |
+
|
667 |
+
// style-8 - ht_ctc_s8 - button with icon
|
668 |
+
function ht_ctc_s8_cb() {
|
669 |
+
|
670 |
+
$options = get_option('ht_ctc_s8');
|
671 |
+
?>
|
672 |
+
<ul class="collapsible" data-collapsible="accordion">
|
673 |
+
<li>
|
674 |
+
<div class="collapsible-header">Style 8</div>
|
675 |
+
<div class="collapsible-body">
|
676 |
+
|
677 |
+
|
678 |
+
<!-- text color -->
|
679 |
+
<div class="row">
|
680 |
+
<div class="col s6">
|
681 |
+
<p>Text Color</p>
|
682 |
+
</div>
|
683 |
+
<div class="input-field col s6">
|
684 |
+
<input id="s8_txt_color" class="ht-ctc-color" data-default-color="#ffffff" name="ht_ctc_s8[s8_txt_color]" value="<?php echo esc_attr( $options['s8_txt_color'] ) ?>" type="text" style="height: 1.375rem;" >
|
685 |
+
<!-- <label for="s3_img_url">Text Color</label> -->
|
686 |
+
<!-- <p class="description">Default Color: #ffffff</p> -->
|
687 |
+
</div>
|
688 |
+
</div>
|
689 |
+
|
690 |
+
<!-- text color on hover -->
|
691 |
+
<div class="row">
|
692 |
+
<div class="col s6">
|
693 |
+
<p>Text Color on Hover</p>
|
694 |
+
</div>
|
695 |
+
<div class="input-field col s6">
|
696 |
+
<input id="s8_txt_color_on_hover" class="ht-ctc-color" data-default-color="#ffffff" name="ht_ctc_s8[s8_txt_color_on_hover]" value="<?php echo esc_attr( $options['s8_txt_color_on_hover'] ) ?>" type="text" style="height: 1.375rem;" >
|
697 |
+
<!-- <label for="s3_img_url">Text Color on Hover</label> -->
|
698 |
+
<!-- <p class="description">Default Color: #ffffff</p> -->
|
699 |
+
</div>
|
700 |
+
</div>
|
701 |
+
|
702 |
+
<!-- background color -->
|
703 |
+
<div class="row">
|
704 |
+
<div class="col s6">
|
705 |
+
<p>Background Color</p>
|
706 |
+
</div>
|
707 |
+
<div class="input-field col s6">
|
708 |
+
<input id="s8_bg_color" class="ht-ctc-color" data-default-color="#26a69a" name="ht_ctc_s8[s8_bg_color]" value="<?php echo esc_attr( $options['s8_bg_color'] ) ?>" type="text" style="height: 1.375rem;" >
|
709 |
+
<!-- <label for="s3_img_url">Background Color</label> -->
|
710 |
+
<!-- <p class="description">Default Color: #26a69a</p> -->
|
711 |
+
</div>
|
712 |
+
</div>
|
713 |
+
|
714 |
+
<!-- background color on hover -->
|
715 |
+
<div class="row">
|
716 |
+
<div class="col s6">
|
717 |
+
<p>Background Color on Hover</p>
|
718 |
+
</div>
|
719 |
+
<div class="input-field col s6">
|
720 |
+
<input id="s8_bg_color_on_hover" class="ht-ctc-color" data-default-color="#26a69a" name="ht_ctc_s8[s8_bg_color_on_hover]" value="<?php echo esc_attr( $options['s8_bg_color_on_hover'] ) ?>" type="text" style="height: 1.375rem;" >
|
721 |
+
<!-- <label for="s3_img_url">Background Color on Hover</label> -->
|
722 |
+
<!-- <p class="description">Default Color: #26a69a</p> -->
|
723 |
+
</div>
|
724 |
+
</div>
|
725 |
+
|
726 |
+
<!-- icon color -->
|
727 |
+
<div class="row">
|
728 |
+
<div class="col s6">
|
729 |
+
<p>Icon Color</p>
|
730 |
+
</div>
|
731 |
+
<div class="input-field col s6">
|
732 |
+
<input id="s8_icon_color" class="ht-ctc-color" data-default-color="#ffffff" name="ht_ctc_s8[s8_icon_color]" value="<?php echo esc_attr( $options['s8_icon_color'] ) ?>" type="text" style="height: 1.375rem;" >
|
733 |
+
<!-- <label for="s3_img_url">Icon Color</label> -->
|
734 |
+
<!-- <p class="description">Default Color: #ffffff</p> -->
|
735 |
+
</div>
|
736 |
+
</div>
|
737 |
+
|
738 |
+
<!-- icon color on hover -->
|
739 |
+
<div class="row">
|
740 |
+
<div class="col s6">
|
741 |
+
<p>Icon Color on Hover</p>
|
742 |
+
</div>
|
743 |
+
<div class="input-field col s6">
|
744 |
+
<input id="s8_icon_color_on_hover" class="ht-ctc-color" data-default-color="#ffffff" name="ht_ctc_s8[s8_icon_color_on_hover]" value="<?php echo esc_attr( $options['s8_icon_color_on_hover'] ) ?>" type="text" style="height: 1.375rem;" >
|
745 |
+
<!-- <label for="s3_img_url">Icon Color on Hover</label> -->
|
746 |
+
<!-- <p class="description">Default Color: #ffffff</p> -->
|
747 |
+
</div>
|
748 |
+
</div>
|
749 |
+
|
750 |
+
|
751 |
+
|
752 |
+
<!-- icon position - left/right -->
|
753 |
+
<?php
|
754 |
+
$icon_position_value = esc_attr( $options['s8_icon_position'] );
|
755 |
+
?>
|
756 |
+
|
757 |
+
<div class="row">
|
758 |
+
<div class="col s6">
|
759 |
+
<p>Icon Position</p>
|
760 |
+
</div>
|
761 |
+
<div class="input-field col s6">
|
762 |
+
<select name="ht_ctc_s8[s8_icon_position]" class="select-2">
|
763 |
+
<option value="left" <?php echo $icon_position_value == 'left' ? 'SELECTED' : ''; ?> >Left</option>
|
764 |
+
<option value="right" <?php echo $icon_position_value == 'right' ? 'SELECTED' : ''; ?> >Right</option>
|
765 |
+
<option value="hide" <?php echo $icon_position_value == 'hide' ? 'SELECTED' : ''; ?> >Hide</option>
|
766 |
+
</select>
|
767 |
+
<!-- <label>Icon Position</label> -->
|
768 |
+
</div>
|
769 |
+
</div>
|
770 |
+
|
771 |
+
|
772 |
+
</div>
|
773 |
+
</div>
|
774 |
+
</li>
|
775 |
+
</ul>
|
776 |
+
|
777 |
+
<?php
|
778 |
+
}
|
779 |
+
|
780 |
+
|
781 |
+
// style-99 - ht_ctc_s99 - own image
|
782 |
+
function ht_ctc_s99_cb() {
|
783 |
+
|
784 |
+
$options = get_option('ht_ctc_s99');
|
785 |
+
?>
|
786 |
+
<ul class="collapsible" data-collapsible="accordion">
|
787 |
+
<li>
|
788 |
+
<div class="collapsible-header">Style 99 - Own Image / GIF</div>
|
789 |
+
<div class="collapsible-body">
|
790 |
+
|
791 |
+
|
792 |
+
<!-- call to action on hover - title -->
|
793 |
+
<div class="row">
|
794 |
+
<div class="col s6">
|
795 |
+
<p>Call to action on hover</p>
|
796 |
+
</div>
|
797 |
+
<div class="input-field col s6">
|
798 |
+
<?php
|
799 |
+
if ( isset( $options['cta_on_hover'] ) ) {
|
800 |
+
?>
|
801 |
+
<p>
|
802 |
+
<label>
|
803 |
+
<input name="ht_ctc_s99[cta_on_hover]" type="checkbox" value="1" <?php checked( $options['cta_on_hover'], 1 ); ?> id="cta_on_hover_s99" />
|
804 |
+
<span>Display Call to action on hover</span>
|
805 |
+
</label>
|
806 |
+
</p>
|
807 |
+
<?php
|
808 |
+
} else {
|
809 |
+
?>
|
810 |
+
<p>
|
811 |
+
<label>
|
812 |
+
<input name="ht_ctc_s99[cta_on_hover]" type="checkbox" value="1" id="cta_on_hover_s99" />
|
813 |
+
<span>Display Call to action on hover</span>
|
814 |
+
</label>
|
815 |
+
</p>
|
816 |
+
<?php
|
817 |
+
}
|
818 |
+
?>
|
819 |
+
</div>
|
820 |
+
</div>
|
821 |
+
|
822 |
+
<!-- Image URL - Desktop -->
|
823 |
+
<div class="row">
|
824 |
+
<!-- <div class="col s6">
|
825 |
+
<p>Image URL</p>
|
826 |
+
</div> -->
|
827 |
+
<div class="input-field col s12">
|
828 |
+
<input name="ht_ctc_s99[s99_dekstop_img_url]" value="<?php echo esc_attr( $options['s99_dekstop_img_url'] ) ?>" id="s99_dekstop_img_url" type="text" class="" >
|
829 |
+
<label for="s99_dekstop_img_url">Image URL - Desktop</label>
|
830 |
+
</div>
|
831 |
+
</div>
|
832 |
+
|
833 |
+
<!-- Image URL - Mobile -->
|
834 |
+
<div class="row">
|
835 |
+
<!-- <div class="col s6">
|
836 |
+
<p>Image URL</p>
|
837 |
+
</div> -->
|
838 |
+
<div class="input-field col s12">
|
839 |
+
<input name="ht_ctc_s99[s99_mobile_img_url]" value="<?php echo esc_attr( $options['s99_mobile_img_url'] ) ?>" id="s99_mobile_img_url" type="text" class="" >
|
840 |
+
<label for="s99_mobile_img_url">Image URL - Mobile</label>
|
841 |
+
</div>
|
842 |
+
</div>
|
843 |
+
|
844 |
+
<!-- Desktop - Image Height -->
|
845 |
+
<div class="row">
|
846 |
+
<div class="col s6">
|
847 |
+
<p>Desktop - Image Height</p>
|
848 |
+
</div>
|
849 |
+
<div class="input-field col s6">
|
850 |
+
<input name="ht_ctc_s99[s99_desktop_img_height]" value="<?php echo esc_attr( $options['s99_desktop_img_height'] ) ?>" id="s99_desktop_img_height" type="text" class="" >
|
851 |
+
<label for="s99_desktop_img_height">Desktop - Image Height</label>
|
852 |
+
</div>
|
853 |
+
</div>
|
854 |
+
|
855 |
+
<!-- Desktop - Image Width -->
|
856 |
+
<div class="row">
|
857 |
+
<div class="col s6">
|
858 |
+
<p>Desktop - Image Width</p>
|
859 |
+
</div>
|
860 |
+
<div class="input-field col s6">
|
861 |
+
<input name="ht_ctc_s99[s99_desktop_img_width]" value="<?php echo esc_attr( $options['s99_desktop_img_width'] ) ?>" id="s99_desktop_img_width" type="text" class="" >
|
862 |
+
<label for="s99_desktop_img_width">Desktop - Image Width</label>
|
863 |
+
</div>
|
864 |
+
</div>
|
865 |
+
|
866 |
+
<!-- Mobile - Image Height -->
|
867 |
+
<div class="row">
|
868 |
+
<div class="col s6">
|
869 |
+
<p>Mobile - Image Height</p>
|
870 |
+
</div>
|
871 |
+
<div class="input-field col s6">
|
872 |
+
<input name="ht_ctc_s99[s99_mobile_img_height]" value="<?php echo esc_attr( $options['s99_mobile_img_height'] ) ?>" id="s99_mobile_img_height" type="text" class="" >
|
873 |
+
<label for="s99_mobile_img_height">Mobile - Image Height</label>
|
874 |
+
</div>
|
875 |
+
</div>
|
876 |
+
|
877 |
+
<!-- Mobile - Image Width -->
|
878 |
+
<div class="row">
|
879 |
+
<div class="col s6">
|
880 |
+
<p>Mobile - Image Height</p>
|
881 |
+
</div>
|
882 |
+
<div class="input-field col s6">
|
883 |
+
<input name="ht_ctc_s99[s99_mobile_img_width]" value="<?php echo esc_attr( $options['s99_mobile_img_width'] ) ?>" id="s99_mobile_img_width" type="text" class="" >
|
884 |
+
<label for="s99_mobile_img_width">Mobile - Image Height</label>
|
885 |
+
</div>
|
886 |
+
</div>
|
887 |
+
|
888 |
+
|
889 |
+
</div>
|
890 |
+
</div>
|
891 |
+
</li>
|
892 |
+
</ul>
|
893 |
+
|
894 |
+
<?php
|
895 |
+
}
|
896 |
+
|
897 |
+
|
898 |
+
|
899 |
+
|
900 |
+
|
901 |
+
|
902 |
+
}
|
903 |
+
|
904 |
+
$ht_ctc_admin_customize_styles = new HT_CTC_Admin_Customize_Styles();
|
905 |
+
|
906 |
+
add_action('admin_menu', array($ht_ctc_admin_customize_styles, 'menu') );
|
907 |
+
add_action('admin_init', array($ht_ctc_admin_customize_styles, 'settings') );
|
908 |
+
|
909 |
+
|
910 |
+
endif; // END class_exists check
|
new/admin/class-ht-ctc-admin-group-page.php
ADDED
@@ -0,0 +1,747 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* group settings page - admin
|
4 |
+
*
|
5 |
+
* group chat options ..
|
6 |
+
*
|
7 |
+
* @package ctc
|
8 |
+
* @subpackage admin
|
9 |
+
* @since 2.0
|
10 |
+
*/
|
11 |
+
|
12 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
13 |
+
|
14 |
+
if ( ! class_exists( 'HT_CTC_Admin_Group_Page' ) ) :
|
15 |
+
|
16 |
+
class HT_CTC_Admin_Group_Page {
|
17 |
+
|
18 |
+
public function menu() {
|
19 |
+
|
20 |
+
add_submenu_page(
|
21 |
+
'click-to-chat',
|
22 |
+
'Group Chat/Invite',
|
23 |
+
'Group',
|
24 |
+
'manage_options',
|
25 |
+
'click-to-chat-group-feature',
|
26 |
+
array( $this, 'settings_page' )
|
27 |
+
);
|
28 |
+
}
|
29 |
+
|
30 |
+
public function settings_page() {
|
31 |
+
|
32 |
+
if ( ! current_user_can('manage_options') ) {
|
33 |
+
return;
|
34 |
+
}
|
35 |
+
|
36 |
+
?>
|
37 |
+
|
38 |
+
<div class="wrap">
|
39 |
+
|
40 |
+
<?php settings_errors(); ?>
|
41 |
+
|
42 |
+
<div class="row">
|
43 |
+
<div class="col s12 m12 xl8 options">
|
44 |
+
<form action="options.php" method="post" class="">
|
45 |
+
<?php settings_fields( 'ht_ctc_group_page_settings_fields' ); ?>
|
46 |
+
<?php do_settings_sections( 'ht_ctc_group_page_settings_sections_do' ) ?>
|
47 |
+
<?php submit_button() ?>
|
48 |
+
</form>
|
49 |
+
</div>
|
50 |
+
<!-- <div class="col s12 m12 xl6 ht-cc-admin-sidebar">
|
51 |
+
</div> -->
|
52 |
+
</div>
|
53 |
+
|
54 |
+
</div>
|
55 |
+
|
56 |
+
<?php
|
57 |
+
|
58 |
+
}
|
59 |
+
|
60 |
+
|
61 |
+
public function settings() {
|
62 |
+
|
63 |
+
// main settings - options enable .. group, share ..
|
64 |
+
// chat options
|
65 |
+
register_setting( 'ht_ctc_group_page_settings_fields', 'ht_ctc_group' , array( $this, 'options_sanitize' ) );
|
66 |
+
|
67 |
+
add_settings_section( 'ht_ctc_main_page_settings_sections_add', '', array( $this, 'main_settings_section_cb' ), 'ht_ctc_group_page_settings_sections_do' );
|
68 |
+
|
69 |
+
add_settings_field( 'group_id', 'WhatsApp Group ID', array( $this, 'group_id_cb' ), 'ht_ctc_group_page_settings_sections_do', 'ht_ctc_main_page_settings_sections_add' );
|
70 |
+
add_settings_field( 'group_cta', 'Call to Action', array( $this, 'group_cta_cb' ), 'ht_ctc_group_page_settings_sections_do', 'ht_ctc_main_page_settings_sections_add' );
|
71 |
+
|
72 |
+
add_settings_field( 'group_ctc_desktop_style', 'Style for Desktop', array( $this, 'group_ctc_desktop_style_cb' ), 'ht_ctc_group_page_settings_sections_do', 'ht_ctc_main_page_settings_sections_add' );
|
73 |
+
add_settings_field( 'group_ctc_mobile_style', 'Style for Mobile', array( $this, 'group_ctc_mobile_style_cb' ), 'ht_ctc_group_page_settings_sections_do', 'ht_ctc_main_page_settings_sections_add' );
|
74 |
+
add_settings_field( 'group_ctc_position', 'Position to place', array( $this, 'group_ctc_position_cb' ), 'ht_ctc_group_page_settings_sections_do', 'ht_ctc_main_page_settings_sections_add' );
|
75 |
+
add_settings_field( 'group_show_hide', 'Show/Hide', array( $this, 'group_show_hide_cb' ), 'ht_ctc_group_page_settings_sections_do', 'ht_ctc_main_page_settings_sections_add' );
|
76 |
+
add_settings_field( 'group_shortcode_cb', '', array( $this, 'group_shortcode_cb' ), 'ht_ctc_group_page_settings_sections_do', 'ht_ctc_main_page_settings_sections_add' );
|
77 |
+
|
78 |
+
|
79 |
+
}
|
80 |
+
|
81 |
+
public function main_settings_section_cb() {
|
82 |
+
?>
|
83 |
+
<h1>Group Chat/Invite</h1>
|
84 |
+
<?php
|
85 |
+
}
|
86 |
+
|
87 |
+
|
88 |
+
// WhatsApp Group ID.
|
89 |
+
function group_id_cb() {
|
90 |
+
$options = get_option('ht_ctc_group');
|
91 |
+
?>
|
92 |
+
<div class="row">
|
93 |
+
<div class="input-field col s12">
|
94 |
+
<input name="ht_ctc_group[group_id]" value="<?php echo esc_attr( $options['group_id'] ) ?>" id="whatsapp_group_id" type="text" class="input-margin">
|
95 |
+
<label for="whatsapp_group_id">WhatsApp Group ID.</label>
|
96 |
+
<p class="description">Enter WhatsApp Group ID. E.g. 9EHLsEsOeJk6AVtE8AvXiA - <a target="_blank" href="https://www.holithemes.com/plugins/click-to-chat/find-whatsapp-group-id/">more info</a> </p>
|
97 |
+
</div>
|
98 |
+
</div>
|
99 |
+
<?php
|
100 |
+
}
|
101 |
+
|
102 |
+
// call to action
|
103 |
+
function group_cta_cb() {
|
104 |
+
$options = get_option('ht_ctc_group');
|
105 |
+
?>
|
106 |
+
<div class="row">
|
107 |
+
<div class="input-field col s12">
|
108 |
+
<input name="ht_ctc_group[call_to_action]" value="<?php echo esc_attr( $options['call_to_action'] ) ?>" id="call_to_action" type="text" class="input-margin">
|
109 |
+
<label for="call_to_action">Call to Action</label>
|
110 |
+
<p class="description"> Text that appears along with WhatsApp icon/button - <a target="_blank" href="https://www.holithemes.com/plugins/click-to-chat/call-to-action/">more info</a> </p>
|
111 |
+
</div>
|
112 |
+
</div>
|
113 |
+
<?php
|
114 |
+
}
|
115 |
+
|
116 |
+
|
117 |
+
|
118 |
+
// Desktop - select style
|
119 |
+
function group_ctc_desktop_style_cb() {
|
120 |
+
$options = get_option('ht_ctc_group');
|
121 |
+
$style_value = esc_attr( $options['style_desktop'] );
|
122 |
+
?>
|
123 |
+
<div class="row">
|
124 |
+
<div class="input-field col s12" style="margin-bottom: 0px;">
|
125 |
+
<select name="ht_ctc_group[style_desktop]" class="select-2">
|
126 |
+
<option value="1" <?php echo $style_value == 1 ? 'SELECTED' : ''; ?> >Style-1</option>
|
127 |
+
<option value="2" <?php echo $style_value == 2 ? 'SELECTED' : ''; ?> >Style-2</option>
|
128 |
+
<option value="3" <?php echo $style_value == 3 ? 'SELECTED' : ''; ?> >Style-3</option>
|
129 |
+
<option value="4" <?php echo $style_value == 4 ? 'SELECTED' : ''; ?> >Style-4</option>
|
130 |
+
<option value="5" <?php echo $style_value == 5 ? 'SELECTED' : ''; ?> >Style-5</option>
|
131 |
+
<option value="6" <?php echo $style_value == 6 ? 'SELECTED' : ''; ?> >Style-6</option>
|
132 |
+
<option value="7" <?php echo $style_value == 7 ? 'SELECTED' : ''; ?> >Style-7</option>
|
133 |
+
<option value="8" <?php echo $style_value == 8 ? 'SELECTED' : ''; ?> >Style-8</option>
|
134 |
+
<option value="99" <?php echo $style_value == 99 ? 'SELECTED' : ''; ?> >Style-99 (Add your own image / GIF)</option>
|
135 |
+
</select>
|
136 |
+
<label>Select Style for Desktop</label>
|
137 |
+
</div>
|
138 |
+
</div>
|
139 |
+
|
140 |
+
<p class="description"> - <a target="_blank" href="https://www.holithemes.com/plugins/click-to-chat/list-of-styles/">List of syles</a> </p>
|
141 |
+
<p class="description">Can customize each style - <a target="_blank" href="<?php echo admin_url( 'admin.php?page=click-to-chat-customize-styles' ); ?>"><?php _e( 'Customize Styles' , 'click-to-chat-for-whatsapp' ) ?></a> </p>
|
142 |
+
|
143 |
+
<?php
|
144 |
+
}
|
145 |
+
|
146 |
+
|
147 |
+
// Mobile - select style
|
148 |
+
function group_ctc_mobile_style_cb() {
|
149 |
+
$options = get_option('ht_ctc_group');
|
150 |
+
$style_value = esc_attr( $options['style_mobile'] );
|
151 |
+
?>
|
152 |
+
<div class="row" style="margin-bottom: 0px;">
|
153 |
+
<div class="input-field col s12">
|
154 |
+
<select name="ht_ctc_group[style_mobile]" class="select-2">
|
155 |
+
<option value="1" <?php echo $style_value == 1 ? 'SELECTED' : ''; ?> >Style-1</option>
|
156 |
+
<option value="2" <?php echo $style_value == 2 ? 'SELECTED' : ''; ?> >Style-2</option>
|
157 |
+
<option value="3" <?php echo $style_value == 3 ? 'SELECTED' : ''; ?> >Style-3</option>
|
158 |
+
<option value="4" <?php echo $style_value == 4 ? 'SELECTED' : ''; ?> >Style-4</option>
|
159 |
+
<option value="5" <?php echo $style_value == 5 ? 'SELECTED' : ''; ?> >Style-5</option>
|
160 |
+
<option value="6" <?php echo $style_value == 6 ? 'SELECTED' : ''; ?> >Style-6</option>
|
161 |
+
<option value="7" <?php echo $style_value == 7 ? 'SELECTED' : ''; ?> >Style-7</option>
|
162 |
+
<option value="8" <?php echo $style_value == 8 ? 'SELECTED' : ''; ?> >Style-8</option>
|
163 |
+
<option value="99" <?php echo $style_value == 99 ? 'SELECTED' : ''; ?> >Style-99 (Add your own image / GIF)</option>
|
164 |
+
</select>
|
165 |
+
<label>Select Style for Mobile</label>
|
166 |
+
</div>
|
167 |
+
</div>
|
168 |
+
|
169 |
+
|
170 |
+
<?php
|
171 |
+
}
|
172 |
+
|
173 |
+
|
174 |
+
// position to place
|
175 |
+
function group_ctc_position_cb() {
|
176 |
+
$options = get_option('ht_ctc_group');
|
177 |
+
|
178 |
+
$side_1 = esc_attr( $options['side_1'] );
|
179 |
+
$side_2 = esc_attr( $options['side_2'] );
|
180 |
+
?>
|
181 |
+
<!-- side - 1 -->
|
182 |
+
<div class="row">
|
183 |
+
<div class="input-field col s6">
|
184 |
+
<select name="ht_ctc_group[side_1]" class="select-2">
|
185 |
+
<option value="bottom" <?php echo $side_1 == 'bottom' ? 'SELECTED' : ''; ?> >bottom</option>
|
186 |
+
<option value="top" <?php echo $side_1 == 'top' ? 'SELECTED' : ''; ?> >top</option>
|
187 |
+
</select>
|
188 |
+
<label>top / bottom </label>
|
189 |
+
</div>
|
190 |
+
|
191 |
+
<div class="input-field col s6">
|
192 |
+
<input name="ht_ctc_group[side_1_value]" value="<?php echo esc_attr( $options['side_1_value'] ) ?>" id="side_1_value" type="text" class="input-margin">
|
193 |
+
<label for="side_1_value">e.g. 10px</label>
|
194 |
+
</div>
|
195 |
+
</div>
|
196 |
+
|
197 |
+
<!-- side - 2 -->
|
198 |
+
<div class="row">
|
199 |
+
<div class="input-field col s6">
|
200 |
+
<select name="ht_ctc_group[side_2]" class="select-2">
|
201 |
+
<option value="right" <?php echo $side_2 == 'right' ? 'SELECTED' : ''; ?> >right</option>
|
202 |
+
<option value="left" <?php echo $side_2 == 'left' ? 'SELECTED' : ''; ?> >left</option>
|
203 |
+
</select>
|
204 |
+
<label>right / left </label>
|
205 |
+
</div>
|
206 |
+
|
207 |
+
<div class="input-field col s6">
|
208 |
+
<input name="ht_ctc_group[side_2_value]" value="<?php echo esc_attr( $options['side_2_value'] ) ?>" id="side_2_value" type="text" class="input-margin">
|
209 |
+
<label for="side_2_value">e.g. 10px</label>
|
210 |
+
</div>
|
211 |
+
</div>
|
212 |
+
|
213 |
+
<p class="description">Add css units as suffix - e.g. 10px, 50% - <a target="_blank" href="https://www.holithemes.com/plugins/click-to-chat/position-to-place/">more info</a> </p>
|
214 |
+
<?php
|
215 |
+
}
|
216 |
+
|
217 |
+
|
218 |
+
|
219 |
+
|
220 |
+
// show/hide
|
221 |
+
function group_show_hide_cb() {
|
222 |
+
|
223 |
+
|
224 |
+
$options = get_option('ht_ctc_group');
|
225 |
+
|
226 |
+
$show_or_hide = esc_attr( $options['show_or_hide'] );
|
227 |
+
?>
|
228 |
+
|
229 |
+
<ul class="collapsible">
|
230 |
+
<li>
|
231 |
+
<div class="collapsible-header">Show/Hide</div>
|
232 |
+
<div class="collapsible-body">
|
233 |
+
|
234 |
+
<?php
|
235 |
+
|
236 |
+
|
237 |
+
// Hide on Mobile Devices
|
238 |
+
if ( isset( $options['hideon_mobile'] ) ) {
|
239 |
+
?>
|
240 |
+
<p>
|
241 |
+
<label>
|
242 |
+
<input name="ht_ctc_group[hideon_mobile]" type="checkbox" value="1" <?php checked( $options['hideon_mobile'], 1 ); ?> id="hideon_mobile" />
|
243 |
+
<span>Hide on - Mobile Devices</span>
|
244 |
+
</label>
|
245 |
+
</p>
|
246 |
+
<?php
|
247 |
+
} else {
|
248 |
+
?>
|
249 |
+
<p>
|
250 |
+
<label>
|
251 |
+
<input name="ht_ctc_group[hideon_mobile]" type="checkbox" value="1" id="hideon_mobile" />
|
252 |
+
<span>Hide on - Mobile Devices</span>
|
253 |
+
</label>
|
254 |
+
</p>
|
255 |
+
<?php
|
256 |
+
}
|
257 |
+
|
258 |
+
// Hide on Desktop Devices
|
259 |
+
if ( isset( $options['hideon_desktop'] ) ) {
|
260 |
+
?>
|
261 |
+
<p>
|
262 |
+
<label>
|
263 |
+
<input name="ht_ctc_group[hideon_desktop]" type="checkbox" value="1" <?php checked( $options['hideon_desktop'], 1 ); ?> id="hideon_desktop" />
|
264 |
+
<span>Hide on - Desktop Devices</span>
|
265 |
+
</label>
|
266 |
+
</p>
|
267 |
+
<?php
|
268 |
+
} else {
|
269 |
+
?>
|
270 |
+
<p>
|
271 |
+
<label>
|
272 |
+
<input name="ht_ctc_group[hideon_desktop]" type="checkbox" value="1" id="hideon_desktop" />
|
273 |
+
<span>Hide on - Desktop Devices</span>
|
274 |
+
</label>
|
275 |
+
</p>
|
276 |
+
<?php
|
277 |
+
}
|
278 |
+
?>
|
279 |
+
<!-- <p class="description">plugin detects device based on HTTP User agent </p> -->
|
280 |
+
<p class="description">If working in reverse it might be the cache plugin not detecting the devices - <a target="_blank" href="https://www.holithemes.com/plugins/click-to-chat/hide-based-on-device/">more info</a> </p>
|
281 |
+
|
282 |
+
|
283 |
+
<div class="row" style="margin-bottom: 0px;">
|
284 |
+
<div class="input-field col s12">
|
285 |
+
<select name="ht_ctc_group[show_or_hide]" class="select_show_or_hide">
|
286 |
+
<option value="hide" <?php echo $show_or_hide == "hide" ? 'SELECTED' : ''; ?> >Hide on selected pages</option>
|
287 |
+
<option value="show" <?php echo $show_or_hide == "show" ? 'SELECTED' : ''; ?> >Show on selected pages</option>
|
288 |
+
</select>
|
289 |
+
<!-- <label><?php _e( 'enable' , 'click-to-chat-for-whatsapp' ) ?></label> -->
|
290 |
+
</div>
|
291 |
+
</div>
|
292 |
+
<?php
|
293 |
+
|
294 |
+
// ######### Hide #########
|
295 |
+
|
296 |
+
?>
|
297 |
+
<p class="description ctc_show_hide_display show-hide_display-none hidebased" style="margin-bottom: 15px">
|
298 |
+
<?php echo 'Select pages to Hide styles <span style="color: green;"> ( Default Shows on all page ) ' ?>
|
299 |
+
</p>
|
300 |
+
<!-- <br><br> -->
|
301 |
+
<?php
|
302 |
+
|
303 |
+
// checkboxes - Hide based on Type of posts
|
304 |
+
|
305 |
+
// Single Posts
|
306 |
+
if ( isset( $options['hideon_posts'] ) ) {
|
307 |
+
?>
|
308 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
309 |
+
<label>
|
310 |
+
<input name="ht_ctc_group[hideon_posts]" type="checkbox" value="1" <?php checked( $options['hideon_posts'], 1 ); ?> id="filled-in-box1" />
|
311 |
+
<span>Hide on - Posts</span>
|
312 |
+
</label>
|
313 |
+
</p>
|
314 |
+
<?php
|
315 |
+
} else {
|
316 |
+
?>
|
317 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
318 |
+
<label>
|
319 |
+
<input name="ht_ctc_group[hideon_posts]" type="checkbox" value="1" id="filled-in-box1" />
|
320 |
+
<span>Hide on - Posts</span>
|
321 |
+
</label>
|
322 |
+
</p>
|
323 |
+
<?php
|
324 |
+
}
|
325 |
+
|
326 |
+
|
327 |
+
// Page
|
328 |
+
if ( isset( $options['hideon_page'] ) ) {
|
329 |
+
?>
|
330 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
331 |
+
<label>
|
332 |
+
<input name="ht_ctc_group[hideon_page]" type="checkbox" value="1" <?php checked( $options['hideon_page'], 1 ); ?> id="filled-in-box2" />
|
333 |
+
<span>Hide on - Pages</span>
|
334 |
+
</label>
|
335 |
+
</p>
|
336 |
+
<?php
|
337 |
+
} else {
|
338 |
+
?>
|
339 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
340 |
+
<label>
|
341 |
+
<input name="ht_ctc_group[hideon_page]" type="checkbox" value="1" id="filled-in-box2" />
|
342 |
+
<span>Hide on - Pages</span>
|
343 |
+
</label>
|
344 |
+
</p>
|
345 |
+
<?php
|
346 |
+
}
|
347 |
+
|
348 |
+
|
349 |
+
|
350 |
+
|
351 |
+
// Home Page
|
352 |
+
// is_home and is_front_page - combined. calling as home/front page
|
353 |
+
if ( isset( $options['hideon_homepage'] ) ) {
|
354 |
+
?>
|
355 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
356 |
+
<label>
|
357 |
+
<input name="ht_ctc_group[hideon_homepage]" type="checkbox" value="1" <?php checked( $options['hideon_homepage'], 1 ); ?> id="filled-in-box3" />
|
358 |
+
<span>Hide on - Home/Front Page</span>
|
359 |
+
</label>
|
360 |
+
</p>
|
361 |
+
<?php
|
362 |
+
} else {
|
363 |
+
?>
|
364 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
365 |
+
<label>
|
366 |
+
<input name="ht_ctc_group[hideon_homepage]" type="checkbox" value="1" id="filled-in-box3" />
|
367 |
+
<span>Hide on - Home/Front Page</span>
|
368 |
+
</label>
|
369 |
+
</p>
|
370 |
+
<?php
|
371 |
+
}
|
372 |
+
|
373 |
+
|
374 |
+
// Category
|
375 |
+
if ( isset( $options['hideon_category'] ) ) {
|
376 |
+
?>
|
377 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
378 |
+
<label>
|
379 |
+
<input name="ht_ctc_group[hideon_category]" type="checkbox" value="1" <?php checked( $options['hideon_category'], 1 ); ?> id="filled-in-box5" />
|
380 |
+
<span>Hide on - Category</span>
|
381 |
+
</label>
|
382 |
+
</p>
|
383 |
+
<?php
|
384 |
+
} else {
|
385 |
+
?>
|
386 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
387 |
+
<label>
|
388 |
+
<input name="ht_ctc_group[hideon_category]" type="checkbox" value="1" id="filled-in-box5" />
|
389 |
+
<span>Hide on - Category</span>
|
390 |
+
</label>
|
391 |
+
</p>
|
392 |
+
<?php
|
393 |
+
}
|
394 |
+
|
395 |
+
|
396 |
+
|
397 |
+
// Archive
|
398 |
+
if ( isset( $options['hideon_archive'] ) ) {
|
399 |
+
?>
|
400 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
401 |
+
<label>
|
402 |
+
<input name="ht_ctc_group[hideon_archive]" type="checkbox" value="1" <?php checked( $options['hideon_archive'], 1 ); ?> id="filled-in-box6" />
|
403 |
+
<span>Hide on - Archive</span>
|
404 |
+
</label>
|
405 |
+
</p>
|
406 |
+
<?php
|
407 |
+
} else {
|
408 |
+
?>
|
409 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
410 |
+
<label>
|
411 |
+
<input name="ht_ctc_group[hideon_archive]" type="checkbox" value="1" id="filled-in-box6" />
|
412 |
+
<span>Hide on - Archive</span>
|
413 |
+
</label>
|
414 |
+
</p>
|
415 |
+
<?php
|
416 |
+
}
|
417 |
+
|
418 |
+
|
419 |
+
// 404 Page
|
420 |
+
if ( isset( $options['hideon_404'] ) ) {
|
421 |
+
?>
|
422 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
423 |
+
<label>
|
424 |
+
<input name="ht_ctc_group[hideon_404]" type="checkbox" value="1" <?php checked( $options['hideon_404'], 1 ); ?> id="filled-in-box7" />
|
425 |
+
<span>Hide on - 404 Page</span>
|
426 |
+
</label>
|
427 |
+
</p>
|
428 |
+
<?php
|
429 |
+
} else {
|
430 |
+
?>
|
431 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
432 |
+
<label>
|
433 |
+
<input name="ht_ctc_group[hideon_404]" type="checkbox" value="1" id="filled-in-box7" />
|
434 |
+
<span>Hide on - 404 Page</span>
|
435 |
+
</label>
|
436 |
+
</p>
|
437 |
+
<?php
|
438 |
+
}
|
439 |
+
|
440 |
+
|
441 |
+
// WooCommerce single product pages
|
442 |
+
if ( isset( $options['hideon_wooproduct'] ) ) {
|
443 |
+
?>
|
444 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
445 |
+
<label>
|
446 |
+
<input name="ht_ctc_group[hideon_wooproduct]" type="checkbox" value="1" <?php checked( $options['hideon_wooproduct'], 1 ); ?> id="filled-in-box7" />
|
447 |
+
<span>Hide on - WooCommerce single product pages</span>
|
448 |
+
</label>
|
449 |
+
</p>
|
450 |
+
<?php
|
451 |
+
} else {
|
452 |
+
?>
|
453 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
454 |
+
<label>
|
455 |
+
<input name="ht_ctc_group[hideon_wooproduct]" type="checkbox" value="1" id="filled-in-box7" />
|
456 |
+
<span>Hide on - WooCommerce single product pages</span>
|
457 |
+
</label>
|
458 |
+
</p>
|
459 |
+
<?php
|
460 |
+
}
|
461 |
+
|
462 |
+
|
463 |
+
?>
|
464 |
+
<p class="description ctc_show_hide_display show-hide_display-none hidebased">Check to hide Styles based on the type of pages </p>
|
465 |
+
<?php
|
466 |
+
|
467 |
+
|
468 |
+
|
469 |
+
|
470 |
+
// ID's list to hide styles
|
471 |
+
|
472 |
+
?>
|
473 |
+
<div class="row ctc_show_hide_display show-hide_display-none hidebased">
|
474 |
+
<div class="input-field col s12">
|
475 |
+
<input name="ht_ctc_group[list_hideon_pages]" value="<?php echo esc_attr( $options['list_hideon_pages'] ) ?>" id="ccw_list_id_tohide" type="text" class="input-margin">
|
476 |
+
<label for="ccw_list_id_tohide">Id's list to Hide - add ',' after each id </label>
|
477 |
+
<p class="description">Add Post, Pages, Media - ID's to hide, can add multiple id's by separating with a comma ( , )</p>
|
478 |
+
</div>
|
479 |
+
</div>
|
480 |
+
<?php
|
481 |
+
|
482 |
+
|
483 |
+
// Categorys list - to hide
|
484 |
+
|
485 |
+
?>
|
486 |
+
<div class="row ctc_show_hide_display show-hide_display-none hidebased">
|
487 |
+
<div class="input-field col s12">
|
488 |
+
<input name="ht_ctc_group[list_hideon_cat]" value="<?php echo esc_attr( $options['list_hideon_cat'] ) ?>" id="ccw_list_cat_tohide" type="text" class="input-margin">
|
489 |
+
<label for="ccw_list_cat_tohide"><?php _e( 'Category name\'s to Hide - add \',\' after each category name' , 'click-to-chat-for-whatsapp' ) ?> </label>
|
490 |
+
<p class="description">Category name\'s to hide, can add multiple Categories by separating with a comma ( , )</p>
|
491 |
+
</div>
|
492 |
+
</div>
|
493 |
+
<?php
|
494 |
+
|
495 |
+
|
496 |
+
// ######### Show #########
|
497 |
+
|
498 |
+
|
499 |
+
?>
|
500 |
+
<p class="description ctc_show_hide_display show-hide_display-none showbased" style="margin-bottom: 15px">
|
501 |
+
<?php echo 'Select pages to display styles <span style="background-color: #dddddd; color: red;"> ( Default hides on all page ) ' ?>
|
502 |
+
</p>
|
503 |
+
<?php
|
504 |
+
|
505 |
+
// checkboxes - Show based on Type of posts
|
506 |
+
|
507 |
+
// Single Posts
|
508 |
+
if ( isset( $options['showon_posts'] ) ) {
|
509 |
+
?>
|
510 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
511 |
+
<label>
|
512 |
+
<input name="ht_ctc_group[showon_posts]" type="checkbox" value="1" <?php checked( $options['showon_posts'], 1 ); ?> id="show_filled-in-box1" />
|
513 |
+
<span>Show on - Posts</span>
|
514 |
+
</label>
|
515 |
+
</p>
|
516 |
+
<?php
|
517 |
+
} else {
|
518 |
+
?>
|
519 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
520 |
+
<label>
|
521 |
+
<input name="ht_ctc_group[showon_posts]" type="checkbox" value="1" id="show_filled-in-box1" />
|
522 |
+
<span>Show on - Posts</span>
|
523 |
+
</label>
|
524 |
+
</p>
|
525 |
+
<?php
|
526 |
+
}
|
527 |
+
|
528 |
+
|
529 |
+
// Page
|
530 |
+
if ( isset( $options['showon_page'] ) ) {
|
531 |
+
?>
|
532 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
533 |
+
<label>
|
534 |
+
<input name="ht_ctc_group[showon_page]" type="checkbox" value="1" <?php checked( $options['showon_page'], 1 ); ?> id="show_filled-in-box2" />
|
535 |
+
<span>Show on - Pages</span>
|
536 |
+
</label>
|
537 |
+
</p>
|
538 |
+
<?php
|
539 |
+
} else {
|
540 |
+
?>
|
541 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
542 |
+
<label>
|
543 |
+
<input name="ht_ctc_group[showon_page]" type="checkbox" value="1" id="show_filled-in-box2" />
|
544 |
+
<span>Show on - Pages</span>
|
545 |
+
</label>
|
546 |
+
</p>
|
547 |
+
<?php
|
548 |
+
}
|
549 |
+
|
550 |
+
|
551 |
+
// Home Page
|
552 |
+
// is_home and is_front_page - combined. calling as home/front page
|
553 |
+
if ( isset( $options['showon_homepage'] ) ) {
|
554 |
+
?>
|
555 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
556 |
+
<label>
|
557 |
+
<input name="ht_ctc_group[showon_homepage]" type="checkbox" value="1" <?php checked( $options['showon_homepage'], 1 ); ?> id="show_filled-in-box3" />
|
558 |
+
<span>Show on - Home/Front Page</span>
|
559 |
+
</label>
|
560 |
+
</p>
|
561 |
+
<?php
|
562 |
+
} else {
|
563 |
+
?>
|
564 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
565 |
+
<label>
|
566 |
+
<input name="ht_ctc_group[showon_homepage]" type="checkbox" value="1" id="show_filled-in-box3" />
|
567 |
+
<span>Show on - Home/Front Page</span>
|
568 |
+
</label>
|
569 |
+
</p>
|
570 |
+
<?php
|
571 |
+
}
|
572 |
+
|
573 |
+
|
574 |
+
// Category
|
575 |
+
if ( isset( $options['showon_category'] ) ) {
|
576 |
+
?>
|
577 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
578 |
+
<label>
|
579 |
+
<input name="ht_ctc_group[showon_category]" type="checkbox" value="1" <?php checked( $options['showon_category'], 1 ); ?> id="show_filled-in-box5" />
|
580 |
+
<span>Show on - Category</span>
|
581 |
+
</label>
|
582 |
+
</p>
|
583 |
+
<?php
|
584 |
+
} else {
|
585 |
+
?>
|
586 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
587 |
+
<label>
|
588 |
+
<input name="ht_ctc_group[showon_category]" type="checkbox" value="1" id="show_filled-in-box5" />
|
589 |
+
<span>Show on - Category</span>
|
590 |
+
</label>
|
591 |
+
</p>
|
592 |
+
<?php
|
593 |
+
}
|
594 |
+
|
595 |
+
// Archive
|
596 |
+
if ( isset( $options['showon_archive'] ) ) {
|
597 |
+
?>
|
598 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
599 |
+
<label>
|
600 |
+
<input name="ht_ctc_group[showon_archive]" type="checkbox" value="1" <?php checked( $options['showon_archive'], 1 ); ?> id="show_filled-in-box6" />
|
601 |
+
<span>Show on - Archive</span>
|
602 |
+
</label>
|
603 |
+
</p>
|
604 |
+
<?php
|
605 |
+
} else {
|
606 |
+
?>
|
607 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
608 |
+
<label>
|
609 |
+
<input name="ht_ctc_group[showon_archive]" type="checkbox" value="1" id="show_filled-in-box6" />
|
610 |
+
<span>Show on - Archive</span>
|
611 |
+
</label>
|
612 |
+
</p>
|
613 |
+
<?php
|
614 |
+
}
|
615 |
+
|
616 |
+
|
617 |
+
// 404 Page
|
618 |
+
if ( isset( $options['showon_404'] ) ) {
|
619 |
+
?>
|
620 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
621 |
+
<label>
|
622 |
+
<input name="ht_ctc_group[showon_404]" type="checkbox" value="1" <?php checked( $options['showon_404'], 1 ); ?> id="show_filled-in-box7" />
|
623 |
+
<span>Show on - 404 Page</span>
|
624 |
+
</label>
|
625 |
+
</p>
|
626 |
+
<?php
|
627 |
+
} else {
|
628 |
+
?>
|
629 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
630 |
+
<label>
|
631 |
+
<input name="ht_ctc_group[showon_404]" type="checkbox" value="1" id="show_filled-in-box7" />
|
632 |
+
<span>Show on - 404 Page</span>
|
633 |
+
</label>
|
634 |
+
</p>
|
635 |
+
<?php
|
636 |
+
}
|
637 |
+
|
638 |
+
|
639 |
+
// WooCommerce single product pages
|
640 |
+
if ( isset( $options['showon_wooproduct'] ) ) {
|
641 |
+
?>
|
642 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
643 |
+
<label>
|
644 |
+
<input name="ht_ctc_group[showon_wooproduct]" type="checkbox" value="1" <?php checked( $options['showon_wooproduct'], 1 ); ?> id="show_filled-in-box7" />
|
645 |
+
<span>Show on - WooCommerce Single product pages</span>
|
646 |
+
</label>
|
647 |
+
</p>
|
648 |
+
<?php
|
649 |
+
} else {
|
650 |
+
?>
|
651 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
652 |
+
<label>
|
653 |
+
<input name="ht_ctc_group[showon_wooproduct]" type="checkbox" value="1" id="show_filled-in-box7" />
|
654 |
+
<span>Show on - WooCommerce Single product pages</span>
|
655 |
+
</label>
|
656 |
+
</p>
|
657 |
+
<?php
|
658 |
+
}
|
659 |
+
|
660 |
+
|
661 |
+
?>
|
662 |
+
<p class="description ctc_show_hide_display show-hide_display-none showbased">Check to display Styles based on type of the page</p>
|
663 |
+
<?php
|
664 |
+
|
665 |
+
|
666 |
+
// ID's list to show styles
|
667 |
+
|
668 |
+
?>
|
669 |
+
<div class="row ctc_show_hide_display show-hide_display-none showbased">
|
670 |
+
<div class="input-field col s12">
|
671 |
+
<input name="ht_ctc_group[list_showon_pages]" value="<?php echo esc_attr( $options['list_showon_pages'] ) ?>" id="ccw_list_id_toshow" type="text" class="input-margin">
|
672 |
+
<label for="ccw_list_id_toshow">Id's list to show - add ',' after each id </label>
|
673 |
+
<p class="description">Add Post, Page, Media - ID's to hide, can add multiple id's by separating with a comma ( , )</p>
|
674 |
+
</div>
|
675 |
+
</div>
|
676 |
+
<?php
|
677 |
+
|
678 |
+
|
679 |
+
// Categorys list - to show
|
680 |
+
|
681 |
+
// $ccw_list_cat_toshow = get_option('ht_ctc_group');
|
682 |
+
|
683 |
+
?>
|
684 |
+
<div class="row ctc_show_hide_display show-hide_display-none showbased">
|
685 |
+
<div class="input-field col s12">
|
686 |
+
<input name="ht_ctc_group[list_showon_cat]" value="<?php echo esc_attr( $options['list_showon_cat'] ) ?>" id="ccw_list_cat_toshow" type="text" class="input-margin">
|
687 |
+
<label for="ccw_list_cat_toshow"><?php _e( 'Category name\'s to Show - add \',\' after each category name' , 'click-to-chat-for-whatsapp' ) ?> </label>
|
688 |
+
<p class="description">Add Categories name to hide, can add multiple Categories by separating with a comma ( , )</p>
|
689 |
+
</div>
|
690 |
+
</div>
|
691 |
+
|
692 |
+
<p class="description"> - <a target="_blank" href="https://www.holithemes.com/plugins/click-to-chat/show-hide-styles/">more info</a> </p>
|
693 |
+
|
694 |
+
|
695 |
+
</div>
|
696 |
+
</li>
|
697 |
+
<ul>
|
698 |
+
|
699 |
+
|
700 |
+
<?php
|
701 |
+
|
702 |
+
}
|
703 |
+
|
704 |
+
|
705 |
+
|
706 |
+
|
707 |
+
function group_shortcode_cb() {
|
708 |
+
?>
|
709 |
+
<p class="description">Shorcodes for Group Chat: [ht-ctc-group] - <a target="_blank" href="https://www.holithemes.com/plugins/click-to-chat/shortcodes-group">more info</a></p>
|
710 |
+
<?php
|
711 |
+
}
|
712 |
+
|
713 |
+
|
714 |
+
|
715 |
+
/**
|
716 |
+
* Sanitize each setting field as needed
|
717 |
+
*
|
718 |
+
* @since 2.0
|
719 |
+
* @param array $input Contains all settings fields as array keys
|
720 |
+
*/
|
721 |
+
public function options_sanitize( $input ) {
|
722 |
+
|
723 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
724 |
+
wp_die( 'not allowed to modify - please contact admin ' );
|
725 |
+
}
|
726 |
+
|
727 |
+
$new_input = array();
|
728 |
+
|
729 |
+
foreach ($input as $key => $value) {
|
730 |
+
if( isset( $input[$key] ) ) {
|
731 |
+
$new_input[$key] = sanitize_text_field( $input[$key] );
|
732 |
+
}
|
733 |
+
}
|
734 |
+
|
735 |
+
|
736 |
+
return $new_input;
|
737 |
+
}
|
738 |
+
|
739 |
+
|
740 |
+
}
|
741 |
+
|
742 |
+
$ht_ctc_admin_group_page = new HT_CTC_Admin_Group_Page();
|
743 |
+
|
744 |
+
add_action('admin_menu', array($ht_ctc_admin_group_page, 'menu') );
|
745 |
+
add_action('admin_init', array($ht_ctc_admin_group_page, 'settings') );
|
746 |
+
|
747 |
+
endif; // END class_exists check
|
new/admin/class-ht-ctc-admin-main-page.php
ADDED
@@ -0,0 +1,375 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Main settings page - admin
|
4 |
+
*
|
5 |
+
* this main settings page contains ..
|
6 |
+
*
|
7 |
+
* enable options .. like chat default enabled, group, share, woocommerce
|
8 |
+
*
|
9 |
+
* switch option
|
10 |
+
*
|
11 |
+
* @package ctc
|
12 |
+
* @subpackage admin
|
13 |
+
* @since 2.0
|
14 |
+
*/
|
15 |
+
|
16 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
17 |
+
|
18 |
+
if ( ! class_exists( 'HT_CTC_Admin_Main_Page' ) ) :
|
19 |
+
|
20 |
+
class HT_CTC_Admin_Main_Page {
|
21 |
+
|
22 |
+
public function menu() {
|
23 |
+
|
24 |
+
add_menu_page(
|
25 |
+
'Click to Chat - New Interface - Plugin Option Page',
|
26 |
+
'Click to Chat',
|
27 |
+
'manage_options',
|
28 |
+
'click-to-chat',
|
29 |
+
array( $this, 'settings_page' ),
|
30 |
+
'dashicons-format-chat'
|
31 |
+
);
|
32 |
+
}
|
33 |
+
|
34 |
+
public function settings_page() {
|
35 |
+
|
36 |
+
if ( ! current_user_can('manage_options') ) {
|
37 |
+
return;
|
38 |
+
}
|
39 |
+
|
40 |
+
?>
|
41 |
+
|
42 |
+
<div class="wrap">
|
43 |
+
|
44 |
+
<?php settings_errors(); ?>
|
45 |
+
|
46 |
+
<div class="row">
|
47 |
+
|
48 |
+
<div class="col s12 m12 xl7 options">
|
49 |
+
<form action="options.php" method="post" class="">
|
50 |
+
<?php settings_fields( 'ht_ctc_main_page_settings_fields' ); ?>
|
51 |
+
<?php do_settings_sections( 'ht_ctc_main_page_settings_sections_do' ) ?>
|
52 |
+
<?php submit_button() ?>
|
53 |
+
</form>
|
54 |
+
</div>
|
55 |
+
|
56 |
+
<!-- sidebar content -->
|
57 |
+
<div class="col s12 m12 xl4 ht-cc-admin-sidebar">
|
58 |
+
<div style="margin-top: 100px; margin-left: 40px;">
|
59 |
+
|
60 |
+
<div class="row">
|
61 |
+
<div class="col s12">
|
62 |
+
<p>
|
63 |
+
Please let us know if you have any suggestions or feedback!! <br>
|
64 |
+
<a href="http://api.whatsapp.com/send?phone=919494429789&text=Hi HoliThemes, I have a Suggestion/Feedback:" target="_blank">WhatsApp</a> <br>
|
65 |
+
mail: wp@holithemes.com
|
66 |
+
</p>
|
67 |
+
</div>
|
68 |
+
</div>
|
69 |
+
|
70 |
+
<div class="row">
|
71 |
+
<div class="col s12">
|
72 |
+
<div class="collection with-header">
|
73 |
+
<div class="collection-header"><bold>HoliThemes On</bold></div>
|
74 |
+
<a target="_blank" href="https://www.facebook.com/holithemes/" class="collection-item">Facebook</a>
|
75 |
+
<a target="_blank" href="https://twitter.com/holithemes" class="collection-item">Twitter</a>
|
76 |
+
<a target="_blank" href="https://www.instagram.com/holithemes/" class="collection-item">Instagram</a>
|
77 |
+
<a target="_blank" href="https://www.youtube.com/channel/UC2Tf_WB9PWffO2B3tswWCGw" class="collection-item">YouTube</a>
|
78 |
+
<a target="_blank" href="https://www.linkedin.com/company/holithemes" class="collection-item">LinkedIn</a>
|
79 |
+
</div>
|
80 |
+
</div>
|
81 |
+
</div>
|
82 |
+
</div>
|
83 |
+
|
84 |
+
</div>
|
85 |
+
</div>
|
86 |
+
|
87 |
+
</div>
|
88 |
+
|
89 |
+
</div>
|
90 |
+
|
91 |
+
<?php
|
92 |
+
|
93 |
+
}
|
94 |
+
|
95 |
+
|
96 |
+
public function settings() {
|
97 |
+
|
98 |
+
// main settings - options enable .. chat, group, share
|
99 |
+
// switch options
|
100 |
+
register_setting( 'ht_ctc_main_page_settings_fields', 'ht_ctc_main_options' , array( $this, 'options_sanitize' ) );
|
101 |
+
|
102 |
+
|
103 |
+
add_settings_section( 'ht_ctc_main_page_settings_sections_add', '', array( $this, 'main_settings_section_cb' ), 'ht_ctc_main_page_settings_sections_do' );
|
104 |
+
|
105 |
+
add_settings_field( 'ctc_enable_chat', 'Enable Chat', array( $this, 'ctc_enable_chat_cb' ), 'ht_ctc_main_page_settings_sections_do', 'ht_ctc_main_page_settings_sections_add' );
|
106 |
+
add_settings_field( 'ctc_enable_group', 'Enable Group', array( $this, 'ctc_enable_group_cb' ), 'ht_ctc_main_page_settings_sections_do', 'ht_ctc_main_page_settings_sections_add' );
|
107 |
+
add_settings_field( 'ctc_enable_share', 'Enable Share', array( $this, 'ctc_enable_share_cb' ), 'ht_ctc_main_page_settings_sections_do', 'ht_ctc_main_page_settings_sections_add' );
|
108 |
+
|
109 |
+
add_settings_field( 'ctc_enable_other', 'Enable Features', array( $this, 'ctc_enable_other_cb' ), 'ht_ctc_main_page_settings_sections_do', 'ht_ctc_main_page_settings_sections_add' );
|
110 |
+
|
111 |
+
|
112 |
+
$ccw_options = get_option('ccw_options');
|
113 |
+
if ( isset( $ccw_options['number'] ) ) {
|
114 |
+
// display this setting page only if user switched from previous interface.. ( for new users no switch option )
|
115 |
+
register_setting( 'ht_ctc_main_page_settings_fields', 'ht_ctc_switch' , array( $this, 'options_sanitize' ) );
|
116 |
+
add_settings_field( 'ht_ctc_switch', '', array( $this, 'ht_ctc_switch_cb' ), 'ht_ctc_main_page_settings_sections_do', 'ht_ctc_main_page_settings_sections_add' );
|
117 |
+
}
|
118 |
+
|
119 |
+
}
|
120 |
+
|
121 |
+
public function main_settings_section_cb() {
|
122 |
+
?>
|
123 |
+
<h1>Click to Chat ( New Interface )</h1>
|
124 |
+
<?php
|
125 |
+
}
|
126 |
+
|
127 |
+
|
128 |
+
// Enable WhatsApp Chat Features
|
129 |
+
function ctc_enable_chat_cb() {
|
130 |
+
|
131 |
+
$options = get_option('ht_ctc_main_options');
|
132 |
+
|
133 |
+
if ( isset( $options['enable_chat'] ) ) {
|
134 |
+
?>
|
135 |
+
<p>
|
136 |
+
<label>
|
137 |
+
<input name="ht_ctc_main_options[enable_chat]" type="checkbox" value="1" <?php checked( $options['enable_chat'], 1 ); ?> id="enable_chat" />
|
138 |
+
<span>Enable WhatsApp Chat Features</span>
|
139 |
+
</label>
|
140 |
+
<p class="description"> - <a href="<?php echo admin_url( 'admin.php?page=click-to-chat-chat-feature' ); ?>">Chat Settings page</a> </p>
|
141 |
+
</p>
|
142 |
+
<?php
|
143 |
+
} else {
|
144 |
+
?>
|
145 |
+
<p>
|
146 |
+
<label>
|
147 |
+
<input name="ht_ctc_main_options[enable_chat]" type="checkbox" value="1" id="enable_chat" />
|
148 |
+
<span>Enable WhatsApp Chat Features</span>
|
149 |
+
</label>
|
150 |
+
</p>
|
151 |
+
<?php
|
152 |
+
}
|
153 |
+
?>
|
154 |
+
<p class="description"> - <a target="_blank" href="https://www.holithemes.com/plugins/click-to-chat/enable-chat">more info</a> </p>
|
155 |
+
|
156 |
+
<?php
|
157 |
+
|
158 |
+
}
|
159 |
+
|
160 |
+
|
161 |
+
// Enable WhatsApp Group Features
|
162 |
+
function ctc_enable_group_cb() {
|
163 |
+
|
164 |
+
$options = get_option('ht_ctc_main_options');
|
165 |
+
|
166 |
+
if ( isset( $options['enable_group'] ) ) {
|
167 |
+
?>
|
168 |
+
<p>
|
169 |
+
<label>
|
170 |
+
<input name="ht_ctc_main_options[enable_group]" type="checkbox" value="1" <?php checked( $options['enable_group'], 1 ); ?> id="enable_group" />
|
171 |
+
<span>Enable Group Features</span>
|
172 |
+
</label>
|
173 |
+
<p class="description"> - <a href="<?php echo admin_url( 'admin.php?page=click-to-chat-group-feature' ); ?>">Group Settings page</a> </p>
|
174 |
+
</p>
|
175 |
+
<?php
|
176 |
+
} else {
|
177 |
+
?>
|
178 |
+
<p>
|
179 |
+
<label>
|
180 |
+
<input name="ht_ctc_main_options[enable_group]" type="checkbox" value="1" id="enable_group" />
|
181 |
+
<span>Enable Group Features</span>
|
182 |
+
</label>
|
183 |
+
</p>
|
184 |
+
<?php
|
185 |
+
}
|
186 |
+
?>
|
187 |
+
<p class="description"> - <a target="_blank" href="https://www.holithemes.com/plugins/click-to-chat/enable-group">more info</a> </p>
|
188 |
+
|
189 |
+
<?php
|
190 |
+
|
191 |
+
}
|
192 |
+
|
193 |
+
|
194 |
+
// Enable WhatsApp Share Features
|
195 |
+
function ctc_enable_share_cb() {
|
196 |
+
|
197 |
+
$options = get_option('ht_ctc_main_options');
|
198 |
+
|
199 |
+
if ( isset( $options['enable_share'] ) ) {
|
200 |
+
?>
|
201 |
+
<p>
|
202 |
+
<label>
|
203 |
+
<input name="ht_ctc_main_options[enable_share]" type="checkbox" value="1" <?php checked( $options['enable_share'], 1 ); ?> id="enable_share" />
|
204 |
+
<span>Enable Share Features</span>
|
205 |
+
</label>
|
206 |
+
<p class="description"> - <a href="<?php echo admin_url( 'admin.php?page=click-to-chat-share-feature' ); ?>">Share Settings page</a> </p>
|
207 |
+
</p>
|
208 |
+
<?php
|
209 |
+
} else {
|
210 |
+
?>
|
211 |
+
<p>
|
212 |
+
<label>
|
213 |
+
<input name="ht_ctc_main_options[enable_share]" type="checkbox" value="1" id="enable_share" />
|
214 |
+
<span>Enable Share Features</span>
|
215 |
+
</label>
|
216 |
+
</p>
|
217 |
+
<?php
|
218 |
+
}
|
219 |
+
?>
|
220 |
+
<p class="description"> - <a target="_blank" href="https://www.holithemes.com/plugins/click-to-chat/enable-share">more info</a> </p>
|
221 |
+
|
222 |
+
|
223 |
+
<br>
|
224 |
+
<?php
|
225 |
+
|
226 |
+
}
|
227 |
+
|
228 |
+
|
229 |
+
|
230 |
+
|
231 |
+
// Enable Features
|
232 |
+
function ctc_enable_other_cb() {
|
233 |
+
|
234 |
+
$options = get_option('ht_ctc_main_options');
|
235 |
+
|
236 |
+
?>
|
237 |
+
|
238 |
+
<ul class="collapsible">
|
239 |
+
<li>
|
240 |
+
<div class="collapsible-header">Enable Other features</div>
|
241 |
+
<div class="collapsible-body">
|
242 |
+
|
243 |
+
<?php
|
244 |
+
|
245 |
+
|
246 |
+
// Google Analytics
|
247 |
+
if ( isset( $options['google_analytics'] ) ) {
|
248 |
+
?>
|
249 |
+
<p>
|
250 |
+
<label>
|
251 |
+
<input name="ht_ctc_main_options[google_analytics]" type="checkbox" value="1" <?php checked( $options['google_analytics'], 1 ); ?> id="google_analytics" />
|
252 |
+
<span>Google Analytics</span>
|
253 |
+
</label>
|
254 |
+
</p>
|
255 |
+
<?php
|
256 |
+
} else {
|
257 |
+
?>
|
258 |
+
<p>
|
259 |
+
<label>
|
260 |
+
<input name="ht_ctc_main_options[google_analytics]" type="checkbox" value="1" id="google_analytics" />
|
261 |
+
<span>Google Analytics</span>
|
262 |
+
</label>
|
263 |
+
</p>
|
264 |
+
<?php
|
265 |
+
}
|
266 |
+
?>
|
267 |
+
<p class="description">If Google Analytics installed creates an Event there - <a target="_blank" href="https://www.holithemes.com/plugins/click-to-chat/google-analytics/">more info</a> </p>
|
268 |
+
<br>
|
269 |
+
|
270 |
+
<?php
|
271 |
+
|
272 |
+
|
273 |
+
|
274 |
+
// Facebook Analytics
|
275 |
+
if ( isset( $options['fb_analytics'] ) ) {
|
276 |
+
?>
|
277 |
+
<p>
|
278 |
+
<label>
|
279 |
+
<input name="ht_ctc_main_options[fb_analytics]" type="checkbox" value="1" <?php checked( $options['fb_analytics'], 1 ); ?> id="fb_analytics" />
|
280 |
+
<span>Facebook Analytics</span>
|
281 |
+
</label>
|
282 |
+
</p>
|
283 |
+
<?php
|
284 |
+
} else {
|
285 |
+
?>
|
286 |
+
<p>
|
287 |
+
<label>
|
288 |
+
<input name="ht_ctc_main_options[fb_analytics]" type="checkbox" value="1" id="fb_analytics" />
|
289 |
+
<span>Facebook Analytics</span>
|
290 |
+
</label>
|
291 |
+
</p>
|
292 |
+
<?php
|
293 |
+
}
|
294 |
+
?>
|
295 |
+
<p class="description"> If Facebook Analytics installed - creates an Event there - <a target="_blank" href="https://www.holithemes.com/plugins/click-to-chat/facebook-analytics/">more info</a> </p>
|
296 |
+
|
297 |
+
</div>
|
298 |
+
</div>
|
299 |
+
</li>
|
300 |
+
<ul>
|
301 |
+
|
302 |
+
<?php
|
303 |
+
}
|
304 |
+
|
305 |
+
|
306 |
+
|
307 |
+
// switch interface
|
308 |
+
function ht_ctc_switch_cb() {
|
309 |
+
$options = get_option('ht_ctc_switch');
|
310 |
+
$interface_value = esc_attr( $options['interface'] );
|
311 |
+
?>
|
312 |
+
<!-- <br><br><br><br><br><br><br><br> -->
|
313 |
+
<ul class="collapsible">
|
314 |
+
<li>
|
315 |
+
<div class="collapsible-header">Switch Interface</div>
|
316 |
+
<div class="collapsible-body">
|
317 |
+
|
318 |
+
<p class="description">If you are convenient with the previous interface in comparison to the new one, please switch to previous interface</p>
|
319 |
+
<br><br>
|
320 |
+
<div class="row">
|
321 |
+
<div class="input-field col s12" style="margin-bottom: 0px;">
|
322 |
+
<select name="ht_ctc_switch[interface]" class="select-2">
|
323 |
+
<option value="no" <?php echo $interface_value == 'no' ? 'SELECTED' : ''; ?> >Previous Interface</option>
|
324 |
+
<option value="yes" <?php echo $interface_value == 'yes' ? 'SELECTED' : ''; ?> >New Interface</option>
|
325 |
+
</select>
|
326 |
+
<label>Switch Interface</label>
|
327 |
+
</div>
|
328 |
+
<!-- <p class="description">If you are convenient with the previous interface in comparison to the new one, please switch to previous interface</p> -->
|
329 |
+
</div>
|
330 |
+
|
331 |
+
</div>
|
332 |
+
</div>
|
333 |
+
</li>
|
334 |
+
<ul>
|
335 |
+
|
336 |
+
<?php
|
337 |
+
}
|
338 |
+
|
339 |
+
|
340 |
+
|
341 |
+
|
342 |
+
|
343 |
+
/**
|
344 |
+
* Sanitize each setting field as needed
|
345 |
+
*
|
346 |
+
* @since 2.0
|
347 |
+
* @param array $input Contains all settings fields as array keys
|
348 |
+
*/
|
349 |
+
public function options_sanitize( $input ) {
|
350 |
+
|
351 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
352 |
+
wp_die( 'not allowed to modify - please contact admin ' );
|
353 |
+
}
|
354 |
+
|
355 |
+
$new_input = array();
|
356 |
+
|
357 |
+
foreach ($input as $key => $value) {
|
358 |
+
if( isset( $input[$key] ) ) {
|
359 |
+
$new_input[$key] = sanitize_text_field( $input[$key] );
|
360 |
+
}
|
361 |
+
}
|
362 |
+
|
363 |
+
|
364 |
+
return $new_input;
|
365 |
+
}
|
366 |
+
|
367 |
+
|
368 |
+
}
|
369 |
+
|
370 |
+
$ht_ctc_admin_main_page = new HT_CTC_Admin_Main_Page();
|
371 |
+
|
372 |
+
add_action('admin_menu', array($ht_ctc_admin_main_page, 'menu') );
|
373 |
+
add_action('admin_init', array($ht_ctc_admin_main_page, 'settings') );
|
374 |
+
|
375 |
+
endif; // END class_exists check
|
new/admin/class-ht-ctc-admin-scripts.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Register css styles, javascript files at admin side
|
4 |
+
*
|
5 |
+
* @package ctc
|
6 |
+
* @subpackage admin
|
7 |
+
* @since 2.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
11 |
+
|
12 |
+
if ( ! class_exists( 'HT_CTC_Admin_Scripts' ) ) :
|
13 |
+
|
14 |
+
class HT_CTC_Admin_Scripts {
|
15 |
+
|
16 |
+
|
17 |
+
// Register css styles, javascript files only on 'click-to-chat' page
|
18 |
+
function register_scripts_admin($hook) {
|
19 |
+
|
20 |
+
// hook ..
|
21 |
+
if( 'toplevel_page_click-to-chat' == $hook || 'click-to-chat_page_click-to-chat-chat-feature' == $hook || 'click-to-chat_page_click-to-chat-group-feature' == $hook || 'click-to-chat_page_click-to-chat-share-feature' == $hook || 'click-to-chat_page_click-to-chat-customize-styles' == $hook ) {
|
22 |
+
|
23 |
+
wp_enqueue_style( 'wp-color-picker' );
|
24 |
+
wp_enqueue_style('ctc_admin_md_css', plugins_url( 'prev/assets/css/materialize.min.css', HT_CTC_PLUGIN_FILE ) , '', HT_CTC_VERSION );
|
25 |
+
wp_enqueue_style('ctc_admin_css', plugins_url( 'new/admin/admin_assets/css/admin.css', HT_CTC_PLUGIN_FILE ) , '', HT_CTC_VERSION );
|
26 |
+
|
27 |
+
|
28 |
+
wp_enqueue_script( 'ctc_admin_md_js', plugins_url( 'prev/assets/js/materialize.min.js', HT_CTC_PLUGIN_FILE ), array( 'jquery' ), HT_CTC_VERSION, true );
|
29 |
+
wp_enqueue_script( 'ctc_admin_js', plugins_url( 'new/admin/admin_assets/js/admin.js', HT_CTC_PLUGIN_FILE ), array( 'jquery', 'wp-color-picker', 'ctc_admin_md_js' ), HT_CTC_VERSION, true );
|
30 |
+
|
31 |
+
} else {
|
32 |
+
return;
|
33 |
+
}
|
34 |
+
|
35 |
+
|
36 |
+
}
|
37 |
+
|
38 |
+
}
|
39 |
+
|
40 |
+
$ht_ctc_admin_scripts = new HT_CTC_Admin_Scripts();
|
41 |
+
|
42 |
+
add_action('admin_enqueue_scripts', array( $ht_ctc_admin_scripts, 'register_scripts_admin' ) );
|
43 |
+
|
44 |
+
|
45 |
+
endif; // END class_exists check
|
new/admin/class-ht-ctc-admin-share-page.php
ADDED
@@ -0,0 +1,748 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* share settings page - admin
|
4 |
+
*
|
5 |
+
* share options ..
|
6 |
+
*
|
7 |
+
* @package ctc
|
8 |
+
* @subpackage admin
|
9 |
+
* @since 2.0
|
10 |
+
*/
|
11 |
+
|
12 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
13 |
+
|
14 |
+
if ( ! class_exists( 'HT_CTC_Admin_Share_Page' ) ) :
|
15 |
+
|
16 |
+
class HT_CTC_Admin_Share_Page {
|
17 |
+
|
18 |
+
public function menu() {
|
19 |
+
|
20 |
+
add_submenu_page(
|
21 |
+
'click-to-chat',
|
22 |
+
'Share Invite',
|
23 |
+
'Share',
|
24 |
+
'manage_options',
|
25 |
+
'click-to-chat-share-feature',
|
26 |
+
array( $this, 'settings_page' )
|
27 |
+
);
|
28 |
+
}
|
29 |
+
|
30 |
+
public function settings_page() {
|
31 |
+
|
32 |
+
if ( ! current_user_can('manage_options') ) {
|
33 |
+
return;
|
34 |
+
}
|
35 |
+
|
36 |
+
?>
|
37 |
+
|
38 |
+
<div class="wrap">
|
39 |
+
|
40 |
+
<?php settings_errors(); ?>
|
41 |
+
|
42 |
+
<div class="row">
|
43 |
+
<div class="col s12 m12 xl8 options">
|
44 |
+
<form action="options.php" method="post" class="">
|
45 |
+
<?php settings_fields( 'ht_ctc_share_page_settings_fields' ); ?>
|
46 |
+
<?php do_settings_sections( 'ht_ctc_share_page_settings_sections_do' ) ?>
|
47 |
+
<?php submit_button() ?>
|
48 |
+
</form>
|
49 |
+
</div>
|
50 |
+
<!-- <div class="col s12 m12 xl6 ht-cc-admin-sidebar">
|
51 |
+
</div> -->
|
52 |
+
</div>
|
53 |
+
|
54 |
+
</div>
|
55 |
+
|
56 |
+
<?php
|
57 |
+
|
58 |
+
}
|
59 |
+
|
60 |
+
|
61 |
+
public function settings() {
|
62 |
+
|
63 |
+
// main settings - options enable .. share, share ..
|
64 |
+
// chat options
|
65 |
+
register_setting( 'ht_ctc_share_page_settings_fields', 'ht_ctc_share' , array( $this, 'options_sanitize' ) );
|
66 |
+
|
67 |
+
add_settings_section( 'ht_ctc_main_page_settings_sections_add', '', array( $this, 'main_settings_section_cb' ), 'ht_ctc_share_page_settings_sections_do' );
|
68 |
+
|
69 |
+
add_settings_field( 'share_text', 'Share Text', array( $this, 'share_text_cb' ), 'ht_ctc_share_page_settings_sections_do', 'ht_ctc_main_page_settings_sections_add' );
|
70 |
+
add_settings_field( 'share_cta', 'Call to Action', array( $this, 'share_cta_cb' ), 'ht_ctc_share_page_settings_sections_do', 'ht_ctc_main_page_settings_sections_add' );
|
71 |
+
|
72 |
+
add_settings_field( 'share_ctc_desktop_style', 'Style for Desktop', array( $this, 'share_ctc_desktop_style_cb' ), 'ht_ctc_share_page_settings_sections_do', 'ht_ctc_main_page_settings_sections_add' );
|
73 |
+
add_settings_field( 'share_ctc_mobile_style', 'Style for Mobile', array( $this, 'share_ctc_mobile_style_cb' ), 'ht_ctc_share_page_settings_sections_do', 'ht_ctc_main_page_settings_sections_add' );
|
74 |
+
add_settings_field( 'share_ctc_position', 'Position to place', array( $this, 'share_ctc_position_cb' ), 'ht_ctc_share_page_settings_sections_do', 'ht_ctc_main_page_settings_sections_add' );
|
75 |
+
add_settings_field( 'share_show_hide', 'Show/Hide', array( $this, 'share_show_hide_cb' ), 'ht_ctc_share_page_settings_sections_do', 'ht_ctc_main_page_settings_sections_add' );
|
76 |
+
add_settings_field( 'share_shortcode', '', array( $this, 'share_shortcode_cb' ), 'ht_ctc_share_page_settings_sections_do', 'ht_ctc_main_page_settings_sections_add' );
|
77 |
+
|
78 |
+
|
79 |
+
}
|
80 |
+
|
81 |
+
public function main_settings_section_cb() {
|
82 |
+
?>
|
83 |
+
<h1>Share</h1>
|
84 |
+
<?php
|
85 |
+
}
|
86 |
+
|
87 |
+
|
88 |
+
// WhatsApp share ID.
|
89 |
+
function share_text_cb() {
|
90 |
+
$options = get_option('ht_ctc_share');
|
91 |
+
?>
|
92 |
+
<div class="row">
|
93 |
+
<div class="input-field col s12">
|
94 |
+
<input name="ht_ctc_share[share_text]" value="<?php echo esc_attr( $options['share_text'] ) ?>" id="whatsapp_share_text" type="text" class="input-margin">
|
95 |
+
<label for="whatsapp_share_text">Share Text</label>
|
96 |
+
<p class="description">Placeholder {{url}} returns current webpage URL - <a target="_blank" href="https://www.holithemes.com/plugins/click-to-chat/share-text/">more info</a> ) </p>
|
97 |
+
</div>
|
98 |
+
</div>
|
99 |
+
<?php
|
100 |
+
}
|
101 |
+
|
102 |
+
// call to action
|
103 |
+
function share_cta_cb() {
|
104 |
+
$options = get_option('ht_ctc_share');
|
105 |
+
?>
|
106 |
+
<div class="row">
|
107 |
+
<div class="input-field col s12">
|
108 |
+
<input name="ht_ctc_share[call_to_action]" value="<?php echo esc_attr( $options['call_to_action'] ) ?>" id="call_to_action" type="text" class="input-margin">
|
109 |
+
<label for="call_to_action">Call to Action</label>
|
110 |
+
<p class="description">Text that appears along with WhatsApp icon/button - <a target="_blank" href="https://www.holithemes.com/plugins/click-to-chat/call-to-action/">more info</a> </p>
|
111 |
+
</div>
|
112 |
+
</div>
|
113 |
+
<?php
|
114 |
+
}
|
115 |
+
|
116 |
+
|
117 |
+
|
118 |
+
// Desktop - select style
|
119 |
+
function share_ctc_desktop_style_cb() {
|
120 |
+
$options = get_option('ht_ctc_share');
|
121 |
+
$style_value = esc_attr( $options['style_desktop'] );
|
122 |
+
?>
|
123 |
+
<div class="row">
|
124 |
+
<div class="input-field col s12" style="margin-bottom: 0px;">
|
125 |
+
<select name="ht_ctc_share[style_desktop]" class="select-2">
|
126 |
+
<option value="1" <?php echo $style_value == 1 ? 'SELECTED' : ''; ?> >Style-1</option>
|
127 |
+
<option value="2" <?php echo $style_value == 2 ? 'SELECTED' : ''; ?> >Style-2</option>
|
128 |
+
<option value="3" <?php echo $style_value == 3 ? 'SELECTED' : ''; ?> >Style-3</option>
|
129 |
+
<option value="4" <?php echo $style_value == 4 ? 'SELECTED' : ''; ?> >Style-4</option>
|
130 |
+
<option value="5" <?php echo $style_value == 5 ? 'SELECTED' : ''; ?> >Style-5</option>
|
131 |
+
<option value="6" <?php echo $style_value == 6 ? 'SELECTED' : ''; ?> >Style-6</option>
|
132 |
+
<option value="7" <?php echo $style_value == 7 ? 'SELECTED' : ''; ?> >Style-7</option>
|
133 |
+
<option value="8" <?php echo $style_value == 8 ? 'SELECTED' : ''; ?> >Style-8</option>
|
134 |
+
<option value="99" <?php echo $style_value == 99 ? 'SELECTED' : ''; ?> >Style-99 (Add your own image / GIF)</option>
|
135 |
+
</select>
|
136 |
+
<label>Select Style for Desktop</label>
|
137 |
+
</div>
|
138 |
+
</div>
|
139 |
+
|
140 |
+
<p class="description"> - <a target="_blank" href="https://www.holithemes.com/plugins/click-to-chat/list-of-styles/">List of syles</a> </p>
|
141 |
+
<p class="description">Can customize each style - <a target="_blank" href="<?php echo admin_url( 'admin.php?page=click-to-chat-customize-styles' ); ?>"><?php _e( 'Customize Styles' , 'click-to-chat-for-whatsapp' ) ?></a> </p>
|
142 |
+
|
143 |
+
<?php
|
144 |
+
}
|
145 |
+
|
146 |
+
|
147 |
+
// Mobile - select style
|
148 |
+
function share_ctc_mobile_style_cb() {
|
149 |
+
$options = get_option('ht_ctc_share');
|
150 |
+
$style_value = esc_attr( $options['style_mobile'] );
|
151 |
+
?>
|
152 |
+
<div class="row" style="margin-bottom: 0px;">
|
153 |
+
<div class="input-field col s12">
|
154 |
+
<select name="ht_ctc_share[style_mobile]" class="select-2">
|
155 |
+
<option value="1" <?php echo $style_value == 1 ? 'SELECTED' : ''; ?> >Style-1</option>
|
156 |
+
<option value="2" <?php echo $style_value == 2 ? 'SELECTED' : ''; ?> >Style-2</option>
|
157 |
+
<option value="3" <?php echo $style_value == 3 ? 'SELECTED' : ''; ?> >Style-3</option>
|
158 |
+
<option value="4" <?php echo $style_value == 4 ? 'SELECTED' : ''; ?> >Style-4</option>
|
159 |
+
<option value="5" <?php echo $style_value == 5 ? 'SELECTED' : ''; ?> >Style-5</option>
|
160 |
+
<option value="6" <?php echo $style_value == 6 ? 'SELECTED' : ''; ?> >Style-6</option>
|
161 |
+
<option value="7" <?php echo $style_value == 7 ? 'SELECTED' : ''; ?> >Style-7</option>
|
162 |
+
<option value="8" <?php echo $style_value == 8 ? 'SELECTED' : ''; ?> >Style-8</option>
|
163 |
+
<option value="99" <?php echo $style_value == 99 ? 'SELECTED' : ''; ?> >Style-99 (Add your own image / GIF)</option>
|
164 |
+
</select>
|
165 |
+
<label>Select Style for Mobile</label>
|
166 |
+
</div>
|
167 |
+
</div>
|
168 |
+
|
169 |
+
<?php
|
170 |
+
}
|
171 |
+
|
172 |
+
|
173 |
+
// position to place
|
174 |
+
function share_ctc_position_cb() {
|
175 |
+
$options = get_option('ht_ctc_share');
|
176 |
+
|
177 |
+
$side_1 = esc_attr( $options['side_1'] );
|
178 |
+
$side_2 = esc_attr( $options['side_2'] );
|
179 |
+
?>
|
180 |
+
<!-- side - 1 -->
|
181 |
+
<div class="row">
|
182 |
+
<div class="input-field col s6">
|
183 |
+
<select name="ht_ctc_share[side_1]" class="select-2">
|
184 |
+
<option value="bottom" <?php echo $side_1 == 'bottom' ? 'SELECTED' : ''; ?> >bottom</option>
|
185 |
+
<option value="top" <?php echo $side_1 == 'top' ? 'SELECTED' : ''; ?> >top</option>
|
186 |
+
</select>
|
187 |
+
<label>top / bottom </label>
|
188 |
+
</div>
|
189 |
+
|
190 |
+
<div class="input-field col s6">
|
191 |
+
<input name="ht_ctc_share[side_1_value]" value="<?php echo esc_attr( $options['side_1_value'] ) ?>" id="side_1_value" type="text" class="input-margin">
|
192 |
+
<label for="side_1_value">e.g. 10px</label>
|
193 |
+
</div>
|
194 |
+
</div>
|
195 |
+
|
196 |
+
<!-- side - 2 -->
|
197 |
+
<div class="row">
|
198 |
+
<div class="input-field col s6">
|
199 |
+
<select name="ht_ctc_share[side_2]" class="select-2">
|
200 |
+
<option value="right" <?php echo $side_2 == 'right' ? 'SELECTED' : ''; ?> >right</option>
|
201 |
+
<option value="left" <?php echo $side_2 == 'left' ? 'SELECTED' : ''; ?> >left</option>
|
202 |
+
</select>
|
203 |
+
<label>right / left </label>
|
204 |
+
</div>
|
205 |
+
|
206 |
+
<div class="input-field col s6">
|
207 |
+
<input name="ht_ctc_share[side_2_value]" value="<?php echo esc_attr( $options['side_2_value'] ) ?>" id="side_2_value" type="text" class="input-margin">
|
208 |
+
<label for="side_2_value">e.g. 10px</label>
|
209 |
+
</div>
|
210 |
+
</div>
|
211 |
+
|
212 |
+
<p class="description">Add css units as suffix - e.g. 10px, 50% - <a target="_blank" href="https://www.holithemes.com/plugins/click-to-chat/position-to-place/">more info</a> </p>
|
213 |
+
<?php
|
214 |
+
}
|
215 |
+
|
216 |
+
|
217 |
+
|
218 |
+
|
219 |
+
// show/hide
|
220 |
+
function share_show_hide_cb() {
|
221 |
+
|
222 |
+
|
223 |
+
$options = get_option('ht_ctc_share');
|
224 |
+
|
225 |
+
$show_or_hide = esc_attr( $options['show_or_hide'] );
|
226 |
+
?>
|
227 |
+
|
228 |
+
<ul class="collapsible">
|
229 |
+
<li>
|
230 |
+
<div class="collapsible-header">Show/Hide</div>
|
231 |
+
<div class="collapsible-body">
|
232 |
+
|
233 |
+
<?php
|
234 |
+
|
235 |
+
|
236 |
+
// Hide on Mobile Devices
|
237 |
+
if ( isset( $options['hideon_mobile'] ) ) {
|
238 |
+
?>
|
239 |
+
<p>
|
240 |
+
<label>
|
241 |
+
<input name="ht_ctc_share[hideon_mobile]" type="checkbox" value="1" <?php checked( $options['hideon_mobile'], 1 ); ?> id="hideon_mobile" />
|
242 |
+
<span>Hide on - Mobile Devices</span>
|
243 |
+
</label>
|
244 |
+
</p>
|
245 |
+
<?php
|
246 |
+
} else {
|
247 |
+
?>
|
248 |
+
<p>
|
249 |
+
<label>
|
250 |
+
<input name="ht_ctc_share[hideon_mobile]" type="checkbox" value="1" id="hideon_mobile" />
|
251 |
+
<span>Hide on - Mobile Devices</span>
|
252 |
+
</label>
|
253 |
+
</p>
|
254 |
+
<?php
|
255 |
+
}
|
256 |
+
|
257 |
+
// Hide on Desktop Devices
|
258 |
+
if ( isset( $options['hideon_desktop'] ) ) {
|
259 |
+
?>
|
260 |
+
<p>
|
261 |
+
<label>
|
262 |
+
<input name="ht_ctc_share[hideon_desktop]" type="checkbox" value="1" <?php checked( $options['hideon_desktop'], 1 ); ?> id="hideon_desktop" />
|
263 |
+
<span>Hide on - Desktop Devices</span>
|
264 |
+
</label>
|
265 |
+
</p>
|
266 |
+
<?php
|
267 |
+
} else {
|
268 |
+
?>
|
269 |
+
<p>
|
270 |
+
<label>
|
271 |
+
<input name="ht_ctc_share[hideon_desktop]" type="checkbox" value="1" id="hideon_desktop" />
|
272 |
+
<span>Hide on - Desktop Devices</span>
|
273 |
+
</label>
|
274 |
+
</p>
|
275 |
+
<?php
|
276 |
+
}
|
277 |
+
?>
|
278 |
+
<!-- <p class="description">plugin detects device based on HTTP User agent </p> -->
|
279 |
+
<p class="description">If working in reverse it might be the cache plugin not detecting the devices - <a target="_blank" href="https://www.holithemes.com/plugins/click-to-chat/hide-based-on-device/">more info</a> </p>
|
280 |
+
|
281 |
+
|
282 |
+
<div class="row" style="margin-bottom: 0px;">
|
283 |
+
<div class="input-field col s12">
|
284 |
+
<select name="ht_ctc_share[show_or_hide]" class="select_show_or_hide">
|
285 |
+
<option value="hide" <?php echo $show_or_hide == "hide" ? 'SELECTED' : ''; ?> >Hide on selected pages</option>
|
286 |
+
<option value="show" <?php echo $show_or_hide == "show" ? 'SELECTED' : ''; ?> >Show on selected pages</option>
|
287 |
+
</select>
|
288 |
+
<!-- <label><?php _e( 'enable' , 'click-to-chat-for-whatsapp' ) ?></label> -->
|
289 |
+
</div>
|
290 |
+
</div>
|
291 |
+
<?php
|
292 |
+
|
293 |
+
// ######### Hide #########
|
294 |
+
|
295 |
+
?>
|
296 |
+
<p class="description ctc_show_hide_display show-hide_display-none hidebased" style="margin-bottom: 15px">
|
297 |
+
<?php echo 'Select pages to Hide styles <span style="color: green;"> ( Default Shows on all page ) ' ?>
|
298 |
+
</p>
|
299 |
+
<!-- <br><br> -->
|
300 |
+
<?php
|
301 |
+
|
302 |
+
// checkboxes - Hide based on Type of posts
|
303 |
+
|
304 |
+
// Single Posts
|
305 |
+
if ( isset( $options['hideon_posts'] ) ) {
|
306 |
+
?>
|
307 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
308 |
+
<label>
|
309 |
+
<input name="ht_ctc_share[hideon_posts]" type="checkbox" value="1" <?php checked( $options['hideon_posts'], 1 ); ?> id="filled-in-box1" />
|
310 |
+
<span>Hide on - Posts</span>
|
311 |
+
</label>
|
312 |
+
</p>
|
313 |
+
<?php
|
314 |
+
} else {
|
315 |
+
?>
|
316 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
317 |
+
<label>
|
318 |
+
<input name="ht_ctc_share[hideon_posts]" type="checkbox" value="1" id="filled-in-box1" />
|
319 |
+
<span>Hide on - Posts</span>
|
320 |
+
</label>
|
321 |
+
</p>
|
322 |
+
<?php
|
323 |
+
}
|
324 |
+
|
325 |
+
|
326 |
+
// Page
|
327 |
+
if ( isset( $options['hideon_page'] ) ) {
|
328 |
+
?>
|
329 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
330 |
+
<label>
|
331 |
+
<input name="ht_ctc_share[hideon_page]" type="checkbox" value="1" <?php checked( $options['hideon_page'], 1 ); ?> id="filled-in-box2" />
|
332 |
+
<span>Hide on - Pages</span>
|
333 |
+
</label>
|
334 |
+
</p>
|
335 |
+
<?php
|
336 |
+
} else {
|
337 |
+
?>
|
338 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
339 |
+
<label>
|
340 |
+
<input name="ht_ctc_share[hideon_page]" type="checkbox" value="1" id="filled-in-box2" />
|
341 |
+
<span>Hide on - Pages</span>
|
342 |
+
</label>
|
343 |
+
</p>
|
344 |
+
<?php
|
345 |
+
}
|
346 |
+
|
347 |
+
|
348 |
+
|
349 |
+
|
350 |
+
// Home Page
|
351 |
+
// is_home and is_front_page - combined. calling as home/front page
|
352 |
+
if ( isset( $options['hideon_homepage'] ) ) {
|
353 |
+
?>
|
354 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
355 |
+
<label>
|
356 |
+
<input name="ht_ctc_share[hideon_homepage]" type="checkbox" value="1" <?php checked( $options['hideon_homepage'], 1 ); ?> id="filled-in-box3" />
|
357 |
+
<span>Hide on - Home/Front Page</span>
|
358 |
+
</label>
|
359 |
+
</p>
|
360 |
+
<?php
|
361 |
+
} else {
|
362 |
+
?>
|
363 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
364 |
+
<label>
|
365 |
+
<input name="ht_ctc_share[hideon_homepage]" type="checkbox" value="1" id="filled-in-box3" />
|
366 |
+
<span>Hide on - Home/Front Page</span>
|
367 |
+
</label>
|
368 |
+
</p>
|
369 |
+
<?php
|
370 |
+
}
|
371 |
+
|
372 |
+
|
373 |
+
// Category
|
374 |
+
if ( isset( $options['hideon_category'] ) ) {
|
375 |
+
?>
|
376 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
377 |
+
<label>
|
378 |
+
<input name="ht_ctc_share[hideon_category]" type="checkbox" value="1" <?php checked( $options['hideon_category'], 1 ); ?> id="filled-in-box5" />
|
379 |
+
<span>Hide on - Category</span>
|
380 |
+
</label>
|
381 |
+
</p>
|
382 |
+
<?php
|
383 |
+
} else {
|
384 |
+
?>
|
385 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
386 |
+
<label>
|
387 |
+
<input name="ht_ctc_share[hideon_category]" type="checkbox" value="1" id="filled-in-box5" />
|
388 |
+
<span>Hide on - Category</span>
|
389 |
+
</label>
|
390 |
+
</p>
|
391 |
+
<?php
|
392 |
+
}
|
393 |
+
|
394 |
+
|
395 |
+
|
396 |
+
// Archive
|
397 |
+
if ( isset( $options['hideon_archive'] ) ) {
|
398 |
+
?>
|
399 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
400 |
+
<label>
|
401 |
+
<input name="ht_ctc_share[hideon_archive]" type="checkbox" value="1" <?php checked( $options['hideon_archive'], 1 ); ?> id="filled-in-box6" />
|
402 |
+
<span>Hide on - Archive</span>
|
403 |
+
</label>
|
404 |
+
</p>
|
405 |
+
<?php
|
406 |
+
} else {
|
407 |
+
?>
|
408 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
409 |
+
<label>
|
410 |
+
<input name="ht_ctc_share[hideon_archive]" type="checkbox" value="1" id="filled-in-box6" />
|
411 |
+
<span>Hide on - Archive</span>
|
412 |
+
</label>
|
413 |
+
</p>
|
414 |
+
<?php
|
415 |
+
}
|
416 |
+
|
417 |
+
|
418 |
+
// 404 Page
|
419 |
+
if ( isset( $options['hideon_404'] ) ) {
|
420 |
+
?>
|
421 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
422 |
+
<label>
|
423 |
+
<input name="ht_ctc_share[hideon_404]" type="checkbox" value="1" <?php checked( $options['hideon_404'], 1 ); ?> id="filled-in-box7" />
|
424 |
+
<span>Hide on - 404 Page</span>
|
425 |
+
</label>
|
426 |
+
</p>
|
427 |
+
<?php
|
428 |
+
} else {
|
429 |
+
?>
|
430 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
431 |
+
<label>
|
432 |
+
<input name="ht_ctc_share[hideon_404]" type="checkbox" value="1" id="filled-in-box7" />
|
433 |
+
<span>Hide on - 404 Page</span>
|
434 |
+
</label>
|
435 |
+
</p>
|
436 |
+
<?php
|
437 |
+
}
|
438 |
+
|
439 |
+
|
440 |
+
// WooCommerce single product pages
|
441 |
+
if ( isset( $options['hideon_wooproduct'] ) ) {
|
442 |
+
?>
|
443 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
444 |
+
<label>
|
445 |
+
<input name="ht_ctc_share[hideon_wooproduct]" type="checkbox" value="1" <?php checked( $options['hideon_wooproduct'], 1 ); ?> id="filled-in-box7" />
|
446 |
+
<span>Hide on - WooCommerce single product pages</span>
|
447 |
+
</label>
|
448 |
+
</p>
|
449 |
+
<?php
|
450 |
+
} else {
|
451 |
+
?>
|
452 |
+
<p class="ctc_show_hide_display show-hide_display-none hidebased">
|
453 |
+
<label>
|
454 |
+
<input name="ht_ctc_share[hideon_wooproduct]" type="checkbox" value="1" id="filled-in-box7" />
|
455 |
+
<span>Hide on - WooCommerce single product pages</span>
|
456 |
+
</label>
|
457 |
+
</p>
|
458 |
+
<?php
|
459 |
+
}
|
460 |
+
|
461 |
+
|
462 |
+
?>
|
463 |
+
<p class="description ctc_show_hide_display show-hide_display-none hidebased">Check to hide Styles based on the type of pages</p>
|
464 |
+
<?php
|
465 |
+
|
466 |
+
|
467 |
+
|
468 |
+
|
469 |
+
// ID's list to hide styles
|
470 |
+
|
471 |
+
?>
|
472 |
+
<div class="row ctc_show_hide_display show-hide_display-none hidebased">
|
473 |
+
<div class="input-field col s12">
|
474 |
+
<input name="ht_ctc_share[list_hideon_pages]" value="<?php echo esc_attr( $options['list_hideon_pages'] ) ?>" id="ccw_list_id_tohide" type="text" class="input-margin">
|
475 |
+
<label for="ccw_list_id_tohide">Id's list to Hide - add ',' after each id </label>
|
476 |
+
<p class="description">Add Post, Page, Media - ID's to hide, can add multiple id's by separating with a comma ( , )</p>
|
477 |
+
</div>
|
478 |
+
</div>
|
479 |
+
<?php
|
480 |
+
|
481 |
+
|
482 |
+
// Categorys list - to hide
|
483 |
+
|
484 |
+
?>
|
485 |
+
<div class="row ctc_show_hide_display show-hide_display-none hidebased">
|
486 |
+
<div class="input-field col s12">
|
487 |
+
<input name="ht_ctc_share[list_hideon_cat]" value="<?php echo esc_attr( $options['list_hideon_cat'] ) ?>" id="ccw_list_cat_tohide" type="text" class="input-margin">
|
488 |
+
<label for="ccw_list_cat_tohide"><?php _e( 'Category name\'s to Hide - add \',\' after each category name' , 'click-to-chat-for-whatsapp' ) ?> </label>
|
489 |
+
<p class="description">Add Categories name to hide, can add multiple Categories by separating with a comma ( , )</p>
|
490 |
+
</div>
|
491 |
+
</div>
|
492 |
+
<?php
|
493 |
+
|
494 |
+
|
495 |
+
// ######### Show #########
|
496 |
+
|
497 |
+
|
498 |
+
?>
|
499 |
+
<p class="description ctc_show_hide_display show-hide_display-none showbased" style="margin-bottom: 15px">
|
500 |
+
<?php echo 'Select pages to display styles <span style="background-color: #dddddd; color: red;"> ( Default hides on all page ) ' ?>
|
501 |
+
</p>
|
502 |
+
<?php
|
503 |
+
|
504 |
+
// checkboxes - Show based on Type of posts
|
505 |
+
|
506 |
+
// Single Posts
|
507 |
+
if ( isset( $options['showon_posts'] ) ) {
|
508 |
+
?>
|
509 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
510 |
+
<label>
|
511 |
+
<input name="ht_ctc_share[showon_posts]" type="checkbox" value="1" <?php checked( $options['showon_posts'], 1 ); ?> id="show_filled-in-box1" />
|
512 |
+
<span>Show on - Posts</span>
|
513 |
+
</label>
|
514 |
+
</p>
|
515 |
+
<?php
|
516 |
+
} else {
|
517 |
+
?>
|
518 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
519 |
+
<label>
|
520 |
+
<input name="ht_ctc_share[showon_posts]" type="checkbox" value="1" id="show_filled-in-box1" />
|
521 |
+
<span>Show on - Posts</span>
|
522 |
+
</label>
|
523 |
+
</p>
|
524 |
+
<?php
|
525 |
+
}
|
526 |
+
|
527 |
+
|
528 |
+
// Page
|
529 |
+
if ( isset( $options['showon_page'] ) ) {
|
530 |
+
?>
|
531 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
532 |
+
<label>
|
533 |
+
<input name="ht_ctc_share[showon_page]" type="checkbox" value="1" <?php checked( $options['showon_page'], 1 ); ?> id="show_filled-in-box2" />
|
534 |
+
<span>Show on - Pages</span>
|
535 |
+
</label>
|
536 |
+
</p>
|
537 |
+
<?php
|
538 |
+
} else {
|
539 |
+
?>
|
540 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
541 |
+
<label>
|
542 |
+
<input name="ht_ctc_share[showon_page]" type="checkbox" value="1" id="show_filled-in-box2" />
|
543 |
+
<span>Show on - Pages</span>
|
544 |
+
</label>
|
545 |
+
</p>
|
546 |
+
<?php
|
547 |
+
}
|
548 |
+
|
549 |
+
|
550 |
+
// Home Page
|
551 |
+
// is_home and is_front_page - combined. calling as home/front page
|
552 |
+
if ( isset( $options['showon_homepage'] ) ) {
|
553 |
+
?>
|
554 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
555 |
+
<label>
|
556 |
+
<input name="ht_ctc_share[showon_homepage]" type="checkbox" value="1" <?php checked( $options['showon_homepage'], 1 ); ?> id="show_filled-in-box3" />
|
557 |
+
<span>Show on - Home/Front Page</span>
|
558 |
+
</label>
|
559 |
+
</p>
|
560 |
+
<?php
|
561 |
+
} else {
|
562 |
+
?>
|
563 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
564 |
+
<label>
|
565 |
+
<input name="ht_ctc_share[showon_homepage]" type="checkbox" value="1" id="show_filled-in-box3" />
|
566 |
+
<span>Show on - Home/Front Page</span>
|
567 |
+
</label>
|
568 |
+
</p>
|
569 |
+
<?php
|
570 |
+
}
|
571 |
+
|
572 |
+
|
573 |
+
// Category
|
574 |
+
if ( isset( $options['showon_category'] ) ) {
|
575 |
+
?>
|
576 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
577 |
+
<label>
|
578 |
+
<input name="ht_ctc_share[showon_category]" type="checkbox" value="1" <?php checked( $options['showon_category'], 1 ); ?> id="show_filled-in-box5" />
|
579 |
+
<span>Show on - Category</span>
|
580 |
+
</label>
|
581 |
+
</p>
|
582 |
+
<?php
|
583 |
+
} else {
|
584 |
+
?>
|
585 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
586 |
+
<label>
|
587 |
+
<input name="ht_ctc_share[showon_category]" type="checkbox" value="1" id="show_filled-in-box5" />
|
588 |
+
<span>Show on - Category</span>
|
589 |
+
</label>
|
590 |
+
</p>
|
591 |
+
<?php
|
592 |
+
}
|
593 |
+
|
594 |
+
// Archive
|
595 |
+
if ( isset( $options['showon_archive'] ) ) {
|
596 |
+
?>
|
597 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
598 |
+
<label>
|
599 |
+
<input name="ht_ctc_share[showon_archive]" type="checkbox" value="1" <?php checked( $options['showon_archive'], 1 ); ?> id="show_filled-in-box6" />
|
600 |
+
<span>Show on - Archive</span>
|
601 |
+
</label>
|
602 |
+
</p>
|
603 |
+
<?php
|
604 |
+
} else {
|
605 |
+
?>
|
606 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
607 |
+
<label>
|
608 |
+
<input name="ht_ctc_share[showon_archive]" type="checkbox" value="1" id="show_filled-in-box6" />
|
609 |
+
<span>Show on - Archive</span>
|
610 |
+
</label>
|
611 |
+
</p>
|
612 |
+
<?php
|
613 |
+
}
|
614 |
+
|
615 |
+
|
616 |
+
// 404 Page
|
617 |
+
if ( isset( $options['showon_404'] ) ) {
|
618 |
+
?>
|
619 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
620 |
+
<label>
|
621 |
+
<input name="ht_ctc_share[showon_404]" type="checkbox" value="1" <?php checked( $options['showon_404'], 1 ); ?> id="show_filled-in-box7" />
|
622 |
+
<span>Show on - 404 Page</span>
|
623 |
+
</label>
|
624 |
+
</p>
|
625 |
+
<?php
|
626 |
+
} else {
|
627 |
+
?>
|
628 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
629 |
+
<label>
|
630 |
+
<input name="ht_ctc_share[showon_404]" type="checkbox" value="1" id="show_filled-in-box7" />
|
631 |
+
<span>Show on - 404 Page</span>
|
632 |
+
</label>
|
633 |
+
</p>
|
634 |
+
<?php
|
635 |
+
}
|
636 |
+
|
637 |
+
|
638 |
+
// WooCommerce single product pages
|
639 |
+
if ( isset( $options['showon_wooproduct'] ) ) {
|
640 |
+
?>
|
641 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
642 |
+
<label>
|
643 |
+
<input name="ht_ctc_share[showon_wooproduct]" type="checkbox" value="1" <?php checked( $options['showon_wooproduct'], 1 ); ?> id="show_filled-in-box7" />
|
644 |
+
<span>Show on - WooCommerce Single product pages</span>
|
645 |
+
</label>
|
646 |
+
</p>
|
647 |
+
<?php
|
648 |
+
} else {
|
649 |
+
?>
|
650 |
+
<p class="ctc_show_hide_display show-hide_display-none showbased">
|
651 |
+
<label>
|
652 |
+
<input name="ht_ctc_share[showon_wooproduct]" type="checkbox" value="1" id="show_filled-in-box7" />
|
653 |
+
<span>Show on - WooCommerce Single product pages</span>
|
654 |
+
</label>
|
655 |
+
</p>
|
656 |
+
<?php
|
657 |
+
}
|
658 |
+
|
659 |
+
|
660 |
+
?>
|
661 |
+
<p class="description ctc_show_hide_display show-hide_display-none showbased"><?php _e( 'Check to display Styles based on type of the page' , 'click-to-chat-for-whatsapp' ) ?> <a target="_blank" href="https://www.holithemes.com/plugins/show-hide-styles-based-on-type-of-the-page/">more info</a> </p>
|
662 |
+
<?php
|
663 |
+
|
664 |
+
|
665 |
+
// ID's list to show styles
|
666 |
+
|
667 |
+
?>
|
668 |
+
<div class="row ctc_show_hide_display show-hide_display-none showbased">
|
669 |
+
<div class="input-field col s12">
|
670 |
+
<input name="ht_ctc_share[list_showon_pages]" value="<?php echo esc_attr( $options['list_showon_pages'] ) ?>" id="ccw_list_id_toshow" type="text" class="input-margin">
|
671 |
+
<label for="ccw_list_id_toshow">Id's list to show - add ',' after each id </label>
|
672 |
+
<p class="description"> Add Post, Pages, Media - ID's to show styles, can add multiple id's separate with a comma ( , ) - <a target="_blank" href="https://www.holithemes.com/plugins/show-hide-styles-based-on-id/">more info</a> </p>
|
673 |
+
</div>
|
674 |
+
</div>
|
675 |
+
<?php
|
676 |
+
|
677 |
+
|
678 |
+
// Categorys list - to show
|
679 |
+
|
680 |
+
// $ccw_list_cat_toshow = get_option('ht_ctc_share');
|
681 |
+
|
682 |
+
?>
|
683 |
+
<div class="row ctc_show_hide_display show-hide_display-none showbased">
|
684 |
+
<div class="input-field col s12">
|
685 |
+
<input name="ht_ctc_share[list_showon_cat]" value="<?php echo esc_attr( $options['list_showon_cat'] ) ?>" id="ccw_list_cat_toshow" type="text" class="input-margin">
|
686 |
+
<label for="ccw_list_cat_toshow"><?php _e( 'Category name\'s to Show - add \',\' after each category name' , 'click-to-chat-for-whatsapp' ) ?> </label>
|
687 |
+
<p class="description"><?php _e( 'Category name\'s to show styles, can add multiple Categories separate with a comma ( , )' , 'click-to-chat-for-whatsapp' ) ?> - <a target="_blank" href="https://www.holithemes.com/plugins/click-to-chat/hide-styles-based-on-category/">more info</a> </p>
|
688 |
+
</div>
|
689 |
+
</div>
|
690 |
+
|
691 |
+
|
692 |
+
<p class="description"><a target="_blank" href="https://www.holithemes.com/plugins/click-to-chat/show-hide-styles/">more info</a> </p>
|
693 |
+
|
694 |
+
|
695 |
+
</div>
|
696 |
+
</li>
|
697 |
+
<ul>
|
698 |
+
|
699 |
+
|
700 |
+
<?php
|
701 |
+
|
702 |
+
}
|
703 |
+
|
704 |
+
|
705 |
+
function share_shortcode_cb() {
|
706 |
+
?>
|
707 |
+
<p class="description">Shorcodes for Share: [ht-ctc-share] - <a target="_blank" href="https://www.holithemes.com/plugins/click-to-chat/shortcodes-share">more info</a></p>
|
708 |
+
<?php
|
709 |
+
}
|
710 |
+
|
711 |
+
|
712 |
+
|
713 |
+
|
714 |
+
|
715 |
+
|
716 |
+
/**
|
717 |
+
* Sanitize each setting field as needed
|
718 |
+
*
|
719 |
+
* @since 2.0
|
720 |
+
* @param array $input Contains all settings fields as array keys
|
721 |
+
*/
|
722 |
+
public function options_sanitize( $input ) {
|
723 |
+
|
724 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
725 |
+
wp_die( 'not allowed to modify - please contact admin ' );
|
726 |
+
}
|
727 |
+
|
728 |
+
$new_input = array();
|
729 |
+
|
730 |
+
foreach ($input as $key => $value) {
|
731 |
+
if( isset( $input[$key] ) ) {
|
732 |
+
$new_input[$key] = sanitize_text_field( $input[$key] );
|
733 |
+
}
|
734 |
+
}
|
735 |
+
|
736 |
+
|
737 |
+
return $new_input;
|
738 |
+
}
|
739 |
+
|
740 |
+
|
741 |
+
}
|
742 |
+
|
743 |
+
$ht_ctc_admin_share_page = new HT_CTC_Admin_Share_Page();
|
744 |
+
|
745 |
+
add_action('admin_menu', array($ht_ctc_admin_share_page, 'menu') );
|
746 |
+
add_action('admin_init', array($ht_ctc_admin_share_page, 'settings') );
|
747 |
+
|
748 |
+
endif; // END class_exists check
|
new/admin/class-ht-ctc-db.php
ADDED
@@ -0,0 +1,563 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Default Values
|
4 |
+
*
|
5 |
+
* set the default values
|
6 |
+
* which stores in database options table
|
7 |
+
*
|
8 |
+
* @package ctc
|
9 |
+
* @since 2.0
|
10 |
+
* @from ht-ccw-register.php
|
11 |
+
*/
|
12 |
+
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
14 |
+
|
15 |
+
if ( ! class_exists( 'HT_CTC_DB' ) ) :
|
16 |
+
|
17 |
+
class HT_CTC_DB {
|
18 |
+
|
19 |
+
|
20 |
+
public function __construct() {
|
21 |
+
$this->db();
|
22 |
+
}
|
23 |
+
|
24 |
+
|
25 |
+
/**
|
26 |
+
* based on condition.. update the db ..
|
27 |
+
*
|
28 |
+
*/
|
29 |
+
public function db() {
|
30 |
+
|
31 |
+
$this->ht_ctc_main_options();
|
32 |
+
$this->ht_ctc_chat_options();
|
33 |
+
$this->ht_ctc_plugin_details();
|
34 |
+
$this->ht_ctc_group();
|
35 |
+
$this->ht_ctc_share();
|
36 |
+
$this->ht_ctc_one_time();
|
37 |
+
|
38 |
+
$this->ht_ctc_switch();
|
39 |
+
|
40 |
+
// $this->ht_ctc_s1();
|
41 |
+
$this->ht_ctc_s2();
|
42 |
+
$this->ht_ctc_s3();
|
43 |
+
$this->ht_ctc_s4();
|
44 |
+
$this->ht_ctc_s5();
|
45 |
+
$this->ht_ctc_s6();
|
46 |
+
$this->ht_ctc_s7();
|
47 |
+
$this->ht_ctc_s8();
|
48 |
+
|
49 |
+
$this->ht_ctc_s99();
|
50 |
+
|
51 |
+
}
|
52 |
+
|
53 |
+
|
54 |
+
/**
|
55 |
+
* table name: "ht_ctc_main_options"
|
56 |
+
*
|
57 |
+
* enable options ..
|
58 |
+
*
|
59 |
+
* checkboxes ..
|
60 |
+
* enable_chat enable chat
|
61 |
+
* enable_group enable_group_chat
|
62 |
+
* enable_share enable_share
|
63 |
+
*
|
64 |
+
* enable_ga Google analytics
|
65 |
+
* enable_fba Facebook Analytics
|
66 |
+
* enable_fbp Facebook Pixel ( pro )
|
67 |
+
*
|
68 |
+
* enable_woo enable_woocommerce
|
69 |
+
*/
|
70 |
+
public function ht_ctc_main_options() {
|
71 |
+
|
72 |
+
$values = array(
|
73 |
+
'enable_chat' => '1',
|
74 |
+
);
|
75 |
+
|
76 |
+
$db_values = get_option( 'ht_ctc_main_options', array() );
|
77 |
+
$update_values = array_merge($values, $db_values);
|
78 |
+
update_option('ht_ctc_main_options', $update_values);
|
79 |
+
|
80 |
+
}
|
81 |
+
|
82 |
+
|
83 |
+
|
84 |
+
|
85 |
+
/**
|
86 |
+
* table name: "ht_ctc_chat_options"
|
87 |
+
*
|
88 |
+
* Chat options, main page .. some feature enable options ..
|
89 |
+
*
|
90 |
+
* checkboxes ..
|
91 |
+
* hide/show options ..
|
92 |
+
*
|
93 |
+
* cache_issue
|
94 |
+
*
|
95 |
+
* enable_share
|
96 |
+
* enable_group
|
97 |
+
*
|
98 |
+
* webandapi - default checked. if checked works web/api.whatsapp if uncheched wa.me link
|
99 |
+
*
|
100 |
+
*/
|
101 |
+
public function ht_ctc_chat_options() {
|
102 |
+
|
103 |
+
$values = array(
|
104 |
+
'number' => '',
|
105 |
+
'pre_filled' => '',
|
106 |
+
'call_to_action' => 'WhatsApp us',
|
107 |
+
'style_desktop' => '2',
|
108 |
+
'style_mobile' => '3',
|
109 |
+
|
110 |
+
'side_1' => 'bottom',
|
111 |
+
'side_1_value' => '10px',
|
112 |
+
|
113 |
+
'side_2' => 'right',
|
114 |
+
'side_2_value' => '10px',
|
115 |
+
|
116 |
+
'show_or_hide' => 'hide',
|
117 |
+
'list_hideon_pages' => '',
|
118 |
+
'list_hideon_cat' => '',
|
119 |
+
// 'webandapi' => '1',
|
120 |
+
|
121 |
+
);
|
122 |
+
|
123 |
+
$db_values = get_option( 'ht_ctc_chat_options', array() );
|
124 |
+
$update_values = array_merge($values, $db_values);
|
125 |
+
update_option('ht_ctc_chat_options', $update_values);
|
126 |
+
|
127 |
+
}
|
128 |
+
|
129 |
+
|
130 |
+
|
131 |
+
|
132 |
+
/**
|
133 |
+
* table name: "ht_ctc_group"
|
134 |
+
*
|
135 |
+
* Group chat
|
136 |
+
*/
|
137 |
+
public function ht_ctc_group() {
|
138 |
+
|
139 |
+
$values = array(
|
140 |
+
|
141 |
+
'group_id' => '',
|
142 |
+
'call_to_action' => 'WhatsApp Group',
|
143 |
+
|
144 |
+
'style_desktop' => '1',
|
145 |
+
'style_mobile' => '2',
|
146 |
+
|
147 |
+
'side_1' => 'bottom',
|
148 |
+
'side_1_value' => '10px',
|
149 |
+
|
150 |
+
'side_2' => 'left',
|
151 |
+
'side_2_value' => '10px',
|
152 |
+
|
153 |
+
'side_1_mobile' => 'bottom',
|
154 |
+
'side_1_mobile_value' => '10px',
|
155 |
+
|
156 |
+
'side_2_mobile' => 'left',
|
157 |
+
'side_2_mobile_value' => '10px',
|
158 |
+
|
159 |
+
'show_or_hide' => 'hide',
|
160 |
+
'list_hideon_pages' => '',
|
161 |
+
'list_hideon_cat' => '',
|
162 |
+
|
163 |
+
);
|
164 |
+
|
165 |
+
$db_values = get_option( 'ht_ctc_group', array() );
|
166 |
+
$update_values = array_merge($values, $db_values);
|
167 |
+
update_option('ht_ctc_group', $update_values);
|
168 |
+
}
|
169 |
+
|
170 |
+
|
171 |
+
|
172 |
+
/**
|
173 |
+
* table name: "ht_ctc_share"
|
174 |
+
*
|
175 |
+
* share chat
|
176 |
+
*/
|
177 |
+
public function ht_ctc_share() {
|
178 |
+
|
179 |
+
$values = array(
|
180 |
+
|
181 |
+
'share_text' => 'Checkout this Awesome page {{url}}',
|
182 |
+
'call_to_action' => 'WhatsApp Share',
|
183 |
+
|
184 |
+
'style_desktop' => '1',
|
185 |
+
'style_mobile' => '2',
|
186 |
+
|
187 |
+
'side_1' => 'top',
|
188 |
+
'side_1_value' => '10px',
|
189 |
+
|
190 |
+
'side_2' => 'right',
|
191 |
+
'side_2_value' => '10px',
|
192 |
+
|
193 |
+
'side_1_mobile' => 'top',
|
194 |
+
'side_1_mobile_value' => '10px',
|
195 |
+
|
196 |
+
'side_2_mobile' => 'right',
|
197 |
+
'side_2_mobile_value' => '10px',
|
198 |
+
|
199 |
+
'show_or_hide' => 'hide',
|
200 |
+
'list_hideon_pages' => '',
|
201 |
+
'list_hideon_cat' => '',
|
202 |
+
);
|
203 |
+
|
204 |
+
$db_values = get_option( 'ht_ctc_share', array() );
|
205 |
+
$update_values = array_merge($values, $db_values);
|
206 |
+
update_option('ht_ctc_share', $update_values);
|
207 |
+
}
|
208 |
+
|
209 |
+
|
210 |
+
|
211 |
+
/**
|
212 |
+
* name: ht_ctc_plugin_details
|
213 |
+
*
|
214 |
+
* don't preseve already existing values
|
215 |
+
* Always use update_option - override new values ..
|
216 |
+
*
|
217 |
+
* Add plugin Details to db
|
218 |
+
* Add plugin version to db - useful while updating plugin
|
219 |
+
*/
|
220 |
+
public function ht_ctc_plugin_details() {
|
221 |
+
|
222 |
+
// plugin details
|
223 |
+
$values = array(
|
224 |
+
'version' => HT_CTC_VERSION,
|
225 |
+
);
|
226 |
+
|
227 |
+
// Always use update_option - override new values .. don't preseve already existing values
|
228 |
+
update_option( 'ht_ctc_plugin_details', $values );
|
229 |
+
}
|
230 |
+
|
231 |
+
|
232 |
+
/**
|
233 |
+
* name: ht_ctc_one_time
|
234 |
+
*
|
235 |
+
* ***** caution *****
|
236 |
+
* when using this values always check if exists..
|
237 |
+
* as some new values may add in other versions..
|
238 |
+
* and thoose values may not exists if this option is added before
|
239 |
+
* ( it add_option not update_option )
|
240 |
+
*
|
241 |
+
* dont update values. .. one time values ..
|
242 |
+
*
|
243 |
+
* first_version - first version installed
|
244 |
+
*
|
245 |
+
* Add plugin Details to db
|
246 |
+
* Add plugin version to db - useful while updating plugin
|
247 |
+
*/
|
248 |
+
public function ht_ctc_one_time() {
|
249 |
+
|
250 |
+
// plugin details
|
251 |
+
$values = array(
|
252 |
+
'first_version' => HT_CTC_VERSION,
|
253 |
+
);
|
254 |
+
|
255 |
+
// dont update values. .. one time values ..
|
256 |
+
add_option( 'ht_ctc_one_time', $values );
|
257 |
+
}
|
258 |
+
|
259 |
+
|
260 |
+
/**
|
261 |
+
* name: ht_ctc_switch
|
262 |
+
*
|
263 |
+
* interface - option - 1 new interface, 2 previous interface
|
264 |
+
*
|
265 |
+
*/
|
266 |
+
public function ht_ctc_switch() {
|
267 |
+
|
268 |
+
$interface = 'yes';
|
269 |
+
|
270 |
+
$first_version = get_option('ht_ctc_one_time');
|
271 |
+
if ( isset ( $first_version['first_version'] ) ) {
|
272 |
+
if ( '1.8' == $first_version['first_version'] || '1.8.1' == $first_version['first_version'] || '1.8.2' == $first_version['first_version'] ) {
|
273 |
+
$ccw_options = get_option('ccw_options');
|
274 |
+
if ( isset ( $ccw_options['number'] ) ) {
|
275 |
+
if ( isset ( $ccw_options['switch_to_new'] ) ) {
|
276 |
+
$interface = 'yes';
|
277 |
+
} else {
|
278 |
+
$interface = 'no';
|
279 |
+
}
|
280 |
+
}
|
281 |
+
}
|
282 |
+
}
|
283 |
+
|
284 |
+
// plugin details
|
285 |
+
$values = array(
|
286 |
+
'interface' => $interface,
|
287 |
+
);
|
288 |
+
|
289 |
+
|
290 |
+
$db_values = get_option( 'ht_ctc_switch', array() );
|
291 |
+
$update_values = array_merge($values, $db_values);
|
292 |
+
update_option('ht_ctc_switch', $update_values);
|
293 |
+
|
294 |
+
}
|
295 |
+
|
296 |
+
|
297 |
+
|
298 |
+
|
299 |
+
|
300 |
+
|
301 |
+
|
302 |
+
// styles
|
303 |
+
|
304 |
+
|
305 |
+
|
306 |
+
/**
|
307 |
+
* name: ht_ctc_s1
|
308 |
+
*
|
309 |
+
* Style-1
|
310 |
+
* style-1 is default button, nothing to modify..
|
311 |
+
*/
|
312 |
+
// public function ht_ctc_s1() {
|
313 |
+
|
314 |
+
// $style_1 = array(
|
315 |
+
|
316 |
+
// 's1_img' => '',
|
317 |
+
|
318 |
+
// );
|
319 |
+
|
320 |
+
// $db_values = get_option( 'ht_ctc_s1', array() );
|
321 |
+
// $update_values = array_merge($style_1, $db_values);
|
322 |
+
// update_option('ht_ctc_s1', $update_values);
|
323 |
+
|
324 |
+
// }
|
325 |
+
|
326 |
+
|
327 |
+
|
328 |
+
|
329 |
+
|
330 |
+
|
331 |
+
/**
|
332 |
+
* name: ht_ctc_s2
|
333 |
+
*
|
334 |
+
* Style-2
|
335 |
+
* green square icon
|
336 |
+
*/
|
337 |
+
public function ht_ctc_s2() {
|
338 |
+
|
339 |
+
$style_2 = array(
|
340 |
+
|
341 |
+
's2_img_size' => '50px',
|
342 |
+
'cta_on_hover' => '1',
|
343 |
+
|
344 |
+
);
|
345 |
+
|
346 |
+
$db_values = get_option( 'ht_ctc_s2', array() );
|
347 |
+
$update_values = array_merge($style_2, $db_values);
|
348 |
+
update_option('ht_ctc_s2', $update_values);
|
349 |
+
|
350 |
+
}
|
351 |
+
|
352 |
+
|
353 |
+
/**
|
354 |
+
* name: ht_ctc_s3
|
355 |
+
*
|
356 |
+
* Style-3
|
357 |
+
* icon
|
358 |
+
*/
|
359 |
+
public function ht_ctc_s3() {
|
360 |
+
|
361 |
+
$style_3 = array(
|
362 |
+
|
363 |
+
's3_img_size' => '50px',
|
364 |
+
'cta_on_hover' => '1',
|
365 |
+
|
366 |
+
);
|
367 |
+
|
368 |
+
$db_values = get_option( 'ht_ctc_s3', array() );
|
369 |
+
$update_values = array_merge($style_3, $db_values);
|
370 |
+
update_option('ht_ctc_s3', $update_values);
|
371 |
+
|
372 |
+
}
|
373 |
+
|
374 |
+
|
375 |
+
|
376 |
+
/**
|
377 |
+
* name: ht_ctc_s4
|
378 |
+
*
|
379 |
+
* Style-4
|
380 |
+
* chip
|
381 |
+
*/
|
382 |
+
public function ht_ctc_s4() {
|
383 |
+
|
384 |
+
// if first installed version is 1.8 - then drop and add the style_4
|
385 |
+
$first_version = get_option('ht_ctc_one_time');
|
386 |
+
if ( isset ( $first_version['first_version'] ) ) {
|
387 |
+
if ( '1.8' == $first_version['first_version'] || '1.8.1' == $first_version['first_version'] || '1.8.0.1' == $first_version['first_version'] ) {
|
388 |
+
$s4 = get_option('ht_ctc_s4');
|
389 |
+
if ( !is_array( $s4 ) ) {
|
390 |
+
delete_option('ht_ctc_s4');
|
391 |
+
}
|
392 |
+
}
|
393 |
+
}
|
394 |
+
|
395 |
+
$style_4 = array(
|
396 |
+
|
397 |
+
's4_text_color' => '#7f7d7d',
|
398 |
+
's4_bg_color' => '#e4e4e4',
|
399 |
+
's4_img_url' => '',
|
400 |
+
|
401 |
+
);
|
402 |
+
|
403 |
+
$db_values = get_option( 'ht_ctc_s4', array() );
|
404 |
+
$update_values = array_merge($style_4, $db_values);
|
405 |
+
update_option('ht_ctc_s4', $update_values);
|
406 |
+
|
407 |
+
}
|
408 |
+
|
409 |
+
|
410 |
+
|
411 |
+
/**
|
412 |
+
* name: ht_ctc_s5
|
413 |
+
*
|
414 |
+
* Style-5
|
415 |
+
* chip
|
416 |
+
*/
|
417 |
+
public function ht_ctc_s5() {
|
418 |
+
|
419 |
+
$style_5 = array(
|
420 |
+
|
421 |
+
's5_line_1' => '',
|
422 |
+
's5_line_2' => 'We will respond as soon as possible',
|
423 |
+
's5_line_1_color' => '#000000',
|
424 |
+
's5_line_2_color' => '#000000',
|
425 |
+
's5_background_color' => '#ffffff',
|
426 |
+
's5_border_color' => '#dddddd',
|
427 |
+
's5_img' => '',
|
428 |
+
's5_img_height' => '70px',
|
429 |
+
's5_img_width' => '70px',
|
430 |
+
's5_content_height' => '70px',
|
431 |
+
's5_content_width' => '270px',
|
432 |
+
's5_img_position' => 'right', // left means nothing - right means - order: 1
|
433 |
+
|
434 |
+
);
|
435 |
+
|
436 |
+
$db_values = get_option( 'ht_ctc_s5', array() );
|
437 |
+
$update_values = array_merge($style_5, $db_values);
|
438 |
+
update_option('ht_ctc_s5', $update_values);
|
439 |
+
|
440 |
+
}
|
441 |
+
|
442 |
+
|
443 |
+
/**
|
444 |
+
* name: ht_ctc_s6
|
445 |
+
*
|
446 |
+
* Style-6
|
447 |
+
*
|
448 |
+
* #006ccc
|
449 |
+
* #0073aa
|
450 |
+
* #005177
|
451 |
+
*/
|
452 |
+
public function ht_ctc_s6() {
|
453 |
+
|
454 |
+
$style_6 = array(
|
455 |
+
|
456 |
+
's6_txt_color' => '',
|
457 |
+
's6_txt_color_on_hover' => '',
|
458 |
+
's6_txt_decoration' => '',
|
459 |
+
's6_txt_decoration_on_hover' => '',
|
460 |
+
|
461 |
+
);
|
462 |
+
|
463 |
+
$db_values = get_option( 'ht_ctc_s6', array() );
|
464 |
+
$update_values = array_merge($style_6, $db_values);
|
465 |
+
update_option('ht_ctc_s6', $update_values);
|
466 |
+
|
467 |
+
}
|
468 |
+
|
469 |
+
|
470 |
+
/**
|
471 |
+
* name: ht_ctc_s7
|
472 |
+
*
|
473 |
+
* Style-7
|
474 |
+
*
|
475 |
+
* border is padding
|
476 |
+
* 's7_icon_color_hover' => '#6b6b6b', #262626, #455a64
|
477 |
+
*/
|
478 |
+
public function ht_ctc_s7() {
|
479 |
+
|
480 |
+
$style_7 = array(
|
481 |
+
|
482 |
+
's7_icon_size' => '28px',
|
483 |
+
's7_icon_color' => '#ffffff',
|
484 |
+
's7_icon_color_hover' => '#455a64',
|
485 |
+
's7_border_size' => '12px',
|
486 |
+
's7_border_color' => '#25D366',
|
487 |
+
's7_border_color_hover' => '#25D366',
|
488 |
+
's7_border_radius' => '50%',
|
489 |
+
'cta_on_hover' => '1',
|
490 |
+
|
491 |
+
);
|
492 |
+
|
493 |
+
$db_values = get_option( 'ht_ctc_s7', array() );
|
494 |
+
$update_values = array_merge($style_7, $db_values);
|
495 |
+
update_option('ht_ctc_s7', $update_values);
|
496 |
+
|
497 |
+
}
|
498 |
+
|
499 |
+
|
500 |
+
|
501 |
+
/**
|
502 |
+
* name: ht_ctc_s8
|
503 |
+
*
|
504 |
+
* Style-8
|
505 |
+
*/
|
506 |
+
public function ht_ctc_s8() {
|
507 |
+
|
508 |
+
$style_8 = array(
|
509 |
+
|
510 |
+
's8_txt_color' => '#ffffff',
|
511 |
+
's8_txt_color_on_hover' => '#ffffff',
|
512 |
+
's8_bg_color' => '#26a69a',
|
513 |
+
's8_bg_color_on_hover' => '#26a69a',
|
514 |
+
's8_icon_color' => '#ffffff',
|
515 |
+
's8_icon_color_on_hover' => '#ffffff',
|
516 |
+
's8_icon_position' => 'left',
|
517 |
+
|
518 |
+
);
|
519 |
+
|
520 |
+
$db_values = get_option( 'ht_ctc_s8', array() );
|
521 |
+
$update_values = array_merge($style_8, $db_values);
|
522 |
+
update_option('ht_ctc_s8', $update_values);
|
523 |
+
|
524 |
+
}
|
525 |
+
|
526 |
+
|
527 |
+
/**
|
528 |
+
* name: ht_ctc_s99
|
529 |
+
*
|
530 |
+
* Style-99
|
531 |
+
*/
|
532 |
+
public function ht_ctc_s99() {
|
533 |
+
|
534 |
+
$style_99 = array(
|
535 |
+
|
536 |
+
's99_dekstop_img_url' => '',
|
537 |
+
's99_mobile_img_url' => '',
|
538 |
+
's99_desktop_img_height' => '50px',
|
539 |
+
's99_desktop_img_width' => '',
|
540 |
+
's99_mobile_img_height' => '50px',
|
541 |
+
's99_mobile_img_width' => '',
|
542 |
+
'cta_on_hover' => '1',
|
543 |
+
|
544 |
+
);
|
545 |
+
|
546 |
+
$db_values = get_option( 'ht_ctc_s99', array() );
|
547 |
+
$update_values = array_merge($style_99, $db_values);
|
548 |
+
update_option('ht_ctc_s99', $update_values);
|
549 |
+
|
550 |
+
}
|
551 |
+
|
552 |
+
|
553 |
+
|
554 |
+
|
555 |
+
|
556 |
+
|
557 |
+
|
558 |
+
|
559 |
+
}
|
560 |
+
|
561 |
+
new HT_CTC_DB();
|
562 |
+
|
563 |
+
endif; // END class_exists check
|
new/admin/class-ht-ctc-metabox.php
ADDED
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Meta box
|
4 |
+
* change values at page level
|
5 |
+
*/
|
6 |
+
|
7 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
8 |
+
|
9 |
+
if ( ! class_exists( 'HT_CTC_MetaBox' ) ) :
|
10 |
+
|
11 |
+
class HT_CTC_MetaBox {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* add meta box
|
15 |
+
*/
|
16 |
+
function meta_box() {
|
17 |
+
|
18 |
+
add_meta_box(
|
19 |
+
'ht_ctc_settings_meta_box', // Id.
|
20 |
+
'Click to Chat', // Title.
|
21 |
+
array( $this, 'display_meta_box' ), // Callback.
|
22 |
+
'', // Post_type.
|
23 |
+
'side', // Context.
|
24 |
+
'default' // Priority.
|
25 |
+
);
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* render meta box content
|
30 |
+
*/
|
31 |
+
function display_meta_box( $current_post ) {
|
32 |
+
|
33 |
+
wp_nonce_field( 'ht_ctc_page_meta_box', 'ht_ctc_page_meta_box_nonce' );
|
34 |
+
$options = get_option( 'ht_ctc_main_options' );
|
35 |
+
|
36 |
+
?>
|
37 |
+
<div class="row">
|
38 |
+
<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>
|
39 |
+
</div>
|
40 |
+
<?php
|
41 |
+
|
42 |
+
// if group enabled
|
43 |
+
if ( isset( $options['enable_chat'] ) ) {
|
44 |
+
?>
|
45 |
+
|
46 |
+
<!-- number -->
|
47 |
+
<div class="row">
|
48 |
+
<label for="number">Chat - WhatsApp Number</label><br>
|
49 |
+
<input name="ht_ctc_page_number" value="<?php echo esc_attr( get_post_meta( $current_post->ID, 'ht_ctc_page_number', true ) ); ?>" id="number" type="text">
|
50 |
+
<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>
|
51 |
+
</div>
|
52 |
+
|
53 |
+
<!-- call to action -->
|
54 |
+
<div class="row">
|
55 |
+
<label for="call_to_action">Chat - Call to Action</label><br>
|
56 |
+
<input name="ht_ctc_page_call_to_action" value="<?php echo esc_attr( get_post_meta( $current_post->ID, 'ht_ctc_page_call_to_action', true ) ); ?>" id="call_to_action" type="text">
|
57 |
+
</div>
|
58 |
+
|
59 |
+
|
60 |
+
<?php
|
61 |
+
}
|
62 |
+
|
63 |
+
|
64 |
+
|
65 |
+
// if group enabled
|
66 |
+
if ( isset( $options['enable_group'] ) ) {
|
67 |
+
?>
|
68 |
+
|
69 |
+
<!-- group id -->
|
70 |
+
<div class="row">
|
71 |
+
<label for="group_id">Group - Group ID</label><br>
|
72 |
+
<input name="ht_ctc_page_group_id" value="<?php echo esc_attr( get_post_meta( $current_post->ID, 'ht_ctc_page_group_id', true ) ); ?>" id="group_id" type="text">
|
73 |
+
<!-- <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> -->
|
74 |
+
</div>
|
75 |
+
|
76 |
+
<?php
|
77 |
+
}
|
78 |
+
|
79 |
+
|
80 |
+
}
|
81 |
+
|
82 |
+
|
83 |
+
/**
|
84 |
+
* save meta box
|
85 |
+
*/
|
86 |
+
function save_meta_box( $post_id ) {
|
87 |
+
|
88 |
+
|
89 |
+
// Check if our nonce is set.
|
90 |
+
if ( ! isset( $_POST['ht_ctc_page_meta_box_nonce'] ) ) {
|
91 |
+
return;
|
92 |
+
}
|
93 |
+
|
94 |
+
$nonce = $_POST['ht_ctc_page_meta_box_nonce'];
|
95 |
+
|
96 |
+
// Verify that the nonce is valid.
|
97 |
+
if ( ! wp_verify_nonce( $nonce, 'ht_ctc_page_meta_box' ) ) {
|
98 |
+
return;
|
99 |
+
}
|
100 |
+
|
101 |
+
// If this is an autosave
|
102 |
+
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
|
103 |
+
return;
|
104 |
+
}
|
105 |
+
|
106 |
+
// Check the user's permissions.
|
107 |
+
if ( ! current_user_can( 'edit_post', $post_id ) ) {
|
108 |
+
return $post_id;
|
109 |
+
}
|
110 |
+
|
111 |
+
|
112 |
+
|
113 |
+
// if ( isset( $_POST['ht_ctc_page_number'] ) && $_POST['ht_ctc_page_number'] != '' ) {
|
114 |
+
if ( isset( $_POST['ht_ctc_page_number'] ) ) {
|
115 |
+
update_post_meta( $post_id, 'ht_ctc_page_number', sanitize_text_field( $_POST['ht_ctc_page_number'] ) );
|
116 |
+
}
|
117 |
+
|
118 |
+
if ( isset( $_POST['ht_ctc_page_call_to_action'] ) ) {
|
119 |
+
update_post_meta( $post_id, 'ht_ctc_page_call_to_action', sanitize_text_field( $_POST['ht_ctc_page_call_to_action'] ) );
|
120 |
+
}
|
121 |
+
|
122 |
+
if ( isset( $_POST['ht_ctc_page_group_id'] ) ) {
|
123 |
+
update_post_meta( $post_id, 'ht_ctc_page_group_id', sanitize_text_field( $_POST['ht_ctc_page_group_id'] ) );
|
124 |
+
}
|
125 |
+
|
126 |
+
}
|
127 |
+
|
128 |
+
|
129 |
+
|
130 |
+
|
131 |
+
|
132 |
+
}
|
133 |
+
|
134 |
+
$ht_ctc_metabox = new HT_CTC_MetaBox();
|
135 |
+
|
136 |
+
|
137 |
+
add_action( 'add_meta_boxes', array($ht_ctc_metabox, 'meta_box') );
|
138 |
+
add_action( 'save_post', array($ht_ctc_metabox, 'save_meta_box') );
|
139 |
+
|
140 |
+
|
141 |
+
endif; // END class_exists check
|
new/class-ht-ctc.php
ADDED
@@ -0,0 +1,218 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* new interface starter ..
|
4 |
+
*
|
5 |
+
* Include files - admin - front end
|
6 |
+
* add hooks
|
7 |
+
*
|
8 |
+
* added variable to declare other instance if needed
|
9 |
+
* ( in some cases in this plugin, using static methods and calling with out creating instance )
|
10 |
+
*
|
11 |
+
* @package CTC
|
12 |
+
* @since 2.0
|
13 |
+
*/
|
14 |
+
|
15 |
+
|
16 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
17 |
+
|
18 |
+
if ( ! class_exists( 'HT_CTC' ) ) :
|
19 |
+
|
20 |
+
class HT_CTC {
|
21 |
+
|
22 |
+
|
23 |
+
/**
|
24 |
+
* singleton instance
|
25 |
+
*
|
26 |
+
* @var HT_CTC
|
27 |
+
*/
|
28 |
+
private static $instance = null;
|
29 |
+
|
30 |
+
|
31 |
+
/**
|
32 |
+
* wp_is_mobile - if true then yes, else no
|
33 |
+
*
|
34 |
+
* @var if mobile, tab .. then yes, else no
|
35 |
+
*/
|
36 |
+
public $device_type;
|
37 |
+
|
38 |
+
|
39 |
+
/**
|
40 |
+
* instance of HT_CTC_Values
|
41 |
+
*
|
42 |
+
* database values , .. . options ..
|
43 |
+
*
|
44 |
+
* @var HT_CTC_Values
|
45 |
+
*/
|
46 |
+
public $values = null;
|
47 |
+
|
48 |
+
|
49 |
+
/**
|
50 |
+
* main instance - HT_CTC
|
51 |
+
*
|
52 |
+
* @return HT_CTC instance
|
53 |
+
* @since 1.0
|
54 |
+
*/
|
55 |
+
public static function instance() {
|
56 |
+
if ( is_null( self::$instance ) ) {
|
57 |
+
self::$instance = new self();
|
58 |
+
}
|
59 |
+
return self::$instance;
|
60 |
+
}
|
61 |
+
|
62 |
+
|
63 |
+
public function __clone() {
|
64 |
+
wc_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'click-to-chat-for-whatsapp' ), '1.0' );
|
65 |
+
}
|
66 |
+
|
67 |
+
public function __wakeup() {
|
68 |
+
wc_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'click-to-chat-for-whatsapp' ), '1.0' );
|
69 |
+
}
|
70 |
+
|
71 |
+
|
72 |
+
|
73 |
+
/**
|
74 |
+
* constructor
|
75 |
+
* calling to - includes - which include files
|
76 |
+
* calling to - hooks - which run hooks
|
77 |
+
*/
|
78 |
+
public function __construct() {
|
79 |
+
$this->define_constants();
|
80 |
+
|
81 |
+
$this->basic();
|
82 |
+
|
83 |
+
$this->includes();
|
84 |
+
$this->hooks();
|
85 |
+
}
|
86 |
+
|
87 |
+
|
88 |
+
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Define Constants
|
92 |
+
*
|
93 |
+
* @return void
|
94 |
+
*/
|
95 |
+
private function define_constants() {
|
96 |
+
|
97 |
+
$this->define( 'HT_CTC_WP_MIN_VERSION', '4.6' );
|
98 |
+
$this->define( 'HT_CTC_PLUGIN_DIR', plugin_dir_path( HT_CTC_PLUGIN_FILE ) );
|
99 |
+
$this->define( 'HT_CTC_PLUGIN_BASENAME', plugin_basename( HT_CTC_PLUGIN_FILE ) );
|
100 |
+
}
|
101 |
+
|
102 |
+
|
103 |
+
|
104 |
+
|
105 |
+
/**
|
106 |
+
* add the basic things
|
107 |
+
*
|
108 |
+
* calling this before include, initilize other things
|
109 |
+
*
|
110 |
+
* because this things may useful before initilize other things
|
111 |
+
*
|
112 |
+
* e.g. include, initialize files based on device, user settings
|
113 |
+
*/
|
114 |
+
private function basic() {
|
115 |
+
|
116 |
+
include_once HT_CTC_PLUGIN_DIR .'new/inc/commons/class-ht-ctc-ismobile.php';
|
117 |
+
include_once HT_CTC_PLUGIN_DIR .'new/inc/commons/class-ht-ctc-values.php';
|
118 |
+
|
119 |
+
$this->device_type = new HT_CTC_IsMobile();
|
120 |
+
$this->values = new HT_CTC_Values();
|
121 |
+
|
122 |
+
}
|
123 |
+
|
124 |
+
|
125 |
+
|
126 |
+
|
127 |
+
/**
|
128 |
+
* @uses this->define_constants
|
129 |
+
*
|
130 |
+
* @param string $name Constant name
|
131 |
+
* @param string.. $value Constant value
|
132 |
+
*/
|
133 |
+
private function define( $name, $value ) {
|
134 |
+
if ( ! defined( $name ) ) {
|
135 |
+
define( $name, $value );
|
136 |
+
}
|
137 |
+
}
|
138 |
+
|
139 |
+
|
140 |
+
|
141 |
+
|
142 |
+
/**
|
143 |
+
* include plugin file
|
144 |
+
*/
|
145 |
+
private function includes() {
|
146 |
+
|
147 |
+
// include in admin and front pages
|
148 |
+
include_once HT_CTC_PLUGIN_DIR .'new/inc/class-ht-ctc-register.php';
|
149 |
+
|
150 |
+
// is_admin ? include file to admin area : include files to non-admin area
|
151 |
+
if ( is_admin() ) {
|
152 |
+
include_once HT_CTC_PLUGIN_DIR . 'new/admin/admin.php';
|
153 |
+
} else {
|
154 |
+
|
155 |
+
// main file
|
156 |
+
include_once HT_CTC_PLUGIN_DIR . 'new/inc/class-ht-ctc-main.php';
|
157 |
+
|
158 |
+
// scripts
|
159 |
+
include_once HT_CTC_PLUGIN_DIR . 'new/inc/commons/class-ht-ctc-scripts.php';
|
160 |
+
|
161 |
+
}
|
162 |
+
}
|
163 |
+
|
164 |
+
|
165 |
+
|
166 |
+
/**
|
167 |
+
* Register hooks - when plugin activate, deactivate, uninstall
|
168 |
+
* commented deactivation, uninstall hook - its not needed as now
|
169 |
+
*
|
170 |
+
* plugins_loaded - Check Diff - uses when plugin updates.
|
171 |
+
*/
|
172 |
+
private function hooks() {
|
173 |
+
|
174 |
+
register_activation_hook( __FILE__, array( 'HT_CTC_Register', 'activate' ) );
|
175 |
+
register_deactivation_hook( __FILE__, array( 'HT_CTC_Register', 'deactivate' ) );
|
176 |
+
register_uninstall_hook(__FILE__, array( 'HT_CTC_Register', 'uninstall' ) );
|
177 |
+
|
178 |
+
// initilaze classes
|
179 |
+
if ( ! is_admin() ) {
|
180 |
+
add_action( 'init', array( $this, 'init' ), 0 );
|
181 |
+
}
|
182 |
+
|
183 |
+
// enable shortcodes in widget area.
|
184 |
+
add_filter('widget_text', 'do_shortcode');
|
185 |
+
|
186 |
+
// add_filter( 'the_excerpt', 'do_shortcode');
|
187 |
+
|
188 |
+
// settings page link
|
189 |
+
add_filter( 'plugin_action_links_' . HT_CTC_PLUGIN_BASENAME, array( 'HT_CTC_Register', 'plugin_action_links' ) );
|
190 |
+
|
191 |
+
// when plugin updated - check version diff
|
192 |
+
add_action('plugins_loaded', array( 'HT_CTC_Register', 'version_check' ) );
|
193 |
+
|
194 |
+
}
|
195 |
+
|
196 |
+
|
197 |
+
|
198 |
+
|
199 |
+
/**
|
200 |
+
* create instance
|
201 |
+
* @uses this->hooks() - using init hook - priority 0
|
202 |
+
*/
|
203 |
+
public function init() {
|
204 |
+
|
205 |
+
// $this->values = new HT_CTC_Values();
|
206 |
+
|
207 |
+
// $this->device_type = new HT_CTC_IsMobile();
|
208 |
+
|
209 |
+
// $this->floating_style = new HT_CTC_Floating_Style();
|
210 |
+
// $this->floating_style = new HT_CTC_Chat();
|
211 |
+
|
212 |
+
}
|
213 |
+
|
214 |
+
|
215 |
+
|
216 |
+
}
|
217 |
+
|
218 |
+
endif; // END class_exists check
|
new/inc/assets/css/main.css
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
@font-face {
|
3 |
+
font-family: 'ccw';
|
4 |
+
src: url(../fonts/ccw.eot);
|
5 |
+
src: url(../fonts/ccw.eot#iefix) format('embedded-opentype'),
|
6 |
+
url(../fonts/ccw.ttf) format('truetype'),
|
7 |
+
url(../fonts/ccw.woff) format('woff'),
|
8 |
+
url(../fonts/ccw.svg#ccw) format('svg');
|
9 |
+
font-weight: normal;
|
10 |
+
font-style: normal;
|
11 |
+
}
|
12 |
+
|
13 |
+
.icon {
|
14 |
+
/* use !important to prevent issues with browser extensions that change fonts */
|
15 |
+
font-family: 'ccw' !important;
|
16 |
+
speak: none;
|
17 |
+
font-style: normal;
|
18 |
+
font-weight: normal;
|
19 |
+
font-variant: normal;
|
20 |
+
text-transform: none;
|
21 |
+
line-height: 1;
|
22 |
+
|
23 |
+
/* Better Font Rendering =========== */
|
24 |
+
-webkit-font-smoothing: antialiased;
|
25 |
+
-moz-osx-font-smoothing: grayscale;
|
26 |
+
}
|
27 |
+
|
28 |
+
.icon-whatsapp2:before {
|
29 |
+
content: "\E902";
|
30 |
+
}
|
31 |
+
|
32 |
+
.icon-whatsapp:before {
|
33 |
+
content: "\ea93";
|
34 |
+
}
|
35 |
+
|
new/inc/assets/fonts/ccw.eot
ADDED
Binary file
|
new/inc/assets/fonts/ccw.svg
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" standalone="no"?>
|
2 |
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
3 |
+
<svg xmlns="http://www.w3.org/2000/svg">
|
4 |
+
<metadata>Generated by IcoMoon</metadata>
|
5 |
+
<defs>
|
6 |
+
<font id="ccw" horiz-adv-x="1024">
|
7 |
+
<font-face units-per-em="1024" ascent="960" descent="-64" />
|
8 |
+
<missing-glyph horiz-adv-x="1024" />
|
9 |
+
<glyph unicode=" " horiz-adv-x="512" d="" />
|
10 |
+
<glyph unicode="" glyph-name="send" d="M64 64v298l640 86-640 86v298l896-384z" />
|
11 |
+
<glyph unicode="" glyph-name="brand" d="M746.56 346.368c-12.8 6.4-75.328 36.992-87.040 41.216-11.648 4.288-20.16 6.4-28.672-6.4-8.448-12.608-32.896-41.152-40.32-49.6-7.424-8.32-14.848-8.96-27.52-3.2-12.8 6.4-53.888 19.84-102.528 63.36-37.888 33.92-63.36 75.52-70.848 88.32-7.424 12.8-0.832 19.84 5.568 26.24 5.76 5.76 12.8 14.72 19.2 22.4 6.272 7.68 8.32 12.8 12.672 21.12 4.224 8.96 2.112 16-1.088 22.4s-28.672 69.12-39.296 94.080c-10.24 24.96-20.8 21.76-28.672 21.76-7.36 0.64-15.872 0.64-24.32 0.64-8.576 0-22.4-3.2-34.048-15.36-11.648-12.8-44.544-43.52-44.544-105.6s45.632-122.24 51.968-131.2c6.4-8.32 89.856-136.32 217.6-191.36 30.464-12.8 54.144-20.48 72.704-26.88 30.464-9.6 58.24-8.32 80.192-5.12 24.512 3.84 75.392 30.72 86.016 60.8 10.88 30.080 10.88 55.040 7.68 60.8s-11.52 8.96-24.32 14.72zM514.56 32h-0.64c-75.52 0-150.4 20.48-215.68 58.88l-15.36 9.152-160-41.6 42.88 155.52-10.24 16c-42.24 67.2-64.64 144.64-64.64 224.384 0 232.32 190.080 421.76 424.192 421.76 113.28 0 219.52-44.16 299.52-124.16 80-79.36 124.16-185.6 124.16-298.24-0.192-232.32-190.272-421.76-423.872-421.76zM875.52 812.8c-97.28 94.080-225.28 147.2-361.6 147.2-280.832 0-509.44-227.584-509.632-507.392 0-89.408 23.424-176.64 68.032-253.696l-72.32-262.912 270.272 70.528c74.496-40.32 158.336-61.696 243.648-61.76h0.256c280.96 0 509.696 227.648 509.824 507.52 0 135.488-52.928 263.040-149.12 358.912z" />
|
12 |
+
<glyph unicode="" glyph-name="whatsapp2" horiz-adv-x="878" d="M562.857 394.286c9.714 0 102.857-48.571 106.857-55.429 1.143-2.857 1.143-6.286 1.143-8.571 0-14.286-4.571-30.286-9.714-43.429-13.143-32-66.286-52.571-98.857-52.571-27.429 0-84 24-108.571 35.429-81.714 37.143-132.571 100.571-181.714 173.143-21.714 32-41.143 71.429-40.571 110.857v4.571c1.143 37.714 14.857 64.571 42.286 90.286 8.571 8 17.714 12.571 29.714 12.571 6.857 0 13.714-1.714 21.143-1.714 15.429 0 18.286-4.571 24-19.429 4-9.714 33.143-87.429 33.143-93.143 0-21.714-39.429-46.286-39.429-59.429 0-2.857 1.143-5.714 2.857-8.571 12.571-26.857 36.571-57.714 58.286-78.286 26.286-25.143 54.286-41.714 86.286-57.714 4-2.286 8-4 12.571-4 17.143 0 45.714 55.429 60.571 55.429zM446.857 91.428c197.714 0 358.857 161.143 358.857 358.857s-161.143 358.857-358.857 358.857-358.857-161.143-358.857-358.857c0-75.429 24-149.143 68.571-210.286l-45.143-133.143 138.286 44c58.286-38.286 127.429-59.429 197.143-59.429zM446.857 881.143c237.714 0 430.857-193.143 430.857-430.857s-193.143-430.857-430.857-430.857c-72.571 0-144.571 18.286-208.571 53.714l-238.286-76.571 77.714 231.429c-40.571 66.857-61.714 144-61.714 222.286 0 237.714 193.143 430.857 430.857 430.857z" />
|
13 |
+
<glyph unicode="" glyph-name="whatsapp" d="M873 811.2c-95.8 96-223.2 148.8-359 148.8-279.6 0-507.2-227.6-507.2-507.4 0-89.4 23.4-176.8 67.8-253.6l-72-263 269 70.6c74.2-40.4 157.6-61.8 242.4-61.8h0.2c0 0 0 0 0 0 279.6 0 507.4 227.6 507.4 507.4 0 135.6-52.8 263-148.6 359zM514.2 30.4v0c-75.8 0-150 20.4-214.8 58.8l-15.4 9.2-159.6-41.8 42.6 155.6-10 16c-42.4 67-64.6 144.6-64.6 224.4 0 232.6 189.2 421.8 422 421.8 112.6 0 218.6-44 298.2-123.6 79.6-79.8 123.4-185.6 123.4-298.4-0.2-232.8-189.4-422-421.8-422zM745.4 346.4c-12.6 6.4-75 37-86.6 41.2s-20 6.4-28.6-6.4c-8.4-12.6-32.8-41.2-40.2-49.8-7.4-8.4-14.8-9.6-27.4-3.2s-53.6 19.8-102 63c-37.6 33.6-63.2 75.2-70.6 87.8s-0.8 19.6 5.6 25.8c5.8 5.6 12.6 14.8 19 22.2s8.4 12.6 12.6 21.2c4.2 8.4 2.2 15.8-1 22.2s-28.6 68.8-39 94.2c-10.2 24.8-20.8 21.4-28.6 21.8-7.4 0.4-15.8 0.4-24.2 0.4s-22.2-3.2-33.8-15.8c-11.6-12.6-44.4-43.4-44.4-105.8s45.4-122.6 51.8-131.2c6.4-8.4 89.4-136.6 216.6-191.4 30.2-13 53.8-20.8 72.2-26.8 30.4-9.6 58-8.2 79.8-5 24.4 3.6 75 30.6 85.6 60.2s10.6 55 7.4 60.2c-3 5.6-11.4 8.8-24.2 15.2z" />
|
14 |
+
</font></defs></svg>
|
new/inc/assets/fonts/ccw.ttf
ADDED
Binary file
|
new/inc/assets/fonts/ccw.woff
ADDED
Binary file
|
new/inc/assets/js/app.js
ADDED
@@ -0,0 +1,227 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Click to Chat - new interface
|
3 |
+
*/
|
4 |
+
|
5 |
+
var url = window.location.href;
|
6 |
+
|
7 |
+
|
8 |
+
// post title
|
9 |
+
var post_title = ht_ctc_var.post_title;
|
10 |
+
|
11 |
+
// is_mobile yes/no
|
12 |
+
var is_mobile = ht_ctc_var.is_mobile;
|
13 |
+
|
14 |
+
|
15 |
+
/**
|
16 |
+
* click
|
17 |
+
*/
|
18 |
+
ht_ctc_click_event();
|
19 |
+
|
20 |
+
function ht_ctc_click_event() {
|
21 |
+
|
22 |
+
// chat
|
23 |
+
var ht_ctc_chat = document.querySelectorAll('.ht-ctc-chat');
|
24 |
+
if (ht_ctc_chat) {
|
25 |
+
for(var i = 0; i < ht_ctc_chat.length; i++)
|
26 |
+
{
|
27 |
+
ht_ctc_chat[i].addEventListener('click', ht_ctc_clicked_chat );
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
// share
|
32 |
+
var ht_ctc_share = document.querySelectorAll('.ht-ctc-share');
|
33 |
+
if (ht_ctc_share) {
|
34 |
+
for(var i = 0; i < ht_ctc_share.length; i++)
|
35 |
+
{
|
36 |
+
ht_ctc_share[i].addEventListener('click', ht_ctc_clicked_share );
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
// group
|
41 |
+
var ht_ctc_group = document.querySelectorAll('.ht-ctc-group');
|
42 |
+
if (ht_ctc_group) {
|
43 |
+
for(var i = 0; i < ht_ctc_group.length; i++)
|
44 |
+
{
|
45 |
+
ht_ctc_group[i].addEventListener('click', ht_ctc_clicked_group );
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
// var woo = document.querySelector('.ht-ctc-chat-woo');
|
50 |
+
// if (woo) {
|
51 |
+
// woo.addEventListener('click', ht_click_clicked);
|
52 |
+
// }
|
53 |
+
}
|
54 |
+
|
55 |
+
// return_type
|
56 |
+
function ht_ctc_clicked_chat() {
|
57 |
+
ht_ctc_clicked('chat');
|
58 |
+
}
|
59 |
+
function ht_ctc_clicked_share() {
|
60 |
+
ht_ctc_clicked('share');
|
61 |
+
}
|
62 |
+
function ht_ctc_clicked_group() {
|
63 |
+
ht_ctc_clicked('group');
|
64 |
+
}
|
65 |
+
|
66 |
+
// clicked
|
67 |
+
function ht_ctc_clicked( return_type ) {
|
68 |
+
|
69 |
+
// link
|
70 |
+
ht_ctc_link( return_type );
|
71 |
+
|
72 |
+
// analytics
|
73 |
+
ht_ctc_analytics( return_type );
|
74 |
+
|
75 |
+
}
|
76 |
+
|
77 |
+
|
78 |
+
// link
|
79 |
+
function ht_ctc_link( return_type ) {
|
80 |
+
|
81 |
+
|
82 |
+
var base_link = '';
|
83 |
+
|
84 |
+
|
85 |
+
if (is_mobile == 'yes') {
|
86 |
+
// mobile, tab devices
|
87 |
+
|
88 |
+
if (return_type == 'group') {
|
89 |
+
// group
|
90 |
+
var base_link = 'https://chat.whatsapp.com/';
|
91 |
+
} else if (return_type == 'share') {
|
92 |
+
// share
|
93 |
+
var base_link = 'https://api.whatsapp.com/send';
|
94 |
+
} else {
|
95 |
+
// chat
|
96 |
+
// new way added direclty - window.open - using wa.me link
|
97 |
+
var base_link = 'https://api.whatsapp.com/send';
|
98 |
+
}
|
99 |
+
} else {
|
100 |
+
// desktop devices
|
101 |
+
|
102 |
+
if (return_type == 'group') {
|
103 |
+
// group
|
104 |
+
var base_link = 'https://chat.whatsapp.com/';
|
105 |
+
} else if (return_type == 'share') {
|
106 |
+
// share
|
107 |
+
var base_link = 'https://web.whatsapp.com/send';
|
108 |
+
} else {
|
109 |
+
// chat
|
110 |
+
// new way added direclty - window.open - using wa.me link
|
111 |
+
var base_link = 'https://web.whatsapp.com/send';
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
|
116 |
+
// var width = '10000';
|
117 |
+
// var height = '1000';
|
118 |
+
// var three = 'noopener';
|
119 |
+
// var blank = '';
|
120 |
+
|
121 |
+
// if ( 1 == 10 ) {
|
122 |
+
// // height, width
|
123 |
+
// var three = 'width='+width+',height='+height;
|
124 |
+
// } else if ( 1 == 1 ) {
|
125 |
+
// // blank
|
126 |
+
// var blank = "_blank";
|
127 |
+
// if ( 1 == 1 ) {
|
128 |
+
// // noopener
|
129 |
+
// var noopener = "noopener";
|
130 |
+
// }
|
131 |
+
// }
|
132 |
+
|
133 |
+
|
134 |
+
// link
|
135 |
+
if (return_type == 'group') {
|
136 |
+
// group
|
137 |
+
var group_id = ht_ctc_var_group.group_id;
|
138 |
+
window.open(base_link + group_id, '_blank', 'noopener');
|
139 |
+
} else if (return_type == 'share') {
|
140 |
+
// share
|
141 |
+
var share_text = ht_ctc_var_share.share_text;
|
142 |
+
window.open(base_link + '?text=' + share_text, '_blank', 'noopener');
|
143 |
+
} else {
|
144 |
+
// chat
|
145 |
+
var number = ht_ctc_var_chat.number;
|
146 |
+
var pre_filled = ht_ctc_var_chat.pre_filled;
|
147 |
+
|
148 |
+
// web/api.whastapp or wa.me
|
149 |
+
if ( '1' == ht_ctc_var_chat.webandapi ) {
|
150 |
+
// i.e. if web.whatsapp / api.whatsapp is checked
|
151 |
+
window.open(base_link + '?phone=' + number + '&text=' + pre_filled, '_blank', 'noopener');
|
152 |
+
} else {
|
153 |
+
// new way - wa.me link
|
154 |
+
var base_link = 'https://wa.me/';
|
155 |
+
window.open(base_link + number + '?text=' + pre_filled, '_blank', 'noopener');
|
156 |
+
}
|
157 |
+
|
158 |
+
}
|
159 |
+
|
160 |
+
}
|
161 |
+
|
162 |
+
|
163 |
+
// shortcode link
|
164 |
+
// know issue - if in link "" are used the link my not work properly.. (prefilled message)
|
165 |
+
function ht_ctc_shortcode_click(link) {
|
166 |
+
data_link = link.getAttribute("data-ctc-link");
|
167 |
+
window.open(data_link, '_blank', 'noopener');
|
168 |
+
|
169 |
+
return_type = link.getAttribute("data-ctc-type");
|
170 |
+
|
171 |
+
ht_ctc_analytics( return_type );
|
172 |
+
}
|
173 |
+
|
174 |
+
|
175 |
+
|
176 |
+
// Analytics
|
177 |
+
function ht_ctc_analytics( return_type ){
|
178 |
+
|
179 |
+
// Google Analytics
|
180 |
+
var is_ga_enable = ht_ctc_var.is_ga_enable;
|
181 |
+
if ( 'yes' == is_ga_enable ) {
|
182 |
+
ht_ctc_ga( return_type );
|
183 |
+
}
|
184 |
+
|
185 |
+
// FB Analytics
|
186 |
+
var is_fb_an_enable = ht_ctc_var.is_fb_an_enable;
|
187 |
+
if ( 'yes' == is_fb_an_enable ) {
|
188 |
+
ht_ctc_fb_an( return_type );
|
189 |
+
}
|
190 |
+
|
191 |
+
}
|
192 |
+
|
193 |
+
// Google Analytics
|
194 |
+
function ht_ctc_ga( return_type ) {
|
195 |
+
|
196 |
+
var ga_category = 'Click to Chat for WhatsApp';
|
197 |
+
var ga_action = 'return type: ' + return_type ;
|
198 |
+
var ga_label = post_title + ', ' + url ;
|
199 |
+
|
200 |
+
// // ga('send', 'event', 'Contact', 'Call Now Button', 'Phone');
|
201 |
+
|
202 |
+
if ("ga" in window) {
|
203 |
+
// if ( ga.window && ga.create) {
|
204 |
+
tracker = ga.getAll()[0];
|
205 |
+
if (tracker) tracker.send("event", ga_category, ga_action, ga_label );
|
206 |
+
} else if ("gtag" in window) {
|
207 |
+
gtag('event', ga_action, {
|
208 |
+
'event_category': ga_category,
|
209 |
+
'event_label': ga_label,
|
210 |
+
});
|
211 |
+
}
|
212 |
+
|
213 |
+
}
|
214 |
+
|
215 |
+
// FB Analytics
|
216 |
+
function ht_ctc_fb_an( return_type ) {
|
217 |
+
|
218 |
+
var fb_event_name = 'Click to Chat for WhatsApp';
|
219 |
+
|
220 |
+
var params = {};
|
221 |
+
params['Category'] = 'Click to Chat for WhatsApp';
|
222 |
+
params['Action'] = 'return type: ' + return_type;
|
223 |
+
params['Label'] = post_title + ', ' + url ;
|
224 |
+
|
225 |
+
// if fb analytics is not installed, then uncheck fb analytics option from main plugin settings
|
226 |
+
FB.AppEvents.logEvent( fb_event_name, null, params);
|
227 |
+
}
|
new/inc/chat/chat-position.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* @included from - class-ht-ctc-chat.php
|
5 |
+
*
|
6 |
+
* position to place ..
|
7 |
+
*/
|
8 |
+
|
9 |
+
|
10 |
+
|
11 |
+
$side_1 = esc_attr( $options['side_1'] );
|
12 |
+
$side_1_value = esc_attr( $options['side_1_value'] );
|
13 |
+
|
14 |
+
$side_2 = esc_attr( $options['side_2'] );
|
15 |
+
$side_2_value = esc_attr( $options['side_2_value'] );
|
16 |
+
|
17 |
+
$position = "$side_1: $side_1_value; $side_2: $side_2_value;";
|
new/inc/chat/chat-show-hide.php
ADDED
@@ -0,0 +1,200 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* @included from - class-ht-ctc-chat.php
|
5 |
+
*
|
6 |
+
* sets $display - yes to show styles or no to hide styles
|
7 |
+
*/
|
8 |
+
|
9 |
+
$this_page_id = get_the_ID();
|
10 |
+
|
11 |
+
|
12 |
+
// yes to display style and no to hide styles
|
13 |
+
// @uses at 'class-ht-ctc-chat.php'
|
14 |
+
$display = 'yes';
|
15 |
+
|
16 |
+
|
17 |
+
// show / hide
|
18 |
+
if ( 'show' == $options['show_or_hide'] ) {
|
19 |
+
// show based no
|
20 |
+
|
21 |
+
// in show - default display is no
|
22 |
+
$display = 'no';
|
23 |
+
|
24 |
+
$pages_list_toshow = $options['list_showon_pages'];
|
25 |
+
$pages_list_toshow_array = explode(',', $pages_list_toshow);
|
26 |
+
|
27 |
+
if( ( is_single() || is_page() ) && in_array( $this_page_id, $pages_list_toshow_array ) ) {
|
28 |
+
$display = 'yes';
|
29 |
+
return;
|
30 |
+
}
|
31 |
+
|
32 |
+
if ( is_single() && isset( $options['showon_posts'] ) ) {
|
33 |
+
$display = 'yes';
|
34 |
+
return;
|
35 |
+
}
|
36 |
+
|
37 |
+
if ( is_page() && isset( $options['showon_page'] ) ) {
|
38 |
+
if ( ( !is_home() ) && ( !is_front_page() ) ) {
|
39 |
+
$display = 'yes';
|
40 |
+
return;
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
// is_home and is_front_page - combined.
|
45 |
+
if ( ( is_home() || is_front_page() ) && ( isset( $options['showon_homepage'] ) ) ) {
|
46 |
+
$display = 'yes';
|
47 |
+
return;
|
48 |
+
}
|
49 |
+
|
50 |
+
|
51 |
+
if ( is_category() && isset( $options['showon_category'] ) ) {
|
52 |
+
$display = 'yes';
|
53 |
+
return;
|
54 |
+
}
|
55 |
+
|
56 |
+
if ( is_archive() && isset( $options['showon_archive'] ) ) {
|
57 |
+
$display = 'yes';
|
58 |
+
return;
|
59 |
+
}
|
60 |
+
|
61 |
+
if ( is_404() && isset( $options['showon_404'] ) ) {
|
62 |
+
$display = 'yes';
|
63 |
+
return;
|
64 |
+
}
|
65 |
+
|
66 |
+
// show on woocommerce single product pages.
|
67 |
+
if ( isset( $options['showon_wooproduct'] ) ) {
|
68 |
+
if ( function_exists( 'is_product' ) ) {
|
69 |
+
if ( is_product() ) {
|
70 |
+
$display = 'yes';
|
71 |
+
return;
|
72 |
+
}
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
// Hide styles on this catergorys - list
|
77 |
+
$list_showon_cat = $options['list_showon_cat'];
|
78 |
+
|
79 |
+
// avoid calling foreach, explode when hide on categorys list is empty
|
80 |
+
if( $list_showon_cat ) {
|
81 |
+
|
82 |
+
// Get current post Categorys list and create an array for that..
|
83 |
+
$current_categorys_array = array();
|
84 |
+
$current_categorys = get_the_category();
|
85 |
+
foreach ( $current_categorys as $category ) {
|
86 |
+
$current_categorys_array[] = strtolower($category->name);
|
87 |
+
}
|
88 |
+
|
89 |
+
$list_showon_cat_array = explode(',', $list_showon_cat);
|
90 |
+
|
91 |
+
foreach ( $list_showon_cat_array as $category ) {
|
92 |
+
$category_trim = trim($category);
|
93 |
+
if ( in_array( strtolower($category_trim), $current_categorys_array ) ) {
|
94 |
+
$display = 'yes';
|
95 |
+
return;
|
96 |
+
}
|
97 |
+
}
|
98 |
+
}
|
99 |
+
|
100 |
+
} else {
|
101 |
+
|
102 |
+
// hide based on
|
103 |
+
|
104 |
+
// in hide - default display is yes
|
105 |
+
$display = 'yes';
|
106 |
+
|
107 |
+
|
108 |
+
$pages_list_tohide = $options['list_hideon_pages'];
|
109 |
+
$pages_list_tohide_array = explode(',', $pages_list_tohide);
|
110 |
+
|
111 |
+
if( ( is_single() || is_page() ) && in_array( $this_page_id, $pages_list_tohide_array ) ) {
|
112 |
+
$display = 'no';
|
113 |
+
return;
|
114 |
+
}
|
115 |
+
|
116 |
+
if ( is_single() && isset( $options['hideon_posts'] ) ) {
|
117 |
+
$display = 'no';
|
118 |
+
return;
|
119 |
+
}
|
120 |
+
|
121 |
+
if ( is_page() && isset( $options['hideon_page'] ) ) {
|
122 |
+
if ( ( !is_home() ) && ( !is_front_page() ) ) {
|
123 |
+
$display = 'no';
|
124 |
+
return;
|
125 |
+
}
|
126 |
+
}
|
127 |
+
|
128 |
+
// is_home and is_front_page - combined.
|
129 |
+
if ( ( is_home() || is_front_page() ) && ( isset( $options['hideon_homepage'] ) ) ) {
|
130 |
+
$display = 'no';
|
131 |
+
return;
|
132 |
+
}
|
133 |
+
|
134 |
+
if ( is_category() && isset( $options['hideon_category'] ) ) {
|
135 |
+
$display = 'no';
|
136 |
+
return;
|
137 |
+
}
|
138 |
+
|
139 |
+
if ( is_archive() && isset( $options['hideon_archive'] ) ) {
|
140 |
+
$display = 'no';
|
141 |
+
return;
|
142 |
+
}
|
143 |
+
|
144 |
+
if ( is_404() && isset( $options['hideon_404'] ) ) {
|
145 |
+
$display = 'no';
|
146 |
+
return;
|
147 |
+
}
|
148 |
+
|
149 |
+
// hide on woocommerce single product pages.
|
150 |
+
if ( isset( $options['hideon_wooproduct'] ) ) {
|
151 |
+
if ( function_exists( 'is_product' ) ) {
|
152 |
+
if ( is_product() ) {
|
153 |
+
$display = 'no';
|
154 |
+
return;
|
155 |
+
}
|
156 |
+
}
|
157 |
+
}
|
158 |
+
|
159 |
+
// Hide styles on this catergorys - list
|
160 |
+
$list_hideon_cat = $options['list_hideon_cat'];
|
161 |
+
|
162 |
+
// avoid calling foreach, explode when hide on categorys list is empty
|
163 |
+
if( $list_hideon_cat ) {
|
164 |
+
|
165 |
+
// Get current post Categorys list and create an array for that..
|
166 |
+
$current_categorys_array = array();
|
167 |
+
$current_categorys = get_the_category();
|
168 |
+
foreach ( $current_categorys as $category ) {
|
169 |
+
$current_categorys_array[] = strtolower($category->name);
|
170 |
+
}
|
171 |
+
|
172 |
+
$list_hideon_cat_array = explode(',', $list_hideon_cat);
|
173 |
+
|
174 |
+
foreach ( $list_hideon_cat_array as $category ) {
|
175 |
+
$category_trim = trim($category);
|
176 |
+
if ( in_array( strtolower($category_trim), $current_categorys_array ) ) {
|
177 |
+
$display = 'no';
|
178 |
+
return;
|
179 |
+
}
|
180 |
+
}
|
181 |
+
}
|
182 |
+
|
183 |
+
}
|
184 |
+
|
185 |
+
|
186 |
+
// Hide based on device
|
187 |
+
|
188 |
+
if ( function_exists( 'wp_is_mobile' ) ) {
|
189 |
+
if ( wp_is_mobile() ) {
|
190 |
+
// mobile
|
191 |
+
if ( isset( $options['hideon_mobile'] ) ) {
|
192 |
+
$display = 'no';
|
193 |
+
}
|
194 |
+
} else {
|
195 |
+
// desktop
|
196 |
+
if ( isset( $options['hideon_desktop'] ) ) {
|
197 |
+
$display = 'no';
|
198 |
+
}
|
199 |
+
}
|
200 |
+
}
|
new/inc/chat/class-ht-ctc-chat-shortcode.php
ADDED
@@ -0,0 +1,194 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* shortcodes
|
4 |
+
* for list of attribute support check -> shortcode_atts ( $a )
|
5 |
+
*
|
6 |
+
* @package chat
|
7 |
+
* @since 2.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
11 |
+
|
12 |
+
if ( ! class_exists( 'HT_CTC_Chat_Shortcode' ) ) :
|
13 |
+
|
14 |
+
class HT_CTC_Chat_Shortcode {
|
15 |
+
|
16 |
+
|
17 |
+
// Register shortcode
|
18 |
+
public function shortcodes_init() {
|
19 |
+
add_shortcode( 'ht-ctc-chat', array( $this, 'shortcode' ) );
|
20 |
+
}
|
21 |
+
|
22 |
+
// call back function - shortcode
|
23 |
+
public function shortcode( $atts = [], $content = null, $shortcode = '' ) {
|
24 |
+
|
25 |
+
// $options = ht_ctc()->values->ctc_chat_options;
|
26 |
+
$options = get_option( 'ht_ctc_chat_options' );
|
27 |
+
|
28 |
+
$number_db = esc_attr( $options['number'] );
|
29 |
+
$call_to_action_db = esc_attr( $options['call_to_action'] );
|
30 |
+
$pre_filled_db = esc_attr( $options['pre_filled'] );
|
31 |
+
|
32 |
+
$number = __( $number_db , 'click-to-chat-for-whatsapp' );
|
33 |
+
$call_to_action = __( $call_to_action_db , 'click-to-chat-for-whatsapp' );
|
34 |
+
$pre_filled = __( $pre_filled_db , 'click-to-chat-for-whatsapp' );
|
35 |
+
|
36 |
+
$style_desktop = esc_attr( $options['style_desktop'] );
|
37 |
+
$style_mobile = esc_attr( $options['style_mobile'] );
|
38 |
+
|
39 |
+
$is_mobile = ht_ctc()->device_type->is_mobile();
|
40 |
+
|
41 |
+
$style = $style_desktop;;
|
42 |
+
if ( 'yes' == $is_mobile ) {
|
43 |
+
$style = $style_mobile;
|
44 |
+
}
|
45 |
+
|
46 |
+
// $content = do_shortcode($content);
|
47 |
+
|
48 |
+
// $ccw_options_cs = get_option('ccw_options_cs');
|
49 |
+
// use like $ccw_options_cs['']
|
50 |
+
|
51 |
+
$a = shortcode_atts(
|
52 |
+
array(
|
53 |
+
'number' => $number,
|
54 |
+
'call_to_action' => $call_to_action,
|
55 |
+
'pre_filled' => $pre_filled,
|
56 |
+
'style' => $style,
|
57 |
+
|
58 |
+
'position' => '',
|
59 |
+
'top' => '',
|
60 |
+
'right' => '',
|
61 |
+
'bottom' => '',
|
62 |
+
'left' => '',
|
63 |
+
'home' => '', // home - to hide on experts ..
|
64 |
+
'hide_mobile' => '',
|
65 |
+
'hide_desktop' => '',
|
66 |
+
// 'inline_issue' => '',
|
67 |
+
|
68 |
+
's5_img_position' => '', //left, right
|
69 |
+
's8_width' => '',
|
70 |
+
's8_icon_position' => '', // left, right, hide
|
71 |
+
|
72 |
+
), $atts, $shortcode );
|
73 |
+
// use like - '.$a["title"].'
|
74 |
+
|
75 |
+
|
76 |
+
// number
|
77 |
+
$number = $a["number"];
|
78 |
+
|
79 |
+
// pre-filled text
|
80 |
+
$page_url = get_permalink();
|
81 |
+
$page_title = esc_html( get_the_title() );
|
82 |
+
|
83 |
+
$pre_filled = $a["pre_filled"];
|
84 |
+
|
85 |
+
$pre_filled = str_replace( '{{url}}', $page_url, $pre_filled );
|
86 |
+
$pre_filled = str_replace( '{{title}}', $page_title, $pre_filled );
|
87 |
+
|
88 |
+
// hide on devices
|
89 |
+
// if 'yes' then hide
|
90 |
+
$hide_mobile = $a["hide_mobile"];
|
91 |
+
$hide_desktop = $a["hide_desktop"];
|
92 |
+
|
93 |
+
if( 'yes' == $is_mobile ) {
|
94 |
+
if ( 'yes' == $hide_mobile ) {
|
95 |
+
return;
|
96 |
+
}
|
97 |
+
} else {
|
98 |
+
if ( 'yes' == $hide_desktop ) {
|
99 |
+
return;
|
100 |
+
}
|
101 |
+
}
|
102 |
+
|
103 |
+
|
104 |
+
|
105 |
+
$position = $a["position"];
|
106 |
+
$top = $a["top"];
|
107 |
+
$right = $a["right"];
|
108 |
+
$bottom = $a["bottom"];
|
109 |
+
$left = $a["left"];
|
110 |
+
|
111 |
+
$css = '';
|
112 |
+
|
113 |
+
if ( '' !== $position ) {
|
114 |
+
$css .= 'position:'.$position.';';
|
115 |
+
}
|
116 |
+
if ( '' !== $top ) {
|
117 |
+
$css .= 'top:'.$top.';';
|
118 |
+
}
|
119 |
+
if ( '' !== $right ) {
|
120 |
+
$css .= 'right:'.$right.';';
|
121 |
+
}
|
122 |
+
if ( '' !== $bottom ) {
|
123 |
+
$css .= 'bottom:'.$bottom.';';
|
124 |
+
}
|
125 |
+
if ( '' !== $left ) {
|
126 |
+
$css .= 'left:'.$left.';';
|
127 |
+
}
|
128 |
+
|
129 |
+
// to hide styles in home page
|
130 |
+
$home = $a["home"];
|
131 |
+
|
132 |
+
// $position !== 'fixed' why !== to avoid double time adding display: none ..
|
133 |
+
if ( 'fixed' !== $position && 'hide' == $home && ( is_home() || is_category() || is_archive() ) ) {
|
134 |
+
$css .= 'display:none;';
|
135 |
+
}
|
136 |
+
|
137 |
+
// By default postion: fixed style hide on home screen,
|
138 |
+
// if plan to show, then add hide='show' ( actually something not equal to 'hide' )
|
139 |
+
if ( 'fixed' == $position && 'show' !== $home && ( is_home() || is_category() || is_archive() ) ) {
|
140 |
+
$css .= 'display:none;';
|
141 |
+
}
|
142 |
+
|
143 |
+
$web_api = 'web';
|
144 |
+
|
145 |
+
// mobile
|
146 |
+
if ( 'yes' == $is_mobile ) {
|
147 |
+
$web_api = 'api';
|
148 |
+
} else {
|
149 |
+
$web_api = 'web';
|
150 |
+
}
|
151 |
+
|
152 |
+
// if cache issue
|
153 |
+
if ( isset ( $options['cache_issue'] ) ) {
|
154 |
+
$web_api = 'api';
|
155 |
+
}
|
156 |
+
|
157 |
+
$link = "https://$web_api.whatsapp.com/send?phone=$number&text=$pre_filled";
|
158 |
+
$return_type = "chat";
|
159 |
+
|
160 |
+
$style = $a["style"];
|
161 |
+
|
162 |
+
// call to action
|
163 |
+
$call_to_action = $a["call_to_action"];
|
164 |
+
$class_names = "ht-ctc-sc-chat sc-style-$style";
|
165 |
+
|
166 |
+
$o = '';
|
167 |
+
|
168 |
+
// shortcode template file path
|
169 |
+
$sc_path = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/styles-shortcode/sc-style-' . $style. '.php';
|
170 |
+
|
171 |
+
if ( is_file( $sc_path ) ) {
|
172 |
+
include $sc_path;
|
173 |
+
} else {
|
174 |
+
// if style is not in the list..
|
175 |
+
$img_link = plugins_url("./prev/assets/img/whatsapp-logo.png", HT_CCW_PLUGIN_FILE );
|
176 |
+
$o .= '<div class="ccw_plugin">';
|
177 |
+
$o .= '<img class="img-icon-sc sc_item pointer style-3-sc" src="'.$img_link.'" alt="WhatsApp chat" onclick="'.$img_click_link.'" style="height: 36px; '.$css.' " >';
|
178 |
+
$o .= '</div>';
|
179 |
+
}
|
180 |
+
|
181 |
+
|
182 |
+
return $o;
|
183 |
+
|
184 |
+
}
|
185 |
+
|
186 |
+
|
187 |
+
}
|
188 |
+
|
189 |
+
|
190 |
+
$shortcode = new HT_CTC_Chat_Shortcode();
|
191 |
+
|
192 |
+
add_action('init', array( $shortcode, 'shortcodes_init' ) );
|
193 |
+
|
194 |
+
endif; // END class_exists check
|
new/inc/chat/class-ht-ctc-chat.php
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WhatsApp Chat - main page ..
|
4 |
+
*
|
5 |
+
* @subpackage chat
|
6 |
+
*/
|
7 |
+
|
8 |
+
|
9 |
+
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
11 |
+
|
12 |
+
if ( ! class_exists( 'HT_CTC_Chat' ) ) :
|
13 |
+
|
14 |
+
class HT_CTC_Chat {
|
15 |
+
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Which features are enable - based on this call function ..
|
19 |
+
*/
|
20 |
+
public function chat() {
|
21 |
+
|
22 |
+
$options = get_option('ht_ctc_chat_options');
|
23 |
+
|
24 |
+
|
25 |
+
// show/hide ..
|
26 |
+
include_once HT_CTC_PLUGIN_DIR .'new/inc/chat/chat-show-hide.php';
|
27 |
+
|
28 |
+
if ( 'no' == $display ) {
|
29 |
+
return;
|
30 |
+
}
|
31 |
+
|
32 |
+
// position
|
33 |
+
include_once HT_CTC_PLUGIN_DIR .'new/inc/chat/chat-position.php';
|
34 |
+
|
35 |
+
// is mobile to select styles
|
36 |
+
$is_mobile = ht_ctc()->device_type->is_mobile();
|
37 |
+
|
38 |
+
// style
|
39 |
+
if ( 'yes' == $is_mobile ) {
|
40 |
+
$style = esc_attr( $options['style_mobile'] );
|
41 |
+
} else {
|
42 |
+
$style = esc_attr( $options['style_desktop'] );
|
43 |
+
}
|
44 |
+
|
45 |
+
// call to action
|
46 |
+
// todo localization for number, .. ( at variables page ) - call to action for share, group
|
47 |
+
$call_to_action_db = esc_attr( $options['call_to_action'] );
|
48 |
+
$call_to_action = __( $call_to_action_db , 'click-to-chat-for-whatsapp' );
|
49 |
+
|
50 |
+
|
51 |
+
// call to action - at page level
|
52 |
+
$page_id = get_the_ID();
|
53 |
+
$page_call_to_action = esc_attr( get_post_meta( $page_id, 'ht_ctc_page_call_to_action', true ) );
|
54 |
+
|
55 |
+
if ( isset( $page_call_to_action ) && '' !== $page_call_to_action ){
|
56 |
+
$call_to_action = $page_call_to_action;
|
57 |
+
}
|
58 |
+
|
59 |
+
// class names
|
60 |
+
$class_names = "ht-ctc-chat style-$style";
|
61 |
+
|
62 |
+
// call style
|
63 |
+
$path = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/styles/style-' . $style. '.php';
|
64 |
+
|
65 |
+
if ( is_file( $path ) ) {
|
66 |
+
include $path;
|
67 |
+
}
|
68 |
+
|
69 |
+
|
70 |
+
}
|
71 |
+
|
72 |
+
}
|
73 |
+
|
74 |
+
// new HT_CTC_Chat();
|
75 |
+
|
76 |
+
$ht_ctc_chat = new HT_CTC_Chat();
|
77 |
+
add_action( 'wp_footer', array( $ht_ctc_chat, 'chat' ) );
|
78 |
+
|
79 |
+
|
80 |
+
endif; // END class_exists check
|
new/inc/class-ht-ctc-main.php
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* main file to get started for front end ..
|
4 |
+
*/
|
5 |
+
|
6 |
+
|
7 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
8 |
+
|
9 |
+
if ( ! class_exists( 'HT_CTC_Main' ) ) :
|
10 |
+
|
11 |
+
class HT_CTC_Main {
|
12 |
+
|
13 |
+
public function __construct() {
|
14 |
+
$this->enables();
|
15 |
+
}
|
16 |
+
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Which features are enable - based on this call function..
|
20 |
+
*
|
21 |
+
*/
|
22 |
+
public function enables() {
|
23 |
+
|
24 |
+
$options = get_option( 'ht_ctc_main_options' );
|
25 |
+
|
26 |
+
|
27 |
+
// if enable call 'chat' features
|
28 |
+
if ( isset( $options['enable_chat'] ) ) {
|
29 |
+
include_once HT_CTC_PLUGIN_DIR .'new/inc/chat/class-ht-ctc-chat.php';
|
30 |
+
|
31 |
+
include_once HT_CTC_PLUGIN_DIR . 'new/inc/chat/class-ht-ctc-chat-shortcode.php';
|
32 |
+
}
|
33 |
+
|
34 |
+
|
35 |
+
// if enable call 'group' features
|
36 |
+
if ( isset( $options['enable_group'] ) ) {
|
37 |
+
include_once HT_CTC_PLUGIN_DIR .'new/inc/group/class-ht-ctc-group.php';
|
38 |
+
|
39 |
+
include_once HT_CTC_PLUGIN_DIR . 'new/inc/group/class-ht-ctc-group-shortcode.php';
|
40 |
+
|
41 |
+
}
|
42 |
+
|
43 |
+
// if enabled call 'share' features
|
44 |
+
if ( isset( $options['enable_share'] ) ) {
|
45 |
+
include_once HT_CTC_PLUGIN_DIR .'new/inc/share/class-ht-ctc-share.php';
|
46 |
+
|
47 |
+
include_once HT_CTC_PLUGIN_DIR . 'new/inc/share/class-ht-ctc-share-shortcode.php';
|
48 |
+
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
+
|
53 |
+
public function variables() {
|
54 |
+
|
55 |
+
// include variables.. as of now display on all pages ..
|
56 |
+
include_once HT_CTC_PLUGIN_DIR .'new/inc/commons/ht-ctc-variables.php';
|
57 |
+
|
58 |
+
}
|
59 |
+
|
60 |
+
|
61 |
+
}
|
62 |
+
|
63 |
+
$ht_ctc_main = new HT_CTC_Main();
|
64 |
+
|
65 |
+
// variables
|
66 |
+
add_action( 'wp_footer', array( $ht_ctc_main, 'variables' ) );
|
67 |
+
|
68 |
+
|
69 |
+
endif; // END class_exists check
|
new/inc/class-ht-ctc-register.php
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* three function - while activate , deactivate , uninstall( while deleting )
|
4 |
+
* as plan to preserve the database options which usefull when reinstall plugin/ update
|
5 |
+
* so that setting wont last
|
6 |
+
* and as no custom post types or so.. to flush rewrite rules
|
7 |
+
* so deactivate, uninstall not doing any thing here
|
8 |
+
*
|
9 |
+
* @package ctc
|
10 |
+
* @since 2.0
|
11 |
+
*/
|
12 |
+
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
14 |
+
|
15 |
+
if ( ! class_exists( 'HT_CTC_Register' ) ) :
|
16 |
+
|
17 |
+
class HT_CTC_Register {
|
18 |
+
|
19 |
+
// when plugin activate
|
20 |
+
public static function activate() {
|
21 |
+
|
22 |
+
|
23 |
+
if( version_compare( get_bloginfo('version'), '3.1.0', '<') ) {
|
24 |
+
wp_die( 'please update WordPress' );
|
25 |
+
}
|
26 |
+
|
27 |
+
// add default values to options db
|
28 |
+
include_once( HT_CTC_PLUGIN_DIR . '/new/admin/class-ht-ctc-db.php' );
|
29 |
+
}
|
30 |
+
|
31 |
+
// when plugin deactivate
|
32 |
+
public static function deactivate() {
|
33 |
+
}
|
34 |
+
|
35 |
+
// when plugin uninstall
|
36 |
+
public static function uninstall() {
|
37 |
+
}
|
38 |
+
|
39 |
+
// for plugin updates - run on plugins_loaded
|
40 |
+
public static function version_check() {
|
41 |
+
|
42 |
+
$ht_ctc_plugin_details = get_option('ht_ctc_plugin_details');
|
43 |
+
|
44 |
+
if ( HT_CTC_VERSION !== $ht_ctc_plugin_details['version'] ) {
|
45 |
+
// to update the plugin - just like activate plugin
|
46 |
+
self::activate();
|
47 |
+
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
// add settings page links in plugins page - at plugin
|
52 |
+
public static function plugin_action_links( $links ) {
|
53 |
+
$new_links = array(
|
54 |
+
'settings' => '<a href="' . admin_url( 'admin.php?page=click-to-chat' ) . '">' . __( 'Settings' , 'click-to-chat-for-whatsapp' ) . '</a>',
|
55 |
+
);
|
56 |
+
|
57 |
+
return array_merge( $new_links, $links );
|
58 |
+
}
|
59 |
+
|
60 |
+
|
61 |
+
|
62 |
+
}
|
63 |
+
|
64 |
+
endif; // END class_exists check
|
new/inc/commons/class-ht-ctc-ismobile.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* find mobile device or not ..
|
4 |
+
*/
|
5 |
+
|
6 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
7 |
+
|
8 |
+
if ( ! class_exists( 'HT_CTC_IsMobile' ) ) :
|
9 |
+
|
10 |
+
class HT_CTC_IsMobile {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* return is mobile or not
|
14 |
+
* while using in condition check with 1 not with 2
|
15 |
+
* @var int - if mobile : 1 ? 2
|
16 |
+
*/
|
17 |
+
public $is_mobile;
|
18 |
+
|
19 |
+
public function __construct() {
|
20 |
+
|
21 |
+
// $this->is_mobile = $this->is_mobile();
|
22 |
+
$this->is_mobile = $this->is_mobile();
|
23 |
+
|
24 |
+
}
|
25 |
+
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Check is mobile device or not
|
29 |
+
* wp_is_mobile - if true then 1, else 2
|
30 |
+
*/
|
31 |
+
public function is_mobile() {
|
32 |
+
|
33 |
+
if ( function_exists( 'wp_is_mobile' ) ) {
|
34 |
+
if ( wp_is_mobile() ) {
|
35 |
+
return $this->is_mobile = 'yes';
|
36 |
+
} else {
|
37 |
+
return $this->is_mobile = 'no';
|
38 |
+
}
|
39 |
+
} else {
|
40 |
+
// added like this - an user mention that wp_is_mobile uncauched error
|
41 |
+
if ( $this->php_is_mobile() ) {
|
42 |
+
return $this->is_mobile = 'yes';
|
43 |
+
} else {
|
44 |
+
return $this->is_mobile = 'no';
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
}
|
49 |
+
|
50 |
+
|
51 |
+
/**
|
52 |
+
* @uses $this -> is_mobile
|
53 |
+
*
|
54 |
+
* fallback for wp_is_mobile
|
55 |
+
* php way of find is mobile - but not with wordpress defined wp_is_mobile
|
56 |
+
*
|
57 |
+
* wp_is_mobile is more efficient
|
58 |
+
* - uses if in user server cause Fatal error: Uncaught Error
|
59 |
+
* @return boolean
|
60 |
+
*/
|
61 |
+
public function php_is_mobile() {
|
62 |
+
// return preg_match("/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i", $_SERVER["HTTP_USER_AGENT"]);
|
63 |
+
return preg_match("/(android|webos|avantgo|iphone|ipad|ipod|blackberry|iemobile|bolt|boost|cricket|docomo|fone|hiptop|mini|opera mini|kitkat|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i", $_SERVER["HTTP_USER_AGENT"]);
|
64 |
+
}
|
65 |
+
|
66 |
+
|
67 |
+
|
68 |
+
}
|
69 |
+
|
70 |
+
endif; // END class_exists check
|
new/inc/commons/class-ht-ctc-scripts.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Register css styles, javascript files front end
|
4 |
+
*
|
5 |
+
* @package ctc
|
6 |
+
* @since 2.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
10 |
+
|
11 |
+
if ( ! class_exists( 'HT_CTC_Scripts' ) ) :
|
12 |
+
|
13 |
+
class HT_CTC_Scripts {
|
14 |
+
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Register styles - front end ( non admin )
|
18 |
+
*
|
19 |
+
* @since 1.0
|
20 |
+
*/
|
21 |
+
function register_scripts() {
|
22 |
+
|
23 |
+
// css
|
24 |
+
wp_enqueue_style('ht_ctc_main_css', plugins_url( 'new/inc/assets/css/main.css', HT_CTC_PLUGIN_FILE ), '', HT_CTC_VERSION );
|
25 |
+
|
26 |
+
// style-8 - enqueue at page level
|
27 |
+
wp_register_style('ht_ctc_mdstyle8_css', plugins_url( 'prev/assets/css/mdstyle8.css', HT_CTC_PLUGIN_FILE ) , '', HT_CTC_VERSION );
|
28 |
+
|
29 |
+
|
30 |
+
// js
|
31 |
+
wp_enqueue_script( 'ht_ctc_app_js', plugins_url( 'new/inc/assets/js/app.js', HT_CTC_PLUGIN_FILE ), array ( 'jquery' ), HT_CTC_VERSION, true );
|
32 |
+
|
33 |
+
|
34 |
+
}
|
35 |
+
|
36 |
+
}
|
37 |
+
|
38 |
+
$ht_ctc_scripts = new HT_CTC_Scripts();
|
39 |
+
|
40 |
+
add_action('wp_enqueue_scripts', array( $ht_ctc_scripts, 'register_scripts' ) );
|
41 |
+
|
42 |
+
endif; // END class_exists check
|
new/inc/commons/class-ht-ctc-values.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* variables/values.. db values..
|
4 |
+
*
|
5 |
+
* ht_ctc()->values->ctc_options['number'];
|
6 |
+
* or
|
7 |
+
* $values = ht_ctc()->values->ctc_options;
|
8 |
+
* $values["number"];
|
9 |
+
*
|
10 |
+
* similar to variables.php in /prev
|
11 |
+
* @package ctc
|
12 |
+
* @since 2.0
|
13 |
+
*/
|
14 |
+
|
15 |
+
|
16 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
17 |
+
|
18 |
+
if ( ! class_exists( 'HT_CTC_Values' ) ) :
|
19 |
+
|
20 |
+
class HT_CTC_Values {
|
21 |
+
|
22 |
+
|
23 |
+
/**
|
24 |
+
* db options table - ht_ctc_options values
|
25 |
+
*
|
26 |
+
* @var array get_options ht_ctc_options
|
27 |
+
*/
|
28 |
+
// public $ctc_options;
|
29 |
+
|
30 |
+
|
31 |
+
/**
|
32 |
+
* db options table - ht_ctc_chat_options values
|
33 |
+
*
|
34 |
+
* @var array get_options ht_ctc_chat_options
|
35 |
+
*/
|
36 |
+
public $ctc_chat_options;
|
37 |
+
|
38 |
+
|
39 |
+
public function __construct() {
|
40 |
+
$this->ctc_chat_options_fn();
|
41 |
+
// $this->is_mobile_fn();
|
42 |
+
}
|
43 |
+
|
44 |
+
|
45 |
+
public function ctc_chat_options_fn() {
|
46 |
+
$this->ctc_chat_options = get_option('ht_ctc_chat_options');
|
47 |
+
}
|
48 |
+
|
49 |
+
// public function is_mobile_fn() {
|
50 |
+
|
51 |
+
// }
|
52 |
+
|
53 |
+
|
54 |
+
}
|
55 |
+
|
56 |
+
endif; // END class_exists check
|
new/inc/commons/ht-ctc-variables.php
ADDED
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Variables
|
4 |
+
*
|
5 |
+
* uses to call at javascript..
|
6 |
+
*
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
10 |
+
|
11 |
+
$main_options = get_option('ht_ctc_main_options');
|
12 |
+
|
13 |
+
$page_id = get_the_ID();
|
14 |
+
$post_title = esc_html( get_the_title() );
|
15 |
+
|
16 |
+
|
17 |
+
// Analytics - to have to add another var .. and pass main options
|
18 |
+
$is_ga_enable = 'no';
|
19 |
+
$is_fb_an_enable = 'no';
|
20 |
+
|
21 |
+
if ( isset( $main_options['google_analytics'] ) ) {
|
22 |
+
$is_ga_enable = 'yes';
|
23 |
+
}
|
24 |
+
|
25 |
+
if ( isset( $main_options['fb_analytics'] ) ) {
|
26 |
+
$is_fb_an_enable = 'yes';
|
27 |
+
}
|
28 |
+
|
29 |
+
$ht_ctc_options = ht_ctc();
|
30 |
+
|
31 |
+
// is_mobile
|
32 |
+
$is_mobile = $ht_ctc_options->device_type->is_mobile;
|
33 |
+
|
34 |
+
|
35 |
+
// variables ..
|
36 |
+
$ht_ctc_var = array (
|
37 |
+
'is_mobile' => $is_mobile,
|
38 |
+
'post_title' => $post_title,
|
39 |
+
'is_ga_enable' => $is_ga_enable,
|
40 |
+
'is_fb_an_enable' => $is_fb_an_enable,
|
41 |
+
);
|
42 |
+
|
43 |
+
wp_localize_script( 'ht_ctc_app_js', 'ht_ctc_var', $ht_ctc_var );
|
44 |
+
|
45 |
+
|
46 |
+
/**
|
47 |
+
* if Chat enabled
|
48 |
+
*/
|
49 |
+
if ( isset( $main_options['enable_chat'] ) ) {
|
50 |
+
|
51 |
+
// number
|
52 |
+
$number = esc_attr( $ht_ctc_options->values->ctc_chat_options['number'] );
|
53 |
+
|
54 |
+
// number - at page level
|
55 |
+
$page_number = esc_attr( get_post_meta( $page_id, 'ht_ctc_page_number', true ) );
|
56 |
+
|
57 |
+
if ( isset( $page_number ) && '' !== $page_number ){
|
58 |
+
$number = $page_number;
|
59 |
+
}
|
60 |
+
|
61 |
+
$chat_show_or_hide = esc_attr( $ht_ctc_options->values->ctc_chat_options['show_or_hide'] );
|
62 |
+
|
63 |
+
|
64 |
+
$page_url = get_permalink();
|
65 |
+
|
66 |
+
// chat
|
67 |
+
$pre_filled = esc_attr( $ht_ctc_options->values->ctc_chat_options['pre_filled'] );
|
68 |
+
$pre_filled = str_replace( '{{url}}', $page_url, $pre_filled );
|
69 |
+
$pre_filled = str_replace( '{{title}}', $post_title, $pre_filled );
|
70 |
+
|
71 |
+
$chat_webandapi = '';
|
72 |
+
if ( isset( $ht_ctc_options->values->ctc_chat_options['webandapi'] ) ) {
|
73 |
+
$chat_webandapi = '1';
|
74 |
+
}
|
75 |
+
|
76 |
+
// chat variables ..
|
77 |
+
$ht_ctc_var_chat = array (
|
78 |
+
'number' => $number,
|
79 |
+
'pre_filled' => $pre_filled,
|
80 |
+
'show_or_hide' => $chat_show_or_hide,
|
81 |
+
'webandapi' => $chat_webandapi
|
82 |
+
);
|
83 |
+
|
84 |
+
|
85 |
+
wp_localize_script( 'ht_ctc_app_js', 'ht_ctc_var_chat', $ht_ctc_var_chat );
|
86 |
+
|
87 |
+
}
|
88 |
+
|
89 |
+
|
90 |
+
/**
|
91 |
+
* if group enabled
|
92 |
+
*/
|
93 |
+
if ( isset( $main_options['enable_group'] ) ) {
|
94 |
+
|
95 |
+
|
96 |
+
$ht_ctc_group = get_option('ht_ctc_group');
|
97 |
+
|
98 |
+
$group_id = esc_attr( $ht_ctc_group['group_id'] );
|
99 |
+
|
100 |
+
// group_id - at page level
|
101 |
+
$page_group_id = esc_attr( get_post_meta( $page_id, 'ht_ctc_page_group_id', true ) );
|
102 |
+
|
103 |
+
if ( isset( $page_group_id ) && '' !== $page_group_id ){
|
104 |
+
$group_id = $page_group_id;
|
105 |
+
}
|
106 |
+
|
107 |
+
$group_show_or_hide = esc_attr( $ht_ctc_group['show_or_hide'] );
|
108 |
+
|
109 |
+
// Group variables
|
110 |
+
$ht_ctc_var_group = array (
|
111 |
+
'group_id' => $group_id,
|
112 |
+
'show_or_hide' => $group_show_or_hide
|
113 |
+
);
|
114 |
+
|
115 |
+
|
116 |
+
wp_localize_script( 'ht_ctc_app_js', 'ht_ctc_var_group', $ht_ctc_var_group );
|
117 |
+
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* if share enabled
|
122 |
+
*/
|
123 |
+
if ( isset( $main_options['enable_share'] ) ) {
|
124 |
+
|
125 |
+
$ht_ctc_share = get_option('ht_ctc_share');
|
126 |
+
|
127 |
+
$share_text = esc_attr( $ht_ctc_share['share_text'] );
|
128 |
+
|
129 |
+
// if ( is_home() || is_front_page() ) {
|
130 |
+
if ( is_home() ) {
|
131 |
+
$page_title = get_bloginfo('name');
|
132 |
+
$page_url = get_bloginfo('url');
|
133 |
+
}
|
134 |
+
|
135 |
+
$share_text = str_replace( '{{url}}', $page_url, $share_text );
|
136 |
+
$share_text = str_replace( '{{title}}', $page_title, $share_text );
|
137 |
+
|
138 |
+
$share_show_or_hide = $ht_ctc_share['show_or_hide'];
|
139 |
+
|
140 |
+
// Share variables
|
141 |
+
$ht_ctc_var_share = array (
|
142 |
+
'share_text' => $share_text,
|
143 |
+
'show_or_hide' => $share_show_or_hide
|
144 |
+
);
|
145 |
+
|
146 |
+
|
147 |
+
wp_localize_script( 'ht_ctc_app_js', 'ht_ctc_var_share', $ht_ctc_var_share );
|
148 |
+
|
149 |
+
}
|
new/inc/group/class-ht-ctc-group-shortcode.php
ADDED
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* shortcodes
|
4 |
+
* for list of attribute support check -> shortcode_atts ( $a )
|
5 |
+
*
|
6 |
+
* @package chat
|
7 |
+
* @since 2.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
11 |
+
|
12 |
+
if ( ! class_exists( 'HT_CTC_Group_Shortcode' ) ) :
|
13 |
+
|
14 |
+
class HT_CTC_Group_Shortcode {
|
15 |
+
|
16 |
+
|
17 |
+
// Register shortcode
|
18 |
+
public function shortcodes_init() {
|
19 |
+
add_shortcode( 'ht-ctc-group', array( $this, 'shortcode' ) );
|
20 |
+
}
|
21 |
+
|
22 |
+
// call back function - shortcode
|
23 |
+
public function shortcode( $atts = [], $content = null, $shortcode = '' ) {
|
24 |
+
|
25 |
+
$options = get_option('ht_ctc_group');
|
26 |
+
|
27 |
+
|
28 |
+
$group_id = esc_attr( $options['group_id'] );
|
29 |
+
$call_to_action_db = esc_attr( $options['call_to_action'] );
|
30 |
+
$pre_filled_db = esc_attr( $options['pre_filled'] );
|
31 |
+
|
32 |
+
$group_id = __( $group_id , 'click-to-chat-for-whatsapp' );
|
33 |
+
$call_to_action = __( $call_to_action_db , 'click-to-chat-for-whatsapp' );
|
34 |
+
$pre_filled = __( $pre_filled_db , 'click-to-chat-for-whatsapp' );
|
35 |
+
|
36 |
+
$style_desktop = esc_attr( $options['style_desktop'] );
|
37 |
+
$style_mobile = esc_attr( $options['style_mobile'] );
|
38 |
+
|
39 |
+
$is_mobile = ht_ctc()->device_type->is_mobile();
|
40 |
+
|
41 |
+
$style = $style_desktop;;
|
42 |
+
if ( 'yes' == $is_mobile ) {
|
43 |
+
$style = $style_mobile;
|
44 |
+
}
|
45 |
+
|
46 |
+
// $content = do_shortcode($content);
|
47 |
+
|
48 |
+
// $ccw_options_cs = get_option('ccw_options_cs');
|
49 |
+
// use like $ccw_options_cs['']
|
50 |
+
|
51 |
+
$a = shortcode_atts(
|
52 |
+
array(
|
53 |
+
'group_id' => $group_id,
|
54 |
+
'call_to_action' => $call_to_action,
|
55 |
+
'style' => $style,
|
56 |
+
|
57 |
+
'position' => '',
|
58 |
+
'top' => '',
|
59 |
+
'right' => '',
|
60 |
+
'bottom' => '',
|
61 |
+
'left' => '',
|
62 |
+
'home' => '', // home - to hide on experts ..
|
63 |
+
'hide_mobile' => '',
|
64 |
+
'hide_desktop' => '',
|
65 |
+
// 'inline_issue' => '',
|
66 |
+
|
67 |
+
's5_img_position' => '', //left, right
|
68 |
+
's8_width' => '',
|
69 |
+
's8_icon_position' => '', // left, right, hide
|
70 |
+
|
71 |
+
), $atts, $shortcode );
|
72 |
+
// use like - '.$a["title"].'
|
73 |
+
|
74 |
+
|
75 |
+
// group_id
|
76 |
+
$group_id = $a["group_id"];
|
77 |
+
|
78 |
+
|
79 |
+
|
80 |
+
|
81 |
+
|
82 |
+
// hide on devices
|
83 |
+
// if 'yes' then hide
|
84 |
+
$hide_mobile = $a["hide_mobile"];
|
85 |
+
$hide_desktop = $a["hide_desktop"];
|
86 |
+
|
87 |
+
if( 'yes' == $is_mobile ) {
|
88 |
+
if ( 'yes' == $hide_mobile ) {
|
89 |
+
return;
|
90 |
+
}
|
91 |
+
} else {
|
92 |
+
if ( 'yes' == $hide_desktop ) {
|
93 |
+
return;
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
|
98 |
+
|
99 |
+
$position = $a["position"];
|
100 |
+
$top = $a["top"];
|
101 |
+
$right = $a["right"];
|
102 |
+
$bottom = $a["bottom"];
|
103 |
+
$left = $a["left"];
|
104 |
+
|
105 |
+
$css = '';
|
106 |
+
|
107 |
+
if ( '' !== $position ) {
|
108 |
+
$css .= 'position:'.$position.';';
|
109 |
+
}
|
110 |
+
if ( '' !== $top ) {
|
111 |
+
$css .= 'top:'.$top.';';
|
112 |
+
}
|
113 |
+
if ( '' !== $right ) {
|
114 |
+
$css .= 'right:'.$right.';';
|
115 |
+
}
|
116 |
+
if ( '' !== $bottom ) {
|
117 |
+
$css .= 'bottom:'.$bottom.';';
|
118 |
+
}
|
119 |
+
if ( '' !== $left ) {
|
120 |
+
$css .= 'left:'.$left.';';
|
121 |
+
}
|
122 |
+
|
123 |
+
// to hide styles in home page
|
124 |
+
$home = $a["home"];
|
125 |
+
|
126 |
+
// $position !== 'fixed' why !== to avoid double time adding display: none ..
|
127 |
+
if ( 'fixed' !== $position && 'hide' == $home && ( is_home() || is_category() || is_archive() ) ) {
|
128 |
+
$css .= 'display:none;';
|
129 |
+
}
|
130 |
+
|
131 |
+
// By default postion: fixed style hide on home screen,
|
132 |
+
// if plan to show, then add hide='show' ( actually something not equal to 'hide' )
|
133 |
+
if ( 'fixed' == $position && 'show' !== $home && ( is_home() || is_category() || is_archive() ) ) {
|
134 |
+
$css .= 'display:none;';
|
135 |
+
}
|
136 |
+
|
137 |
+
|
138 |
+
$link = "https://chat.whatsapp.com/$group_id";
|
139 |
+
$return_type = "group";
|
140 |
+
|
141 |
+
// call to action
|
142 |
+
$call_to_action = $a["call_to_action"];
|
143 |
+
|
144 |
+
$style = $a["style"];
|
145 |
+
|
146 |
+
$class_names = "ht-ctc-sc-group sc-style-$style";
|
147 |
+
|
148 |
+
|
149 |
+
$o = '';
|
150 |
+
|
151 |
+
// shortcode template file path
|
152 |
+
$sc_path = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/styles-shortcode/sc-style-' . $style. '.php';
|
153 |
+
|
154 |
+
if ( is_file( $sc_path ) ) {
|
155 |
+
include $sc_path;
|
156 |
+
} else {
|
157 |
+
// if style is not in the list..
|
158 |
+
$img_link = plugins_url("./prev/assets/img/whatsapp-logo.png", HT_CCW_PLUGIN_FILE );
|
159 |
+
$o .= '<div class="ccw_plugin">';
|
160 |
+
$o .= '<img class="img-icon-sc sc_item pointer style-3-sc" src="'.$img_link.'" alt="WhatsApp chat" onclick="'.$img_click_link.'" style="height: 36px; '.$css.' " >';
|
161 |
+
$o .= '</div>';
|
162 |
+
}
|
163 |
+
|
164 |
+
|
165 |
+
return $o;
|
166 |
+
|
167 |
+
}
|
168 |
+
|
169 |
+
|
170 |
+
}
|
171 |
+
|
172 |
+
|
173 |
+
$shortcode = new HT_CTC_Group_Shortcode();
|
174 |
+
|
175 |
+
add_action('init', array( $shortcode, 'shortcodes_init' ) );
|
176 |
+
|
177 |
+
endif; // END class_exists check
|
new/inc/group/class-ht-ctc-group.php
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Group chat/invite feature - main page
|
4 |
+
*
|
5 |
+
* @subpackage group
|
6 |
+
* @since 2.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
10 |
+
|
11 |
+
if ( ! class_exists( 'HT_CTC_Group' ) ) :
|
12 |
+
|
13 |
+
class HT_CTC_Group {
|
14 |
+
|
15 |
+
public function __construct() {
|
16 |
+
// $this->group();
|
17 |
+
}
|
18 |
+
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Which features are enable - based on this call function ..
|
22 |
+
*/
|
23 |
+
public function group() {
|
24 |
+
|
25 |
+
$options = get_option('ht_ctc_group');
|
26 |
+
|
27 |
+
|
28 |
+
// show/hide ..
|
29 |
+
include_once HT_CTC_PLUGIN_DIR .'new/inc/group/group-show-hide.php';
|
30 |
+
|
31 |
+
if ( 'no' == $display ) {
|
32 |
+
return;
|
33 |
+
}
|
34 |
+
|
35 |
+
// position
|
36 |
+
include_once HT_CTC_PLUGIN_DIR .'new/inc/group/group-position.php';
|
37 |
+
|
38 |
+
// is mobile to select styles
|
39 |
+
$is_mobile = ht_ctc()->device_type->is_mobile();
|
40 |
+
|
41 |
+
// style
|
42 |
+
if ( 'yes' == $is_mobile ) {
|
43 |
+
$style = esc_attr( $options['style_mobile'] );
|
44 |
+
} else {
|
45 |
+
$style = esc_attr( $options['style_desktop'] );
|
46 |
+
}
|
47 |
+
|
48 |
+
// call to action
|
49 |
+
$call_to_action = esc_attr( $options['call_to_action'] );
|
50 |
+
|
51 |
+
// class names
|
52 |
+
$class_names = "ht-ctc-group style-$style";
|
53 |
+
|
54 |
+
// call style
|
55 |
+
$path = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/styles/style-' . $style. '.php';
|
56 |
+
|
57 |
+
if ( is_file( $path ) ) {
|
58 |
+
include $path;
|
59 |
+
}
|
60 |
+
|
61 |
+
|
62 |
+
}
|
63 |
+
|
64 |
+
}
|
65 |
+
|
66 |
+
// new HT_CTC_Group();
|
67 |
+
|
68 |
+
$ht_ctc_group = new HT_CTC_Group();
|
69 |
+
add_action( 'wp_footer', array( $ht_ctc_group, 'group' ) );
|
70 |
+
|
71 |
+
|
72 |
+
endif; // END class_exists check
|
new/inc/group/group-position.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* @included from - class-ht-ctc-group.php
|
5 |
+
*
|
6 |
+
* position to place ..
|
7 |
+
*/
|
8 |
+
|
9 |
+
|
10 |
+
|
11 |
+
$side_1 = esc_attr( $options['side_1'] );
|
12 |
+
$side_1_value = esc_attr( $options['side_1_value'] );
|
13 |
+
|
14 |
+
$side_2 = esc_attr( $options['side_2'] );
|
15 |
+
$side_2_value = esc_attr( $options['side_2_value'] );
|
16 |
+
|
17 |
+
$position = "$side_1: $side_1_value; $side_2: $side_2_value;";
|
new/inc/group/group-show-hide.php
ADDED
@@ -0,0 +1,212 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* @included from - class-ht-ctc-group.php
|
5 |
+
*
|
6 |
+
* sets $display - yes to show styles or no to hide styles
|
7 |
+
*/
|
8 |
+
|
9 |
+
$this_page_id = get_the_ID();
|
10 |
+
|
11 |
+
|
12 |
+
// yes to display style and no to hide styles
|
13 |
+
// @uses at 'class-ht-ctc-group.php'
|
14 |
+
$display = 'yes';
|
15 |
+
|
16 |
+
|
17 |
+
// show / hide
|
18 |
+
if ( 'show' == $options['show_or_hide'] ) {
|
19 |
+
// show based no
|
20 |
+
|
21 |
+
// in show - default display is no
|
22 |
+
$display = 'no';
|
23 |
+
|
24 |
+
$pages_list_toshow = esc_attr( $options['list_showon_pages'] );
|
25 |
+
$pages_list_toshow_array = explode(',', $pages_list_toshow);
|
26 |
+
|
27 |
+
if( ( is_single() || is_page() ) && in_array( $this_page_id, $pages_list_toshow_array ) ) {
|
28 |
+
$display = 'yes';
|
29 |
+
return;
|
30 |
+
}
|
31 |
+
|
32 |
+
if ( is_single() && isset( $options['showon_posts'] ) ) {
|
33 |
+
$display = 'yes';
|
34 |
+
return;
|
35 |
+
}
|
36 |
+
|
37 |
+
if ( is_page() && isset( $options['showon_page'] ) ) {
|
38 |
+
if ( ( !is_home() ) && ( !is_front_page() ) ) {
|
39 |
+
$display = 'yes';
|
40 |
+
return;
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
// is_home and is_front_page - combined.
|
45 |
+
if ( ( is_home() || is_front_page() ) && ( isset( $options['showon_homepage'] ) ) ) {
|
46 |
+
$display = 'yes';
|
47 |
+
return;
|
48 |
+
}
|
49 |
+
|
50 |
+
|
51 |
+
if ( is_category() && isset( $options['showon_category'] ) ) {
|
52 |
+
$display = 'yes';
|
53 |
+
return;
|
54 |
+
}
|
55 |
+
|
56 |
+
if ( is_archive() && isset( $options['showon_archive'] ) ) {
|
57 |
+
$display = 'yes';
|
58 |
+
return;
|
59 |
+
}
|
60 |
+
|
61 |
+
if ( is_404() && isset( $options['showon_404'] ) ) {
|
62 |
+
$display = 'yes';
|
63 |
+
return;
|
64 |
+
}
|
65 |
+
|
66 |
+
// show on woocommerce single product pages.
|
67 |
+
if ( isset( $options['showon_wooproduct'] ) ) {
|
68 |
+
if ( function_exists( 'is_product' ) ) {
|
69 |
+
if ( is_product() ) {
|
70 |
+
$display = 'yes';
|
71 |
+
return;
|
72 |
+
}
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
|
77 |
+
// Hide styles on this catergorys - list
|
78 |
+
$list_showon_cat = esc_attr( $options['list_showon_cat'] );
|
79 |
+
|
80 |
+
// avoid calling foreach, explode when hide on categorys list is empty
|
81 |
+
if( $list_showon_cat ) {
|
82 |
+
|
83 |
+
// Get current post Categorys list and create an array for that..
|
84 |
+
$current_categorys_array = array();
|
85 |
+
$current_categorys = get_the_category();
|
86 |
+
foreach ( $current_categorys as $category ) {
|
87 |
+
$current_categorys_array[] = strtolower($category->name);
|
88 |
+
}
|
89 |
+
|
90 |
+
$list_showon_cat_array = explode(',', $list_showon_cat);
|
91 |
+
|
92 |
+
foreach ( $list_showon_cat_array as $category ) {
|
93 |
+
$category_trim = trim($category);
|
94 |
+
if ( in_array( strtolower($category_trim), $current_categorys_array ) ) {
|
95 |
+
$display = 'yes';
|
96 |
+
return;
|
97 |
+
}
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
} else {
|
102 |
+
|
103 |
+
// hide based on
|
104 |
+
|
105 |
+
// in hide - default display is yes
|
106 |
+
$display = 'yes';
|
107 |
+
|
108 |
+
|
109 |
+
$pages_list_tohide = $options['list_hideon_pages'];
|
110 |
+
$pages_list_tohide_array = explode(',', $pages_list_tohide);
|
111 |
+
|
112 |
+
if( ( is_single() || is_page() ) && in_array( $this_page_id, $pages_list_tohide_array ) ) {
|
113 |
+
$display = 'no';
|
114 |
+
return;
|
115 |
+
}
|
116 |
+
|
117 |
+
if ( is_single() && isset( $options['hideon_posts'] ) ) {
|
118 |
+
$display = 'no';
|
119 |
+
return;
|
120 |
+
}
|
121 |
+
|
122 |
+
if ( is_page() && isset( $options['hideon_page'] ) ) {
|
123 |
+
if ( ( !is_home() ) && ( !is_front_page() ) ) {
|
124 |
+
$display = 'no';
|
125 |
+
return;
|
126 |
+
}
|
127 |
+
}
|
128 |
+
|
129 |
+
// if ( is_home() && isset( $options['hideon_homepage'] ) ) {
|
130 |
+
// $display = 'no';
|
131 |
+
// return;
|
132 |
+
// }
|
133 |
+
|
134 |
+
// if ( is_front_page() && isset( $options['hideon_frontpage'] ) ) {
|
135 |
+
// $display = 'no';
|
136 |
+
// return;
|
137 |
+
// }
|
138 |
+
|
139 |
+
// is_home and is_front_page - combined.
|
140 |
+
if ( ( is_home() || is_front_page() ) && ( isset( $options['hideon_homepage'] ) ) ) {
|
141 |
+
$display = 'no';
|
142 |
+
return;
|
143 |
+
}
|
144 |
+
|
145 |
+
if ( is_category() && isset( $options['hideon_category'] ) ) {
|
146 |
+
$display = 'no';
|
147 |
+
return;
|
148 |
+
}
|
149 |
+
|
150 |
+
if ( is_archive() && isset( $options['hideon_archive'] ) ) {
|
151 |
+
$display = 'no';
|
152 |
+
return;
|
153 |
+
}
|
154 |
+
|
155 |
+
if ( is_404() && isset( $options['hideon_404'] ) ) {
|
156 |
+
$display = 'no';
|
157 |
+
return;
|
158 |
+
}
|
159 |
+
|
160 |
+
// hide on woocommerce single product pages.
|
161 |
+
if ( isset( $options['hideon_wooproduct'] ) ) {
|
162 |
+
if ( function_exists( 'is_product' ) ) {
|
163 |
+
if ( is_product() ) {
|
164 |
+
$display = 'no';
|
165 |
+
return;
|
166 |
+
}
|
167 |
+
}
|
168 |
+
}
|
169 |
+
|
170 |
+
|
171 |
+
// Hide styles on this catergorys - list
|
172 |
+
$list_hideon_cat = $options['list_hideon_cat'];
|
173 |
+
|
174 |
+
// avoid calling foreach, explode when hide on categorys list is empty
|
175 |
+
if( $list_hideon_cat ) {
|
176 |
+
|
177 |
+
// Get current post Categorys list and create an array for that..
|
178 |
+
$current_categorys_array = array();
|
179 |
+
$current_categorys = get_the_category();
|
180 |
+
foreach ( $current_categorys as $category ) {
|
181 |
+
$current_categorys_array[] = strtolower($category->name);
|
182 |
+
}
|
183 |
+
|
184 |
+
$list_hideon_cat_array = explode(',', $list_hideon_cat);
|
185 |
+
|
186 |
+
foreach ( $list_hideon_cat_array as $category ) {
|
187 |
+
$category_trim = trim($category);
|
188 |
+
if ( in_array( strtolower($category_trim), $current_categorys_array ) ) {
|
189 |
+
$display = 'no';
|
190 |
+
return;
|
191 |
+
}
|
192 |
+
}
|
193 |
+
}
|
194 |
+
|
195 |
+
}
|
196 |
+
|
197 |
+
|
198 |
+
// Hide based on device
|
199 |
+
|
200 |
+
if ( function_exists( 'wp_is_mobile' ) ) {
|
201 |
+
if ( wp_is_mobile() ) {
|
202 |
+
// mobile
|
203 |
+
if ( isset( $options['hideon_mobile'] ) ) {
|
204 |
+
$display = 'no';
|
205 |
+
}
|
206 |
+
} else {
|
207 |
+
// desktop
|
208 |
+
if ( isset( $options['hideon_desktop'] ) ) {
|
209 |
+
$display = 'no';
|
210 |
+
}
|
211 |
+
}
|
212 |
+
}
|
new/inc/share/class-ht-ctc-share-shortcode.php
ADDED
@@ -0,0 +1,191 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* shortcodes
|
4 |
+
* for list of attribute support check -> shortcode_atts ( $a )
|
5 |
+
*
|
6 |
+
* @package chat
|
7 |
+
* @since 2.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
11 |
+
|
12 |
+
if ( ! class_exists( 'HT_CTC_Share_Shortcode' ) ) :
|
13 |
+
|
14 |
+
class HT_CTC_Share_Shortcode {
|
15 |
+
|
16 |
+
|
17 |
+
// Register shortcode
|
18 |
+
public function shortcodes_init() {
|
19 |
+
add_shortcode( 'ht-ctc-share', array( $this, 'shortcode' ) );
|
20 |
+
}
|
21 |
+
|
22 |
+
// call back function - shortcode
|
23 |
+
public function shortcode( $atts = [], $content = null, $shortcode = '' ) {
|
24 |
+
|
25 |
+
$options = get_option('ht_ctc_share');
|
26 |
+
|
27 |
+
|
28 |
+
$share_text_db = esc_attr( $options['share_text'] );
|
29 |
+
$call_to_action_db = esc_attr( $options['call_to_action'] );
|
30 |
+
|
31 |
+
$share_text = __( $share_text_db , 'click-to-chat-for-whatsapp' );
|
32 |
+
$call_to_action = __( $call_to_action_db , 'click-to-chat-for-whatsapp' );
|
33 |
+
|
34 |
+
$style_desktop = esc_attr( $options['style_desktop'] );
|
35 |
+
$style_mobile = esc_attr( $options['style_mobile'] );
|
36 |
+
|
37 |
+
$is_mobile = ht_ctc()->device_type->is_mobile();
|
38 |
+
|
39 |
+
$style = $style_desktop;;
|
40 |
+
if ( 'yes' == $is_mobile ) {
|
41 |
+
$style = $style_mobile;
|
42 |
+
}
|
43 |
+
|
44 |
+
// $content = do_shortcode($content);
|
45 |
+
|
46 |
+
// $ccw_options_cs = get_option('ccw_options_cs');
|
47 |
+
// use like $ccw_options_cs['']
|
48 |
+
|
49 |
+
$a = shortcode_atts(
|
50 |
+
array(
|
51 |
+
'share_text' => $share_text,
|
52 |
+
'call_to_action' => $call_to_action,
|
53 |
+
'style' => $style,
|
54 |
+
|
55 |
+
'position' => '',
|
56 |
+
'top' => '',
|
57 |
+
'right' => '',
|
58 |
+
'bottom' => '',
|
59 |
+
'left' => '',
|
60 |
+
'home' => '', // home - to hide on experts ..
|
61 |
+
'hide_mobile' => '',
|
62 |
+
'hide_desktop' => '',
|
63 |
+
// 'inline_issue' => '',
|
64 |
+
|
65 |
+
's5_img_position' => '', //left, right
|
66 |
+
's8_width' => '',
|
67 |
+
's8_icon_position' => '', // left, right, hide
|
68 |
+
|
69 |
+
), $atts, $shortcode );
|
70 |
+
// use like - '.$a["title"].'
|
71 |
+
|
72 |
+
|
73 |
+
// share_text
|
74 |
+
$share_text = $a["share_text"];
|
75 |
+
|
76 |
+
$page_url = get_permalink();
|
77 |
+
$page_title = esc_html( get_the_title() );
|
78 |
+
|
79 |
+
$share_text = str_replace( '{{url}}', $page_url, $share_text );
|
80 |
+
$share_text = str_replace( '{{title}}', $page_title, $share_text );
|
81 |
+
|
82 |
+
|
83 |
+
// hide on devices
|
84 |
+
// if 'yes' then hide
|
85 |
+
$hide_mobile = $a["hide_mobile"];
|
86 |
+
$hide_desktop = $a["hide_desktop"];
|
87 |
+
|
88 |
+
if( 'yes' == $is_mobile ) {
|
89 |
+
if ( 'yes' == $hide_mobile ) {
|
90 |
+
return;
|
91 |
+
}
|
92 |
+
} else {
|
93 |
+
if ( 'yes' == $hide_desktop ) {
|
94 |
+
return;
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
|
99 |
+
|
100 |
+
$position = $a["position"];
|
101 |
+
$top = $a["top"];
|
102 |
+
$right = $a["right"];
|
103 |
+
$bottom = $a["bottom"];
|
104 |
+
$left = $a["left"];
|
105 |
+
|
106 |
+
$css = '';
|
107 |
+
|
108 |
+
if ( '' !== $position ) {
|
109 |
+
$css .= 'position:'.$position.';';
|
110 |
+
}
|
111 |
+
if ( '' !== $top ) {
|
112 |
+
$css .= 'top:'.$top.';';
|
113 |
+
}
|
114 |
+
if ( '' !== $right ) {
|
115 |
+
$css .= 'right:'.$right.';';
|
116 |
+
}
|
117 |
+
if ( '' !== $bottom ) {
|
118 |
+
$css .= 'bottom:'.$bottom.';';
|
119 |
+
}
|
120 |
+
if ( '' !== $left ) {
|
121 |
+
$css .= 'left:'.$left.';';
|
122 |
+
}
|
123 |
+
|
124 |
+
// to hide styles in home page
|
125 |
+
$home = $a["home"];
|
126 |
+
|
127 |
+
// $position !== 'fixed' why !== to avoid double time adding display: none ..
|
128 |
+
if ( 'fixed' !== $position && 'hide' == $home && ( is_home() || is_category() || is_archive() ) ) {
|
129 |
+
$css .= 'display:none;';
|
130 |
+
}
|
131 |
+
|
132 |
+
// By default postion: fixed style hide on home screen,
|
133 |
+
// if plan to show, then add hide='show' ( actually something not equal to 'hide' )
|
134 |
+
if ( 'fixed' == $position && 'show' !== $home && ( is_home() || is_category() || is_archive() ) ) {
|
135 |
+
$css .= 'display:none;';
|
136 |
+
}
|
137 |
+
|
138 |
+
$web_api = 'web';
|
139 |
+
|
140 |
+
// mobile
|
141 |
+
if ( 'yes' == $is_mobile ) {
|
142 |
+
$web_api = 'api';
|
143 |
+
} else {
|
144 |
+
$web_api = 'web';
|
145 |
+
}
|
146 |
+
|
147 |
+
// if cache issue - setting at admin
|
148 |
+
if ( isset ( $options['cache_issue'] ) ) {
|
149 |
+
$web_api = 'api';
|
150 |
+
}
|
151 |
+
|
152 |
+
$link = "https://$web_api.whatsapp.com/send?text=$share_text";
|
153 |
+
$return_type = "share";
|
154 |
+
|
155 |
+
// call to action
|
156 |
+
$call_to_action = $a["call_to_action"];
|
157 |
+
|
158 |
+
$style = $a["style"];
|
159 |
+
|
160 |
+
$class_names = "ht-ctc-sc-share sc-style-$style";
|
161 |
+
|
162 |
+
|
163 |
+
$o = '';
|
164 |
+
|
165 |
+
// shortcode template file path
|
166 |
+
$sc_path = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/styles-shortcode/sc-style-' . $style. '.php';
|
167 |
+
|
168 |
+
if ( is_file( $sc_path ) ) {
|
169 |
+
include $sc_path;
|
170 |
+
} else {
|
171 |
+
// if style is not in the list..
|
172 |
+
$img_link = plugins_url("./prev/assets/img/whatsapp-logo.png", HT_CCW_PLUGIN_FILE );
|
173 |
+
$o .= '<div class="ccw_plugin">';
|
174 |
+
$o .= '<img class="img-icon-sc sc_item pointer style-3-sc" src="'.$img_link.'" alt="WhatsApp chat" onclick="'.$img_click_link.'" style="height: 36px; '.$css.' " >';
|
175 |
+
$o .= '</div>';
|
176 |
+
}
|
177 |
+
|
178 |
+
|
179 |
+
return $o;
|
180 |
+
|
181 |
+
}
|
182 |
+
|
183 |
+
|
184 |
+
}
|
185 |
+
|
186 |
+
|
187 |
+
$shortcode = new HT_CTC_Share_Shortcode();
|
188 |
+
|
189 |
+
add_action('init', array( $shortcode, 'shortcodes_init' ) );
|
190 |
+
|
191 |
+
endif; // END class_exists check
|
new/inc/share/class-ht-ctc-share.php
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Share feature - main page
|
4 |
+
*
|
5 |
+
* @subpackage share
|
6 |
+
* @since 2.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
10 |
+
|
11 |
+
if ( ! class_exists( 'HT_CTC_Share' ) ) :
|
12 |
+
|
13 |
+
class HT_CTC_Share {
|
14 |
+
|
15 |
+
public function __construct() {
|
16 |
+
// $this->share();
|
17 |
+
}
|
18 |
+
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Which features are enable - based on this call function ..
|
22 |
+
*/
|
23 |
+
public function share() {
|
24 |
+
|
25 |
+
$options = get_option('ht_ctc_share');
|
26 |
+
|
27 |
+
|
28 |
+
// show/hide ..
|
29 |
+
include_once HT_CTC_PLUGIN_DIR .'new/inc/share/share-show-hide.php';
|
30 |
+
|
31 |
+
if ( 'no' == $display ) {
|
32 |
+
return;
|
33 |
+
}
|
34 |
+
|
35 |
+
// position
|
36 |
+
include_once HT_CTC_PLUGIN_DIR .'new/inc/share/share-position.php';
|
37 |
+
|
38 |
+
// is mobile to select styles
|
39 |
+
$is_mobile = ht_ctc()->device_type->is_mobile();
|
40 |
+
|
41 |
+
// style
|
42 |
+
if ( 'yes' == $is_mobile ) {
|
43 |
+
$style = esc_html( $options['style_mobile'] );
|
44 |
+
} else {
|
45 |
+
$style = esc_html( $options['style_desktop'] );
|
46 |
+
}
|
47 |
+
|
48 |
+
// call to action
|
49 |
+
$call_to_action = esc_html( $options['call_to_action'] );
|
50 |
+
|
51 |
+
// class names
|
52 |
+
$class_names = "ht-ctc-share style-$style";
|
53 |
+
|
54 |
+
// call style
|
55 |
+
$path = plugin_dir_path( HT_CTC_PLUGIN_FILE ) . 'new/inc/styles/style-' . $style. '.php';
|
56 |
+
|
57 |
+
if ( is_file( $path ) ) {
|
58 |
+
include $path;
|
59 |
+
}
|
60 |
+
|
61 |
+
|
62 |
+
}
|
63 |
+
|
64 |
+
}
|
65 |
+
|
66 |
+
// new HT_CTC_Share();
|
67 |
+
|
68 |
+
$ht_ctc_share = new HT_CTC_Share();
|
69 |
+
add_action( 'wp_footer', array( $ht_ctc_share, 'share' ) );
|
70 |
+
|
71 |
+
|
72 |
+
endif; // END class_exists check
|
new/inc/share/share-position.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* @included from - class-ht-ctc-share.php
|
5 |
+
*
|
6 |
+
* position to place ..
|
7 |
+
*/
|
8 |
+
|
9 |
+
|
10 |
+
|
11 |
+
$side_1 = esc_html( $options['side_1'] );
|
12 |
+
$side_1_value = esc_html( $options['side_1_value'] );
|
13 |
+
|
14 |
+
$side_2 = esc_html( $options['side_2'] );
|
15 |
+
$side_2_value = esc_html( $options['side_2_value'] );
|
16 |
+
|
17 |
+
$position = "$side_1: $side_1_value; $side_2: $side_2_value;";
|
new/inc/share/share-show-hide.php
ADDED
@@ -0,0 +1,211 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* @included from - class-ht-ctc-share.php
|
5 |
+
*
|
6 |
+
* sets $display - yes to show styles or no to hide styles
|
7 |
+
*/
|
8 |
+
|
9 |
+
$this_page_id = get_the_ID();
|
10 |
+
|
11 |
+
|
12 |
+
// yes to display style and no to hide styles
|
13 |
+
// @uses at 'class-ht-ctc-share.php'
|
14 |
+
$display = 'yes';
|
15 |
+
|
16 |
+
|
17 |
+
// show / hide
|
18 |
+
if ( 'show' == $options['show_or_hide'] ) {
|
19 |
+
// show based no
|
20 |
+
|
21 |
+
// in show - default display is no
|
22 |
+
$display = 'no';
|
23 |
+
|
24 |
+
$pages_list_toshow = esc_html( $options['list_showon_pages'] );
|
25 |
+
$pages_list_toshow_array = explode(',', $pages_list_toshow);
|
26 |
+
|
27 |
+
if( ( is_single() || is_page() ) && in_array( $this_page_id, $pages_list_toshow_array ) ) {
|
28 |
+
$display = 'yes';
|
29 |
+
return;
|
30 |
+
}
|
31 |
+
|
32 |
+
if ( is_single() && isset( $options['showon_posts'] ) ) {
|
33 |
+
$display = 'yes';
|
34 |
+
return;
|
35 |
+
}
|
36 |
+
|
37 |
+
if ( is_page() && isset( $options['showon_page'] ) ) {
|
38 |
+
if ( ( !is_home() ) && ( !is_front_page() ) ) {
|
39 |
+
$display = 'yes';
|
40 |
+
return;
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
// is_home and is_front_page - combined.
|
45 |
+
if ( ( is_home() || is_front_page() ) && ( isset( $options['showon_homepage'] ) ) ) {
|
46 |
+
$display = 'yes';
|
47 |
+
return;
|
48 |
+
}
|
49 |
+
|
50 |
+
|
51 |
+
if ( is_category() && isset( $options['showon_category'] ) ) {
|
52 |
+
$display = 'yes';
|
53 |
+
return;
|
54 |
+
}
|
55 |
+
|
56 |
+
if ( is_archive() && isset( $options['showon_archive'] ) ) {
|
57 |
+
$display = 'yes';
|
58 |
+
return;
|
59 |
+
}
|
60 |
+
|
61 |
+
if ( is_404() && isset( $options['showon_404'] ) ) {
|
62 |
+
$display = 'yes';
|
63 |
+
return;
|
64 |
+
}
|
65 |
+
|
66 |
+
// show on woocommerce single product pages.
|
67 |
+
if ( isset( $options['showon_wooproduct'] ) ) {
|
68 |
+
if ( function_exists( 'is_product' ) ) {
|
69 |
+
if ( is_product() ) {
|
70 |
+
$display = 'yes';
|
71 |
+
return;
|
72 |
+
}
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
|
77 |
+
// Hide styles on this catergorys - list
|
78 |
+
$list_showon_cat = esc_html( $options['list_showon_cat'] );
|
79 |
+
|
80 |
+
// avoid calling foreach, explode when hide on categorys list is empty
|
81 |
+
if( $list_showon_cat ) {
|
82 |
+
|
83 |
+
// Get current post Categorys list and create an array for that..
|
84 |
+
$current_categorys_array = array();
|
85 |
+
$current_categorys = get_the_category();
|
86 |
+
foreach ( $current_categorys as $category ) {
|
87 |
+
$current_categorys_array[] = strtolower($category->name);
|
88 |
+
}
|
89 |
+
|
90 |
+
$list_showon_cat_array = explode(',', $list_showon_cat);
|
91 |
+
|
92 |
+
foreach ( $list_showon_cat_array as $category ) {
|
93 |
+
$category_trim = trim($category);
|
94 |
+
if ( in_array( strtolower($category_trim), $current_categorys_array ) ) {
|
95 |
+
$display = 'yes';
|
96 |
+
return;
|
97 |
+
}
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
} else {
|
102 |
+
|
103 |
+
// hide based on
|
104 |
+
|
105 |
+
// in hide - default display is yes
|
106 |
+
$display = 'yes';
|
107 |
+
|
108 |
+
|
109 |
+
$pages_list_tohide = esc_html( $options['list_hideon_pages'] );
|
110 |
+
$pages_list_tohide_array = explode(',', $pages_list_tohide);
|
111 |
+
|
112 |
+
if( ( is_single() || is_page() ) && in_array( $this_page_id, $pages_list_tohide_array ) ) {
|
113 |
+
$display = 'no';
|
114 |
+
return;
|
115 |
+
}
|
116 |
+
|
117 |
+
if ( is_single() && isset( $options['hideon_posts'] ) ) {
|
118 |
+
$display = 'no';
|
119 |
+
return;
|
120 |
+
}
|
121 |
+
|
122 |
+
if ( is_page() && isset( $options['hideon_page'] ) ) {
|
123 |
+
if ( ( !is_home() ) && ( !is_front_page() ) ) {
|
124 |
+
$display = 'no';
|
125 |
+
return;
|
126 |
+
}
|
127 |
+
}
|
128 |
+
|
129 |
+
// if ( is_home() && isset( $options['hideon_homepage'] ) ) {
|
130 |
+
// $display = 'no';
|
131 |
+
// return;
|
132 |
+
// }
|
133 |
+
|
134 |
+
// if ( is_front_page() && isset( $options['hideon_frontpage'] ) ) {
|
135 |
+
// $display = 'no';
|
136 |
+
// return;
|
137 |
+
// }
|
138 |
+
|
139 |
+
// is_home and is_front_page - combined.
|
140 |
+
if ( ( is_home() || is_front_page() ) && ( isset( $options['hideon_homepage'] ) ) ) {
|
141 |
+
$display = 'no';
|
142 |
+
return;
|
143 |
+
}
|
144 |
+
|
145 |
+
if ( is_category() && isset( $options['hideon_category'] ) ) {
|
146 |
+
$display = 'no';
|
147 |
+
return;
|
148 |
+
}
|
149 |
+
|
150 |
+
if ( is_archive() && isset( $options['hideon_archive'] ) ) {
|
151 |
+
$display = 'no';
|
152 |
+
return;
|
153 |
+
}
|
154 |
+
|
155 |
+
if ( is_404() && isset( $options['hideon_404'] ) ) {
|
156 |
+
$display = 'no';
|
157 |
+
return;
|
158 |
+
}
|
159 |
+
|
160 |
+
// hide on woocommerce single product pages.
|
161 |
+
if ( isset( $options['hideon_wooproduct'] ) ) {
|
162 |
+
if ( function_exists( 'is_product' ) ) {
|
163 |
+
if ( is_product() ) {
|
164 |
+
$display = 'no';
|
165 |
+
return;
|
166 |
+
}
|
167 |
+
}
|
168 |
+
}
|
169 |
+
|
170 |
+
// Hide styles on this catergorys - list
|
171 |
+
$list_hideon_cat = esc_html( $options['list_hideon_cat'] );
|
172 |
+
|
173 |
+
// avoid calling foreach, explode when hide on categorys list is empty
|
174 |
+
if( $list_hideon_cat ) {
|
175 |
+
|
176 |
+
// Get current post Categorys list and create an array for that..
|
177 |
+
$current_categorys_array = array();
|
178 |
+
$current_categorys = get_the_category();
|
179 |
+
foreach ( $current_categorys as $category ) {
|
180 |
+
$current_categorys_array[] = strtolower($category->name);
|
181 |
+
}
|
182 |
+
|
183 |
+
$list_hideon_cat_array = explode(',', $list_hideon_cat);
|
184 |
+
|
185 |
+
foreach ( $list_hideon_cat_array as $category ) {
|
186 |
+
$category_trim = trim($category);
|
187 |
+
if ( in_array( strtolower($category_trim), $current_categorys_array ) ) {
|
188 |
+
$display = 'no';
|
189 |
+
return;
|
190 |
+
}
|
191 |
+
}
|
192 |
+
}
|
193 |
+
|
194 |
+
}
|
195 |
+
|
196 |
+
|
197 |
+
// Hide based on device
|
198 |
+
|
199 |
+
if ( function_exists( 'wp_is_mobile' ) ) {
|
200 |
+
if ( wp_is_mobile() ) {
|
201 |
+
// mobile
|
202 |
+
if ( isset( $options['hideon_mobile'] ) ) {
|
203 |
+
$display = 'no';
|
204 |
+
}
|
205 |
+
} else {
|
206 |
+
// desktop
|
207 |
+
if ( isset( $options['hideon_desktop'] ) ) {
|
208 |
+
$display = 'no';
|
209 |
+
}
|
210 |
+
}
|
211 |
+
}
|
new/inc/styles-shortcode/sc-style-1.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
|
7 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
8 |
+
|
9 |
+
// $s1_options = get_option( 'ht_ctc_s1' );
|
10 |
+
// $s1_img_size = esc_attr( $s1_options['s1_img_size'] );
|
11 |
+
|
12 |
+
|
13 |
+
$o .= '
|
14 |
+
<div onclick="ht_ctc_shortcode_click(this);" data-ctc-link="'.$link.'" data-ctc-type="'.$return_type.'" style="display: inline; cursor: pointer; z-index: 99999999; '.$css.'" class="'.$class_names.' ht-ctc-inline '.$css.'">
|
15 |
+
<button>'.$call_to_action.'</button>
|
16 |
+
</div>
|
17 |
+
';
|
18 |
+
|
19 |
+
|
20 |
+
?>
|
new/inc/styles-shortcode/sc-style-2.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
|
7 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
8 |
+
|
9 |
+
$s2_options = get_option( 'ht_ctc_s2' );
|
10 |
+
|
11 |
+
$s2_img_size = esc_attr( $s2_options['s2_img_size'] );
|
12 |
+
|
13 |
+
$s2_img_link = plugins_url( './prev/assets/img/whatsapp-icon-square.svg', HT_CTC_PLUGIN_FILE );
|
14 |
+
|
15 |
+
if ( !isset( $s2_options['cta_on_hover'] ) ) {
|
16 |
+
$call_to_action = '';
|
17 |
+
}
|
18 |
+
|
19 |
+
$o .= '
|
20 |
+
<div onclick="ht_ctc_shortcode_click(this);" data-ctc-link="'.$link.'" data-ctc-type="'.$return_type.'" class="'.$class_names.' ht-ctc-inline" style="display: inline; cursor: pointer; z-index: 99999999; '.$css.'">
|
21 |
+
<img class="img-icon" title="'.$call_to_action.'" style="height: '.$s2_img_size.';" src="'.$s2_img_link.'" alt="WhatsApp chat">
|
22 |
+
</div>
|
23 |
+
';
|
24 |
+
|
25 |
+
|
26 |
+
?>
|
new/inc/styles-shortcode/sc-style-3.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
|
7 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
8 |
+
|
9 |
+
$s3_options = get_option( 'ht_ctc_s3' );
|
10 |
+
|
11 |
+
$s3_img_size = esc_attr( $s3_options['s3_img_size'] );
|
12 |
+
|
13 |
+
$s3_img_link = plugins_url( './prev/assets/img/whatsapp-logo.svg', HT_CTC_PLUGIN_FILE );
|
14 |
+
|
15 |
+
if ( !isset( $s3_options['cta_on_hover'] ) ) {
|
16 |
+
$call_to_action = '';
|
17 |
+
}
|
18 |
+
|
19 |
+
$o .= '
|
20 |
+
<div onclick="ht_ctc_shortcode_click(this);" data-ctc-link="'.$link.'" data-ctc-type="'.$return_type.'" style="display: inline; cursor: pointer; '.$css.'" class="'.$class_names.' ht-ctc-inline z-index: 99999999;">
|
21 |
+
<img class="img-icon" title="'.$call_to_action.'" style="height: '.$s3_img_size.';" src="'.$s3_img_link.'" alt="WhatsApp chat">
|
22 |
+
</div>
|
23 |
+
';
|
24 |
+
|
25 |
+
|
26 |
+
?>
|
new/inc/styles-shortcode/sc-style-4.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* chip style
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
|
7 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
8 |
+
|
9 |
+
$s4_options = get_option( 'ht_ctc_s4' );
|
10 |
+
|
11 |
+
|
12 |
+
$s4_text_color = esc_attr( $s4_options['s4_text_color'] );
|
13 |
+
$s4_bg_color = esc_attr( $s4_options['s4_bg_color'] );
|
14 |
+
|
15 |
+
$s4_img_url = esc_attr( $s4_options['s4_img_url'] );
|
16 |
+
|
17 |
+
// if user not added any image
|
18 |
+
if ( '' == $s4_img_url ) {
|
19 |
+
$s4_img_url = plugins_url( './prev/assets/img/whatsapp-logo-32x32.png', HT_CTC_PLUGIN_FILE );
|
20 |
+
}
|
21 |
+
|
22 |
+
|
23 |
+
?>
|
24 |
+
|
25 |
+
<style>
|
26 |
+
|
27 |
+
.chip {
|
28 |
+
display: inline-block;
|
29 |
+
padding-left: 12px;
|
30 |
+
padding-right: 12px;
|
31 |
+
padding-top: 0px;
|
32 |
+
padding-bottom: 0px;
|
33 |
+
border-radius: 25px;
|
34 |
+
font-size: 13px;
|
35 |
+
line-height: 32px;
|
36 |
+
}
|
37 |
+
|
38 |
+
/* Image */
|
39 |
+
.chip img {
|
40 |
+
float: left;
|
41 |
+
margin: 0 8px 0 -12px;
|
42 |
+
height: 32px;
|
43 |
+
width: 32px;
|
44 |
+
border-radius: 50%;
|
45 |
+
}
|
46 |
+
|
47 |
+
</style>
|
48 |
+
|
49 |
+
|
50 |
+
<?php
|
51 |
+
|
52 |
+
$o .= '
|
53 |
+
<div onclick="ht_ctc_shortcode_click(this);" data-ctc-link="'.$link.'" data-ctc-type="'.$return_type.'" style="display: inline; cursor: pointer; z-index: 99999999; '.$css.'" class="'.$class_names.' ht-ctc-inline">
|
54 |
+
<div class="chip" style="background-color: '.$s4_bg_color.'; color: '.$s4_text_color.';">
|
55 |
+
'.$call_to_action.'
|
56 |
+
<img src="'.$s4_img_url.'" alt="whatsapp">
|
57 |
+
</div>
|
58 |
+
</div>
|
59 |
+
';
|
60 |
+
|
61 |
+
|
62 |
+
?>
|
new/inc/styles-shortcode/sc-style-5.php
ADDED
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* image with content slider
|
4 |
+
*/
|
5 |
+
|
6 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
7 |
+
|
8 |
+
$s5_options = get_option( 'ht_ctc_s5' );
|
9 |
+
|
10 |
+
$s5_line_1 = esc_attr( $s5_options['s5_line_1'] );
|
11 |
+
$s5_line_2 = esc_attr( $s5_options['s5_line_2'] );
|
12 |
+
$s5_line_1_color = esc_attr( $s5_options['s5_line_1_color'] );
|
13 |
+
$s5_line_2_color = esc_attr( $s5_options['s5_line_2_color'] );
|
14 |
+
$s5_background_color = esc_attr( $s5_options['s5_background_color'] );
|
15 |
+
$s5_border_color = esc_attr( $s5_options['s5_border_color'] );
|
16 |
+
$s5_img = esc_attr( $s5_options['s5_img'] );
|
17 |
+
$s5_img_height = esc_attr( $s5_options['s5_img_height'] );
|
18 |
+
$s5_img_width = esc_attr( $s5_options['s5_img_width'] );
|
19 |
+
$s5_content_height = esc_attr( $s5_options['s5_content_height'] );
|
20 |
+
$s5_content_width = esc_attr( $s5_options['s5_content_width'] );
|
21 |
+
|
22 |
+
// shortcodes image position default to left, can change position using attributes
|
23 |
+
// $s5_img_position = esc_attr( $s5_options['s5_img_position'] );
|
24 |
+
$s5_img_position = 'left';
|
25 |
+
|
26 |
+
// shortcode attributes
|
27 |
+
$s5_img_position_sc = $a["s5_img_position"];
|
28 |
+
|
29 |
+
if ( '' !== $s5_img_position_sc ) {
|
30 |
+
$s5_img_position = $s5_img_position_sc;
|
31 |
+
}
|
32 |
+
|
33 |
+
|
34 |
+
// default image - if user not added any image
|
35 |
+
if ( '' == $s5_img ) {
|
36 |
+
$s5_img = plugins_url( './prev/assets/img/new_style8.jpg', HT_CTC_PLUGIN_FILE );
|
37 |
+
}
|
38 |
+
|
39 |
+
if ( '' == $s5_line_1 ) {
|
40 |
+
$s5_line_1 = $call_to_action;
|
41 |
+
}
|
42 |
+
|
43 |
+
|
44 |
+
$s5_cta_style = "display: -ms-flexbox; display: -webkit-flex; display: flex;";
|
45 |
+
|
46 |
+
|
47 |
+
$s5_img_style = '';
|
48 |
+
$s5_img_style .= 'height: '.$s5_img_height.'; width: '.$s5_img_width.'; z-index: 999999; ';
|
49 |
+
if ( 'right' == $s5_img_position ) {
|
50 |
+
$s5_img_style .= 'order: 1;';
|
51 |
+
}
|
52 |
+
|
53 |
+
$s5_content_style = '';
|
54 |
+
$s5_content_style .= 'flex-direction: column; justify-content: center; align-items: center; ';
|
55 |
+
$s5_content_style .= ' background-color: '.$s5_background_color.'; border: 1px solid '.$s5_border_color.'; height: '.$s5_content_height.'; width: '.$s5_content_width.'; ';
|
56 |
+
if ( 'right' == $s5_img_position ) {
|
57 |
+
$s5_content_style .= 'margin-right: -4px;';
|
58 |
+
} elseif ( 'left' == $s5_img_position ) {
|
59 |
+
$s5_content_style .= 'margin-left: -4px;';
|
60 |
+
}
|
61 |
+
|
62 |
+
|
63 |
+
// adding styles..
|
64 |
+
$s5_css_code = '
|
65 |
+
.ht-ctc-style-5 .s5_img {
|
66 |
+
box-shadow: 2px 5px 10px rgba(0,0,0,.5);
|
67 |
+
}
|
68 |
+
.ht-ctc-style-5 .s5_content {
|
69 |
+
box-shadow: 2px 5px 10px rgba(0,0,0,.5);
|
70 |
+
border-radius: 5px;
|
71 |
+
}
|
72 |
+
.ht-ctc-style-5 .s5_content span {
|
73 |
+
padding: 5px;
|
74 |
+
overflow: hidden;
|
75 |
+
}
|
76 |
+
.ht-ctc-style-5 .s5_content .heading {
|
77 |
+
font-size: 20px;
|
78 |
+
}
|
79 |
+
.ht-ctc-style-5 .s5_content .description {
|
80 |
+
font-size: 12px;
|
81 |
+
}
|
82 |
+
.ht-ctc-style-5 .s5_content.right {
|
83 |
+
animation: 1s s5_translate_right;
|
84 |
+
}
|
85 |
+
.ht-ctc-style-5 .s5_content.left {
|
86 |
+
animation: 1s s5_translate_left;
|
87 |
+
}
|
88 |
+
|
89 |
+
@keyframes s5_translate_right {
|
90 |
+
0% {
|
91 |
+
transform: translateX(55px)
|
92 |
+
}
|
93 |
+
100% {
|
94 |
+
transform: translateX(0px)
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
@keyframes s5_translate_left {
|
99 |
+
0% {
|
100 |
+
transform: translateX(-55px)
|
101 |
+
}
|
102 |
+
100% {
|
103 |
+
transform: translateX(0px)
|
104 |
+
}
|
105 |
+
}
|
106 |
+
';
|
107 |
+
|
108 |
+
|
109 |
+
// styles
|
110 |
+
$o = '';
|
111 |
+
$o .= '<style>';
|
112 |
+
$o .= '.ht-ctc-style-5 .s5_content { display: none; } .ht-ctc-style-5 .s5_cta:hover .s5_content { display: flex; } ';
|
113 |
+
$o .= $s5_css_code;
|
114 |
+
$o .= '</style>';
|
115 |
+
|
116 |
+
|
117 |
+
$o .= '
|
118 |
+
<div onclick="ht_ctc_shortcode_click(this);" data-ctc-link="'.$link.'" data-ctc-type="'.$return_type.'" style="display: inline; cursor: pointer; z-index: 99999999; '.$css.'" class="'.$class_names.' ht-ctc-inline">
|
119 |
+
|
120 |
+
<div class="ht-ctc-style-5" style="cursor: pointer; z-index: 99999999;" >
|
121 |
+
<div class="s5_cta" style="'.$s5_cta_style.'" >
|
122 |
+
<img class="s5_img" src="'.$s5_img.'" style="'.$s5_img_style.'" alt="whatsapp">
|
123 |
+
<div class="s5_content '.$s5_img_position.'" style="'.$s5_content_style.'" >
|
124 |
+
<span class="heading" style="color: '.$s5_line_1_color.'">'.$s5_line_1.'</span>
|
125 |
+
<span class="description" style="color: '.$s5_line_2_color.'">'.$s5_line_2.'</span>
|
126 |
+
</div>
|
127 |
+
</div>
|
128 |
+
</div>
|
129 |
+
|
130 |
+
</div>
|
131 |
+
';
|
132 |
+
|
133 |
+
|
134 |
+
?>
|
new/inc/styles-shortcode/sc-style-6.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* plain text link
|
4 |
+
*/
|
5 |
+
|
6 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
7 |
+
|
8 |
+
$s6_options = get_option( 'ht_ctc_s6' );
|
9 |
+
|
10 |
+
$s6_txt_color = esc_attr( $s6_options['s6_txt_color'] );
|
11 |
+
$s6_txt_color_on_hover = esc_attr( $s6_options['s6_txt_color_on_hover'] );
|
12 |
+
$s6_txt_decoration = esc_attr( $s6_options['s6_txt_decoration'] );
|
13 |
+
$s6_txt_decoration_on_hover = esc_attr( $s6_options['s6_txt_decoration_on_hover'] );
|
14 |
+
|
15 |
+
$input_onhover = "this.style.color='$s6_txt_color_on_hover', this.style.textDecoration='$s6_txt_decoration_on_hover'";
|
16 |
+
$input_onhover_out = "this.style.color='$s6_txt_color', this.style.textDecoration='$s6_txt_decoration'";
|
17 |
+
|
18 |
+
|
19 |
+
$o .= '
|
20 |
+
<div onclick="ht_ctc_shortcode_click(this);" data-ctc-link="'.$link.'" data-ctc-type="'.$return_type.'" style="display: inline; cursor: pointer; z-index: 99999999; '.$css.'" class="'.$class_names.' ht-ctc-inline">
|
21 |
+
<a style="color: '.$s6_txt_color.'; text-decoration: '.$s6_txt_decoration.';"
|
22 |
+
onmouseover = "'.$input_onhover.'"
|
23 |
+
onmouseout = "'.$input_onhover_out.'"
|
24 |
+
>
|
25 |
+
'.$call_to_action.'
|
26 |
+
</a>
|
27 |
+
</div>
|
28 |
+
';
|
29 |
+
|
30 |
+
|
31 |
+
?>
|
new/inc/styles-shortcode/sc-style-7.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* icon with padding borderr
|
4 |
+
*/
|
5 |
+
|
6 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
7 |
+
|
8 |
+
$s7_options = get_option( 'ht_ctc_s7' );
|
9 |
+
|
10 |
+
|
11 |
+
$s7_icon_size = esc_attr( $s7_options['s7_icon_size'] );
|
12 |
+
$s7_icon_color = esc_attr( $s7_options['s7_icon_color'] );
|
13 |
+
$s7_icon_color_hover = esc_attr( $s7_options['s7_icon_color_hover'] );
|
14 |
+
$s7_border_size = esc_attr( $s7_options['s7_border_size'] );
|
15 |
+
$s7_border_color = esc_attr( $s7_options['s7_border_color'] );
|
16 |
+
$s7_border_color_hover = esc_attr( $s7_options['s7_border_color_hover'] );
|
17 |
+
$s7_border_radius = esc_attr( $s7_options['s7_border_radius'] );
|
18 |
+
|
19 |
+
|
20 |
+
$s7_css = "font-size: $s7_icon_size; color: $s7_icon_color; padding: $s7_border_size; background-color: $s7_border_color; border-radius: $s7_border_radius;";
|
21 |
+
|
22 |
+
$input_onhover = "this.style.color='$s7_icon_color_hover', this.style.backgroundColor='$s7_border_color_hover'" ;
|
23 |
+
$input_onhover_out = "this.style.color='$s7_icon_color', this.style.backgroundColor='$s7_border_color'";
|
24 |
+
|
25 |
+
|
26 |
+
$o .= '
|
27 |
+
<div onclick="ht_ctc_shortcode_click(this);" data-ctc-link="'.$link.'" data-ctc-type="'.$return_type.'" style="display: inline; cursor: pointer; z-index: 99999999; '.$css.'" class="'.$class_names.' ht-ctc-inline">
|
28 |
+
<span title="'.$call_to_action.'" class="icon icon-whatsapp2" id="s7-icon" style="'.$s7_css.'"
|
29 |
+
onmouseover = "'.$input_onhover.'"
|
30 |
+
onmouseout = "'.$input_onhover_out.'"
|
31 |
+
></span>
|
32 |
+
</div>
|
33 |
+
';
|
new/inc/styles-shortcode/sc-style-8.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* materialize button
|
4 |
+
*/
|
5 |
+
|
6 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
7 |
+
|
8 |
+
$s8_options = get_option( 'ht_ctc_s8' );
|
9 |
+
|
10 |
+
?>
|
11 |
+
<style>
|
12 |
+
.ht-ctc-sc-style-8 {
|
13 |
+
display: none;
|
14 |
+
}
|
15 |
+
</style>
|
16 |
+
<?php
|
17 |
+
|
18 |
+
wp_enqueue_style('ht_ctc_mdstyle8_css');
|
19 |
+
|
20 |
+
$s8_txt_color = esc_attr( $s8_options['s8_txt_color'] );
|
21 |
+
$s8_icon_color = esc_attr( $s8_options['s8_icon_color'] );
|
22 |
+
$s8_txt_color_on_hover = esc_attr( $s8_options['s8_txt_color_on_hover'] );
|
23 |
+
$s8_bg_color = esc_attr( $s8_options['s8_bg_color'] );
|
24 |
+
$s8_bg_color_on_hover = esc_attr( $s8_options['s8_bg_color_on_hover'] );
|
25 |
+
$s8_icon_color_on_hover = esc_attr( $s8_options['s8_icon_color_on_hover'] );
|
26 |
+
$s8_icon_position = esc_attr( $s8_options['s8_icon_position'] );
|
27 |
+
|
28 |
+
// shortcode attributes
|
29 |
+
$s8_width_sc = $a["s8_width"];
|
30 |
+
// left/right/hide or any thing to display icon just before the text
|
31 |
+
$s8_icon_position_sc = $a["s8_icon_position"];
|
32 |
+
|
33 |
+
if ( '' !== $s8_width_sc ) {
|
34 |
+
$s8_width_css = "width: $s8_width_sc";
|
35 |
+
}
|
36 |
+
|
37 |
+
if ( '' !== $s8_icon_position_sc ) {
|
38 |
+
$s8_icon_position = $s8_icon_position_sc;
|
39 |
+
}
|
40 |
+
|
41 |
+
|
42 |
+
$input_onhover = "this.style.backgroundColor= '$s8_bg_color_on_hover', this.childNodes[1].style.color= '$s8_icon_color_on_hover', this.childNodes[3].style.color= '$s8_txt_color_on_hover'; ";
|
43 |
+
$input_onhover_out = "this.style.backgroundColor= '$s8_bg_color', this.childNodes[1].style.color= '$s8_icon_color', this.childNodes[3].style.color= '$s8_txt_color'; ";
|
44 |
+
|
45 |
+
|
46 |
+
$o .= '
|
47 |
+
<div onclick="ht_ctc_shortcode_click(this);" data-ctc-link="'.$link.'" data-ctc-type="'.$return_type.'" style="cursor: pointer; z-index: 99999999; '.$css.'" class="'.$class_names.' ht-ctc-sc-style-8 ht-ctc-inline mdstyle8">
|
48 |
+
|
49 |
+
<span class="waves-effect waves-light btn" style="background-color: '.$s8_bg_color.'; '.$s8_width_css.'"
|
50 |
+
onmouseover= "'.$input_onhover.'"
|
51 |
+
onmouseout= "'.$input_onhover_out.'">
|
52 |
+
<i class="material-icons '.$s8_icon_position.' icon icon-whatsapp2" style="color: '.$s8_icon_color.';"></i>
|
53 |
+
<span style="color: '.$s8_txt_color.';">'.$call_to_action.'</span>
|
54 |
+
</span>
|
55 |
+
|
56 |
+
</div>
|
57 |
+
';
|
new/inc/styles-shortcode/sc-style-99.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
|
7 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
8 |
+
|
9 |
+
$s99_options = get_option( 'ht_ctc_s99' );
|
10 |
+
|
11 |
+
|
12 |
+
|
13 |
+
$s99_desktop_img_height = esc_attr( $s99_options['s99_desktop_img_height'] );
|
14 |
+
$s99_desktop_img_width = esc_attr( $s99_options['s99_desktop_img_width'] );
|
15 |
+
$s99_mobile_img_height = esc_attr( $s99_options['s99_mobile_img_height'] );
|
16 |
+
$s99_mobile_img_width = esc_attr( $s99_options['s99_mobile_img_width'] );
|
17 |
+
|
18 |
+
// $icon_size = esc_attr( $s1_options['icon_size'] );
|
19 |
+
// $icon_size = '50px';
|
20 |
+
|
21 |
+
|
22 |
+
// img url
|
23 |
+
// image - width, height based on device
|
24 |
+
$s99_img_css = "";
|
25 |
+
|
26 |
+
|
27 |
+
if( 'yes' == $is_mobile ) {
|
28 |
+
|
29 |
+
$s99_own_image = esc_html( $s99_options['s99_mobile_img_url'] );
|
30 |
+
|
31 |
+
if ( '' == $s99_own_image ) {
|
32 |
+
$s99_own_image = plugins_url( './prev/assets/img/whatsapp-icon-square.svg', HT_CTC_PLUGIN_FILE );
|
33 |
+
}
|
34 |
+
|
35 |
+
if ( '' !== $s99_mobile_img_height ) {
|
36 |
+
$s99_img_css .= "height: $s99_mobile_img_height; ";
|
37 |
+
}
|
38 |
+
if ( '' !== $s99_mobile_img_width ) {
|
39 |
+
$s99_img_css .= "width: $s99_mobile_img_width; ";
|
40 |
+
}
|
41 |
+
} else {
|
42 |
+
$s99_own_image = esc_html( $s99_options['s99_dekstop_img_url'] );
|
43 |
+
|
44 |
+
if ( '' == $s99_own_image ) {
|
45 |
+
$s99_own_image = plugins_url( './prev/assets/img/whatsapp-icon-square.svg', HT_CTC_PLUGIN_FILE );
|
46 |
+
}
|
47 |
+
|
48 |
+
if ( '' !== $s99_desktop_img_height ) {
|
49 |
+
$s99_img_css .= "height: $s99_desktop_img_height; ";
|
50 |
+
}
|
51 |
+
|
52 |
+
if ( '' !== $s99_desktop_img_width ) {
|
53 |
+
$s99_img_css .= "width: $s99_desktop_img_width; ";
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
if ( !isset( $s99_options['cta_on_hover'] ) ) {
|
58 |
+
$call_to_action = '';
|
59 |
+
}
|
60 |
+
|
61 |
+
$o .= '
|
62 |
+
<div onclick="ht_ctc_shortcode_click(this);" data-ctc-link="'.$link.'" data-ctc-type="'.$return_type.'" style="display: inline; cursor: pointer; z-index: 99999999; '.$css.'" class="'.$class_names.' ht-ctc-inline">
|
63 |
+
<img class="own-img" title="'.$call_to_action.'" id="style-99" src="'.$s99_own_image.'" style="'.$s99_img_css.'" alt="WhatsApp chat">
|
64 |
+
</div>
|
65 |
+
';
|
66 |
+
|
67 |
+
|
68 |
+
?>
|
new/inc/styles/style-1.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Style - 1
|
4 |
+
*
|
5 |
+
* theme button
|
6 |
+
*
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
10 |
+
|
11 |
+
// $s1_options = get_option( 'ht_ctc_s1' );
|
12 |
+
|
13 |
+
|
14 |
+
?>
|
15 |
+
|
16 |
+
<div class="<?php echo $class_names ?>" style="position: fixed; <?php echo $position ?> cursor: pointer; z-index: 99999999;">
|
17 |
+
<button><?php echo $call_to_action ?></button>
|
18 |
+
</div>
|
new/inc/styles/style-2.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Style - 2
|
4 |
+
*
|
5 |
+
* Andriod like - WhatsApp icon
|
6 |
+
*
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
10 |
+
|
11 |
+
$s2_options = get_option( 'ht_ctc_s2' );
|
12 |
+
|
13 |
+
$s2_img_size = esc_attr( $s2_options['s2_img_size'] );
|
14 |
+
|
15 |
+
|
16 |
+
if ( !isset( $s2_options['cta_on_hover'] ) ) {
|
17 |
+
$call_to_action = '';
|
18 |
+
}
|
19 |
+
|
20 |
+
?>
|
21 |
+
|
22 |
+
<div class="<?php echo $class_names ?>" style="position: fixed; <?php echo $position ?> cursor: pointer; z-index: 99999999;">
|
23 |
+
<!-- <a href="<?php echo $link ?>" target="_blank" rel="noopener"> -->
|
24 |
+
<img class="img-icon" title="<?php echo $call_to_action ?>" style="height: <?php echo $s2_img_size ?>;" src="<?php echo plugins_url( './prev/assets/img/whatsapp-icon-square.svg', HT_CTC_PLUGIN_FILE ) ?>" alt="WhatsApp chat">
|
25 |
+
<!-- </a> -->
|
26 |
+
</div>
|
new/inc/styles/style-3.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Style - 3
|
4 |
+
*
|
5 |
+
* IOS like - WhatsApp icon
|
6 |
+
*
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
10 |
+
|
11 |
+
$s3_options = get_option( 'ht_ctc_s3' );
|
12 |
+
|
13 |
+
$s3_img_size = esc_attr( $s3_options['s3_img_size'] );
|
14 |
+
|
15 |
+
if ( !isset( $s3_options['cta_on_hover'] ) ) {
|
16 |
+
$call_to_action = '';
|
17 |
+
}
|
18 |
+
|
19 |
+
?>
|
20 |
+
<!-- <?php echo $call_to_action; ?> -->
|
21 |
+
|
22 |
+
|
23 |
+
<div class="<?php echo $class_names ?>" style="position: fixed; <?php echo $position ?> cursor: pointer; z-index: 99999999;">
|
24 |
+
<!-- <a href="<?php echo $link ?>" target="_blank"> -->
|
25 |
+
<img class="img-icon" title="<?php echo $call_to_action ?>" style="height: <?php echo $s3_img_size ?>;" src="<?php echo plugins_url( './prev/assets/img/whatsapp-logo.svg', HT_CTC_PLUGIN_FILE ) ?>" alt="WhatsApp chat">
|
26 |
+
<!-- </a> -->
|
27 |
+
</div>
|
new/inc/styles/style-4.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Style - 4
|
4 |
+
*
|
5 |
+
* Chip
|
6 |
+
*
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
10 |
+
|
11 |
+
$s4_options = get_option( 'ht_ctc_s4' );
|
12 |
+
|
13 |
+
|
14 |
+
$s4_text_color = esc_attr( $s4_options['s4_text_color'] );
|
15 |
+
$s4_bg_color = esc_attr( $s4_options['s4_bg_color'] );
|
16 |
+
|
17 |
+
$s4_img_url = esc_attr( $s4_options['s4_img_url'] );
|
18 |
+
|
19 |
+
// if user not added any image
|
20 |
+
if ( '' == $s4_img_url ) {
|
21 |
+
$s4_img_url = plugins_url( './prev/assets/img/whatsapp-logo-32x32.png', HT_CTC_PLUGIN_FILE );
|
22 |
+
}
|
23 |
+
|
24 |
+
?>
|
25 |
+
|
26 |
+
|
27 |
+
<style>
|
28 |
+
|
29 |
+
.chip {
|
30 |
+
display: inline-block;
|
31 |
+
padding-left: 12px;
|
32 |
+
padding-right: 12px;
|
33 |
+
padding-top: 0px;
|
34 |
+
padding-bottom: 0px;
|
35 |
+
border-radius: 25px;
|
36 |
+
font-size: 13px;
|
37 |
+
line-height: 32px;
|
38 |
+
}
|
39 |
+
|
40 |
+
/* Image */
|
41 |
+
.chip img {
|
42 |
+
float: left;
|
43 |
+
margin: 0 8px 0 -12px;
|
44 |
+
height: 32px;
|
45 |
+
width: 32px;
|
46 |
+
border-radius: 50%;
|
47 |
+
}
|
48 |
+
|
49 |
+
</style>
|
50 |
+
|
51 |
+
|
52 |
+
|
53 |
+
|
54 |
+
<div class="<?php echo $class_names ?>" style="position: fixed; <?php echo $position ?> cursor: pointer; z-index: 99999999;">
|
55 |
+
<!-- <a href="<?php echo $link ?>" target="_blank" style="color: inherit;"> -->
|
56 |
+
<div class="chip" style="background-color: <?php echo $s4_bg_color ?>; color: <?php echo $s4_text_color ?>;">
|
57 |
+
<?php echo $call_to_action ?>
|
58 |
+
<img src="<?php echo $s4_img_url ?>" alt="whatsapp">
|
59 |
+
</div>
|
60 |
+
<!-- </a> -->
|
61 |
+
</div>
|
new/inc/styles/style-5.php
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Style - 5
|
4 |
+
* image with content slider
|
5 |
+
*/
|
6 |
+
|
7 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
8 |
+
|
9 |
+
$s5_options = get_option( 'ht_ctc_s5' );
|
10 |
+
|
11 |
+
|
12 |
+
$s5_line_1 = esc_attr( $s5_options['s5_line_1'] );
|
13 |
+
$s5_line_2 = esc_attr( $s5_options['s5_line_2'] );
|
14 |
+
$s5_line_1_color = esc_attr( $s5_options['s5_line_1_color'] );
|
15 |
+
$s5_line_2_color = esc_attr( $s5_options['s5_line_2_color'] );
|
16 |
+
$s5_background_color = esc_attr( $s5_options['s5_background_color'] );
|
17 |
+
$s5_border_color = esc_attr( $s5_options['s5_border_color'] );
|
18 |
+
$s5_img = esc_attr( $s5_options['s5_img'] );
|
19 |
+
$s5_img_height = esc_attr( $s5_options['s5_img_height'] );
|
20 |
+
$s5_img_width = esc_attr( $s5_options['s5_img_width'] );
|
21 |
+
$s5_content_height = esc_attr( $s5_options['s5_content_height'] );
|
22 |
+
$s5_content_width = esc_attr( $s5_options['s5_content_width'] );
|
23 |
+
$s5_img_position = esc_attr( $s5_options['s5_img_position'] );
|
24 |
+
|
25 |
+
|
26 |
+
// default image - if user not added any image
|
27 |
+
if ( '' == $s5_img ) {
|
28 |
+
$s5_img = plugins_url( './prev/assets/img/new_style8.jpg', HT_CTC_PLUGIN_FILE );
|
29 |
+
}
|
30 |
+
|
31 |
+
if ( '' == $s5_line_1 ) {
|
32 |
+
$s5_line_1 = $call_to_action;
|
33 |
+
}
|
34 |
+
|
35 |
+
|
36 |
+
$s5_cta_style = "display: -ms-flexbox; display: -webkit-flex; display: flex;";
|
37 |
+
|
38 |
+
|
39 |
+
$s5_img_style = '';
|
40 |
+
$s5_img_style .= 'height: '.$s5_img_height.'; width: '.$s5_img_width.'; z-index: 999999; ';
|
41 |
+
if ( 'right' == $s5_img_position ) {
|
42 |
+
$s5_img_style .= 'order: 1;';
|
43 |
+
}
|
44 |
+
|
45 |
+
$s5_content_style = '';
|
46 |
+
$s5_content_style .= 'flex-direction: column; justify-content: center; align-items: center; ';
|
47 |
+
$s5_content_style .= ' background-color: '.$s5_background_color.'; border: 1px solid '.$s5_border_color.'; height: '.$s5_content_height.'; width: '.$s5_content_width.'; ';
|
48 |
+
if ( 'right' == $s5_img_position ) {
|
49 |
+
$s5_content_style .= 'margin-right: -4px;';
|
50 |
+
} elseif ( 'left' == $s5_img_position ) {
|
51 |
+
$s5_content_style .= 'margin-left: -4px;';
|
52 |
+
}
|
53 |
+
|
54 |
+
|
55 |
+
// adding styles..
|
56 |
+
$s5_css_code = '
|
57 |
+
.ht-ctc-style-5 .s5_img {
|
58 |
+
box-shadow: 2px 5px 10px rgba(0,0,0,.5);
|
59 |
+
}
|
60 |
+
.ht-ctc-style-5 .s5_content {
|
61 |
+
box-shadow: 2px 5px 10px rgba(0,0,0,.5);
|
62 |
+
border-radius: 5px;
|
63 |
+
}
|
64 |
+
.ht-ctc-style-5 .s5_content span {
|
65 |
+
padding: 5px;
|
66 |
+
overflow: hidden;
|
67 |
+
}
|
68 |
+
.ht-ctc-style-5 .s5_content .heading {
|
69 |
+
font-size: 20px;
|
70 |
+
}
|
71 |
+
.ht-ctc-style-5 .s5_content .description {
|
72 |
+
font-size: 12px;
|
73 |
+
}
|
74 |
+
.ht-ctc-style-5 .s5_content.right {
|
75 |
+
animation: 1s s5_translate_right;
|
76 |
+
}
|
77 |
+
.ht-ctc-style-5 .s5_content.left {
|
78 |
+
animation: 1s s5_translate_left;
|
79 |
+
}
|
80 |
+
|
81 |
+
@keyframes s5_translate_right {
|
82 |
+
0% {
|
83 |
+
transform: translateX(55px)
|
84 |
+
}
|
85 |
+
100% {
|
86 |
+
transform: translateX(0px)
|
87 |
+
}
|
88 |
+
}
|
89 |
+
|
90 |
+
@keyframes s5_translate_left {
|
91 |
+
0% {
|
92 |
+
transform: translateX(-55px)
|
93 |
+
}
|
94 |
+
100% {
|
95 |
+
transform: translateX(0px)
|
96 |
+
}
|
97 |
+
}
|
98 |
+
';
|
99 |
+
|
100 |
+
|
101 |
+
$o = '';
|
102 |
+
$o .= '<style>';
|
103 |
+
$o .= '.ht-ctc-style-5 .s5_content { display: none; } .ht-ctc-style-5 .s5_cta:hover .s5_content { display: flex; } ';
|
104 |
+
$o .= $s5_css_code;
|
105 |
+
$o .= '</style>';
|
106 |
+
|
107 |
+
echo $o;
|
108 |
+
|
109 |
+
|
110 |
+
?>
|
111 |
+
|
112 |
+
<div class="<?php echo $class_names ?>" style="position: fixed; <?php echo $position ?> cursor: pointer; z-index: 99999999;">
|
113 |
+
|
114 |
+
<div class="ht-ctc-style-5" style="cursor: pointer; z-index: 99999999;" >
|
115 |
+
|
116 |
+
<div class="s5_cta" style="<?php echo $s5_cta_style ?>" >
|
117 |
+
<img class="s5_img" src="<?php echo $s5_img ?>" style="<?php echo $s5_img_style ?>" alt="whatsapp">
|
118 |
+
<div class="s5_content <?php echo $s5_img_position ?>" style="<?php echo $s5_content_style ?>" >
|
119 |
+
<span class="heading" style="color: <?php echo $s5_line_1_color ?>"><?php echo $s5_line_1 ?></span>
|
120 |
+
<span class="description" style="color: <?php echo $s5_line_2_color ?>"><?php echo $s5_line_2 ?></span>
|
121 |
+
</div>
|
122 |
+
</div>
|
123 |
+
|
124 |
+
</div>
|
125 |
+
</div>
|
new/inc/styles/style-6.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Style - 6
|
4 |
+
*
|
5 |
+
* link
|
6 |
+
*
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
10 |
+
|
11 |
+
$s6_options = get_option( 'ht_ctc_s6' );
|
12 |
+
|
13 |
+
$s6_txt_color = esc_attr( $s6_options['s6_txt_color'] );
|
14 |
+
$s6_txt_color_on_hover = esc_attr( $s6_options['s6_txt_color_on_hover'] );
|
15 |
+
$s6_txt_decoration = esc_attr( $s6_options['s6_txt_decoration'] );
|
16 |
+
$s6_txt_decoration_on_hover = esc_attr( $s6_options['s6_txt_decoration_on_hover'] );
|
17 |
+
|
18 |
+
|
19 |
+
?>
|
20 |
+
|
21 |
+
<div class="<?php echo $class_names ?>" style="position: fixed; <?php echo $position ?> cursor: pointer; z-index: 99999999;">
|
22 |
+
<!-- <a href="<?php echo $link ?>" target="_blank" -->
|
23 |
+
<a style="color: <?php echo $s6_txt_color ?>; text-decoration: <?php echo $s6_txt_decoration ?>;"
|
24 |
+
onmouseover = "this.style.color = '<?php echo $s6_txt_color_on_hover ?>', this.style.textDecoration = '<?php echo $s6_txt_decoration_on_hover ?>' "
|
25 |
+
onmouseout = "this.style.color = '<?php echo $s6_txt_color ?>', this.style.textDecoration = '<?php echo $s6_txt_decoration ?>' "
|
26 |
+
>
|
27 |
+
<?php echo $call_to_action ?>
|
28 |
+
</a>
|
29 |
+
</div>
|
new/inc/styles/style-7.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Style - 7
|
4 |
+
* icon with customize padding
|
5 |
+
*/
|
6 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
7 |
+
|
8 |
+
$s7_options = get_option( 'ht_ctc_s7' );
|
9 |
+
|
10 |
+
$s7_icon_size = esc_attr( $s7_options['s7_icon_size'] );
|
11 |
+
$s7_icon_color = esc_attr( $s7_options['s7_icon_color'] );
|
12 |
+
$s7_icon_color_hover = esc_attr( $s7_options['s7_icon_color_hover'] );
|
13 |
+
$s7_border_size = esc_attr( $s7_options['s7_border_size'] );
|
14 |
+
$s7_border_color = esc_attr( $s7_options['s7_border_color'] );
|
15 |
+
$s7_border_color_hover = esc_attr( $s7_options['s7_border_color_hover'] );
|
16 |
+
$s7_border_radius = esc_attr( $s7_options['s7_border_radius'] );
|
17 |
+
|
18 |
+
$s7_css = "font-size: $s7_icon_size; color: $s7_icon_color; padding: $s7_border_size; background-color: $s7_border_color; border-radius: $s7_border_radius;";
|
19 |
+
|
20 |
+
|
21 |
+
?>
|
22 |
+
<div class="<?php echo $class_names ?>" style="position: fixed; <?php echo $position ?> cursor: pointer; z-index: 99999999;">
|
23 |
+
<span title="<?php echo $call_to_action ?>" class="icon icon-whatsapp2" id="s7-icon" style="<?php echo $s7_css ?>"
|
24 |
+
onmouseover = "this.style.color = '<?php echo $s7_icon_color_hover ?>', this.style.backgroundColor = '<?php echo $s7_border_color_hover ?>' "
|
25 |
+
onmouseout = "this.style.color = '<?php echo $s7_icon_color ?>', this.style.backgroundColor = '<?php echo $s7_border_color ?>' "
|
26 |
+
></span>
|
27 |
+
</div>
|
new/inc/styles/style-8.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Style - 5
|
4 |
+
*
|
5 |
+
* Button with icon
|
6 |
+
*
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
10 |
+
|
11 |
+
$s8_options = get_option( 'ht_ctc_s8' );
|
12 |
+
|
13 |
+
wp_enqueue_style('ht_ctc_mdstyle8_css');
|
14 |
+
|
15 |
+
?>
|
16 |
+
<style>
|
17 |
+
.ht-ctc-style-8 {
|
18 |
+
display: none;
|
19 |
+
}
|
20 |
+
</style>
|
21 |
+
<?php
|
22 |
+
|
23 |
+
$s8_txt_color = esc_attr( $s8_options['s8_txt_color'] );
|
24 |
+
$s8_icon_color = esc_attr( $s8_options['s8_icon_color'] );
|
25 |
+
$s8_txt_color_on_hover = esc_attr( $s8_options['s8_txt_color_on_hover'] );
|
26 |
+
$s8_bg_color = esc_attr( $s8_options['s8_bg_color'] );
|
27 |
+
$s8_bg_color_on_hover = esc_attr( $s8_options['s8_bg_color_on_hover'] );
|
28 |
+
|
29 |
+
$s8_icon_color_on_hover = esc_attr( $s8_options['s8_icon_color_on_hover'] );
|
30 |
+
|
31 |
+
$s8_icon_position = esc_attr( $s8_options['s8_icon_position'] );
|
32 |
+
|
33 |
+
?>
|
34 |
+
|
35 |
+
|
36 |
+
<div class="<?php echo $class_names ?> mdstyle8 ht-ctc-style-8" style="position: fixed; <?php echo $position ?> cursor: pointer; z-index: 99999999;">
|
37 |
+
<!-- <a href="<?php echo $link ?>" target="_blank"> -->
|
38 |
+
|
39 |
+
<span class="waves-effect waves-light btn" style="background-color: <?php echo $s8_bg_color ?>; "
|
40 |
+
onmouseover = "this.style.backgroundColor = '<?php echo $s8_bg_color_on_hover ?>',
|
41 |
+
document.getElementsByClassName('ht-ctc-s8-icon')[0].style.color = '<?php echo $s8_icon_color_on_hover ?>',
|
42 |
+
document.getElementsByClassName('ht-ctc-s8-text')[0].style.color = '<?php echo $s8_txt_color_on_hover ?>'
|
43 |
+
"
|
44 |
+
onmouseout = "this.style.backgroundColor = '<?php echo $s8_bg_color ?>',
|
45 |
+
document.getElementsByClassName('ht-ctc-s8-icon')[0].style.color = '<?php echo $s8_icon_color ?>',
|
46 |
+
document.getElementsByClassName('ht-ctc-s8-text')[0].style.color = '<?php echo $s8_txt_color ?>'
|
47 |
+
">
|
48 |
+
<i class="material-icons <?php echo $s8_icon_position ?> icon icon-whatsapp2 ht-ctc-s8-icon"
|
49 |
+
style="color: <?php echo $s8_icon_color ?>;">
|
50 |
+
</i>
|
51 |
+
<span class="ht-ctc-s8-text" style="color: <?php echo $s8_txt_color ?>;">
|
52 |
+
<?php echo $call_to_action ?>
|
53 |
+
</span>
|
54 |
+
</span>
|
55 |
+
|
56 |
+
<!-- </a> -->
|
57 |
+
</div>
|
new/inc/styles/style-99.php
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Style - 99
|
4 |
+
*
|
5 |
+
* own image / GIF
|
6 |
+
*
|
7 |
+
*/
|
8 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
9 |
+
|
10 |
+
$s99_options = get_option( 'ht_ctc_s99' );
|
11 |
+
|
12 |
+
|
13 |
+
$s99_desktop_img_height = esc_attr( $s99_options['s99_desktop_img_height'] );
|
14 |
+
$s99_desktop_img_width = esc_attr( $s99_options['s99_desktop_img_width'] );
|
15 |
+
$s99_mobile_img_height = esc_attr( $s99_options['s99_mobile_img_height'] );
|
16 |
+
$s99_mobile_img_width = esc_attr( $s99_options['s99_mobile_img_width'] );
|
17 |
+
|
18 |
+
// $icon_size = esc_attr( $s1_options['icon_size'] );
|
19 |
+
// $icon_size = '50px';
|
20 |
+
|
21 |
+
|
22 |
+
// img url
|
23 |
+
// image - width, height based on device
|
24 |
+
$s99_img_css = "";
|
25 |
+
|
26 |
+
|
27 |
+
if( 'yes' == $is_mobile ) {
|
28 |
+
|
29 |
+
$s99_own_image = esc_html( $s99_options['s99_mobile_img_url'] );
|
30 |
+
|
31 |
+
if ( '' == $s99_own_image ) {
|
32 |
+
$s99_own_image = plugins_url( './prev/assets/img/whatsapp-icon-square.svg', HT_CTC_PLUGIN_FILE );
|
33 |
+
}
|
34 |
+
|
35 |
+
if ( '' !== $s99_mobile_img_height ) {
|
36 |
+
$s99_img_css .= "height: $s99_mobile_img_height; ";
|
37 |
+
}
|
38 |
+
if ( '' !== $s99_mobile_img_width ) {
|
39 |
+
$s99_img_css .= "width: $s99_mobile_img_width; ";
|
40 |
+
}
|
41 |
+
} else {
|
42 |
+
$s99_own_image = esc_html( $s99_options['s99_dekstop_img_url'] );
|
43 |
+
|
44 |
+
if ( '' == $s99_own_image ) {
|
45 |
+
$s99_own_image = plugins_url( './prev/assets/img/whatsapp-icon-square.svg', HT_CTC_PLUGIN_FILE );
|
46 |
+
}
|
47 |
+
|
48 |
+
if ( '' !== $s99_desktop_img_height ) {
|
49 |
+
$s99_img_css .= "height: $s99_desktop_img_height; ";
|
50 |
+
}
|
51 |
+
|
52 |
+
if ( '' !== $s99_desktop_img_width ) {
|
53 |
+
$s99_img_css .= "width: $s99_desktop_img_width; ";
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
// $s99_own_image = "http://www.holithemes.com/whatsapp-chat/wp-content/uploads/2018/03/WhatsApp_Logo_2_desktop.jpg";
|
58 |
+
|
59 |
+
if ( !isset( $s99_options['cta_on_hover'] ) ) {
|
60 |
+
$call_to_action = '';
|
61 |
+
}
|
62 |
+
|
63 |
+
?>
|
64 |
+
|
65 |
+
<div class="<?php echo $class_names ?>" style="position: fixed; <?php echo $position ?> cursor: pointer; z-index: 99999999;">
|
66 |
+
<!-- <a href="<?php echo $link ?>" target="_blank"> -->
|
67 |
+
<img class="own-img" title="<?php echo $call_to_action ?>" id="style-99" src="<?php echo $s99_own_image ?>" style="<?php echo $s99_img_css ?>" alt="WhatsApp chat">
|
68 |
+
<!-- </a> -->
|
69 |
+
</div>
|
70 |
+
|
71 |
+
|
72 |
+
|
73 |
+
|
74 |
+
|
prev/admin/class-ccw-admin-page.php
CHANGED
@@ -16,10 +16,13 @@ class CCW_Admin_Page {
|
|
16 |
|
17 |
function ccw_custom_settings() {
|
18 |
|
|
|
19 |
register_setting( 'ccw_settings_group', 'ccw_options' , 'ccw_options_sanitize' );
|
20 |
|
21 |
add_settings_section( 'ccw_settings', '', array( $this, 'ccw_settings_section' ), 'ccw_options_settings' );
|
22 |
|
|
|
|
|
23 |
add_settings_field( 'ccw_enable', __( 'Enable Floating Styles' , 'click-to-chat-for-whatsapp' ), array( $this, 'ccw_enable_cb' ), 'ccw_options_settings', 'ccw_settings' );
|
24 |
add_settings_field( 'ccw_enable_sc', __( 'Enable ShortCodes' , 'click-to-chat-for-whatsapp' ), array( $this, 'ccw_enable_sc_cb' ), 'ccw_options_settings', 'ccw_settings' );
|
25 |
add_settings_field( 'ccw_return_type', __( 'Return Type' , 'click-to-chat-for-whatsapp' ), array( $this, 'ccw_return_type_cb' ), 'ccw_options_settings', 'ccw_settings' );
|
@@ -48,7 +51,99 @@ class CCW_Admin_Page {
|
|
48 |
echo '<h1>Click to Chat For WhatsApp - Global Settings</h1>';
|
49 |
}
|
50 |
|
51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
// enable / disable floating styles
|
53 |
function ccw_enable_cb() {
|
54 |
$ccw_enable = get_option('ccw_options');
|
@@ -120,7 +215,7 @@ class CCW_Admin_Page {
|
|
120 |
<option value="99" <?php echo $style_value == 99 ? 'SELECTED' : ''; ?> >Style-99 ( Add your own Image / GIF )</option>
|
121 |
<option value="0" <?php echo $style_value == 0 ? 'SELECTED' : ''; ?> ><?php _e( 'Hide on Desktop Devices' , 'click-to-chat-for-whatsapp' ) ?></option>
|
122 |
</select>
|
123 |
-
<label><?php _e( 'Select Style for
|
124 |
<p class="description"> - <a target="_blank" href="https://www.holithemes.com/whatsapp-chat/styles/">List of Styles</a> </p>
|
125 |
<p class="description">These styles are customizable - <a target="_blank" href="<?php echo admin_url( 'admin.php?page=ccw-edit-styles' ); ?>">Customize Styles</a> </p>
|
126 |
|
@@ -516,7 +611,7 @@ class CCW_Admin_Page {
|
|
516 |
<div class="input-field col s12">
|
517 |
<input name="ccw_options[list_hideon_pages]" value="<?php echo esc_attr( $ccw_list_id_tohide['list_hideon_pages'] ) ?>" id="ccw_list_id_tohide" type="text" class="input-margin">
|
518 |
<label for="ccw_list_id_tohide">Id's list to Hide - add ',' after each id </label>
|
519 |
-
<p class="description"> Add Post, Pages, Media - ID's to hide, can add multiple id's separate with comma ( , ) - <a target="_blank" href="https://www.holithemes.com/whatsapp-chat/show-hide-styles-based-on-id/">more info</a> </p>
|
520 |
</div>
|
521 |
</div>
|
522 |
<?php
|
@@ -530,7 +625,7 @@ class CCW_Admin_Page {
|
|
530 |
<div class="input-field col s12">
|
531 |
<input name="ccw_options[list_hideon_cat]" value="<?php echo esc_attr( $ccw_list_cat_tohide['list_hideon_cat'] ) ?>" id="ccw_list_cat_tohide" type="text" class="input-margin">
|
532 |
<label for="ccw_list_cat_tohide">Category name\'s to Hide - add \',\' after each category name </label>
|
533 |
-
<p class="description">Category name\'s to hide, can add multiple Categories separate with comma ( , ) - <a target="_blank" href="https://www.holithemes.com/whatsapp-chat/hide-styles-based-on-category/">more info</a> </p>
|
534 |
</div>
|
535 |
</div>
|
536 |
<?php
|
16 |
|
17 |
function ccw_custom_settings() {
|
18 |
|
19 |
+
register_setting( 'ccw_settings_group', 'ht_ctc_switch' , 'ccw_options_sanitize' );
|
20 |
register_setting( 'ccw_settings_group', 'ccw_options' , 'ccw_options_sanitize' );
|
21 |
|
22 |
add_settings_section( 'ccw_settings', '', array( $this, 'ccw_settings_section' ), 'ccw_options_settings' );
|
23 |
|
24 |
+
add_settings_field( 'ht_ctc_switch', __( 'Switch to new User Interface' , 'click-to-chat-for-whatsapp' ), array( $this, 'ccw_switch_cb' ), 'ccw_options_settings', 'ccw_settings' );
|
25 |
+
|
26 |
add_settings_field( 'ccw_enable', __( 'Enable Floating Styles' , 'click-to-chat-for-whatsapp' ), array( $this, 'ccw_enable_cb' ), 'ccw_options_settings', 'ccw_settings' );
|
27 |
add_settings_field( 'ccw_enable_sc', __( 'Enable ShortCodes' , 'click-to-chat-for-whatsapp' ), array( $this, 'ccw_enable_sc_cb' ), 'ccw_options_settings', 'ccw_settings' );
|
28 |
add_settings_field( 'ccw_return_type', __( 'Return Type' , 'click-to-chat-for-whatsapp' ), array( $this, 'ccw_return_type_cb' ), 'ccw_options_settings', 'ccw_settings' );
|
51 |
echo '<h1>Click to Chat For WhatsApp - Global Settings</h1>';
|
52 |
}
|
53 |
|
54 |
+
|
55 |
+
|
56 |
+
/**
|
57 |
+
* switch interface
|
58 |
+
*/
|
59 |
+
function ccw_switch_cb() {
|
60 |
+
$options = get_option('ht_ctc_switch');
|
61 |
+
$interface_value = esc_attr( $options['interface'] );
|
62 |
+
?>
|
63 |
+
|
64 |
+
<ul class="collapsible" data-collapsible="accordion">
|
65 |
+
<li>
|
66 |
+
<div class="collapsible-header">Switch interface</div>
|
67 |
+
<div class="collapsible-body">
|
68 |
+
|
69 |
+
<p class="description" style="color: red"> <strong> Please reconfigure the settings, after switching to the new interface </strong></p>
|
70 |
+
<br>
|
71 |
+
<p class="description">We developed a new interface with lot more features</p>
|
72 |
+
<p class="description">Chat, Group and Share features</p>
|
73 |
+
<br>
|
74 |
+
|
75 |
+
<div class="row">
|
76 |
+
<div class="input-field col s12" style="margin-bottom: 0px;">
|
77 |
+
<select name="ht_ctc_switch[interface]" class="select-2">
|
78 |
+
<!-- here first option value place as "no" as here default/db value not placed, when save with no changes it saves as no -->
|
79 |
+
<option value="no" <?php echo $interface_value == 'no' ? 'SELECTED' : ''; ?> >Previous Interface</option>
|
80 |
+
<option value="yes" <?php echo $interface_value == 'yes' ? 'SELECTED' : ''; ?> >New Interface (Have to reconfigure the settings)</option>
|
81 |
+
</select>
|
82 |
+
<label>Switch Interface</label>
|
83 |
+
</div>
|
84 |
+
</div>
|
85 |
+
|
86 |
+
<!-- <p class="description"> Please reconfigure the settings, after switching to the new interface </p> -->
|
87 |
+
<p class="description"> Modified: </p>
|
88 |
+
<ol>
|
89 |
+
<li class="description"> Styles </li>
|
90 |
+
<li class="description"> Shortcodes </li>
|
91 |
+
<li class="description"> Show/Hide feature to Show or Hide, the styles</li>
|
92 |
+
</ol>
|
93 |
+
<br>
|
94 |
+
<p class="description"> <a target="_blank" href="https://www.holithemes.com/plugins/click-to-chat/new-interface/">New Interface</a></p>
|
95 |
+
|
96 |
+
</div>
|
97 |
+
</div>
|
98 |
+
</li>
|
99 |
+
</ul>
|
100 |
+
|
101 |
+
<?php
|
102 |
+
}
|
103 |
+
|
104 |
+
|
105 |
+
/**
|
106 |
+
* deprecated switch interface option
|
107 |
+
*/
|
108 |
+
function ccw_switch_cb2() {
|
109 |
+
$options = get_option('ccw_options');
|
110 |
+
|
111 |
+
if ( isset( $options['switch_to_new'] ) ) {
|
112 |
+
?>
|
113 |
+
<p>
|
114 |
+
<label>
|
115 |
+
<input name="ccw_options[switch_to_new]" type="checkbox" value="1" <?php checked( $options['switch_to_new'], 1 ); ?> id="switch_to_new" />
|
116 |
+
<span>Switch to new user Interface <b style="color: red;"> have to reconfigure the plugin settings.</b></span>
|
117 |
+
</label>
|
118 |
+
</p>
|
119 |
+
<?php
|
120 |
+
} else {
|
121 |
+
?>
|
122 |
+
<p>
|
123 |
+
<label>
|
124 |
+
<input name="ccw_options[switch_to_new]" type="checkbox" value="1" id="switch_to_new" />
|
125 |
+
<span>Switch to new user Interface <b style="color: red;"> have to reconfigure the plugin settings.</b></span>
|
126 |
+
</label>
|
127 |
+
</p>
|
128 |
+
<?php
|
129 |
+
}
|
130 |
+
?>
|
131 |
+
|
132 |
+
<!-- <p class="description"> please understand that if switched to new interface have to reconfigure the plugin settings.</p> -->
|
133 |
+
<p class="description"> Upgrade to the new interface to get newly introduced features </p>
|
134 |
+
<p class="description"> Please reconfigure the settings, after switching to the new interface </p>
|
135 |
+
<!-- <p class="description"> New Features:</p> -->
|
136 |
+
<p class="description"> Chat, Group Chat, and Share features </p>
|
137 |
+
<p class="description"> Modified: </p>
|
138 |
+
<li class="description"> Styles </li>
|
139 |
+
<li class="description"> Shortcodes </li>
|
140 |
+
<li class="description"> Show/Hide feature to Show or Hide, the styles.</li>
|
141 |
+
<p class="description"> <a target="_blank" href="https://www.holithemes.com/plugins/click-to-chat/new-interface/">New Interface</a></p>
|
142 |
+
<?php
|
143 |
+
|
144 |
+
}
|
145 |
+
|
146 |
+
|
147 |
// enable / disable floating styles
|
148 |
function ccw_enable_cb() {
|
149 |
$ccw_enable = get_option('ccw_options');
|
215 |
<option value="99" <?php echo $style_value == 99 ? 'SELECTED' : ''; ?> >Style-99 ( Add your own Image / GIF )</option>
|
216 |
<option value="0" <?php echo $style_value == 0 ? 'SELECTED' : ''; ?> ><?php _e( 'Hide on Desktop Devices' , 'click-to-chat-for-whatsapp' ) ?></option>
|
217 |
</select>
|
218 |
+
<label><?php _e( 'Select Style for Desktop' , 'click-to-chat-for-whatsapp' ) ?></label>
|
219 |
<p class="description"> - <a target="_blank" href="https://www.holithemes.com/whatsapp-chat/styles/">List of Styles</a> </p>
|
220 |
<p class="description">These styles are customizable - <a target="_blank" href="<?php echo admin_url( 'admin.php?page=ccw-edit-styles' ); ?>">Customize Styles</a> </p>
|
221 |
|
611 |
<div class="input-field col s12">
|
612 |
<input name="ccw_options[list_hideon_pages]" value="<?php echo esc_attr( $ccw_list_id_tohide['list_hideon_pages'] ) ?>" id="ccw_list_id_tohide" type="text" class="input-margin">
|
613 |
<label for="ccw_list_id_tohide">Id's list to Hide - add ',' after each id </label>
|
614 |
+
<p class="description"> Add Post, Pages, Media - ID's to hide, can add multiple id's separate with a comma ( , ) - <a target="_blank" href="https://www.holithemes.com/whatsapp-chat/show-hide-styles-based-on-id/">more info</a> </p>
|
615 |
</div>
|
616 |
</div>
|
617 |
<?php
|
625 |
<div class="input-field col s12">
|
626 |
<input name="ccw_options[list_hideon_cat]" value="<?php echo esc_attr( $ccw_list_cat_tohide['list_hideon_cat'] ) ?>" id="ccw_list_cat_tohide" type="text" class="input-margin">
|
627 |
<label for="ccw_list_cat_tohide">Category name\'s to Hide - add \',\' after each category name </label>
|
628 |
+
<p class="description">Category name\'s to hide, can add multiple Categories separate with a comma ( , ) - <a target="_blank" href="https://www.holithemes.com/whatsapp-chat/hide-styles-based-on-category/">more info</a> </p>
|
629 |
</div>
|
630 |
</div>
|
631 |
<?php
|
prev/admin/commons/admin-sidebar.php
CHANGED
@@ -25,7 +25,6 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
|
25 |
<p>Please <a href="https://www.holithemes.com/go/ctc-1-8">Download</a> the beta version and reinstall the plugin</p><br>
|
26 |
<!-- <p>After downloading, please delete the current version and reinstall the latest version.</p><br> -->
|
27 |
<br>
|
28 |
-
|
29 |
</div>
|
30 |
<div class="card-action">
|
31 |
<a href="https://www.holithemes.com/go/ctc-1-8">Download</a>
|
25 |
<p>Please <a href="https://www.holithemes.com/go/ctc-1-8">Download</a> the beta version and reinstall the plugin</p><br>
|
26 |
<!-- <p>After downloading, please delete the current version and reinstall the latest version.</p><br> -->
|
27 |
<br>
|
|
|
28 |
</div>
|
29 |
<div class="card-action">
|
30 |
<a href="https://www.holithemes.com/go/ctc-1-8">Download</a>
|
prev/admin/default-values.php
CHANGED
@@ -236,4 +236,40 @@ function new_options() {
|
|
236 |
|
237 |
}
|
238 |
|
239 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
|
237 |
}
|
238 |
|
239 |
+
new_options();
|
240 |
+
|
241 |
+
|
242 |
+
|
243 |
+
/**
|
244 |
+
* name: ht_ctc_switch
|
245 |
+
*
|
246 |
+
* interface - option - yes new interface, no previous interface
|
247 |
+
*
|
248 |
+
* This have to run in previous interface also as 1.8, 1.8., 1.8.2 beta versions released
|
249 |
+
* as switch option is a check option
|
250 |
+
*
|
251 |
+
*/
|
252 |
+
function ht_ctc_switch() {
|
253 |
+
|
254 |
+
// here in prev inteface set default as 'no'
|
255 |
+
$interface = 'no';
|
256 |
+
|
257 |
+
// in 1.8.1, 1.8.2 beta releases used switch option as a checklist
|
258 |
+
$ccw_options = get_option('ccw_options');
|
259 |
+
if ( isset ( $ccw_options['switch_to_new'] ) ) {
|
260 |
+
$interface = 'yes';
|
261 |
+
}
|
262 |
+
|
263 |
+
// plugin details
|
264 |
+
$values = array(
|
265 |
+
'interface' => $interface,
|
266 |
+
);
|
267 |
+
|
268 |
+
|
269 |
+
$db_values = get_option( 'ht_ctc_switch', array() );
|
270 |
+
$update_values = array_merge($values, $db_values);
|
271 |
+
update_option('ht_ctc_switch', $update_values);
|
272 |
+
|
273 |
+
}
|
274 |
+
|
275 |
+
ht_ctc_switch();
|
prev/admin/settings_page.php
CHANGED
@@ -28,7 +28,9 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
|
28 |
|
29 |
<div class="col s12 m12 xl6 admin_sidebar">
|
30 |
<div class="wca_card" style="display: none;">
|
31 |
-
<?php
|
|
|
|
|
32 |
</div>
|
33 |
</div>
|
34 |
|
@@ -36,7 +38,7 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
|
36 |
|
37 |
<hr> <br> <br>
|
38 |
|
39 |
-
|
40 |
<div class="row">
|
41 |
|
42 |
<div class="col s12 m12 l12 xl9">
|
@@ -75,6 +77,18 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
|
75 |
</div>
|
76 |
</div> -->
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
|
79 |
</div>
|
80 |
|
28 |
|
29 |
<div class="col s12 m12 xl6 admin_sidebar">
|
30 |
<div class="wca_card" style="display: none;">
|
31 |
+
<?php
|
32 |
+
// include_once 'commons/admin-sidebar.php';
|
33 |
+
?>
|
34 |
</div>
|
35 |
</div>
|
36 |
|
38 |
|
39 |
<hr> <br> <br>
|
40 |
|
41 |
+
|
42 |
<div class="row">
|
43 |
|
44 |
<div class="col s12 m12 l12 xl9">
|
77 |
</div>
|
78 |
</div> -->
|
79 |
|
80 |
+
<div class="collection with-header">
|
81 |
+
<div class="collection-header"><bold>HoliThemes On</bold></div>
|
82 |
+
<a target="_blank" href="https://www.facebook.com/holithemes/" class="collection-item">Facebook</a>
|
83 |
+
<a target="_blank" href="https://twitter.com/holithemes" class="collection-item">Twitter</a>
|
84 |
+
<a target="_blank" href="https://www.instagram.com/holithemes/" class="collection-item">Instagram</a>
|
85 |
+
<a target="_blank" href="https://www.youtube.com/channel/UC2Tf_WB9PWffO2B3tswWCGw" class="collection-item">YouTube</a>
|
86 |
+
<a target="_blank" href="https://www.linkedin.com/company/holithemes" class="collection-item">LinkedIn</a>
|
87 |
+
</div>
|
88 |
+
|
89 |
+
|
90 |
+
|
91 |
+
|
92 |
|
93 |
</div>
|
94 |
|
prev/assets/css/mdstyle8.css
CHANGED
@@ -865,3 +865,21 @@
|
|
865 |
width: calc(100% - 3rem); }
|
866 |
.mdstyle8 .prefix ~ label {
|
867 |
margin-left: 3rem; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
865 |
width: calc(100% - 3rem); }
|
866 |
.mdstyle8 .prefix ~ label {
|
867 |
margin-left: 3rem; }
|
868 |
+
|
869 |
+
|
870 |
+
|
871 |
+
|
872 |
+
|
873 |
+
|
874 |
+
/* custom code */
|
875 |
+
|
876 |
+
|
877 |
+
/* for new interface */
|
878 |
+
/* for style-8 */
|
879 |
+
/* todo - if plan to swift to new interface content itself.. */
|
880 |
+
.ht-ctc-style-8 {
|
881 |
+
display: block;
|
882 |
+
}
|
883 |
+
.ht-ctc-sc-style-8 {
|
884 |
+
display: inline;
|
885 |
+
}
|
prev/assets/img/new_style8.jpg
ADDED
Binary file
|
readme.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
=== Click to Chat ===
|
2 |
Requires at least: 4.6
|
3 |
-
Tested up to: 5.3
|
4 |
Requires PHP: 5.6
|
5 |
Contributors: holithemes
|
6 |
Stable tag: trunk
|
@@ -12,15 +12,15 @@ License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
-
Let's make your Web page visitors Contact you through "WhatsApp" with a single Click (WhatsApp Chat,
|
16 |
|
17 |
**Mobile:** Navigates to WhatsApp App.
|
18 |
|
19 |
**Desktop:** Navigates to WhatsApp Webpage (web.whatsapp.com). Users can chat directly from the browser.
|
20 |
|
21 |
-
[Demo](https://
|
22 |
|
23 |
-
[Documentation](https://
|
24 |
|
25 |
|
26 |
= How easy the plugin is =
|
@@ -29,44 +29,38 @@ Let's make your Web page visitors Contact you through "WhatsApp" with a single C
|
|
29 |
* If using WhatsApp group invite/chat add WhatsApp group id.
|
30 |
|
31 |
|
32 |
-
* 9 Styles
|
33 |
* Place the styles at any position of the screen.
|
34 |
|
35 |
= Features =
|
36 |
|
37 |
* Navigates to WhatsApp Chat
|
38 |
* Navigates to WhatsApp Group Chat
|
39 |
-
*
|
40 |
* Add Own Image or GIF
|
41 |
* Floating style can position at any place on the screen
|
42 |
( At any pixel of the screen, not limited to fixed positions )
|
43 |
-
* Hide Styles based on Post type, Post ID, Categories, Device Type
|
44 |
* Pre-filled Message ( Includes Placeholder to add Web page URL )
|
45 |
-
*
|
46 |
-
*
|
47 |
-
*
|
48 |
-
* Google Analytics - custom event values
|
49 |
-
* Google Analytics using Google Tag Manager
|
50 |
-
* Facebook Analytics - custom event name, custom parameter name, and value
|
51 |
-
|
52 |
-
[Google Analytics](https://www.holithemes.com/whatsapp-chat/google-analytics/)
|
53 |
|
54 |
-
[
|
55 |
|
56 |
-
|
57 |
|
58 |
|
59 |
= Nine Styles + own Image =
|
60 |
|
61 |
1. **Style-1:** Button, appears as theme button.
|
62 |
-
1. **Style-2:**
|
63 |
1. **Style-3:** Image
|
64 |
1. **Style-4:** Chip style - combination of image and a text message
|
65 |
-
1. **Style-5:**
|
66 |
-
1. **Style-6:**
|
67 |
-
1. **Style-7:** Icon with
|
68 |
1. **Style-8:** Button with text, icon
|
69 |
-
1. **Style-9:** Image
|
70 |
1. **Style - 99:** Own Image / GIF / Animated image
|
71 |
|
72 |
|
@@ -74,42 +68,26 @@ or using [Google Tag Manager](https://www.holithemes.com/google-analytics-for-cl
|
|
74 |
|
75 |
Pre-filled message is the text that appears on the WhatsApp chat window when the user clicks on Image/button. User can start the conversation easily.
|
76 |
|
77 |
-
To add Web page URL in Pre-filled message add {{url}} placeholder - [pre-filled message](https://
|
78 |
|
79 |
by adding the {{url}} placeholder we can understand from which page the user started WhatsApp chat.
|
80 |
|
81 |
|
82 |
-
= Shortcodes: =
|
83 |
-
|
84 |
-
Add styles within line of the post content
|
85 |
-
By default, Shortcodes take value from what saved in your plugin settings pages, can customize using attributes within the shortcode
|
86 |
-
|
87 |
-
**[chat]**
|
88 |
-
|
89 |
-
**[chat num=911234567890]** - To Change WhatsApp number for a shortcode
|
90 |
-
|
91 |
-
**[chat style=1]** - To change Style
|
92 |
-
|
93 |
-
**[chat style=2 num=911234567890]** - To Change Style, WhatsApp Number
|
94 |
-
|
95 |
-
**[chat val='chat to sales team' num=10123456789]** - To change the display text value ( for style-1, style-2, style-4, style-8 )
|
96 |
-
|
97 |
-
= Add Shortcodes in Widget Area =
|
98 |
-
|
99 |
-
Add 'text' or 'HTML' widget in the widget area, and then add shortcode within that widget
|
100 |
-
|
101 |
|
102 |
== screenshots ==
|
103 |
|
104 |
-
1.
|
105 |
1. Global Setting page
|
106 |
-
1.
|
107 |
-
1.
|
108 |
-
1.
|
109 |
-
1.
|
|
|
|
|
|
|
110 |
1. Style - 1 - looks like Theme button
|
111 |
-
1. Style -
|
112 |
-
1. Style - 99 - Add your own Image / GIF
|
113 |
|
114 |
|
115 |
== Installation ==
|
@@ -150,20 +128,20 @@ Add styles at any position of the screen (not fixed to selected positions).
|
|
150 |
|
151 |
e.g.
|
152 |
* bottom-right corner
|
153 |
-
-> select - bottom-right position
|
154 |
bottom: 10px
|
155 |
right: 10px
|
156 |
|
157 |
* bottom-center
|
158 |
-
-> select - bottom-right position
|
159 |
bottom: 10px
|
160 |
right: 50%
|
161 |
|
|
|
|
|
162 |
= In Mobile, If navigates to Web page =
|
163 |
|
164 |
-
|
165 |
|
166 |
-
In
|
167 |
|
168 |
= GDPR =
|
169 |
|
@@ -198,6 +176,9 @@ Thanks for showing interest on this plugin.
|
|
198 |
|
199 |
== Changelog ==
|
200 |
|
|
|
|
|
|
|
201 |
= 1.7.2 =
|
202 |
* Style-8 shortcode issue fixed
|
203 |
|
1 |
=== Click to Chat ===
|
2 |
Requires at least: 4.6
|
3 |
+
Tested up to: 5.3.1
|
4 |
Requires PHP: 5.6
|
5 |
Contributors: holithemes
|
6 |
Stable tag: trunk
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
+
Let's make your Web page visitors Contact you through "WhatsApp" with a single Click (WhatsApp Chat, Group, Share)
|
16 |
|
17 |
**Mobile:** Navigates to WhatsApp App.
|
18 |
|
19 |
**Desktop:** Navigates to WhatsApp Webpage (web.whatsapp.com). Users can chat directly from the browser.
|
20 |
|
21 |
+
[Demo](https://holithemes.com/plugins/click-to-chat/list-of-styles/)
|
22 |
|
23 |
+
[Documentation](https://holithemes.com/plugins/click-to-chat/)
|
24 |
|
25 |
|
26 |
= How easy the plugin is =
|
29 |
* If using WhatsApp group invite/chat add WhatsApp group id.
|
30 |
|
31 |
|
32 |
+
* 9 Styles with one Add any Image/GIF.
|
33 |
* Place the styles at any position of the screen.
|
34 |
|
35 |
= Features =
|
36 |
|
37 |
* Navigates to WhatsApp Chat
|
38 |
* Navigates to WhatsApp Group Chat
|
39 |
+
* Eight pre-configured Styles (customizable)
|
40 |
* Add Own Image or GIF
|
41 |
* Floating style can position at any place on the screen
|
42 |
( At any pixel of the screen, not limited to fixed positions )
|
43 |
+
* Show/Hide Styles based on Post type, Post ID, Categories, Device Type
|
44 |
* Pre-filled Message ( Includes Placeholder to add Web page URL )
|
45 |
+
* Shortcodes to add styles with inline content, floating style
|
46 |
+
* Google Analytics
|
47 |
+
* Facebook Analytics
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
+
[Google Analytics](https://holithemes.com/plugins/click-to-chat/google-analytics/)
|
50 |
|
51 |
+
[Facebook Analytics](https://holithemes.com/plugins/click-to-chat/facebook-analytics/)
|
52 |
|
53 |
|
54 |
= Nine Styles + own Image =
|
55 |
|
56 |
1. **Style-1:** Button, appears as theme button.
|
57 |
+
1. **Style-2:** Image
|
58 |
1. **Style-3:** Image
|
59 |
1. **Style-4:** Chip style - combination of image and a text message
|
60 |
+
1. **Style-5:** Image on hover sidebar content box
|
61 |
+
1. **Style-6:** Plain text with a link navigates to WhatsApp App or web.whatsapp.com
|
62 |
+
1. **Style-7:** Icon with customizable padding
|
63 |
1. **Style-8:** Button with text, icon
|
|
|
64 |
1. **Style - 99:** Own Image / GIF / Animated image
|
65 |
|
66 |
|
68 |
|
69 |
Pre-filled message is the text that appears on the WhatsApp chat window when the user clicks on Image/button. User can start the conversation easily.
|
70 |
|
71 |
+
To add Web page URL in Pre-filled message add {{url}} placeholder - [pre-filled message](https://holithemes.com/plugins/click-to-chat/pre-filled-message/)
|
72 |
|
73 |
by adding the {{url}} placeholder we can understand from which page the user started WhatsApp chat.
|
74 |
|
75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
|
77 |
== screenshots ==
|
78 |
|
79 |
+
1. 8 Styles, 1 Add own image / GIF Style
|
80 |
1. Global Setting page
|
81 |
+
1. Chat Setting page
|
82 |
+
1. Group Setting page
|
83 |
+
1. Share Setting page
|
84 |
+
1. Customize Styles
|
85 |
+
1. Show/Hide settings
|
86 |
+
1. Change 'Number', 'Call to action', 'group id' at page level
|
87 |
+
1. Shortcodes
|
88 |
1. Style - 1 - looks like Theme button
|
89 |
+
1. Style - 5 - Image with content box
|
90 |
+
1. Style - 99 - Add your own Image / GIF(Animated Image)
|
91 |
|
92 |
|
93 |
== Installation ==
|
128 |
|
129 |
e.g.
|
130 |
* bottom-right corner
|
|
|
131 |
bottom: 10px
|
132 |
right: 10px
|
133 |
|
134 |
* bottom-center
|
|
|
135 |
bottom: 10px
|
136 |
right: 50%
|
137 |
|
138 |
+
[position to place](https://holithemes.com/plugins/click-to-chat/position-to-place/)
|
139 |
+
|
140 |
= In Mobile, If navigates to Web page =
|
141 |
|
142 |
+
Plugin Navigates to WhatsApp App on mobile and "web.whatsapp.com" on desktop.
|
143 |
|
144 |
+
In chat settings check/tick the "Web WhatsApp" option to naviagate directly to web.whatsapp.com on dekstops
|
145 |
|
146 |
= GDPR =
|
147 |
|
176 |
|
177 |
== Changelog ==
|
178 |
|
179 |
+
= 2.0 =
|
180 |
+
New interface
|
181 |
+
|
182 |
= 1.7.2 =
|
183 |
* Style-8 shortcode issue fixed
|
184 |
|