Version Description
Hello! We've recently acquired this plugin and included tons of new features.
Download this release
Release Info
| Developer | quadlayers |
| Plugin | |
| Version | 4.4.4 |
| Comparing to | |
| See all releases | |
Code changes from version 4.4.3 to 4.4.4
- assets/js/qlwapp.js +4 -4
- changelog.txt +3 -0
- includes/defaults.php +40 -28
- includes/pages/button.php +6 -6
- includes/pages/contacts.php +11 -102
- includes/settings.php +31 -14
- readme.txt +1 -1
- wp-whatsapp-chat.php +2 -3
assets/js/qlwapp.js
CHANGED
|
@@ -32,10 +32,10 @@
|
|
| 32 |
$qlwapp.on('qlwapp.time', function (e) {
|
| 33 |
|
| 34 |
var $contact = $(e.target),
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
|
| 40 |
if (!timeto || !timefrom || !timezone || (timefrom === timeto)) {
|
| 41 |
return;
|
| 32 |
$qlwapp.on('qlwapp.time', function (e) {
|
| 33 |
|
| 34 |
var $contact = $(e.target),
|
| 35 |
+
timefrom = $contact.data('timefrom') || false,
|
| 36 |
+
timeto = $contact.data('timeto') || false,
|
| 37 |
+
// timeout = $contact.data('timeout'),
|
| 38 |
+
timezone = parseInt($contact.data('timezone')) || false;
|
| 39 |
|
| 40 |
if (!timeto || !timefrom || !timezone || (timefrom === timeto)) {
|
| 41 |
return;
|
changelog.txt
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
= 4.4.3 =
|
| 2 |
* Fix. time settings in pro version
|
| 3 |
|
| 1 |
+
= 4.4.4 =
|
| 2 |
+
* Fix. phone number sanitization
|
| 3 |
+
|
| 4 |
= 4.4.3 =
|
| 5 |
* Fix. time settings in pro version
|
| 6 |
|
includes/defaults.php
CHANGED
|
@@ -34,7 +34,7 @@ if (!class_exists('QLWAPP_Options')) {
|
|
| 34 |
'position' => 'bottom-right',
|
| 35 |
'text' => esc_html__('How can I help you?', 'wp-whatsapp-chat'),
|
| 36 |
'icon' => 'qlwapp-whatsapp-icon',
|
| 37 |
-
'phone' => '
|
| 38 |
'developer' => 'no',
|
| 39 |
'rounded' => 'yes',
|
| 40 |
'timefrom' => '00:00',
|
|
@@ -43,7 +43,7 @@ if (!class_exists('QLWAPP_Options')) {
|
|
| 43 |
'timeout' => 'readonly'
|
| 44 |
),
|
| 45 |
'box' => array(
|
| 46 |
-
'enable' => '
|
| 47 |
'header' => '<h3>Hello!</h3><p>Click one of our representatives below to chat on WhatsApp or send us an email to <a href="mailto:' . get_bloginfo('admin_email') . '">' . get_bloginfo('admin_email') . '</a></p>',
|
| 48 |
'footer' => '<p>Powered by <a target="_blank" href="' . QLWAPP_PURCHASE_URL . '">WhatsApp Chat</a>'
|
| 49 |
// ,'contactstimeout' => 'no'
|
|
@@ -56,7 +56,7 @@ if (!class_exists('QLWAPP_Options')) {
|
|
| 56 |
0 => array(
|
| 57 |
'chat' => true,
|
| 58 |
'avatar' => 'https://www.gravatar.com/avatar/00000000000000000000000000000000',
|
| 59 |
-
'phone' => '
|
| 60 |
'firstname' => 'John',
|
| 61 |
'lastname' => 'Doe',
|
| 62 |
'label' => esc_html__('Support', 'wp-whatsapp-chat'),
|
|
@@ -156,6 +156,15 @@ if (!class_exists('QLWAPP_Options')) {
|
|
| 156 |
return $GMT;
|
| 157 |
} */
|
| 158 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
function get_timezone_offset($timezone) {
|
| 160 |
if (strpos($timezone, 'UTC') !== false) {
|
| 161 |
$offset = preg_replace('/UTC\+?/', '', $timezone) * 60;
|
|
@@ -199,42 +208,45 @@ if (!class_exists('QLWAPP_Options')) {
|
|
| 199 |
|
| 200 |
$options = get_option(QLWAPP_DOMAIN, $this->defaults());
|
| 201 |
|
| 202 |
-
if (isset($options['button']['
|
| 203 |
-
$options['button']['
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 204 |
}
|
|
|
|
| 205 |
if (isset($options['contacts'])) {
|
| 206 |
if (count($options['contacts'])) {
|
| 207 |
foreach ($options['contacts'] as $id => $c) {
|
| 208 |
|
| 209 |
$options['contacts'][$id] = wp_parse_args($c, $this->defaults()['contacts'][0]);
|
| 210 |
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
|
|
|
|
|
|
|
|
|
| 215 |
}
|
| 216 |
}
|
| 217 |
}
|
| 218 |
}
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
$options['box']['
|
| 224 |
-
|
| 225 |
-
// // lo saco
|
| 226 |
-
// if (isset($options['box']['contactstimeout']) && $options['box']['contactstimeout'] == 'yes') {
|
| 227 |
-
// $options['box']['contactstimeout'] = 'yes';
|
| 228 |
-
// }
|
| 229 |
-
if (isset($options['button']['rounded']) && $options['button']['rounded'] == 1) {
|
| 230 |
-
$options['button']['rounded'] = 'yes';
|
| 231 |
-
}
|
| 232 |
-
if (isset($options['button']['developer']) && $options['button']['developer'] == 1) {
|
| 233 |
-
$options['button']['developer'] = 'yes';
|
| 234 |
-
}
|
| 235 |
-
if (isset($options['button']['timezone']) && !is_admin()) {
|
| 236 |
-
$options['button']['timezone'] = $this->get_timezone_offset($options['button']['timezone']);
|
| 237 |
-
}
|
| 238 |
|
| 239 |
$qlwapp = $this->wp_parse_args($options, $this->defaults());
|
| 240 |
}
|
| 34 |
'position' => 'bottom-right',
|
| 35 |
'text' => esc_html__('How can I help you?', 'wp-whatsapp-chat'),
|
| 36 |
'icon' => 'qlwapp-whatsapp-icon',
|
| 37 |
+
'phone' => '',
|
| 38 |
'developer' => 'no',
|
| 39 |
'rounded' => 'yes',
|
| 40 |
'timefrom' => '00:00',
|
| 43 |
'timeout' => 'readonly'
|
| 44 |
),
|
| 45 |
'box' => array(
|
| 46 |
+
'enable' => 'no',
|
| 47 |
'header' => '<h3>Hello!</h3><p>Click one of our representatives below to chat on WhatsApp or send us an email to <a href="mailto:' . get_bloginfo('admin_email') . '">' . get_bloginfo('admin_email') . '</a></p>',
|
| 48 |
'footer' => '<p>Powered by <a target="_blank" href="' . QLWAPP_PURCHASE_URL . '">WhatsApp Chat</a>'
|
| 49 |
// ,'contactstimeout' => 'no'
|
| 56 |
0 => array(
|
| 57 |
'chat' => true,
|
| 58 |
'avatar' => 'https://www.gravatar.com/avatar/00000000000000000000000000000000',
|
| 59 |
+
'phone' => '',
|
| 60 |
'firstname' => 'John',
|
| 61 |
'lastname' => 'Doe',
|
| 62 |
'label' => esc_html__('Support', 'wp-whatsapp-chat'),
|
| 156 |
return $GMT;
|
| 157 |
} */
|
| 158 |
|
| 159 |
+
function get_whatsapp_number($phone) {
|
| 160 |
+
|
| 161 |
+
$phone = preg_replace('/[^0-9]/', '', $phone);
|
| 162 |
+
|
| 163 |
+
$phone = ltrim($phone, '0');
|
| 164 |
+
|
| 165 |
+
return $phone;
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
function get_timezone_offset($timezone) {
|
| 169 |
if (strpos($timezone, 'UTC') !== false) {
|
| 170 |
$offset = preg_replace('/UTC\+?/', '', $timezone) * 60;
|
| 208 |
|
| 209 |
$options = get_option(QLWAPP_DOMAIN, $this->defaults());
|
| 210 |
|
| 211 |
+
if (isset($options['button']['rounded']) && $options['button']['rounded'] == 1) {
|
| 212 |
+
$options['button']['rounded'] = 'yes';
|
| 213 |
+
}
|
| 214 |
+
if (isset($options['button']['developer']) && $options['button']['developer'] == 1) {
|
| 215 |
+
$options['button']['developer'] = 'yes';
|
| 216 |
+
}
|
| 217 |
+
|
| 218 |
+
if (!is_admin()) {
|
| 219 |
+
if (isset($options['button']['phone'])) {
|
| 220 |
+
$options['button']['phone'] = $this->get_whatsapp_number($options['button']['phone']);
|
| 221 |
+
}
|
| 222 |
+
if (isset($options['button']['timezone'])) {
|
| 223 |
+
$options['button']['timezone'] = $this->get_timezone_offset($options['button']['timezone']);
|
| 224 |
+
}
|
| 225 |
}
|
| 226 |
+
|
| 227 |
if (isset($options['contacts'])) {
|
| 228 |
if (count($options['contacts'])) {
|
| 229 |
foreach ($options['contacts'] as $id => $c) {
|
| 230 |
|
| 231 |
$options['contacts'][$id] = wp_parse_args($c, $this->defaults()['contacts'][0]);
|
| 232 |
|
| 233 |
+
if (!is_admin()) {
|
| 234 |
+
if (!empty($options['contacts'][$id]['phone'])) {
|
| 235 |
+
$options['contacts'][$id]['phone'] = $this->get_whatsapp_number($options['button']['phone']);
|
| 236 |
+
}
|
| 237 |
+
if (!empty($options['contacts'][$id]['timezone'])) {
|
| 238 |
+
$options['contacts'][$id]['timezone'] = $this->get_timezone_offset($options['contacts'][$id]['timezone']);
|
| 239 |
+
}
|
| 240 |
}
|
| 241 |
}
|
| 242 |
}
|
| 243 |
}
|
| 244 |
+
/*
|
| 245 |
+
*
|
| 246 |
+
* next update
|
| 247 |
+
if (isset($options['box']['contactstimeout']) && $options['box']['contactstimeout'] == 'yes') {
|
| 248 |
+
$options['box']['contactstimeout'] = 'yes';
|
| 249 |
+
} */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 250 |
|
| 251 |
$qlwapp = $this->wp_parse_args($options, $this->defaults());
|
| 252 |
}
|
includes/pages/button.php
CHANGED
|
@@ -65,7 +65,7 @@
|
|
| 65 |
<tr>
|
| 66 |
<th scope="row"><?php esc_html_e('Phone', 'wp-whatsapp-chat'); ?></th>
|
| 67 |
<td>
|
| 68 |
-
<input type="text" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[button][phone]'); ?>" placeholder="<?php echo esc_html(
|
| 69 |
<p class="description hidden"><?php esc_html_e('Full phone number in international format.', 'wp-whatsapp-chat'); ?></p>
|
| 70 |
|
| 71 |
</td>
|
|
@@ -98,13 +98,13 @@
|
|
| 98 |
</td>
|
| 99 |
</tr>
|
| 100 |
<!-- <tr>
|
| 101 |
-
<th scope="row"><?php // esc_html_e('Timeout', 'wp-whatsapp-chat');
|
| 102 |
<td class="qlwapp-premium-field">
|
| 103 |
-
<select name="<?php // echo esc_attr(QLWAPP_DOMAIN);
|
| 104 |
-
<option value="yes" <?php // selected($qlwapp['button']['timeout'], 'yes');
|
| 105 |
-
<option value="no" <?php // selected($qlwapp['button']['timeout'], 'no');
|
| 106 |
</select>
|
| 107 |
-
<p class="description hidden"><small><?php //esc_html_e('This is a premium feature', 'wp-whatsapp-chat');
|
| 108 |
</td>
|
| 109 |
</tr> -->
|
| 110 |
</tbody>
|
| 65 |
<tr>
|
| 66 |
<th scope="row"><?php esc_html_e('Phone', 'wp-whatsapp-chat'); ?></th>
|
| 67 |
<td>
|
| 68 |
+
<input type="text" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[button][phone]'); ?>" placeholder="<?php echo esc_html('+542215677768'); ?>" value="<?php echo esc_attr($qlwapp['button']['phone']); ?>" class="qlwapp-input" required="required"/>
|
| 69 |
<p class="description hidden"><?php esc_html_e('Full phone number in international format.', 'wp-whatsapp-chat'); ?></p>
|
| 70 |
|
| 71 |
</td>
|
| 98 |
</td>
|
| 99 |
</tr>
|
| 100 |
<!-- <tr>
|
| 101 |
+
<th scope="row"><?php // esc_html_e('Timeout', 'wp-whatsapp-chat'); ?></th>
|
| 102 |
<td class="qlwapp-premium-field">
|
| 103 |
+
<select name="<?php // echo esc_attr(QLWAPP_DOMAIN); ?>[button][timeout]" class="qlwapp-select2">
|
| 104 |
+
<option value="yes" <?php // selected($qlwapp['button']['timeout'], 'yes'); ?>><?php esc_html_e('Show the button as read only', 'wp-whatsapp-chat'); ?></option>
|
| 105 |
+
<option value="no" <?php // selected($qlwapp['button']['timeout'], 'no'); ?>><?php esc_html_e('Do not show the button', 'wp-whatsapp-chat'); ?></option>
|
| 106 |
</select>
|
| 107 |
+
<p class="description hidden"><small><?php //esc_html_e('This is a premium feature', 'wp-whatsapp-chat'); ?></small></p>
|
| 108 |
</td>
|
| 109 |
</tr> -->
|
| 110 |
</tbody>
|
includes/pages/contacts.php
CHANGED
|
@@ -1,6 +1,8 @@
|
|
| 1 |
|
| 2 |
<div class="submit qlwapp-premium-field">
|
| 3 |
-
|
|
|
|
|
|
|
| 4 |
</div>
|
| 5 |
|
| 6 |
<table id="qlwapp-contacts-table" class="form-table widefat striped">
|
|
@@ -21,7 +23,8 @@
|
|
| 21 |
<?php
|
| 22 |
foreach ($qlwapp['contacts'] as $id => $c) {
|
| 23 |
?>
|
| 24 |
-
<tr>
|
|
|
|
| 25 |
<img class="qlwapp-avatar" src="<?php echo $c['avatar']; ?>" alt="" width="50" height="50" /> </td>
|
| 26 |
<td><b><?php echo esc_attr($c['phone']); ?></b></td>
|
| 27 |
<td><b><?php echo $c['firstname'] . ', ' . $c['lastname']; ?> </b></td>
|
|
@@ -30,110 +33,16 @@
|
|
| 30 |
<td><b><?php echo $c['chat']; ?></b></td>
|
| 31 |
<td><b><?php echo $c['timefrom']; ?> to <?php echo $c['timeto']; ?></b></td>
|
| 32 |
<td><b><?php echo $c['timezone']; ?></b></td>
|
| 33 |
-
<td><b>
|
| 34 |
-
<?php
|
| 35 |
-
|
|
|
|
|
|
|
| 36 |
</tr>
|
| 37 |
<?php
|
| 38 |
}
|
| 39 |
?>
|
| 40 |
</tbody>
|
| 41 |
-
</table>
|
| 42 |
-
|
| 43 |
-
<script type="text/html" id='tmpl-wpmi-modal-backdrop'>
|
| 44 |
-
<div class="media-modal-backdrop"> </div>
|
| 45 |
-
</script>
|
| 46 |
-
<script type="text/html" id='tmpl-wpmi-modal-window'>
|
| 47 |
-
<div id="<?php echo esc_attr(QLWAPP_DOMAIN . '_modal'); ?>" class="media-modal wp-core-ui">
|
| 48 |
-
<button type="button" class="media-modal-close close">
|
| 49 |
-
<span class="media-modal-icon">
|
| 50 |
-
<span class="screen-reader-text"><?php esc_html_e('Close media panel'); ?></span>
|
| 51 |
-
</span>
|
| 52 |
-
</button>
|
| 53 |
-
<div class="media-frame mode-select wp-core-ui hide-menu">
|
| 54 |
-
<div class="media-frame-title">
|
| 55 |
-
<h1><?php esc_html_e('Admin Contact'); ?>
|
| 56 |
-
<span class="dashicons dashicons-arrow-down"></span>
|
| 57 |
-
</h1>
|
| 58 |
-
</div>
|
| 59 |
-
<div class="media-modal-content">
|
| 60 |
-
<div class="media-frame mode-select wp-core-ui">
|
| 61 |
-
<div class="media-frame-content" >
|
| 62 |
-
<table>
|
| 63 |
-
<tr>
|
| 64 |
-
<div tabindex="0" class="attachment-details save-ready">
|
| 65 |
-
<div class="upload">
|
| 66 |
-
<img id="cavatar-img" class="qlwapp-avatar" data-src="<?php echo stripslashes(esc_url($qlwapp['contacts'][$id]['avatar'])); ?>" src="<?php echo esc_url($qlwapp['contacts'][$id]['avatar']); ?>" width="75" height="75"/>
|
| 67 |
-
<div>
|
| 68 |
-
<input type="hidden" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts][' . $id . '][avatar]'); ?>" id="cavatar" value="<?php echo esc_url($qlwapp['contacts'][$id]['avatar']); ?>" />
|
| 69 |
-
<button type="button" class="upload_image_button button"><?php esc_html_e('Upload', 'wp-whatsapp-chat'); ?></button>
|
| 70 |
-
<button type="button" class="remove_image_button button">×</button>
|
| 71 |
-
</div>
|
| 72 |
-
</div>
|
| 73 |
-
</div>
|
| 74 |
-
</tr>
|
| 75 |
-
<tr>
|
| 76 |
-
<td><b><?php esc_html_e('Firstname', 'wp-whatsapp-chat'); ?></b></td>
|
| 77 |
-
<td><input type="text" id="cfirstname" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts][' . $id . '][firstname]'); ?>" placeholder="<?php echo esc_html($this->defaults['contacts'][0]['firstname']); ?>" value="<?php echo esc_html($qlwapp['contacts'][$id]['firstname']); ?>" /></td>
|
| 78 |
-
<td><b><?php esc_html_e('Lastname', 'wp-whatsapp-chat'); ?></b></td>
|
| 79 |
-
<td><input type="text" id="clastname" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts][' . $id . '][lastname]'); ?>" placeholder="<?php echo esc_html($this->defaults['contacts'][0]['lastname']); ?>" value="<?php echo esc_html($qlwapp['contacts'][$id]['lastname']); ?>" /></td>
|
| 80 |
-
</tr>
|
| 81 |
-
<tr>
|
| 82 |
-
<td><b><?php esc_html_e('Phone', 'wp-whatsapp-chat'); ?></b></td><td><input type="text" id="cphone" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts][' . $id . '][phone]'); ?>" placeholder="<?php echo esc_html($this->defaults['contacts'][0]['phone']); ?>" value="<?php echo esc_html($qlwapp['contacts'][$id]['phone']); ?>" required="required" pattern="\d[0-9]{6,15}$"/></td>
|
| 83 |
-
<td><b><?php esc_html_e('Label', 'wp-whatsapp-chat'); ?></b></td><td><input type="text" id="clabel" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts][' . $id . '][label]'); ?>" placeholder="<?php echo esc_html($this->defaults['contacts'][0]['label']); ?>" value="<?php echo esc_html($qlwapp['contacts'][$id]['label']); ?>" /></td>
|
| 84 |
-
</tr>
|
| 85 |
-
<tr>
|
| 86 |
-
<td >
|
| 87 |
-
<b><?php esc_html_e('From', 'wp-whatsapp-chat'); ?></b></td>
|
| 88 |
-
<td class="qlwapp-premium-field">
|
| 89 |
-
<input type="time" id="ctimefrom" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts][' . $id . '][timefrom]'); ?>" placeholder="<?php echo esc_html($this->defaults['contacts'][0]['timefrom']); ?>" value="<?php echo esc_html($qlwapp['contacts'][$id]['timefrom']); ?>" />
|
| 90 |
-
<p class="description hidden"><small><?php esc_html_e('This is a premium feature', 'wp-whatsapp-chat'); ?></small></p>
|
| 91 |
-
|
| 92 |
-
</td>
|
| 93 |
-
<td>
|
| 94 |
-
<b><?php esc_html_e('To', 'wp-whatsapp-chat'); ?></b></td>
|
| 95 |
-
<td class="qlwapp-premium-field">
|
| 96 |
-
<input type="time" id="ctimeto" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts][' . $id . '][timeto]'); ?>" placeholder="<?php echo esc_html($this->defaults['contacts'][0]['timeto']); ?>" value="<?php echo esc_html($qlwapp['contacts'][$id]['timeto']); ?>" />
|
| 97 |
-
<p class="description hidden"><small><?php esc_html_e('This is a premium feature', 'wp-whatsapp-chat'); ?></small></p>
|
| 98 |
-
</td>
|
| 99 |
-
</tr>
|
| 100 |
-
<!--
|
| 101 |
-
<tr>
|
| 102 |
-
<td><b><?php esc_html_e('Time is over', 'wp-whatsapp-chat'); ?></b></td>
|
| 103 |
-
<td class="qlwapp-premium-field">
|
| 104 |
-
<select id="ctimeout" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts][' . $id . '][timeout]'); ?>">
|
| 105 |
-
<option value="readonly" ><?php esc_html_e('Show the field as read only', 'wp-whatsapp-chat'); ?></option>
|
| 106 |
-
<option value="disabled" > <?php esc_html_e('Do not show the field', 'wp-whatsapp-chat'); ?></option>
|
| 107 |
-
</select>
|
| 108 |
-
<p class="description hidden"><small><?php esc_html_e('This is a premium feature', 'wp-whatsapp-chat'); ?></small></p>
|
| 109 |
-
</td> -->
|
| 110 |
-
<td>
|
| 111 |
-
<b><label for="timezone"><?php esc_html_e('Timezone', 'wp-whatsapp-chat'); ?></label></b></td>
|
| 112 |
-
<td class="qlwapp-premium-field">
|
| 113 |
-
<select id="ctimezone" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts][' . $id . '][timezone]'); ?>" aria-describedby="timezone-description">
|
| 114 |
-
<?php echo wp_timezone_choice(get_option('timezone_string'), get_user_locale()); ?>
|
| 115 |
-
</select>
|
| 116 |
-
<p class="description hidden"><small><?php esc_html_e('This is a premium feature', 'wp-whatsapp-chat'); ?></small></p>
|
| 117 |
-
|
| 118 |
-
</td>
|
| 119 |
-
</tr>
|
| 120 |
-
</table>
|
| 121 |
-
|
| 122 |
-
</div>
|
| 123 |
-
<div class="media-frame-toolbar">
|
| 124 |
-
<div class="media-toolbar">
|
| 125 |
-
<div class="media-toolbar-secondary"></div>
|
| 126 |
-
<div class="media-toolbar-primary search-form">
|
| 127 |
-
<button type="button" data-id="0" class="button media-button button-large button-primary media-button-select save"><?php esc_html_e('Save'); ?></button>
|
| 128 |
-
<button type="button" class="button media-button button-large button-secondary close"><?php esc_html_e('Close'); ?></button>
|
| 129 |
-
</div>
|
| 130 |
-
</div>
|
| 131 |
-
</div>
|
| 132 |
-
</div>
|
| 133 |
-
</div>
|
| 134 |
-
</div>
|
| 135 |
-
</div>
|
| 136 |
-
</script>
|
| 137 |
-
|
| 138 |
|
| 139 |
|
| 1 |
|
| 2 |
<div class="submit qlwapp-premium-field">
|
| 3 |
+
|
| 4 |
+
<a href="javascript:;" id="qlwapp_settings_add" contact_id ="-1" class="button button-primary"><?php esc_html_e('+ New Contact', 'woocommerce-checkout-manager') ?></a>
|
| 5 |
+
|
| 6 |
</div>
|
| 7 |
|
| 8 |
<table id="qlwapp-contacts-table" class="form-table widefat striped">
|
| 23 |
<?php
|
| 24 |
foreach ($qlwapp['contacts'] as $id => $c) {
|
| 25 |
?>
|
| 26 |
+
<tr data-contact_id="<?php echo esc_attr($id) ?>" >
|
| 27 |
+
<td>
|
| 28 |
<img class="qlwapp-avatar" src="<?php echo $c['avatar']; ?>" alt="" width="50" height="50" /> </td>
|
| 29 |
<td><b><?php echo esc_attr($c['phone']); ?></b></td>
|
| 30 |
<td><b><?php echo $c['firstname'] . ', ' . $c['lastname']; ?> </b></td>
|
| 33 |
<td><b><?php echo $c['chat']; ?></b></td>
|
| 34 |
<td><b><?php echo $c['timefrom']; ?> to <?php echo $c['timeto']; ?></b></td>
|
| 35 |
<td><b><?php echo $c['timezone']; ?></b></td>
|
| 36 |
+
<td><b>
|
| 37 |
+
<a class="qlwapp_settings_edit button" aria-label="<?php esc_html_e('Edit checkout field', 'wp-whatsapp-chat'); ?>" href="javascript:;"><?php esc_html_e('Edit'); ?></a>
|
| 38 |
+
<a class="qlwapp_settings_delete" aria-label="<?php esc_html_e('Edit checkout field', 'wp-whatsapp-chat'); ?>" href="javascript:;"><?php esc_html_e('Delete'); ?></a>
|
| 39 |
+
</b>
|
| 40 |
+
</td>
|
| 41 |
</tr>
|
| 42 |
<?php
|
| 43 |
}
|
| 44 |
?>
|
| 45 |
</tbody>
|
| 46 |
+
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
|
includes/settings.php
CHANGED
|
@@ -292,7 +292,7 @@ if (!class_exists('QLWAPP_Settings')) {
|
|
| 292 |
<td><input type="text" id="clastname" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts][' . $id . '][lastname]'); ?>" placeholder="<?php echo esc_html($this->defaults['contacts'][0]['lastname']); ?>" value="<?php echo esc_html($qlwapp['contacts'][$id]['lastname']); ?>" /></td>
|
| 293 |
</tr>
|
| 294 |
<tr>
|
| 295 |
-
<td><b><?php esc_html_e('Phone', 'wp-whatsapp-chat'); ?></b></td><td><input type="text" id="cphone" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts][' . $id . '][phone]'); ?>" placeholder="<?php echo esc_html(
|
| 296 |
<td><b><?php esc_html_e('Label', 'wp-whatsapp-chat'); ?></b></td><td><input type="text" id="clabel" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts][' . $id . '][label]'); ?>" placeholder="<?php echo esc_html($this->defaults['contacts'][0]['label']); ?>" value="<?php echo esc_html($qlwapp['contacts'][$id]['label']); ?>" /></td>
|
| 297 |
</tr>
|
| 298 |
<tr>
|
|
@@ -461,7 +461,10 @@ if (!class_exists('QLWAPP_Settings')) {
|
|
| 461 |
|
| 462 |
wp_localize_script('qlwapp-admin', 'qlwapp', array('nonce' => array(
|
| 463 |
'qlwapp_get_posts' => wp_create_nonce('qlwapp_get_posts'),
|
| 464 |
-
'qlwapp_get_contact' => wp_create_nonce('qlwapp_get_contact')
|
|
|
|
|
|
|
|
|
|
| 465 |
))
|
| 466 |
);
|
| 467 |
}
|
|
@@ -477,24 +480,38 @@ if (!class_exists('QLWAPP_Settings')) {
|
|
| 477 |
add_filter('pre_update_option_' . sanitize_key(QLWAPP_DOMAIN), array($this, 'filter_pre_update_option'), -1, 3);
|
| 478 |
add_filter('plugin_action_links_' . plugin_basename(QLWAPP_PLUGIN_FILE), array($this, 'add_action_links'));
|
| 479 |
|
| 480 |
-
////
|
| 481 |
-
add_action('
|
|
|
|
|
|
|
| 482 |
}
|
| 483 |
|
| 484 |
///
|
| 485 |
-
function
|
| 486 |
global $qlwapp;
|
| 487 |
-
|
| 488 |
-
|
| 489 |
-
|
| 490 |
-
|
| 491 |
-
if (isset
|
| 492 |
-
|
| 493 |
-
|
| 494 |
-
|
|
|
|
|
|
|
| 495 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 496 |
|
| 497 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 498 |
}
|
| 499 |
|
| 500 |
public static function instance() {
|
| 292 |
<td><input type="text" id="clastname" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts][' . $id . '][lastname]'); ?>" placeholder="<?php echo esc_html($this->defaults['contacts'][0]['lastname']); ?>" value="<?php echo esc_html($qlwapp['contacts'][$id]['lastname']); ?>" /></td>
|
| 293 |
</tr>
|
| 294 |
<tr>
|
| 295 |
+
<td><b><?php esc_html_e('Phone', 'wp-whatsapp-chat'); ?></b></td><td><input type="text" id="cphone" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts][' . $id . '][phone]'); ?>" placeholder="<?php echo esc_html('+542215677768'); ?>" value="<?php echo esc_html($qlwapp['contacts'][$id]['phone']); ?>" required="required"/></td>
|
| 296 |
<td><b><?php esc_html_e('Label', 'wp-whatsapp-chat'); ?></b></td><td><input type="text" id="clabel" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts][' . $id . '][label]'); ?>" placeholder="<?php echo esc_html($this->defaults['contacts'][0]['label']); ?>" value="<?php echo esc_html($qlwapp['contacts'][$id]['label']); ?>" /></td>
|
| 297 |
</tr>
|
| 298 |
<tr>
|
| 461 |
|
| 462 |
wp_localize_script('qlwapp-admin', 'qlwapp', array('nonce' => array(
|
| 463 |
'qlwapp_get_posts' => wp_create_nonce('qlwapp_get_posts'),
|
| 464 |
+
'qlwapp_get_contact' => wp_create_nonce('qlwapp_get_contact'),
|
| 465 |
+
'qlwapp_edit_contact' => wp_create_nonce('qlwapp_edit_contact'),
|
| 466 |
+
'qlwapp_add_contact' => wp_create_nonce('qlwapp_add_contact'),
|
| 467 |
+
'qlwapp_save_contact' => wp_create_nonce('qlwapp_save_contact')
|
| 468 |
))
|
| 469 |
);
|
| 470 |
}
|
| 480 |
add_filter('pre_update_option_' . sanitize_key(QLWAPP_DOMAIN), array($this, 'filter_pre_update_option'), -1, 3);
|
| 481 |
add_filter('plugin_action_links_' . plugin_basename(QLWAPP_PLUGIN_FILE), array($this, 'add_action_links'));
|
| 482 |
|
| 483 |
+
////
|
| 484 |
+
add_action('wp_ajax_qlwapp_add_contact', array($this, 'ajax_add_contact'));
|
| 485 |
+
add_action('wp_ajax_qlwapp_edit_contact', array($this, 'ajax_edit_contact'));
|
| 486 |
+
add_action('wp_ajax_qlwapp_save_contact', array($this, 'ajax_save_contact'));
|
| 487 |
}
|
| 488 |
|
| 489 |
///
|
| 490 |
+
function ajax_edit_contact() {
|
| 491 |
global $qlwapp;
|
| 492 |
+
|
| 493 |
+
if (check_ajax_referer('qlwapp_edit_contact', 'nonce', false)) {
|
| 494 |
+
// set -1 if the contact not exist beacouse allways exist contact 0
|
| 495 |
+
$contact_id = (isset($_REQUEST['contact_id'])) ? absint($_REQUEST['contact_id']) : -1;
|
| 496 |
+
if (isset($qlwapp['contacts'][$contact_id])) {
|
| 497 |
+
$qlwapp['contacts'][$contact_id]['id'] = $contact_id;
|
| 498 |
+
$qlwapp['contacts'][$contact_id]['prev_id'] = $contact_id - 1;
|
| 499 |
+
$qlwapp['contacts'][$contact_id]['next_id'] = min($contact_id + 1, count($qlwapp['contacts']) - 1);
|
| 500 |
+
|
| 501 |
+
wp_send_json_success($qlwapp['contacts'][$contact_id]);
|
| 502 |
}
|
| 503 |
+
} else {
|
| 504 |
+
$this->defaults()['contacts'][0]['id'] = $contact_id;
|
| 505 |
+
wp_send_json_success($this->defaults()['contacts'][0]);
|
| 506 |
+
}
|
| 507 |
+
}
|
| 508 |
|
| 509 |
+
function ajax_save_contact() {
|
| 510 |
+
global $qlwapp;
|
| 511 |
+
}
|
| 512 |
+
|
| 513 |
+
function ajax_add_contact() {
|
| 514 |
+
global $qlwapp;
|
| 515 |
}
|
| 516 |
|
| 517 |
public static function instance() {
|
readme.txt
CHANGED
|
@@ -4,7 +4,7 @@ Donate link: https://quadlayers.com/portfolio/wordpress-whatsapp-chat/
|
|
| 4 |
Tags: whatsapp, whatsapp button, whatsapp chat, whatsapp support, contact, click to chat, directly message whatsapp, floating whatsapp, whatsapp business, messaging, help desk
|
| 5 |
Requires at least: 4.6
|
| 6 |
Tested up to: 5.2.2
|
| 7 |
-
Stable tag: 4.4.
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
| 4 |
Tags: whatsapp, whatsapp button, whatsapp chat, whatsapp support, contact, click to chat, directly message whatsapp, floating whatsapp, whatsapp business, messaging, help desk
|
| 5 |
Requires at least: 4.6
|
| 6 |
Tested up to: 5.2.2
|
| 7 |
+
Stable tag: 4.4.4
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
wp-whatsapp-chat.php
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
* Plugin Name: WhatsApp Chat
|
| 4 |
* Plugin URI: https://quadlayers.com/portfolio/wordpress-whatsapp-chat/
|
| 5 |
* Description: WhatsApp Chat allows your visitors to contact you or your team through WhatsApp chat with a single click.
|
| 6 |
-
* Version: 4.4.
|
| 7 |
* Author: QuadLayers
|
| 8 |
* Author URI: https://quadlayers.com
|
| 9 |
* License: GPL-2.0+
|
|
@@ -18,7 +18,7 @@ if (!defined('QLWAPP_PLUGIN_NAME')) {
|
|
| 18 |
define('QLWAPP_PLUGIN_NAME', 'WhatsApp Chat');
|
| 19 |
}
|
| 20 |
if (!defined('QLWAPP_PLUGIN_VERSION')) {
|
| 21 |
-
define('QLWAPP_PLUGIN_VERSION', '4.4.
|
| 22 |
}
|
| 23 |
if (!defined('QLWAPP_PLUGIN_FILE')) {
|
| 24 |
define('QLWAPP_PLUGIN_FILE', __FILE__);
|
|
@@ -122,7 +122,6 @@ if (!class_exists('QLWAPP')) {
|
|
| 122 |
include_once('includes/defaults.php');
|
| 123 |
include_once('includes/frontend.php');
|
| 124 |
include_once('includes/settings.php');
|
| 125 |
-
//include_once('includes/contacts_ajax.php');
|
| 126 |
}
|
| 127 |
|
| 128 |
public static function is_min() {
|
| 3 |
* Plugin Name: WhatsApp Chat
|
| 4 |
* Plugin URI: https://quadlayers.com/portfolio/wordpress-whatsapp-chat/
|
| 5 |
* Description: WhatsApp Chat allows your visitors to contact you or your team through WhatsApp chat with a single click.
|
| 6 |
+
* Version: 4.4.4
|
| 7 |
* Author: QuadLayers
|
| 8 |
* Author URI: https://quadlayers.com
|
| 9 |
* License: GPL-2.0+
|
| 18 |
define('QLWAPP_PLUGIN_NAME', 'WhatsApp Chat');
|
| 19 |
}
|
| 20 |
if (!defined('QLWAPP_PLUGIN_VERSION')) {
|
| 21 |
+
define('QLWAPP_PLUGIN_VERSION', '4.4.4');
|
| 22 |
}
|
| 23 |
if (!defined('QLWAPP_PLUGIN_FILE')) {
|
| 24 |
define('QLWAPP_PLUGIN_FILE', __FILE__);
|
| 122 |
include_once('includes/defaults.php');
|
| 123 |
include_once('includes/frontend.php');
|
| 124 |
include_once('includes/settings.php');
|
|
|
|
| 125 |
}
|
| 126 |
|
| 127 |
public static function is_min() {
|
