Version Description
- Fix. WhatsApp premium compatibility
Download this release
Release Info
Developer | quadlayers |
Plugin | WhatsApp Chat WP |
Version | 6.1.7 |
Comparing to | |
See all releases |
Code changes from version 6.1.6 to 6.1.7
- compatibility/compatibility.php +229 -0
- includes/backend.php +1 -0
- includes/controllers/SettingsController.php +56 -0
- includes/frontend.php +55 -43
- includes/models/QLWAPP_Model.php +1 -0
- includes/models/Settings.php +24 -0
- includes/qlwapp.php +0 -1
- includes/settings.php +0 -233
- includes/view/backend/pages/settings.php +77 -0
- readme.txt +6 -1
- template/box.php +36 -35
- wp-whatsapp-chat.php +5 -3
compatibility/compatibility.php
ADDED
@@ -0,0 +1,229 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once QLWAPP_PLUGIN_DIR . 'includes/helpers.php';
|
4 |
+
|
5 |
+
class QLWAPP_Compatibility {
|
6 |
+
|
7 |
+
protected static $instance;
|
8 |
+
|
9 |
+
// fix required header in license tab
|
10 |
+
function settings_header() {
|
11 |
+
global $submenu;
|
12 |
+
include QLWAPP_PLUGIN_DIR . '/includes/view/backend/pages/parts/header.php';
|
13 |
+
}
|
14 |
+
|
15 |
+
// fix settings override with defaults on license save
|
16 |
+
function settings_sanitize( $qlwapp ) {
|
17 |
+
$current = get_option( QLWAPP_DOMAIN, array() );
|
18 |
+
|
19 |
+
return wp_parse_args( $qlwapp, $current );
|
20 |
+
}
|
21 |
+
|
22 |
+
// required to save license
|
23 |
+
function settings_register() {
|
24 |
+
register_setting( sanitize_key( QLWAPP_DOMAIN . '-group' ), sanitize_key( QLWAPP_DOMAIN ), array( $this, 'settings_sanitize' ) );
|
25 |
+
}
|
26 |
+
|
27 |
+
function previous_author( $qlwapp ) {
|
28 |
+
// button
|
29 |
+
if ( $phone = get_option( 'whatsapp_chat_page' ) ) {
|
30 |
+
$qlwapp['button']['phone'] = $phone;
|
31 |
+
}
|
32 |
+
if ( $text = get_option( 'whatsapp_chat_button' ) ) {
|
33 |
+
$qlwapp['button']['text'] = $text;
|
34 |
+
}
|
35 |
+
if ( get_option( 'whatsapp_chat_powered_by' ) ) {
|
36 |
+
$qlwapp['button']['developer'] = 'yes';
|
37 |
+
}
|
38 |
+
if ( false !== get_option( 'whatsapp_chat_round' ) ) {
|
39 |
+
$qlwapp['button']['rounded'] = 'no';
|
40 |
+
}
|
41 |
+
if ( false !== get_option( 'whatsapp_chat_down' ) ) {
|
42 |
+
$vposition = get_option( 'whatsapp_chat_down' ) ? 'bottom' : 'middle';
|
43 |
+
$hposition = get_option( 'whatsapp_chat_left_side' ) ? 'left' : 'right';
|
44 |
+
$qlwapp['button']['position'] = "{$vposition}-{$hposition}";
|
45 |
+
}
|
46 |
+
if ( $message = get_option( 'whatsapp_chat_msg' ) ) {
|
47 |
+
$qlwapp['button']['message'] = $message;
|
48 |
+
}
|
49 |
+
// display
|
50 |
+
if ( $mobile = get_option( 'whatsapp_chat_mobile' ) ) {
|
51 |
+
$qlwapp['display']['devices'] = 'mobile';
|
52 |
+
}
|
53 |
+
if ( get_option( 'whatsapp_chat_hide_button' ) ) {
|
54 |
+
$qlwapp['display']['devices'] = 'hide';
|
55 |
+
}
|
56 |
+
if ( get_option( 'whatsapp_chat_hide_post' ) ) {
|
57 |
+
$qlwapp['display']['post'] = array( 'none' );
|
58 |
+
}
|
59 |
+
if ( get_option( 'whatsapp_chat_hide_page' ) ) {
|
60 |
+
$qlwapp['display']['page'] = array( 'none' );
|
61 |
+
}
|
62 |
+
// scheme
|
63 |
+
if ( get_option( 'whatsapp_chat_dark' ) ) {
|
64 |
+
$qlwapp['scheme']['brand'] = '#075E54';
|
65 |
+
$qlwapp['scheme']['text'] = '#ffffff';
|
66 |
+
} elseif ( get_option( 'whatsapp_chat_white' ) ) {
|
67 |
+
$qlwapp['scheme']['brand'] = '#ffffff';
|
68 |
+
$qlwapp['scheme']['text'] = '#075E54';
|
69 |
+
} elseif ( false !== get_option( 'whatsapp_chat_white' ) ) {
|
70 |
+
$qlwapp['scheme']['brand'] = '#20B038';
|
71 |
+
$qlwapp['scheme']['text'] = '#ffffff';
|
72 |
+
}
|
73 |
+
|
74 |
+
return $qlwapp;
|
75 |
+
}
|
76 |
+
|
77 |
+
function previous_versions( $qlwapp ) {
|
78 |
+
if ( isset( $qlwapp['chat']['response'] ) && ! isset( $qlwapp['box']['response'] ) ) {
|
79 |
+
$qlwapp['box']['response'] = $qlwapp['chat']['response'];
|
80 |
+
}
|
81 |
+
if ( isset( $qlwapp['box']['enable'] ) && ! isset( $qlwapp['button']['box'] ) ) {
|
82 |
+
$qlwapp['button']['box'] = $qlwapp['box']['enable'];
|
83 |
+
}
|
84 |
+
if ( isset( $qlwapp['user']['message'] ) && ! isset( $qlwapp['button']['message'] ) ) {
|
85 |
+
$qlwapp['button']['message'] = $qlwapp['user']['message'];
|
86 |
+
}
|
87 |
+
if ( isset( $qlwapp['button']['rounded'] ) && $qlwapp['button']['rounded'] == 1 ) {
|
88 |
+
$qlwapp['button']['rounded'] = 'yes';
|
89 |
+
}
|
90 |
+
if ( isset( $qlwapp['button']['developer'] ) && $qlwapp['button']['developer'] == 1 ) {
|
91 |
+
$qlwapp['button']['developer'] = 'yes';
|
92 |
+
}
|
93 |
+
// display
|
94 |
+
// part free
|
95 |
+
if ( isset( $qlwapp['display']['target'] ) ) {
|
96 |
+
|
97 |
+
if ( ! isset( $qlwapp['display']['target']['ids'] ) && isset( $qlwapp['display']['target'][0] ) ) {
|
98 |
+
|
99 |
+
if ( $qlwapp['display']['target'][0] == 'none' ) {
|
100 |
+
$qlwapp['display']['target']['ids'] = array(
|
101 |
+
'all' => esc_html__( 'All', 'wp-whatsapp-chat' ),
|
102 |
+
);
|
103 |
+
$qlwapp['display']['target']['include'] = '0';
|
104 |
+
} else {
|
105 |
+
$qlwapp['display']['target']['ids'] = $qlwapp['display']['target'];
|
106 |
+
$qlwapp['display']['target']['include'] = '1';
|
107 |
+
}
|
108 |
+
}
|
109 |
+
}
|
110 |
+
// part pro taxonomies
|
111 |
+
// rename-re asign
|
112 |
+
if ( isset( $qlwapp['display']['category'] ) ) {
|
113 |
+
if ( ! isset( $qlwapp['display']['category']['ids'] ) && isset( $qlwapp['display']['category'][0] ) ) {
|
114 |
+
$qlwapp['display']['taxonomies']['category']['include'] = '1';
|
115 |
+
if ( in_array( 'none', $qlwapp['display']['category'] ) ) {
|
116 |
+
$key = array_search( 'none', $qlwapp['display']['category'] );
|
117 |
+
$qlwapp['display']['category'][ $key ] = 'all';
|
118 |
+
$qlwapp['display']['taxonomies']['category']['include'] = '0';
|
119 |
+
}
|
120 |
+
$qlwapp['display']['taxonomies']['category']['ids'] = $qlwapp['display']['category'];
|
121 |
+
}
|
122 |
+
}
|
123 |
+
// part PRO
|
124 |
+
// rename-re asign o ['entries']
|
125 |
+
// PAGE
|
126 |
+
if ( isset( $qlwapp['display']['page'] ) ) {
|
127 |
+
if ( ! isset( $qlwapp['display']['page']['ids'] ) && isset( $qlwapp['display']['page'][0] ) ) {
|
128 |
+
$qlwapp['display']['entries']['page']['include'] = '0';
|
129 |
+
if ( in_array( 'none', $qlwapp['display']['page'] ) ) {
|
130 |
+
$key = array_search( 'none', $qlwapp['display']['page'] );
|
131 |
+
$qlwapp['display']['page'][ $key ] = 'all';
|
132 |
+
$qlwapp['display']['entries']['page']['include'] = '0';
|
133 |
+
}
|
134 |
+
$qlwapp['display']['entries']['page']['ids'] = $qlwapp['display']['page'];
|
135 |
+
}
|
136 |
+
}
|
137 |
+
// POST
|
138 |
+
if ( isset( $qlwapp['display']['post'] ) ) {
|
139 |
+
if ( ! isset( $qlwapp['display']['post']['ids'] ) && isset( $qlwapp['display']['post'][0] ) ) {
|
140 |
+
$qlwapp['display']['entries']['post']['include'] = '1';
|
141 |
+
|
142 |
+
if ( in_array( 'none', $qlwapp['display']['post'] ) ) {
|
143 |
+
$key = array_search( 'none', $qlwapp['display']['post'] );
|
144 |
+
$qlwapp['display']['post'][ $key ] = 'all';
|
145 |
+
$qlwapp['display']['entries']['post']['include'] = '0';
|
146 |
+
}
|
147 |
+
$qlwapp['display']['entries']['post']['ids'] = $qlwapp['display']['post'];
|
148 |
+
}
|
149 |
+
}
|
150 |
+
|
151 |
+
return $qlwapp;
|
152 |
+
}
|
153 |
+
|
154 |
+
function premium_version() {
|
155 |
+
global $qlwapp;
|
156 |
+
// includes
|
157 |
+
include_once QLWAPP_PLUGIN_DIR . 'includes/models/QLWAPP_Model.php';
|
158 |
+
include_once QLWAPP_PLUGIN_DIR . 'includes/models/Button.php';
|
159 |
+
include_once QLWAPP_PLUGIN_DIR . 'includes/models/Box.php';
|
160 |
+
include_once QLWAPP_PLUGIN_DIR . 'includes/models/Contact.php';
|
161 |
+
include_once QLWAPP_PLUGIN_DIR . 'includes/models/Chat.php';
|
162 |
+
include_once QLWAPP_PLUGIN_DIR . 'includes/models/Display.php';
|
163 |
+
include_once QLWAPP_PLUGIN_DIR . 'includes/models/License.php';
|
164 |
+
include_once QLWAPP_PLUGIN_DIR . 'includes/models/Scheme.php';
|
165 |
+
// models
|
166 |
+
$model = new QLWAPP_Model();
|
167 |
+
$license_model = new QLWAPP_License();
|
168 |
+
$button_model = new QLWAPP_Button();
|
169 |
+
$box_model = new QLWAPP_Box();
|
170 |
+
$contact_model = new QLWAPP_Contact();
|
171 |
+
$chat_model = new QLWAPP_Chat();
|
172 |
+
$display_model = new QLWAPP_Display();
|
173 |
+
$scheme_model = new QLWAPP_Scheme();
|
174 |
+
|
175 |
+
// objects
|
176 |
+
$qlwapp = $model->options();
|
177 |
+
$qlwapp['button'] = $button_model->get();
|
178 |
+
$qlwapp['box'] = $box_model->get();
|
179 |
+
$qlwapp['contacts'] = $contact_model->get_contacts_reorder();
|
180 |
+
$qlwapp['chat'] = $chat_model->get();
|
181 |
+
$qlwapp['display'] = $display_model->get();
|
182 |
+
$qlwapp['license'] = $license_model->get();
|
183 |
+
$qlwapp['scheme'] = $scheme_model->get();
|
184 |
+
|
185 |
+
if ( ! is_admin() ) {
|
186 |
+
if ( isset( $qlwapp['button']['phone'] ) ) {
|
187 |
+
$qlwapp['button']['phone'] = qlwapp_format_phone( $qlwapp['button']['phone'] );
|
188 |
+
}
|
189 |
+
if ( isset( $qlwapp['button']['timezone'] ) ) {
|
190 |
+
$qlwapp['button']['timezone'] = qlwapp_get_timezone_offset( $qlwapp['button']['timezone'] );
|
191 |
+
}
|
192 |
+
}
|
193 |
+
|
194 |
+
if ( isset( $qlwapp['contacts'] ) ) {
|
195 |
+
if ( count( $qlwapp['contacts'] ) ) {
|
196 |
+
foreach ( $qlwapp['contacts'] as $id => $c ) {
|
197 |
+
$qlwapp['contacts'][ $id ] = wp_parse_args( $c, $contact_model->get_args() );
|
198 |
+
|
199 |
+
if ( ! is_admin() ) {
|
200 |
+
if ( ! empty( $qlwapp['contacts'][ $id ]['phone'] ) ) {
|
201 |
+
$qlwapp['contacts'][ $id ]['phone'] = qlwapp_format_phone( $qlwapp['contacts'][ $id ]['phone'] );
|
202 |
+
}
|
203 |
+
if ( ! empty( $qlwapp['contacts'][ $id ]['timezone'] ) ) {
|
204 |
+
$qlwapp['contacts'][ $id ]['timezone'] = qlwapp_get_timezone_offset( $qlwapp['contacts'][ $id ]['timezone'] );
|
205 |
+
}
|
206 |
+
}
|
207 |
+
}
|
208 |
+
}
|
209 |
+
}
|
210 |
+
}
|
211 |
+
|
212 |
+
function init() {
|
213 |
+
add_filter( 'wp', array( $this, 'premium_version' ) );
|
214 |
+
add_action( 'customize_register', array( $this, 'premium_version' ), -10 );
|
215 |
+
add_action( 'admin_init', array( $this, 'settings_register' ) );
|
216 |
+
add_filter( 'option_qlwapp', array( $this, 'previous_versions' ) );
|
217 |
+
add_filter( 'default_option_qlwapp', array( $this, 'previous_author' ), 20 );
|
218 |
+
}
|
219 |
+
|
220 |
+
public static function instance() {
|
221 |
+
if ( ! isset( self::$instance ) ) {
|
222 |
+
self::$instance = new self();
|
223 |
+
self::$instance->init();
|
224 |
+
}
|
225 |
+
return self::$instance;
|
226 |
+
}
|
227 |
+
}
|
228 |
+
|
229 |
+
QLWAPP_Compatibility::instance();
|
includes/backend.php
CHANGED
@@ -22,6 +22,7 @@ class QLWAPP_Backend {
|
|
22 |
include_once QLWAPP_PLUGIN_DIR . 'includes/controllers/BoxController.php';
|
23 |
include_once QLWAPP_PLUGIN_DIR . 'includes/controllers/ContactController.php';
|
24 |
include_once QLWAPP_PLUGIN_DIR . 'includes/controllers/DisplayController.php';
|
|
|
25 |
include_once QLWAPP_PLUGIN_DIR . 'includes/controllers/WooCommerceController.php';
|
26 |
include_once QLWAPP_PLUGIN_DIR . 'includes/controllers/SchemeController.php';
|
27 |
include_once QLWAPP_PLUGIN_DIR . 'includes/controllers/PremiumController.php';
|
22 |
include_once QLWAPP_PLUGIN_DIR . 'includes/controllers/BoxController.php';
|
23 |
include_once QLWAPP_PLUGIN_DIR . 'includes/controllers/ContactController.php';
|
24 |
include_once QLWAPP_PLUGIN_DIR . 'includes/controllers/DisplayController.php';
|
25 |
+
include_once QLWAPP_PLUGIN_DIR . 'includes/controllers/SettingsController.php';
|
26 |
include_once QLWAPP_PLUGIN_DIR . 'includes/controllers/WooCommerceController.php';
|
27 |
include_once QLWAPP_PLUGIN_DIR . 'includes/controllers/SchemeController.php';
|
28 |
include_once QLWAPP_PLUGIN_DIR . 'includes/controllers/PremiumController.php';
|
includes/controllers/SettingsController.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once QLWAPP_PLUGIN_DIR . 'includes/models/Settings.php';
|
4 |
+
|
5 |
+
require_once QLWAPP_PLUGIN_DIR . 'includes/controllers/QLWAPP_Controller.php';
|
6 |
+
|
7 |
+
class QLWAPP_Settings_Controller extends QLWAPP_Controller {
|
8 |
+
|
9 |
+
|
10 |
+
protected static $instance;
|
11 |
+
|
12 |
+
function add_menu() {
|
13 |
+
add_submenu_page( QLWAPP_DOMAIN, esc_html__( 'Settings', 'wp-whatsapp-chat' ), esc_html__( 'Settings', 'wp-whatsapp-chat' ), 'manage_options', QLWAPP_DOMAIN . '_settings', array( $this, 'add_panel' ) );
|
14 |
+
}
|
15 |
+
|
16 |
+
function add_panel() {
|
17 |
+
global $submenu;
|
18 |
+
|
19 |
+
$settings_model = new QLWAPP_Settings();
|
20 |
+
$settings = $settings_model->get();
|
21 |
+
|
22 |
+
include QLWAPP_PLUGIN_DIR . '/includes/view/backend/pages/parts/header.php';
|
23 |
+
include QLWAPP_PLUGIN_DIR . '/includes/view/backend/pages/settings.php';
|
24 |
+
}
|
25 |
+
|
26 |
+
function init() {
|
27 |
+
add_action( 'wp_ajax_qlwapp_save_settings', array( $this, 'ajax_qlwapp_save_settings' ) );
|
28 |
+
add_action( 'admin_menu', array( $this, 'add_menu' ) );
|
29 |
+
}
|
30 |
+
|
31 |
+
public function ajax_qlwapp_save_settings() {
|
32 |
+
$settings_model = new QLWAPP_Settings();
|
33 |
+
if ( current_user_can( 'manage_options' ) ) {
|
34 |
+
if ( check_ajax_referer( 'qlwapp_save_settings', 'nonce', false ) && isset( $_REQUEST['form_data'] ) ) {
|
35 |
+
$form_data = array();
|
36 |
+
parse_str( $_REQUEST['form_data'], $form_data );
|
37 |
+
if ( is_array( $form_data ) ) {
|
38 |
+
$settings_model->save( $form_data );
|
39 |
+
return parent::success_save( $form_data );
|
40 |
+
}
|
41 |
+
return parent::error_reload_page();
|
42 |
+
}
|
43 |
+
return parent::error_access_denied();
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
public static function instance() {
|
48 |
+
if ( ! isset( self::$instance ) ) {
|
49 |
+
self::$instance = new self();
|
50 |
+
self::$instance->init();
|
51 |
+
}
|
52 |
+
return self::$instance;
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
QLWAPP_Settings_Controller::instance();
|
includes/frontend.php
CHANGED
@@ -1,20 +1,24 @@
|
|
1 |
<?php
|
2 |
-
if (
|
3 |
|
4 |
-
class QLWAPP_Frontend
|
|
|
5 |
|
6 |
protected static $instance;
|
7 |
|
8 |
-
function add_js()
|
|
|
9 |
$frontend = include_once QLWAPP_PLUGIN_DIR . 'build/frontend/js/index.asset.php';
|
10 |
-
wp_enqueue_style(
|
11 |
-
wp_enqueue_script(
|
|
|
12 |
}
|
13 |
|
14 |
-
function add_box()
|
|
|
15 |
global $qlwapp;
|
16 |
|
17 |
-
if (
|
18 |
include_once QLWAPP_PLUGIN_DIR . 'includes/models/Box.php';
|
19 |
include_once QLWAPP_PLUGIN_DIR . 'includes/models/Contact.php';
|
20 |
include_once QLWAPP_PLUGIN_DIR . 'includes/models/Display.php';
|
@@ -35,65 +39,70 @@ if ( ! class_exists( 'QLWAPP_Frontend' ) ) {
|
|
35 |
}
|
36 |
}
|
37 |
|
38 |
-
function add_frontend_css()
|
|
|
39 |
$scheme_model = new QLWAPP_Scheme();
|
40 |
$scheme = $scheme_model->get();
|
41 |
-
|
42 |
<style>
|
43 |
:root {
|
44 |
<?php
|
45 |
|
46 |
-
unset(
|
47 |
-
unset(
|
48 |
-
foreach (
|
49 |
-
if (
|
50 |
-
if (
|
51 |
$value = "{$value}px";
|
52 |
}
|
53 |
-
printf(
|
54 |
}
|
55 |
}
|
56 |
?>
|
57 |
-
}
|
58 |
</style>
|
59 |
-
|
60 |
}
|
61 |
|
62 |
-
|
|
|
|
|
63 |
global $wp_query;
|
64 |
$display_model = new QLWAPP_Display();
|
65 |
$display = $display_model->get();
|
66 |
-
if (
|
67 |
return true;
|
68 |
}
|
69 |
$display_service = new QLWAPP_DisplayServices_Controller();
|
70 |
-
return $display_service->is_show_view(
|
71 |
}
|
72 |
|
73 |
-
function do_shortcode(
|
|
|
74 |
$button_model = new QLWAPP_Button();
|
75 |
$button = $button_model->get();
|
76 |
|
77 |
-
$atts = wp_parse_args(
|
78 |
|
79 |
ob_start();
|
80 |
-
|
81 |
-
<div style="width: auto;" id="qlwapp" class="qlwapp-js-ready <?php printf(
|
82 |
-
<a class="qlwapp-toggle" data-action="open" data-phone="<?php echo esc_attr(
|
83 |
-
<?php if (
|
84 |
-
<i class="qlwapp-icon <?php echo esc_attr(
|
85 |
<?php endif; ?>
|
86 |
<i class="qlwapp-close" data-action="close">×</i>
|
87 |
-
<?php if (
|
88 |
-
<span class="qlwapp-text"><?php echo esc_html(
|
89 |
<?php endif; ?>
|
90 |
</a>
|
91 |
</div>
|
92 |
-
|
93 |
return ob_get_clean();
|
94 |
}
|
95 |
|
96 |
-
function display()
|
|
|
97 |
include_once QLWAPP_PLUGIN_DIR . 'includes/models/QLWAPP_Model.php';
|
98 |
include_once QLWAPP_PLUGIN_DIR . 'includes/models/Display.php';
|
99 |
include_once QLWAPP_PLUGIN_DIR . 'includes/controllers/Display_services.php';
|
@@ -101,26 +110,29 @@ if ( ! class_exists( 'QLWAPP_Frontend' ) ) {
|
|
101 |
$display = $display_model->get();
|
102 |
$display_service = new QLWAPP_DisplayServices_Controller();
|
103 |
|
104 |
-
if (
|
105 |
|
106 |
-
do_action(
|
107 |
}
|
108 |
}
|
109 |
|
110 |
-
function load()
|
111 |
-
|
112 |
-
add_action(
|
113 |
-
add_action(
|
|
|
114 |
}
|
115 |
|
116 |
-
function init()
|
117 |
-
|
118 |
-
|
119 |
-
|
|
|
120 |
}
|
121 |
|
122 |
-
public static function instance()
|
123 |
-
|
|
|
124 |
self::$instance = new self();
|
125 |
self::$instance->init();
|
126 |
}
|
1 |
<?php
|
2 |
+
if (!class_exists('QLWAPP_Frontend')) {
|
3 |
|
4 |
+
class QLWAPP_Frontend
|
5 |
+
{
|
6 |
|
7 |
protected static $instance;
|
8 |
|
9 |
+
function add_js()
|
10 |
+
{
|
11 |
$frontend = include_once QLWAPP_PLUGIN_DIR . 'build/frontend/js/index.asset.php';
|
12 |
+
wp_enqueue_style(QLWAPP_DOMAIN, plugins_url('/build/frontend/css/style.css', QLWAPP_PLUGIN_FILE), null, QLWAPP_PLUGIN_VERSION, 'all');
|
13 |
+
wp_enqueue_script(QLWAPP_DOMAIN, plugins_url('/build/frontend/js/index.js', QLWAPP_PLUGIN_FILE), $frontend['dependencies'], $frontend['version'], true);
|
14 |
+
|
15 |
}
|
16 |
|
17 |
+
function add_box()
|
18 |
+
{
|
19 |
global $qlwapp;
|
20 |
|
21 |
+
if (is_file($file = apply_filters('qlwapp_box_template', QLWAPP_PLUGIN_DIR . 'template/box.php'))) {
|
22 |
include_once QLWAPP_PLUGIN_DIR . 'includes/models/Box.php';
|
23 |
include_once QLWAPP_PLUGIN_DIR . 'includes/models/Contact.php';
|
24 |
include_once QLWAPP_PLUGIN_DIR . 'includes/models/Display.php';
|
39 |
}
|
40 |
}
|
41 |
|
42 |
+
function add_frontend_css()
|
43 |
+
{
|
44 |
$scheme_model = new QLWAPP_Scheme();
|
45 |
$scheme = $scheme_model->get();
|
46 |
+
?>
|
47 |
<style>
|
48 |
:root {
|
49 |
<?php
|
50 |
|
51 |
+
unset($scheme['_wp_http_referer']);
|
52 |
+
unset($scheme['_scheme_form_nonce']);
|
53 |
+
foreach ($scheme as $key => $value) {
|
54 |
+
if ($value != '') {
|
55 |
+
if (is_numeric($value)) {
|
56 |
$value = "{$value}px";
|
57 |
}
|
58 |
+
printf('--%s-scheme-%s:%s;', QLWAPP_DOMAIN, esc_attr($key), esc_attr($value));
|
59 |
}
|
60 |
}
|
61 |
?>
|
62 |
+
}
|
63 |
</style>
|
64 |
+
<?php
|
65 |
}
|
66 |
|
67 |
+
|
68 |
+
function box_display1($show)
|
69 |
+
{
|
70 |
global $wp_query;
|
71 |
$display_model = new QLWAPP_Display();
|
72 |
$display = $display_model->get();
|
73 |
+
if (is_customize_preview()) {
|
74 |
return true;
|
75 |
}
|
76 |
$display_service = new QLWAPP_DisplayServices_Controller();
|
77 |
+
return $display_service->is_show_view($display);
|
78 |
}
|
79 |
|
80 |
+
function do_shortcode($atts, $content = null)
|
81 |
+
{
|
82 |
$button_model = new QLWAPP_Button();
|
83 |
$button = $button_model->get();
|
84 |
|
85 |
+
$atts = wp_parse_args($atts, $button);
|
86 |
|
87 |
ob_start();
|
88 |
+
?>
|
89 |
+
<div style="width: auto;" id="qlwapp" class="qlwapp-js-ready <?php printf('qlwapp-%s qlwapp-%s', esc_attr($atts['layout']), esc_attr($atts['rounded'] === 'yes' ? 'rounded' : 'square')); ?>">
|
90 |
+
<a class="qlwapp-toggle" data-action="open" data-phone="<?php echo esc_attr($atts['phone']); ?>" data-message="<?php echo esc_html($atts['message']); ?>" href="#" target="_blank">
|
91 |
+
<?php if ($atts['icon']) : ?>
|
92 |
+
<i class="qlwapp-icon <?php echo esc_attr($atts['icon']); ?>"></i>
|
93 |
<?php endif; ?>
|
94 |
<i class="qlwapp-close" data-action="close">×</i>
|
95 |
+
<?php if ($atts['text']) : ?>
|
96 |
+
<span class="qlwapp-text"><?php echo esc_html($content); ?></span>
|
97 |
<?php endif; ?>
|
98 |
</a>
|
99 |
</div>
|
100 |
+
<?php
|
101 |
return ob_get_clean();
|
102 |
}
|
103 |
|
104 |
+
function display()
|
105 |
+
{
|
106 |
include_once QLWAPP_PLUGIN_DIR . 'includes/models/QLWAPP_Model.php';
|
107 |
include_once QLWAPP_PLUGIN_DIR . 'includes/models/Display.php';
|
108 |
include_once QLWAPP_PLUGIN_DIR . 'includes/controllers/Display_services.php';
|
110 |
$display = $display_model->get();
|
111 |
$display_service = new QLWAPP_DisplayServices_Controller();
|
112 |
|
113 |
+
if ($display_service->is_show_view($display)) {
|
114 |
|
115 |
+
do_action('qlwapp_load');
|
116 |
}
|
117 |
}
|
118 |
|
119 |
+
function load()
|
120 |
+
{
|
121 |
+
add_action('wp_enqueue_scripts', array($this, 'add_js'));
|
122 |
+
add_action('wp_head', array($this, 'add_frontend_css'), 200);
|
123 |
+
add_action('wp_footer', array($this, 'add_box'));
|
124 |
}
|
125 |
|
126 |
+
function init()
|
127 |
+
{
|
128 |
+
add_action('wp', array($this, 'display'));
|
129 |
+
add_shortcode('whatsapp', array($this, 'do_shortcode'));
|
130 |
+
add_action('qlwapp_load', array($this, 'load'));
|
131 |
}
|
132 |
|
133 |
+
public static function instance()
|
134 |
+
{
|
135 |
+
if (!isset(self::$instance)) {
|
136 |
self::$instance = new self();
|
137 |
self::$instance->init();
|
138 |
}
|
includes/models/QLWAPP_Model.php
CHANGED
@@ -17,6 +17,7 @@ class QLWAPP_Model {
|
|
17 |
$options['scheme'] = array();
|
18 |
$options['woocommerce'] = array();
|
19 |
$options['license'] = array();
|
|
|
20 |
return $options;
|
21 |
}
|
22 |
|
17 |
$options['scheme'] = array();
|
18 |
$options['woocommerce'] = array();
|
19 |
$options['license'] = array();
|
20 |
+
$options['settings'] = array(); // TODO: check name
|
21 |
return $options;
|
22 |
}
|
23 |
|
includes/models/Settings.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class QLWAPP_Settings extends QLWAPP_Model {
|
4 |
+
|
5 |
+
|
6 |
+
protected $table = 'settings';
|
7 |
+
|
8 |
+
function get_args() {
|
9 |
+
$args = array(
|
10 |
+
'googleAnalytics' => 'disable',
|
11 |
+
'googleAnalyticsScript' => 'no',
|
12 |
+
'googleAnalyticsV3Id' => '',
|
13 |
+
'googleAnalyticsV4Id' => '',
|
14 |
+
'googleAnalyticsLabel' => '',
|
15 |
+
'googleAnalyticsCategory' => '',
|
16 |
+
);
|
17 |
+
|
18 |
+
return $args;
|
19 |
+
}
|
20 |
+
|
21 |
+
function save( $scheme = null ) {
|
22 |
+
return parent::save_data( $this->table, $scheme );
|
23 |
+
}
|
24 |
+
}
|
includes/qlwapp.php
CHANGED
@@ -6,7 +6,6 @@ class QLWAPP {
|
|
6 |
|
7 |
function includes() {
|
8 |
include_once QLWAPP_PLUGIN_DIR . 'includes/helpers.php';
|
9 |
-
include_once QLWAPP_PLUGIN_DIR . 'includes/settings.php';
|
10 |
include_once QLWAPP_PLUGIN_DIR . 'includes/frontend.php';
|
11 |
include_once QLWAPP_PLUGIN_DIR . 'includes/backend.php';
|
12 |
}
|
6 |
|
7 |
function includes() {
|
8 |
include_once QLWAPP_PLUGIN_DIR . 'includes/helpers.php';
|
|
|
9 |
include_once QLWAPP_PLUGIN_DIR . 'includes/frontend.php';
|
10 |
include_once QLWAPP_PLUGIN_DIR . 'includes/backend.php';
|
11 |
}
|
includes/settings.php
DELETED
@@ -1,233 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
include_once(QLWAPP_PLUGIN_DIR . 'includes/helpers.php');
|
4 |
-
|
5 |
-
class QLWAPP_Settings {
|
6 |
-
|
7 |
-
protected static $instance;
|
8 |
-
|
9 |
-
// fix required header in license tab
|
10 |
-
function settings_header() {
|
11 |
-
global $submenu;
|
12 |
-
include (QLWAPP_PLUGIN_DIR . '/includes/view/backend/pages/parts/header.php');
|
13 |
-
}
|
14 |
-
|
15 |
-
// fix settings override with defaults on license save
|
16 |
-
function settings_sanitize($qlwapp) {
|
17 |
-
|
18 |
-
$current = get_option(QLWAPP_DOMAIN, array());
|
19 |
-
|
20 |
-
return wp_parse_args($qlwapp, $current);
|
21 |
-
}
|
22 |
-
|
23 |
-
// required to save license
|
24 |
-
function settings_register() {
|
25 |
-
register_setting(sanitize_key(QLWAPP_DOMAIN . '-group'), sanitize_key(QLWAPP_DOMAIN), array($this, 'settings_sanitize'));
|
26 |
-
}
|
27 |
-
|
28 |
-
function previous_author($qlwapp) {
|
29 |
-
//button
|
30 |
-
if ($phone = get_option('whatsapp_chat_page')) {
|
31 |
-
$qlwapp['button']['phone'] = $phone;
|
32 |
-
}
|
33 |
-
if ($text = get_option('whatsapp_chat_button')) {
|
34 |
-
$qlwapp['button']['text'] = $text;
|
35 |
-
}
|
36 |
-
if (get_option('whatsapp_chat_powered_by')) {
|
37 |
-
$qlwapp['button']['developer'] = 'yes';
|
38 |
-
}
|
39 |
-
if (false !== get_option('whatsapp_chat_round')) {
|
40 |
-
$qlwapp['button']['rounded'] = 'no';
|
41 |
-
}
|
42 |
-
if (false !== get_option('whatsapp_chat_down')) {
|
43 |
-
$vposition = get_option('whatsapp_chat_down') ? 'bottom' : 'middle';
|
44 |
-
$hposition = get_option('whatsapp_chat_left_side') ? 'left' : 'right';
|
45 |
-
$qlwapp['button']['position'] = "{$vposition}-{$hposition}";
|
46 |
-
}
|
47 |
-
if ($message = get_option('whatsapp_chat_msg')) {
|
48 |
-
$qlwapp['button']['message'] = $message;
|
49 |
-
}
|
50 |
-
// display
|
51 |
-
if ($mobile = get_option('whatsapp_chat_mobile')) {
|
52 |
-
$qlwapp['display']['devices'] = 'mobile';
|
53 |
-
}
|
54 |
-
if (get_option('whatsapp_chat_hide_button')) {
|
55 |
-
$qlwapp['display']['devices'] = 'hide';
|
56 |
-
}
|
57 |
-
if (get_option('whatsapp_chat_hide_post')) {
|
58 |
-
$qlwapp['display']['post'] = array('none');
|
59 |
-
}
|
60 |
-
if (get_option('whatsapp_chat_hide_page')) {
|
61 |
-
$qlwapp['display']['page'] = array('none');
|
62 |
-
}
|
63 |
-
//scheme
|
64 |
-
if (get_option('whatsapp_chat_dark')) {
|
65 |
-
$qlwapp['scheme']['brand'] = '#075E54';
|
66 |
-
$qlwapp['scheme']['text'] = '#ffffff';
|
67 |
-
} elseif (get_option('whatsapp_chat_white')) {
|
68 |
-
$qlwapp['scheme']['brand'] = '#ffffff';
|
69 |
-
$qlwapp['scheme']['text'] = '#075E54';
|
70 |
-
} elseif (false !== get_option('whatsapp_chat_white')) {
|
71 |
-
$qlwapp['scheme']['brand'] = '#20B038';
|
72 |
-
$qlwapp['scheme']['text'] = '#ffffff';
|
73 |
-
}
|
74 |
-
|
75 |
-
return $qlwapp;
|
76 |
-
}
|
77 |
-
|
78 |
-
function previous_versions($qlwapp) {
|
79 |
-
if (isset($qlwapp['chat']['response']) && !isset($qlwapp['box']['response'])) {
|
80 |
-
$qlwapp['box']['response'] = $qlwapp['chat']['response'];
|
81 |
-
}
|
82 |
-
if (isset($qlwapp['box']['enable']) && !isset($qlwapp['button']['box'])) {
|
83 |
-
$qlwapp['button']['box'] = $qlwapp['box']['enable'];
|
84 |
-
}
|
85 |
-
if (isset($qlwapp['user']['message']) && !isset($qlwapp['button']['message'])) {
|
86 |
-
$qlwapp['button']['message'] = $qlwapp['user']['message'];
|
87 |
-
}
|
88 |
-
if (isset($qlwapp['button']['rounded']) && $qlwapp['button']['rounded'] == 1) {
|
89 |
-
$qlwapp['button']['rounded'] = 'yes';
|
90 |
-
}
|
91 |
-
if (isset($qlwapp['button']['developer']) && $qlwapp['button']['developer'] == 1) {
|
92 |
-
$qlwapp['button']['developer'] = 'yes';
|
93 |
-
}
|
94 |
-
// display
|
95 |
-
// part free
|
96 |
-
if (isset($qlwapp['display']['target'])) {
|
97 |
-
|
98 |
-
if (!isset($qlwapp['display']['target']['ids']) && isset($qlwapp['display']['target'][0])) {
|
99 |
-
|
100 |
-
if ($qlwapp['display']['target'][0] == 'none') {
|
101 |
-
$qlwapp['display']['target']['ids'] = array(
|
102 |
-
'all' => esc_html__('All', 'wp-whatsapp-chat')
|
103 |
-
);
|
104 |
-
$qlwapp['display']['target']['include'] = '0';
|
105 |
-
} else {
|
106 |
-
$qlwapp['display']['target']['ids'] = $qlwapp['display']['target'];
|
107 |
-
$qlwapp['display']['target']['include'] = '1';
|
108 |
-
}
|
109 |
-
}
|
110 |
-
}
|
111 |
-
// part pro taxonomies
|
112 |
-
// rename-re asign
|
113 |
-
if (isset($qlwapp['display']['category'])) {
|
114 |
-
if (!isset($qlwapp['display']['category']['ids']) && isset($qlwapp['display']['category'][0])) {
|
115 |
-
$qlwapp['display']['taxonomies']['category']['include'] = '1';
|
116 |
-
if (in_array('none', $qlwapp['display']['category'])) {
|
117 |
-
$key = array_search('none', $qlwapp['display']['category']);
|
118 |
-
$qlwapp['display']['category'][$key] = 'all';
|
119 |
-
$qlwapp['display']['taxonomies']['category']['include'] = '0';
|
120 |
-
}
|
121 |
-
$qlwapp['display']['taxonomies']['category']['ids'] = $qlwapp['display']['category'];
|
122 |
-
}
|
123 |
-
}
|
124 |
-
// part PRO
|
125 |
-
// rename-re asign o ['entries']
|
126 |
-
// PAGE
|
127 |
-
if (isset($qlwapp['display']['page'])) {
|
128 |
-
if (!isset($qlwapp['display']['page']['ids']) && isset($qlwapp['display']['page'][0])) {
|
129 |
-
$qlwapp['display']['entries']['page']['include'] = '0';
|
130 |
-
if (in_array('none', $qlwapp['display']['page'])) {
|
131 |
-
$key = array_search('none', $qlwapp['display']['page']);
|
132 |
-
$qlwapp['display']['page'][$key] = 'all';
|
133 |
-
$qlwapp['display']['entries']['page']['include'] = '0';
|
134 |
-
}
|
135 |
-
$qlwapp['display']['entries']['page']['ids'] = $qlwapp['display']['page'];
|
136 |
-
}
|
137 |
-
}
|
138 |
-
// POST
|
139 |
-
if (isset($qlwapp['display']['post'])) {
|
140 |
-
if (!isset($qlwapp['display']['post']['ids']) && isset($qlwapp['display']['post'][0])) {
|
141 |
-
$qlwapp['display']['entries']['post']['include'] = '1';
|
142 |
-
|
143 |
-
if (in_array('none', $qlwapp['display']['post'])) {
|
144 |
-
$key = array_search('none', $qlwapp['display']['post']);
|
145 |
-
$qlwapp['display']['post'][$key] = 'all';
|
146 |
-
$qlwapp['display']['entries']['post']['include'] = '0';
|
147 |
-
}
|
148 |
-
$qlwapp['display']['entries']['post']['ids'] = $qlwapp['display']['post'];
|
149 |
-
}
|
150 |
-
}
|
151 |
-
|
152 |
-
return $qlwapp;
|
153 |
-
}
|
154 |
-
|
155 |
-
function premium_version() {
|
156 |
-
global $qlwapp;
|
157 |
-
//includes
|
158 |
-
include_once(QLWAPP_PLUGIN_DIR . 'includes/models/QLWAPP_Model.php');
|
159 |
-
include_once(QLWAPP_PLUGIN_DIR . 'includes/models/Button.php');
|
160 |
-
include_once(QLWAPP_PLUGIN_DIR . 'includes/models/Box.php');
|
161 |
-
include_once(QLWAPP_PLUGIN_DIR . 'includes/models/Contact.php');
|
162 |
-
include_once(QLWAPP_PLUGIN_DIR . 'includes/models/Chat.php');
|
163 |
-
include_once(QLWAPP_PLUGIN_DIR . 'includes/models/Display.php');
|
164 |
-
include_once(QLWAPP_PLUGIN_DIR . 'includes/models/License.php');
|
165 |
-
include_once(QLWAPP_PLUGIN_DIR . 'includes/models/Scheme.php');
|
166 |
-
// models
|
167 |
-
$model = new QLWAPP_Model();
|
168 |
-
$license_model = new QLWAPP_License();
|
169 |
-
$button_model = new QLWAPP_Button();
|
170 |
-
$box_model = new QLWAPP_Box();
|
171 |
-
$contact_model = new QLWAPP_Contact();
|
172 |
-
$chat_model = new QLWAPP_Chat();
|
173 |
-
$display_model = new QLWAPP_Display();
|
174 |
-
$scheme_model = new QLWAPP_Scheme();
|
175 |
-
|
176 |
-
// objects
|
177 |
-
$qlwapp = $model->options();
|
178 |
-
$qlwapp['button'] = $button_model->get();
|
179 |
-
$qlwapp['box'] = $box_model->get();
|
180 |
-
$qlwapp['contacts'] = $contact_model->get_contacts_reorder();
|
181 |
-
$qlwapp['chat'] = $chat_model->get();
|
182 |
-
$qlwapp['display'] = $display_model->get();
|
183 |
-
$qlwapp['license'] = $license_model->get();
|
184 |
-
$qlwapp['scheme'] = $scheme_model->get();
|
185 |
-
|
186 |
-
|
187 |
-
if (!is_admin()) {
|
188 |
-
if (isset($qlwapp['button']['phone'])) {
|
189 |
-
$qlwapp['button']['phone'] = qlwapp_format_phone($qlwapp['button']['phone']);
|
190 |
-
}
|
191 |
-
if (isset($qlwapp['button']['timezone'])) {
|
192 |
-
$qlwapp['button']['timezone'] = qlwapp_get_timezone_offset($qlwapp['button']['timezone']);
|
193 |
-
}
|
194 |
-
}
|
195 |
-
|
196 |
-
if (isset($qlwapp['contacts'])) {
|
197 |
-
if (count($qlwapp['contacts'])) {
|
198 |
-
foreach ($qlwapp['contacts'] as $id => $c) {
|
199 |
-
$qlwapp['contacts'][$id] = wp_parse_args($c, $contact_model->get_args());
|
200 |
-
|
201 |
-
if (!is_admin()) {
|
202 |
-
if (!empty($qlwapp['contacts'][$id]['phone'])) {
|
203 |
-
$qlwapp['contacts'][$id]['phone'] = qlwapp_format_phone($qlwapp['contacts'][$id]['phone']);
|
204 |
-
}
|
205 |
-
if (!empty($qlwapp['contacts'][$id]['timezone'])) {
|
206 |
-
$qlwapp['contacts'][$id]['timezone'] = qlwapp_get_timezone_offset($qlwapp['contacts'][$id]['timezone']);
|
207 |
-
}
|
208 |
-
}
|
209 |
-
}
|
210 |
-
}
|
211 |
-
}
|
212 |
-
}
|
213 |
-
|
214 |
-
function init() {
|
215 |
-
add_filter('wp', array($this, 'premium_version'));
|
216 |
-
add_action( 'customize_register', array( $this, 'premium_version' ) );
|
217 |
-
add_action('admin_init', array($this, 'settings_register'));
|
218 |
-
add_filter('option_qlwapp', array($this, 'previous_versions'));
|
219 |
-
add_filter('default_option_qlwapp', array($this, 'previous_author'), 20);
|
220 |
-
}
|
221 |
-
|
222 |
-
public static function instance() {
|
223 |
-
if (!isset(self::$instance)) {
|
224 |
-
self::$instance = new self();
|
225 |
-
self::$instance->init();
|
226 |
-
}
|
227 |
-
return self::$instance;
|
228 |
-
}
|
229 |
-
|
230 |
-
}
|
231 |
-
|
232 |
-
QLWAPP_Settings::instance();
|
233 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/view/backend/pages/settings.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wrap about-wrap full-width-layout qlwrap">
|
2 |
+
<form id="qlwapp_settings_form" method="post" action="options.php">
|
3 |
+
<table class="form-table">
|
4 |
+
<tbody>
|
5 |
+
<tr>
|
6 |
+
<th scope="row"><?php esc_html_e( 'Google Analytics', 'wp-whatsapp-chat' ); ?></th>
|
7 |
+
<td class="qlwapp-premium-field">
|
8 |
+
<select name="googleAnalytics" class="qlwapp-select2">
|
9 |
+
<option value="disable" <?php selected( $settings['googleAnalytics'], 'disable' ); ?>><?php esc_html_e( 'Disable', 'wp-whatsapp-chat' ); ?></option>
|
10 |
+
<option value="v3" <?php selected( $settings['googleAnalytics'], 'v3' ); ?>><?php esc_html_e( 'GAv3', 'wp-whatsapp-chat' ); ?></option>
|
11 |
+
<option value="v4" <?php selected( $settings['googleAnalytics'], 'v4' ); ?>><?php esc_html_e( 'GAv4', 'wp-whatsapp-chat' ); ?></option>
|
12 |
+
</select>
|
13 |
+
<p class="description"><?php esc_html_e( 'Switch to change the button layout.', 'wp-whatsapp-chat' ); ?></p>
|
14 |
+
<p class="description hidden"><small><?php esc_html_e( '(This is a premium feature)', 'wp-whatsapp-chat' ); ?></small></p>
|
15 |
+
</td>
|
16 |
+
</tr>
|
17 |
+
<tr class="<?php echo $settings['googleAnalytics'] == 'disable' ? 'hidden' : ''; ?> googleEventContainer">
|
18 |
+
<th scope="row"><?php esc_html_e( 'Script', 'wp-whatsapp-chat' ); ?></th>
|
19 |
+
<td class="qlwapp-premium-field">
|
20 |
+
<select name="googleAnalyticsScript" class="qlwapp-select2">
|
21 |
+
<option value="yes" <?php selected( $settings['googleAnalyticsScript'], 'yes' ); ?>><?php esc_html_e( 'Yes', 'wp-whatsapp-chat' ); ?></option>
|
22 |
+
<option value="no" <?php selected( $settings['googleAnalyticsScript'], 'no' ); ?>><?php esc_html_e( 'No', 'wp-whatsapp-chat' ); ?></option>
|
23 |
+
</select>
|
24 |
+
<p class="description"><?php esc_html_e( 'Select "No" if you have Google Analytics activated via plugin or theme to prevent double load.', 'wp-whatsapp-chat' ); ?></p>
|
25 |
+
<p class="description hidden"><small><?php esc_html_e( '(This is a premium feature)', 'wp-whatsapp-chat' ); ?></small></p>
|
26 |
+
</td>
|
27 |
+
</tr>
|
28 |
+
<tr class="qlwapp-phone-alert <?php echo esc_attr( $settings['googleAnalytics'] == 'disabled' ? 'hidden' : '' ); ?>">
|
29 |
+
<th scope="row"></th>
|
30 |
+
<td>
|
31 |
+
<span style="display:block!important;" class="notice notice-success">
|
32 |
+
<p>
|
33 |
+
<?php printf( __( 'Check our documentation to understand how to configure Google Analytics correctly <a href="%s" target="_blank">here</a>', 'wp-whatsapp-chat' ), esc_url( QLWAPP_DOCUMENTATION_URL ) ); ?>.
|
34 |
+
</p>
|
35 |
+
</span>
|
36 |
+
</td>
|
37 |
+
</tr>
|
38 |
+
<tr class="<?php echo $settings['googleAnalytics'] == 'disable' ? 'hidden' : ''; ?> googleEventContainer">
|
39 |
+
<th scope="row"><?php esc_html_e( 'Label', 'wp-whatsapp-chat' ); ?></th>
|
40 |
+
<td class="qlwapp-premium-field">
|
41 |
+
<input type="text" name="googleAnalyticsLabel" placeholder="" value="<?php echo esc_attr( $settings['googleAnalyticsLabel'] ); ?>" class="qlwapp-input" />
|
42 |
+
<p class="description"><?php esc_html_e( '', 'wp-whatsapp-chat' ); ?></p>
|
43 |
+
</td>
|
44 |
+
</tr>
|
45 |
+
<tr class="<?php echo $settings['googleAnalytics'] == 'disable' ? 'hidden' : ''; ?> googleEventContainer">
|
46 |
+
<th scope="row"><?php esc_html_e( 'Category', 'wp-whatsapp-chat' ); ?></th>
|
47 |
+
<td class="qlwapp-premium-field">
|
48 |
+
<input type="text" name="googleAnalyticsCategory" placeholder="" value="<?php echo esc_attr( $settings['googleAnalyticsCategory'] ); ?>" class="qlwapp-input" />
|
49 |
+
<p class="description"><?php esc_html_e( '', 'wp-whatsapp-chat' ); ?></p>
|
50 |
+
</td>
|
51 |
+
</tr>
|
52 |
+
<tr class="<?php echo $settings['googleAnalytics'] != 'v3' ? 'hidden' : ''; ?> googlev3container">
|
53 |
+
<th scope="row"><?php esc_html_e( 'Property Tracking ID ', 'wp-whatsapp-chat' ); ?></th>
|
54 |
+
<td class="qlwapp-premium-field">
|
55 |
+
<input type="text" name="googleAnalyticsV3Id" placeholder="UA-XXXXXXX-XX" value="<?php echo esc_attr( $settings['googleAnalyticsV3Id'] ); ?>" class="qlwapp-input" />
|
56 |
+
<p class="description"><?php esc_html_e( 'Google Analytics 3 sample property tracking ID: UA-XXXXXXX-XX', 'wp-whatsapp-chat' ); ?></p>
|
57 |
+
</td>
|
58 |
+
</tr>
|
59 |
+
<tr class="<?php echo $settings['googleAnalytics'] != 'v4' ? 'hidden' : ''; ?> googlev4container">
|
60 |
+
<th scope="row"><?php esc_html_e( 'Data Stream Measurement ID ', 'wp-whatsapp-chat' ); ?></th>
|
61 |
+
<td class="qlwapp-premium-field">
|
62 |
+
<input type="text" name="googleAnalyticsV4Id" placeholder="G-XXXXXXXXXX" value="<?php echo esc_attr( $settings['googleAnalyticsV4Id'] ); ?>" class="qlwapp-input" />
|
63 |
+
<p class="description"><?php esc_html_e( 'Google Analytics 4 sample data stream measurement ID: G-XXXXXXXXXX', 'wp-whatsapp-chat' ); ?></p>
|
64 |
+
</td>
|
65 |
+
</tr>
|
66 |
+
</tbody>
|
67 |
+
</table>
|
68 |
+
<?php wp_nonce_field( 'qlwapp_save_settings', 'qlwapp_settings_form_nonce' ); ?>
|
69 |
+
<p class="submit">
|
70 |
+
<?php submit_button( esc_html__( 'Save', 'wp-whatsapp-chat' ), 'primary', 'submit', false ); ?>
|
71 |
+
<span class="settings-save-status">
|
72 |
+
<span class="saved"><?php esc_html_e( 'Saved successfully!', 'wp-whatsapp-chat' ); ?></span>
|
73 |
+
<span class="spinner" style="float: none"></span>
|
74 |
+
</span>
|
75 |
+
</p>
|
76 |
+
</form>
|
77 |
+
</div>
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: whatsapp, whatsapp business, click to chat, whatsapp chat, woocommerce wha
|
|
5 |
Requires at least: 4.6
|
6 |
Requires PHP: 5.6
|
7 |
Tested up to: 6.0
|
8 |
-
Stable tag: 6.1.
|
9 |
License: GPLv3
|
10 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
@@ -82,6 +82,8 @@ Finally, we’ve included an option that allows you to select between more than
|
|
82 |
> * Display WhatsApp button based on custom post types and taxonomies
|
83 |
> * Display WhatsApp Button business hours
|
84 |
> * Display WhatsApp Contacts business hours
|
|
|
|
|
85 |
|
86 |
== WhatsApp Button Installation ==
|
87 |
1. Go to the Plugins Menu in WordPress
|
@@ -132,6 +134,9 @@ Don't use: +001-(555)1234567
|
|
132 |
|
133 |
== Changelog ==
|
134 |
|
|
|
|
|
|
|
135 |
= 6.1.6 =
|
136 |
* Fix. WhatsApp premium compatibility
|
137 |
|
5 |
Requires at least: 4.6
|
6 |
Requires PHP: 5.6
|
7 |
Tested up to: 6.0
|
8 |
+
Stable tag: 6.1.7
|
9 |
License: GPLv3
|
10 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
82 |
> * Display WhatsApp button based on custom post types and taxonomies
|
83 |
> * Display WhatsApp Button business hours
|
84 |
> * Display WhatsApp Contacts business hours
|
85 |
+
> * Google Analytics v3 events
|
86 |
+
> * Google Analytics v4 events
|
87 |
|
88 |
== WhatsApp Button Installation ==
|
89 |
1. Go to the Plugins Menu in WordPress
|
134 |
|
135 |
== Changelog ==
|
136 |
|
137 |
+
= 6.1.7 =
|
138 |
+
* Fix. WhatsApp premium compatibility
|
139 |
+
|
140 |
= 6.1.6 =
|
141 |
* Fix. WhatsApp premium compatibility
|
142 |
|
template/box.php
CHANGED
@@ -1,49 +1,50 @@
|
|
1 |
-
<div id="qlwapp" class="qlwapp-free <?php printf(
|
2 |
<div class="qlwapp-container">
|
3 |
-
<?php if (
|
4 |
<div class="qlwapp-box">
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
</div>
|
13 |
-
</div>
|
14 |
-
<?php endif; ?>
|
15 |
-
<div class="qlwapp-body">
|
16 |
-
<?php if ( isset( $contacts[0] ) ) : ?>
|
17 |
-
<a class="qlwapp-account" data-action="open" data-phone="<?php echo qlwapp_format_phone( $contacts[0]['phone'] ); ?>" data-message="<?php echo esc_html( $button['message'] ); ?>" href="javascript:void(0);" target="_blank">
|
18 |
-
<?php if ( ! empty( $contacts[0]['avatar'] ) ) : ?>
|
19 |
-
<div class="qlwapp-avatar">
|
20 |
-
<div class="qlwapp-avatar-container">
|
21 |
-
<img alt="<?php printf( '%s %s', esc_html( $contacts[0]['firstname'] ), esc_html( $contacts[0]['lastname'] ) ); ?>" src="<?php echo esc_url( $contacts[0]['avatar'] ); ?>">
|
22 |
</div>
|
23 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
<?php endif; ?>
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
28 |
</div>
|
29 |
-
</a>
|
30 |
<?php endif; ?>
|
31 |
</div>
|
32 |
-
<?php if ( ! empty( $box['footer'] ) ) : ?>
|
33 |
-
<div class="qlwapp-footer">
|
34 |
-
<?php echo wpautop( wp_kses_post( $box['footer'] ) ); ?>
|
35 |
-
</div>
|
36 |
-
<?php endif; ?>
|
37 |
-
</div>
|
38 |
<?php endif; ?>
|
39 |
-
|
40 |
-
|
41 |
-
|
|
|
42 |
<?php endif; ?>
|
43 |
<i class="qlwapp-close" data-action="close">×</i>
|
44 |
-
<?php if (
|
45 |
-
<span class="qlwapp-text"><?php echo esc_html(
|
46 |
<?php endif; ?>
|
47 |
</a>
|
48 |
</div>
|
49 |
-
</div>
|
1 |
+
<div id="qlwapp" class="qlwapp-free <?php printf('qlwapp-%s qlwapp-%s qlwapp-%s qlwapp-%s', esc_attr($button['layout']), esc_attr($button['position']), esc_attr($display['devices']), esc_attr($button['rounded'] === 'yes' ? 'rounded' : 'square')); ?>">
|
2 |
<div class="qlwapp-container">
|
3 |
+
<?php if ($button['box'] === 'yes') : ?>
|
4 |
<div class="qlwapp-box">
|
5 |
+
<?php if (!empty($box['header'])) : ?>
|
6 |
+
<div class="qlwapp-header">
|
7 |
+
<i class="qlwapp-close" data-action="close">×</i>
|
8 |
+
<div class="qlwapp-description">
|
9 |
+
<div class="qlwapp-description-container">
|
10 |
+
<?php echo wpautop(wp_kses_post(wpautop($box['header']))); ?>
|
11 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
</div>
|
13 |
</div>
|
14 |
+
<?php endif; ?>
|
15 |
+
<div class="qlwapp-body">
|
16 |
+
<?php if (isset($contacts[0])) : ?>
|
17 |
+
<a class="qlwapp-account" data-action="open" data-phone="<?php echo qlwapp_format_phone($contacts[0]['phone']); ?>" data-message="<?php echo esc_html($button['message']); ?>" href="javascript:void(0);" target="_blank">
|
18 |
+
<?php if (!empty($contacts[0]['avatar'])) : ?>
|
19 |
+
<div class="qlwapp-avatar">
|
20 |
+
<div class="qlwapp-avatar-container">
|
21 |
+
<img alt="<?php printf('%s %s', esc_html($contacts[0]['firstname']), esc_html($contacts[0]['lastname'])); ?>" src="<?php echo esc_url($contacts[0]['avatar']); ?>">
|
22 |
+
</div>
|
23 |
+
</div>
|
24 |
+
<?php endif; ?>
|
25 |
+
<div class="qlwapp-info">
|
26 |
+
<span class="qlwapp-label"><?php echo esc_html($contacts[0]['label']); ?></span>
|
27 |
+
<span class="qlwapp-name"><?php printf('%s %s', esc_html($contacts[0]['firstname']), esc_html($contacts[0]['lastname'])); ?></span>
|
28 |
+
</div>
|
29 |
+
</a>
|
30 |
<?php endif; ?>
|
31 |
+
</div>
|
32 |
+
<?php if (!empty($box['footer'])) : ?>
|
33 |
+
<div class="qlwapp-footer">
|
34 |
+
<?php echo wpautop(wp_kses_post($box['footer'])); ?>
|
35 |
</div>
|
|
|
36 |
<?php endif; ?>
|
37 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
<?php endif; ?>
|
39 |
+
|
40 |
+
<a class=" qlwapp-toggle" data-action="<?php echo ($button['box'] === 'yes' ? 'box' : 'open'); ?>" data-phone="<?php echo qlwapp_format_phone($button['phone']); ?>" data-message="<?php echo esc_html($button['message']); ?>" href="javascript:void(0);" target="_blank">
|
41 |
+
<?php if ($button['icon']) : ?>
|
42 |
+
<i class="qlwapp-icon <?php echo esc_attr($button['icon']); ?>"></i>
|
43 |
<?php endif; ?>
|
44 |
<i class="qlwapp-close" data-action="close">×</i>
|
45 |
+
<?php if ($button['text']) : ?>
|
46 |
+
<span class="qlwapp-text"><?php echo esc_html($button['text']); ?></span>
|
47 |
<?php endif; ?>
|
48 |
</a>
|
49 |
</div>
|
50 |
+
</div>
|
wp-whatsapp-chat.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: Social Chat
|
5 |
* Description: Social Chat allows your visitors to contact you or your team through WhatsApp chat with a single click.
|
6 |
* Plugin URI: https://quadlayers.com/portfolio/whatsapp-chat/
|
7 |
-
* Version: 6.1.
|
8 |
* Author: QuadLayers
|
9 |
* Author URI: https://quadlayers.com
|
10 |
* License: GPLv3
|
@@ -18,7 +18,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
18 |
}
|
19 |
|
20 |
define( 'QLWAPP_PLUGIN_NAME', 'Social Chat' );
|
21 |
-
define( 'QLWAPP_PLUGIN_VERSION', '6.1.
|
22 |
define( 'QLWAPP_PLUGIN_FILE', __FILE__ );
|
23 |
define( 'QLWAPP_PLUGIN_DIR', __DIR__ . DIRECTORY_SEPARATOR );
|
24 |
define( 'QLWAPP_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
@@ -46,7 +46,9 @@ define( 'QLWAPP_CROSS_INSTALL_URL', 'https://quadlayers.com/portfolio/instagram-
|
|
46 |
if ( ! class_exists( 'QLWAPP' ) ) {
|
47 |
include_once QLWAPP_PLUGIN_DIR . 'includes/qlwapp.php';
|
48 |
}
|
|
|
49 |
|
|
|
50 |
require_once QLWAPP_PLUGIN_DIR . 'includes/quadlayers/widget.php';
|
51 |
require_once QLWAPP_PLUGIN_DIR . 'includes/quadlayers/notices.php';
|
52 |
-
require_once QLWAPP_PLUGIN_DIR . 'includes/quadlayers/links.php';
|
4 |
* Plugin Name: Social Chat
|
5 |
* Description: Social Chat allows your visitors to contact you or your team through WhatsApp chat with a single click.
|
6 |
* Plugin URI: https://quadlayers.com/portfolio/whatsapp-chat/
|
7 |
+
* Version: 6.1.7
|
8 |
* Author: QuadLayers
|
9 |
* Author URI: https://quadlayers.com
|
10 |
* License: GPLv3
|
18 |
}
|
19 |
|
20 |
define( 'QLWAPP_PLUGIN_NAME', 'Social Chat' );
|
21 |
+
define( 'QLWAPP_PLUGIN_VERSION', '6.1.7' );
|
22 |
define( 'QLWAPP_PLUGIN_FILE', __FILE__ );
|
23 |
define( 'QLWAPP_PLUGIN_DIR', __DIR__ . DIRECTORY_SEPARATOR );
|
24 |
define( 'QLWAPP_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
46 |
if ( ! class_exists( 'QLWAPP' ) ) {
|
47 |
include_once QLWAPP_PLUGIN_DIR . 'includes/qlwapp.php';
|
48 |
}
|
49 |
+
/// compability
|
50 |
|
51 |
+
require_once QLWAPP_PLUGIN_DIR . 'compatibility/compatibility.php';
|
52 |
require_once QLWAPP_PLUGIN_DIR . 'includes/quadlayers/widget.php';
|
53 |
require_once QLWAPP_PLUGIN_DIR . 'includes/quadlayers/notices.php';
|
54 |
+
require_once QLWAPP_PLUGIN_DIR . 'includes/quadlayers/links.php';
|