WhatsApp Chat WP - Version 4.3.0

Version Description

Hello! We've recently acquired this plugin and included tons of new features.

Download this release

Release Info

Developer quadlayers
Plugin Icon 128x128 WhatsApp Chat WP
Version 4.3.0
Comparing to
See all releases

Code changes from version 4.2.9 to 4.3.0

assets/js/qlwapp-admin.js CHANGED
@@ -1,79 +1,93 @@
1
- (function ($) {
2
-
3
- $(document).on('ready', function () {
4
-
5
- $('.qlwapp-select2').select2({allowClear: false, theme: 'default', minimumResultsForSearch: -1});
6
-
7
- $('.qlwapp-select2-ajax').each(function () {
8
-
9
- var $select = $(this),
10
- name = $(this).data('name');
11
-
12
- $select.select2({
13
- allowClear: true,
14
- ajax: {
15
- url: ajaxurl,
16
- dataType: 'json',
17
- delay: 5000,
18
- data: function (params) {
19
- return {
20
- q: params.term,
21
- name: name,
22
- per_page: 10,
23
- action: 'qlwapp_get_posts'
24
- };
25
- },
26
- processResults: function (response) {
27
-
28
- var options = [];
29
-
30
- if (response) {
31
- $.each(response, function (index, text) {
32
- options.push({id: text[0], text: text[1]});
33
- });
34
- }
35
- return {
36
- results: options
37
- };
38
- },
39
- cache: true
40
- },
41
- //minimumInputLength: 3
42
- });
43
-
44
- });
45
-
46
- $('.qlwapp-color-field').wpColorPicker();
47
- });
48
-
49
-
50
- $(document).on('click', '.upload_image_button', function (e) {
51
- e.preventDefault();
52
-
53
- var send_attachment_bkp = wp.media.editor.send.attachment,
54
- button = $(this);
55
-
56
- wp.media.editor.send.attachment = function (props, attachment) {
57
- $(button).parent().prev().attr('src', attachment.url);
58
- $(button).prev().val(attachment.url);
59
- wp.media.editor.send.attachment = send_attachment_bkp;
60
- }
61
-
62
- wp.media.editor.open(button);
63
-
64
- return false;
65
- });
66
-
67
- $(document).on('click', '.remove_image_button', function (e) {
68
- e.preventDefault();
69
-
70
- var src = $(this).parent().prev().attr('data-src');
71
-
72
- $(this).parent().prev().attr('src', src);
73
-
74
- $(this).prev().prev().val('');
75
-
76
- return false;
77
- });
78
-
79
})(jQuery);
1
+ (function ($) {
2
+
3
+ // Validation box.contact.phone number
4
+ $('form :input').keyup(function (e) {
5
+ if (!this.reportValidity()) {
6
+ $(this).closest('td').addClass('form-invalid');
7
+ $('#btn-save-contact').attr('disabled', 'disabled');
8
+ } else {
9
+ $('#btn-save-contact').removeAttr('disabled');
10
+ $(this).closest('td').removeClass('form-invalid');
11
+ ;
12
+ }
13
+ });
14
+
15
+ //$(document).on('ready', function () {
16
+
17
+ $('.qlwapp-select2').select2({allowClear: false, theme: 'default', minimumResultsForSearch: -1});
18
+
19
+ $('.qlwapp-select2-ajax').each(function () {
20
+
21
+ var $select = $(this),
22
+ name = $(this).data('name');
23
+
24
+ $select.select2({
25
+ allowClear: true,
26
+ ajax: {
27
+ url: ajaxurl,
28
+ dataType: 'json',
29
+ delay: 5000,
30
+ data: function (params) {
31
+ return {
32
+ q: params.term,
33
+ name: name,
34
+ per_page: 10,
35
+ action: 'qlwapp_get_posts'
36
+ };
37
+ },
38
+ processResults: function (response) {
39
+
40
+ var options = [];
41
+
42
+ if (response) {
43
+ $.each(response, function (index, text) {
44
+ options.push({id: text[0], text: text[1]});
45
+ });
46
+ }
47
+ return {
48
+ results: options
49
+ };
50
+ },
51
+ cache: true
52
+ },
53
+ //minimumInputLength: 3
54
+ });
55
+
56
+ });
57
+
58
+ $('.qlwapp-color-field').wpColorPicker();
59
+ //});
60
+
61
+
62
+ $(document).on('click', '.upload_image_button', function (e) {
63
+ e.preventDefault();
64
+
65
+ var send_attachment_bkp = wp.media.editor.send.attachment,
66
+ button = $(this);
67
+
68
+ wp.media.editor.send.attachment = function (props, attachment) {
69
+ $(button).parent().prev().attr('src', attachment.url);
70
+ $(button).prev().val(attachment.url);
71
+ wp.media.editor.send.attachment = send_attachment_bkp;
72
+ }
73
+
74
+ wp.media.editor.open(button);
75
+
76
+ return false;
77
+ });
78
+
79
+ $(document).on('click', '.remove_image_button', function (e) {
80
+ e.preventDefault();
81
+
82
+ var src = $(this).parent().prev().attr('data-src');
83
+
84
+ $(this).parent().prev().attr('src', src);
85
+
86
+ $(this).prev().prev().val('');
87
+
88
+ return false;
89
+ });
90
+
91
+
92
+
93
})(jQuery);
assets/js/qlwapp-admin.min.js CHANGED
@@ -1 +1,2 @@
1
- (function(a){a(document).on("ready",function(){a(".qlwapp-select2").select2({allowClear:false,theme:"default",minimumResultsForSearch:-1});a(".qlwapp-select2-ajax").each(function(){var c=a(this),b=a(this).data("name");c.select2({allowClear:true,ajax:{url:ajaxurl,dataType:"json",delay:5000,data:function(d){return{q:d.term,name:b,per_page:10,action:"qlwapp_get_posts"}},processResults:function(d){var e=[];if(d){a.each(d,function(f,g){e.push({id:g[0],text:g[1]})})}return{results:e}},cache:true},})});a(".qlwapp-color-field").wpColorPicker()});a(document).on("click",".upload_image_button",function(d){d.preventDefault();var b=wp.media.editor.send.attachment,c=a(this);wp.media.editor.send.attachment=function(e,f){a(c).parent().prev().attr("src",f.url);a(c).prev().val(f.url);wp.media.editor.send.attachment=b};wp.media.editor.open(c);return false});a(document).on("click",".remove_image_button",function(b){b.preventDefault();var c=a(this).parent().prev().attr("data-src");a(this).parent().prev().attr("src",c);a(this).prev().prev().val("");return false})})(jQuery);
1
+
2
+ (function(a){a("form :input").keyup(function(b){if(!this.reportValidity()){a(this).closest("td").addClass("form-invalid");a("#btn-save-contact").attr("disabled","disabled")}else{a("#btn-save-contact").removeAttr("disabled");a(this).closest("td").removeClass("form-invalid")}});a(".qlwapp-select2").select2({allowClear:false,theme:"default",minimumResultsForSearch:-1});a(".qlwapp-select2-ajax").each(function(){var c=a(this),b=a(this).data("name");c.select2({allowClear:true,ajax:{url:ajaxurl,dataType:"json",delay:5000,data:function(d){return{q:d.term,name:b,per_page:10,action:"qlwapp_get_posts"}},processResults:function(d){var e=[];if(d){a.each(d,function(f,g){e.push({id:g[0],text:g[1]})})}return{results:e}},cache:true},})});a(".qlwapp-color-field").wpColorPicker();a(document).on("click",".upload_image_button",function(d){d.preventDefault();var b=wp.media.editor.send.attachment,c=a(this);wp.media.editor.send.attachment=function(e,f){a(c).parent().prev().attr("src",f.url);a(c).prev().val(f.url);wp.media.editor.send.attachment=b};wp.media.editor.open(c);return false});a(document).on("click",".remove_image_button",function(b){b.preventDefault();var c=a(this).parent().prev().attr("data-src");a(this).parent().prev().attr("src",c);a(this).prev().prev().val("");return false})})(jQuery);
changelog.txt CHANGED
@@ -1,3 +1,8 @@
1
= 4.2.9 =
2
* Fix. wordpress 4.2 compatibility
3
1
+ = 4.3.0 =
2
+ * Fix. bad spelling
3
+ * Fix. whatsapp chat pro features not working
4
+ * Improvement. wpml compatibility
5
+
6
= 4.2.9 =
7
* Fix. wordpress 4.2 compatibility
8
includes/defaults.php CHANGED
@@ -35,7 +35,9 @@ if (!class_exists('QLWAPP_Options')) {
35
'icon' => 'qlwapp-whatsapp-icon',
36
'phone' => '+441234567890',
37
'developer' => 'no',
38
- 'rounded' => 'yes'
39
),
40
'box' => array(
41
'enable' => 'no',
@@ -54,7 +56,9 @@ if (!class_exists('QLWAPP_Options')) {
54
'firstname' => 'John',
55
'lastname' => 'Doe',
56
'label' => esc_html__('Support', 'wp-whatsapp-chat'),
57
- 'message' => esc_html__('Hello! I\'m John from the support team.', 'wp-whatsapp-chat')
58
),
59
),
60
'display' => array(
35
'icon' => 'qlwapp-whatsapp-icon',
36
'phone' => '+441234567890',
37
'developer' => 'no',
38
+ 'rounded' => 'yes',
39
+ 'timefrom'=> '08:00',
40
+ 'timeto'=> '18:00'
41
),
42
'box' => array(
43
'enable' => 'no',
56
'firstname' => 'John',
57
'lastname' => 'Doe',
58
'label' => esc_html__('Support', 'wp-whatsapp-chat'),
59
+ 'message' => esc_html__('Hello! I\'m John from the support team.', 'wp-whatsapp-chat'),
60
+ 'timefrom'=> '08:00',
61
+ 'timeto'=> '18:00'
62
),
63
),
64
'display' => array(
includes/pages/box.php CHANGED
@@ -1,175 +1,178 @@
1
- <form method="post" action="options.php">
2
- <?php settings_fields(sanitize_key(QLWAPP_DOMAIN . '-group')); ?>
3
- <?php do_settings_sections(sanitize_key(QLWAPP_DOMAIN . '-group')); ?>
4
- <table class="form-table">
5
- <tbody>
6
- <tr>
7
- <th scope="row"><?php esc_html_e('Disable', 'wp-whatsapp-chat'); ?></th>
8
- <td>
9
- <select name="<?php echo esc_attr(QLWAPP_DOMAIN); ?>[box][enable]" class="qlwapp-select2">
10
- <option value="yes" <?php selected($qlwapp['box']['enable'], 'yes'); ?>><?php esc_html_e('Enable contact box', 'wp-whatsapp-chat'); ?></option>
11
- <option value="no" <?php selected($qlwapp['box']['enable'], 'no'); ?>><?php esc_html_e('Disable contact box', 'wp-whatsapp-chat'); ?></option>
12
- </select>
13
- </td>
14
- </tr>
15
- <tr>
16
- <th scope="row"><?php esc_html_e('Header', 'wp-whatsapp-chat'); ?></th>
17
- <td>
18
- <?php wp_editor($qlwapp['box']['header'], 'qlwapp_box_header', array('editor_height' => 200, 'textarea_name' => esc_attr(QLWAPP_DOMAIN) . '[box][header]')); ?>
19
- </td>
20
- </tr>
21
- <tr>
22
- <th scope="row"><?php esc_html_e('Footer', 'wp-whatsapp-chat'); ?></th>
23
- <td>
24
- <?php wp_editor($qlwapp['box']['footer'], 'qlwapp_box_footer', array('editor_height' => 200, 'textarea_name' => esc_attr(QLWAPP_DOMAIN) . '[box][footer]')); ?>
25
- </td>
26
- </tr>
27
- <tr>
28
- <th scope="row"><?php esc_html_e('Response', 'wp-whatsapp-chat'); ?></th>
29
- <td>
30
- <input type="text" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[chat][response]'); ?>" placeholder="<?php echo esc_html($this->defaults['chat']['response']); ?>" value="<?php echo esc_attr($qlwapp['chat']['response']); ?>" class="qlwapp-input"/>
31
- <p class="description"><?php esc_html_e('Write a response text.', 'wp-whatsapp-chat'); ?></p>
32
- </td>
33
- </tr>
34
- <tr>
35
- <th scope="row">
36
- <?php esc_html_e('Contacts', 'wp-whatsapp-chat'); ?>
37
- </th>
38
- <td>
39
- <table id="qlwapp-contact-form" class="form-table widefat hidden" data-editindex="-1">
40
- <?php $this->contact_table(); ?>
41
- <tfoot>
42
- <tr>
43
- <td colspan="2">
44
- <?php submit_button(esc_html__('Save Contact', 'wp-whatsapp-chat'), 'primary', null, false, array('id' => 'btn-save-contact')); ?>
45
- <span class="spinner"></span>
46
- </td>
47
- </tr>
48
- <tfoot>
49
- </table>
50
- <div class="submit qlwapp-premium-field">
51
- <?php submit_button(esc_html__('Add Contact', 'wp-whatsapp-chat'), 'secondary', null, false, array('id' => 'btn-add-contact')); ?>
52
- <p class="description"><small><?php esc_html_e('This is a premium feature', 'wp-whatsapp-chat'); ?></small></p>
53
- </div>
54
- <table id="qlwapp-contacts-table" class="form-table widefat striped">
55
- <thead>
56
- <tr>
57
- <td><b><?php esc_html_e('Avatar', 'wp-whatsapp-chat'); ?></b></td>
58
- <td><b><?php esc_html_e('Phone', 'wp-whatsapp-chat'); ?></b></td>
59
- <td><b><?php esc_html_e('Name', 'wp-whatsapp-chat'); ?></b></td>
60
- <td><b><?php esc_html_e('Label', 'wp-whatsapp-chat'); ?></b></td>
61
- <td><b><?php esc_html_e('Message', 'wp-whatsapp-chat'); ?></b></td>
62
- <td><b><?php esc_html_e('Chat', 'wp-whatsapp-chat'); ?></b></td>
63
- <td><b><?php esc_html_e('Actions', 'wp-whatsapp-chat'); ?></b></td>
64
- </tr>
65
- </thead>
66
- <tbody>
67
- </tbody>
68
- </table>
69
- </td>
70
- </tr>
71
- </tbody>
72
- </table>
73
- <?php submit_button() ?>
74
- </form>
75
- <script>
76
- (function($) {
77
- let qlwapp_contacts = <?php echo json_encode($qlwapp['contacts']) ?>;
78
- let tableBody = document.querySelector('#qlwapp-contacts-table tbody');
79
- $(document).on('click', '#btn-edit-contact', function() {
80
- esc_html_edit_contact(this.dataset.cid);
81
- return false;
82
- });
83
- $('#btn-save-contact').click(function(e) {
84
- e.preventDefault();
85
- let contact = {
86
-
87
- firstname: $('#qlwapp-contact-form #cfirstname').val(),
88
- lastname: $('#qlwapp-contact-form #clastname').val(),
89
- phone: $('#qlwapp-contact-form #cphone').val(),
90
- label: $('#qlwapp-contact-form #clabel').val(),
91
- message: $('#qlwapp-contact-form #cmessage').val(),
92
- chat: $('#qlwapp-contact-form .cchat:checked').val(),
93
- avatar: $('#qlwapp-contact-form #cavatar').val()
94
- }
95
-
96
- let index = document.querySelector('#qlwapp-contact-form').dataset.editindex;
97
- if (index != '-1') {
98
- qlwapp_contacts[parseInt(index)] = contact;
99
- } else {
100
- qlwapp_contacts.push(contact);
101
- }
102
- qlwapp_show_contacts();
103
- $('#qlwapp-contact-form').slideToggle();
104
- return false;
105
- });
106
- $(document).on('click', '#btn-delete-contact', function () {
107
- let index = this.dataset.cid;
108
- if (!qlwapp_contacts[index])
109
- return false;
110
- qlwapp_contacts.splice(index, 1);
111
- qlwapp_show_contacts();
112
- return false;
113
- });
114
- function qlwapp_show_contacts() {
115
- tableBody.innerHTML = '';
116
- let i = 0;
117
- for (let contact of qlwapp_contacts) {
118
- let tr = document.createElement('tr');
119
- tr.dataset.cid = i;
120
- let td1 = document.createElement('td');
121
- let td2 = document.createElement('td');
122
- let td3 = document.createElement('td');
123
- let td4 = document.createElement('td');
124
- let td5 = document.createElement('td');
125
- let td6 = document.createElement('td');
126
- let tda = document.createElement('td');
127
- let avatar = contact.avatar ? contact.avatar : 'https://www.gravatar.com/avatar/00000000000000000000000000000000';
128
- //td0.innerHTML = (i + 1);
129
- tda.innerHTML = '<img class="qlwapp-avatar" src="' + avatar + '" alt="" width="100" height="100" />' +
130
- '<input type="hidden" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts]'); ?>[' + i + '][avatar]" value="' + avatar + '" />';
131
- td1.innerHTML = contact.phone +
132
- '<input type="hidden" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts]'); ?>[' + i + '][phone]" value="' + contact.phone + '" />';
133
- td2.innerHTML = contact.firstname + ' ' + contact.lastname +
134
- '<input type="hidden" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts]'); ?>[' + i + '][firstname]" value="' + contact.firstname + '" />' +
135
- '<input type="hidden" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts]'); ?>[' + i + '][lastname]" value="' + contact.lastname + '" />';
136
- td3.innerHTML = contact.label +
137
- '<input type="hidden" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts]'); ?>[' + i + '][label]" value="' + contact.label + '" />';
138
- td4.innerHTML = contact.message +
139
- '<input type="hidden" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts]'); ?>[' + i + '][message]" value="' + contact.message + '" />';
140
- td5.innerHTML = (Number(contact.chat) ? 'Enabled' : 'Disabled') +
141
- '<input type="hidden" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts]'); ?>[' + i + '][chat]" value="' + Number(contact.chat) + '" />';
142
- td6.innerHTML = '<a href="javascript:;" id="btn-delete-contact" data-cid="' + i + '">Remove</a> | ' +
143
- '<a href="javascript:;" id="btn-edit-contact" data-cid="' + i + '">Edit</a>';
144
- //tr.appendChild(td0);
145
- tr.appendChild(tda);
146
- tr.appendChild(td1);
147
- tr.appendChild(td2);
148
- tr.appendChild(td3);
149
- tr.appendChild(td4);
150
- tr.appendChild(td5);
151
- tr.appendChild(td6);
152
- tableBody.appendChild(tr);
153
- i++;
154
- }
155
- }
156
-
157
- function esc_html_edit_contact(index) {
158
- let contact = qlwapp_contacts[index] || null;
159
- if (!contact)
160
- return false;
161
- document.querySelector('#qlwapp-contact-form').dataset.editindex = index;
162
- $('#qlwapp-contact-form #cfirstname').val(contact.firstname);
163
- $('#qlwapp-contact-form #clastname').val(contact.lastname);
164
- $('#qlwapp-contact-form #cphone').val(contact.phone);
165
- $('#qlwapp-contact-form #clabel').val(contact.label);
166
- $('#qlwapp-contact-form .cchat[value="1"]').attr('checked', contact.chat);
167
- $('#qlwapp-contact-form .cchat[value="0"]').attr('checked', !contact.chat);
168
- $('#qlwapp-contact-form #cmessage').val(contact.message);
169
- $('#qlwapp-contact-form #cavatar').val(contact.avatar);
170
- $('#qlwapp-contact-form #cavatar-img').attr('src', contact.avatar);
171
- $('#qlwapp-contact-form').slideToggle();
172
- }
173
- qlwapp_show_contacts();
174
- })(jQuery);
175
</script>
1
+ <form method="post" action="options.php">
2
+ <?php settings_fields(sanitize_key(QLWAPP_DOMAIN . '-group')); ?>
3
+ <?php do_settings_sections(sanitize_key(QLWAPP_DOMAIN . '-group')); ?>
4
+ <table class="form-table">
5
+ <tbody>
6
+ <tr>
7
+ <th scope="row"><?php esc_html_e('Disable', 'wp-whatsapp-chat'); ?></th>
8
+ <td>
9
+ <select name="<?php echo esc_attr(QLWAPP_DOMAIN); ?>[box][enable]" class="qlwapp-select2">
10
+ <option value="yes" <?php selected($qlwapp['box']['enable'], 'yes'); ?>><?php esc_html_e('Enable contact box', 'wp-whatsapp-chat'); ?></option>
11
+ <option value="no" <?php selected($qlwapp['box']['enable'], 'no'); ?>><?php esc_html_e('Disable contact box', 'wp-whatsapp-chat'); ?></option>
12
+ </select>
13
+ </td>
14
+ </tr>
15
+ <tr>
16
+ <th scope="row"><?php esc_html_e('Header', 'wp-whatsapp-chat'); ?></th>
17
+ <td>
18
+ <?php wp_editor($qlwapp['box']['header'], 'qlwapp_box_header', array('editor_height' => 200, 'textarea_name' => esc_attr(QLWAPP_DOMAIN) . '[box][header]')); ?>
19
+ </td>
20
+ </tr>
21
+ <tr>
22
+ <th scope="row"><?php esc_html_e('Footer', 'wp-whatsapp-chat'); ?></th>
23
+ <td>
24
+ <?php wp_editor($qlwapp['box']['footer'], 'qlwapp_box_footer', array('editor_height' => 200, 'textarea_name' => esc_attr(QLWAPP_DOMAIN) . '[box][footer]')); ?>
25
+ </td>
26
+ </tr>
27
+ <tr>
28
+ <th scope="row"><?php esc_html_e('Response', 'wp-whatsapp-chat'); ?></th>
29
+ <td>
30
+ <input type="text" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[chat][response]'); ?>" placeholder="<?php echo esc_html($this->defaults['chat']['response']); ?>" value="<?php echo esc_attr($qlwapp['chat']['response']); ?>" class="qlwapp-input"/>
31
+ <p class="description hidden"><?php esc_html_e('Write a response text.', 'wp-whatsapp-chat'); ?></p>
32
+ </td>
33
+ </tr>
34
+ <tr>
35
+ <th scope="row">
36
+ <?php esc_html_e('Contacts', 'wp-whatsapp-chat'); ?>
37
+ </th>
38
+ <td>
39
+ <table id="qlwapp-contact-form" class="form-table widefat hidden" data-editindex="-1">
40
+ <?php $this->contact_table(); ?>
41
+ <tfoot>
42
+ <tr>
43
+ <td colspan="2">
44
+ <?php submit_button(esc_html__('Save Contact', 'wp-whatsapp-chat'), 'primary', null, false, array('id' => 'btn-save-contact')); ?>
45
+ <span class="spinner"></span>
46
+ </td>
47
+ </tr>
48
+ <tfoot>
49
+ </table>
50
+ <div class="submit qlwapp-premium-field">
51
+ <?php submit_button(esc_html__('Add Contact', 'wp-whatsapp-chat'), 'secondary', null, false, array('id' => 'btn-add-contact')); ?>
52
+ <p class="description hidden"><small><?php esc_html_e('This is a premium feature', 'wp-whatsapp-chat'); ?></small></p>
53
+ </div>
54
+ <table id="qlwapp-contacts-table" class="form-table widefat striped">
55
+ <thead>
56
+ <tr>
57
+ <td><b><?php esc_html_e('Avatar', 'wp-whatsapp-chat'); ?></b></td>
58
+ <td><b><?php esc_html_e('Phone', 'wp-whatsapp-chat'); ?></b></td>
59
+ <td><b><?php esc_html_e('Name', 'wp-whatsapp-chat'); ?></b></td>
60
+ <td><b><?php esc_html_e('Label', 'wp-whatsapp-chat'); ?></b></td>
61
+ <td><b><?php esc_html_e('Message', 'wp-whatsapp-chat'); ?></b></td>
62
+ <td><b><?php esc_html_e('Chat', 'wp-whatsapp-chat'); ?></b></td>
63
+ <td><b><?php esc_html_e('Actions', 'wp-whatsapp-chat'); ?></b></td>
64
+ </tr>
65
+ </thead>
66
+ <tbody>
67
+ </tbody>
68
+ </table>
69
+ </td>
70
+ </tr>
71
+ </tbody>
72
+ </table>
73
+ <?php submit_button() ?>
74
+ </form>
75
+ <script>
76
+ (function($) {
77
+ let qlwapp_contacts = <?php echo json_encode($qlwapp['contacts']) ?>;
78
+ let tableBody = document.querySelector('#qlwapp-contacts-table tbody');
79
+ $(document).on('click', '#btn-edit-contact', function() {
80
+ esc_html_edit_contact(this.dataset.cid);
81
+ return false;
82
+ });
83
+
84
+
85
+ $('#btn-save-contact').click(function(e) {
86
+
87
+ e.preventDefault();
88
+ let contact = {
89
+
90
+ firstname: $('#qlwapp-contact-form #cfirstname').val(),
91
+ lastname: $('#qlwapp-contact-form #clastname').val(),
92
+ phone: $('#qlwapp-contact-form #cphone').val(),
93
+ label: $('#qlwapp-contact-form #clabel').val(),
94
+ message: $('#qlwapp-contact-form #cmessage').val(),
95
+ chat: $('#qlwapp-contact-form .cchat:checked').val(),
96
+ avatar: $('#qlwapp-contact-form #cavatar').val()
97
+ }
98
+
99
+ let index = document.querySelector('#qlwapp-contact-form').dataset.editindex;
100
+ if (index != '-1') {
101
+ qlwapp_contacts[parseInt(index)] = contact;
102
+ } else {
103
+ qlwapp_contacts.push(contact);
104
+ }
105
+ qlwapp_show_contacts();
106
+ $('#qlwapp-contact-form').slideToggle();
107
+ return false;
108
+ });
109
+ $(document).on('click', '#btn-delete-contact', function () {
110
+ let index = this.dataset.cid;
111
+ if (!qlwapp_contacts[index])
112
+ return false;
113
+ qlwapp_contacts.splice(index, 1);
114
+ qlwapp_show_contacts();
115
+ return false;
116
+ });
117
+ function qlwapp_show_contacts() {
118
+ tableBody.innerHTML = '';
119
+ let i = 0;
120
+ for (let contact of qlwapp_contacts) {
121
+ let tr = document.createElement('tr');
122
+ tr.dataset.cid = i;
123
+ let td1 = document.createElement('td');
124
+ let td2 = document.createElement('td');
125
+ let td3 = document.createElement('td');
126
+ let td4 = document.createElement('td');
127
+ let td5 = document.createElement('td');
128
+ let td6 = document.createElement('td');
129
+ let tda = document.createElement('td');
130
+ let avatar = contact.avatar ? contact.avatar : 'https://www.gravatar.com/avatar/00000000000000000000000000000000';
131
+ //td0.innerHTML = (i + 1);
132
+ tda.innerHTML = '<img class="qlwapp-avatar" src="' + avatar + '" alt="" width="100" height="100" />' +
133
+ '<input type="hidden" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts]'); ?>[' + i + '][avatar]" value="' + avatar + '" />';
134
+ td1.innerHTML = contact.phone +
135
+ '<input type="hidden" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts]'); ?>[' + i + '][phone]" value="' + contact.phone + '" />';
136
+ td2.innerHTML = contact.firstname + ' ' + contact.lastname +
137
+ '<input type="hidden" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts]'); ?>[' + i + '][firstname]" value="' + contact.firstname + '" />' +
138
+ '<input type="hidden" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts]'); ?>[' + i + '][lastname]" value="' + contact.lastname + '" />';
139
+ td3.innerHTML = contact.label +
140
+ '<input type="hidden" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts]'); ?>[' + i + '][label]" value="' + contact.label + '" />';
141
+ td4.innerHTML = contact.message +
142
+ '<input type="hidden" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts]'); ?>[' + i + '][message]" value="' + contact.message + '" />';
143
+ td5.innerHTML = (Number(contact.chat) ? 'Enabled' : 'Disabled') +
144
+ '<input type="hidden" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts]'); ?>[' + i + '][chat]" value="' + Number(contact.chat) + '" />';
145
+ td6.innerHTML = '<a href="javascript:;" id="btn-delete-contact" data-cid="' + i + '">Remove</a> | ' +
146
+ '<a href="javascript:;" id="btn-edit-contact" data-cid="' + i + '">Edit</a>';
147
+ //tr.appendChild(td0);
148
+ tr.appendChild(tda);
149
+ tr.appendChild(td1);
150
+ tr.appendChild(td2);
151
+ tr.appendChild(td3);
152
+ tr.appendChild(td4);
153
+ tr.appendChild(td5);
154
+ tr.appendChild(td6);
155
+ tableBody.appendChild(tr);
156
+ i++;
157
+ }
158
+ }
159
+
160
+ function esc_html_edit_contact(index) {
161
+ let contact = qlwapp_contacts[index] || null;
162
+ if (!contact)
163
+ return false;
164
+ document.querySelector('#qlwapp-contact-form').dataset.editindex = index;
165
+ $('#qlwapp-contact-form #cfirstname').val(contact.firstname);
166
+ $('#qlwapp-contact-form #clastname').val(contact.lastname);
167
+ $('#qlwapp-contact-form #cphone').val(contact.phone);
168
+ $('#qlwapp-contact-form #clabel').val(contact.label);
169
+ $('#qlwapp-contact-form .cchat[value="1"]').attr('checked', contact.chat);
170
+ $('#qlwapp-contact-form .cchat[value="0"]').attr('checked', !contact.chat);
171
+ $('#qlwapp-contact-form #cmessage').val(contact.message);
172
+ $('#qlwapp-contact-form #cavatar').val(contact.avatar);
173
+ $('#qlwapp-contact-form #cavatar-img').attr('src', contact.avatar);
174
+ $('#qlwapp-contact-form').slideToggle();
175
+ }
176
+ qlwapp_show_contacts();
177
+ })(jQuery);
178
</script>
includes/pages/button.php CHANGED
@@ -1,83 +1,92 @@
1
- <form method="post" action="options.php">
2
- <?php settings_fields(sanitize_key(QLWAPP_DOMAIN . '-group')); ?>
3
- <?php do_settings_sections(sanitize_key(QLWAPP_DOMAIN . '-group')); ?>
4
- <table class="form-table">
5
- <tbody>
6
- <tr>
7
- <th scope="row"><?php esc_html_e('Layout', 'wp-whatsapp-chat'); ?></th>
8
- <td>
9
- <select name="<?php echo esc_attr(QLWAPP_DOMAIN); ?>[button][layout]" class="qlwapp-select2">
10
- <option value="button" <?php selected($qlwapp['button']['layout'], 'button'); ?>><?php esc_html_e('Button', 'wp-whatsapp-chat'); ?></option>
11
- <option value="bubble" <?php selected($qlwapp['button']['layout'], 'bubble'); ?>><?php esc_html_e('Bubble', '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
- </td>
15
- </tr>
16
- <tr>
17
- <th scope="row"><?php esc_html_e('Rounded', 'wp-whatsapp-chat'); ?></th>
18
- <td>
19
- <select name="<?php echo esc_attr(QLWAPP_DOMAIN); ?>[button][rounded]" class="qlwapp-select2">
20
- <option value="yes" <?php selected($qlwapp['button']['rounded'], 'yes'); ?>><?php esc_html_e('Add rounded border', 'wp-whatsapp-chat'); ?></option>
21
- <option value="no" <?php selected($qlwapp['button']['rounded'], 'no'); ?>><?php esc_html_e('Remove rounded border', 'wp-whatsapp-chat'); ?></option>
22
- </select>
23
- <p class="description"><?php esc_html_e('Add rounded border to the button.', 'wp-whatsapp-chat'); ?></p>
24
- </td>
25
- </tr>
26
- <tr>
27
- <th scope="row"><?php esc_html_e('Position', 'wp-whatsapp-chat'); ?></th>
28
- <td>
29
- <select name="<?php echo esc_attr(QLWAPP_DOMAIN); ?>[button][position]" class="qlwapp-select2">
30
- <option value="middle-left" <?php selected($qlwapp['button']['position'], 'middle-left'); ?>><?php esc_html_e('Middle Left', 'wp-whatsapp-chat'); ?></option>
31
- <option value="middle-right" <?php selected($qlwapp['button']['position'], 'middle-right'); ?>><?php esc_html_e('Middle Right', 'wp-whatsapp-chat'); ?></option>
32
- <option value="bottom-left" <?php selected($qlwapp['button']['position'], 'bottom-left'); ?>><?php esc_html_e('Bottom Left', 'wp-whatsapp-chat'); ?></option>
33
- <option value="bottom-right" <?php selected($qlwapp['button']['position'], 'bottom-right'); ?>><?php esc_html_e('Bottom Right', 'wp-whatsapp-chat'); ?></option>
34
- </select>
35
- <p class="description"><?php esc_html_e('Switch to change the button position.', 'wp-whatsapp-chat'); ?></p>
36
- </td>
37
- </tr>
38
- <tr>
39
- <th scope="row"><?php esc_html_e('Text', 'wp-whatsapp-chat'); ?></th>
40
- <td>
41
- <input type="text" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[button][text]'); ?>" placeholder="<?php echo esc_html($this->defaults['button']['text']); ?>" value="<?php echo esc_attr($qlwapp['button']['text']); ?>" class="qlwapp-input"/>
42
- <p class="description"><?php esc_html_e('Customize your text.', 'wp-whatsapp-chat'); ?></p>
43
- </td>
44
- </tr>
45
- <tr>
46
- <th scope="row"><?php esc_html_e('Phone', 'wp-whatsapp-chat'); ?></th>
47
- <td>
48
- <input type="tel" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[button][phone]'); ?>" placeholder="<?php echo esc_html($this->defaults['button']['phone']); ?>" value="<?php echo esc_attr($qlwapp['button']['phone']); ?>" class="qlwapp-input"/>
49
- <p class="description"><?php esc_html_e('Full phone number in international format.', 'wp-whatsapp-chat'); ?></p>
50
-
51
- </td>
52
- </tr>
53
- <tr>
54
- <th scope="row"><?php esc_html_e('Icon', 'wp-whatsapp-chat'); ?></th>
55
- <td>
56
- <div class="submit qlwapp-premium-field">
57
- <?php submit_button(__('Add Icon', 'wp-whatsapp-chat'), 'secondary', null, false, array('id' => 'btn-add-icon')); ?>
58
- <p class="description"><small><?php esc_html_e('This is a premium feature', 'wp-whatsapp-chat'); ?></small></p>
59
- </div>
60
- <input type="text" name="<?php echo esc_attr(QLWAPP_DOMAIN); ?>[button][icon]" placeholder="<?php echo esc_html($this->defaults['button']['icon']); ?>" value="<?php echo esc_attr($qlwapp['button']['icon']); ?>" class="qlwapp-input"/>
61
- </td>
62
- </tr>
63
- <tr>
64
- <th scope="row"><?php esc_html_e('Message', 'wp-whatsapp-chat'); ?></th>
65
- <td>
66
- <textarea maxlength="500" style="width:100%;height: 100px;padding: 8px;" name="<?php echo esc_attr(QLWAPP_DOMAIN); ?>[user][message]" placeholder="<?php echo esc_html($this->defaults['user']['message']); ?>" ><?php echo esc_html(trim($qlwapp['user']['message'])); ?></textarea>
67
- <p class="description"><?php esc_html_e('Message that will automatically appear in the text field of a chat.', 'wp-whatsapp-chat'); ?></p>
68
- </td>
69
- </tr>
70
- <tr>
71
- <th scope="row"><?php esc_html_e('Discreet link', 'wp-whatsapp-chat'); ?></th>
72
- <td>
73
- <select name="<?php echo esc_attr(QLWAPP_DOMAIN); ?>[button][developer]" class="qlwapp-select2">
74
- <option value="yes" <?php selected($qlwapp['button']['developer'], 'yes'); ?>><?php esc_html_e('Show developer link', 'wp-whatsapp-chat'); ?></option>
75
- <option value="no" <?php selected($qlwapp['button']['developer'], 'no'); ?>><?php esc_html_e('Hide developer link', 'wp-whatsapp-chat'); ?></option>
76
- </select>
77
- <p class="description"><?php esc_html_e('Leave a discrete link to developer to help and keep new updates and support.', 'wp-whatsapp-chat'); ?></p>
78
- </td>
79
- </tr>
80
- </tbody>
81
- </table>
82
- <?php submit_button() ?>
83
</form>
1
+ <form method="post" action="options.php">
2
+ <?php settings_fields(sanitize_key(QLWAPP_DOMAIN . '-group')); ?>
3
+ <?php do_settings_sections(sanitize_key(QLWAPP_DOMAIN . '-group')); ?>
4
+ <table class="form-table">
5
+ <tbody>
6
+ <tr>
7
+ <th scope="row"><?php esc_html_e('Layout', 'wp-whatsapp-chat'); ?></th>
8
+ <td>
9
+ <select name="<?php echo esc_attr(QLWAPP_DOMAIN); ?>[button][layout]" class="qlwapp-select2">
10
+ <option value="button" <?php selected($qlwapp['button']['layout'], 'button'); ?>><?php esc_html_e('Button', 'wp-whatsapp-chat'); ?></option>
11
+ <option value="bubble" <?php selected($qlwapp['button']['layout'], 'bubble'); ?>><?php esc_html_e('Bubble', 'wp-whatsapp-chat'); ?></option>
12
+ </select>
13
+ <p class="description hidden"><?php esc_html_e('Switch to change the button layout.', 'wp-whatsapp-chat'); ?></p>
14
+ </td>
15
+ </tr>
16
+ <tr>
17
+ <th scope="row"><?php esc_html_e('Rounded', 'wp-whatsapp-chat'); ?></th>
18
+ <td>
19
+ <select name="<?php echo esc_attr(QLWAPP_DOMAIN); ?>[button][rounded]" class="qlwapp-select2">
20
+ <option value="yes" <?php selected($qlwapp['button']['rounded'], 'yes'); ?>><?php esc_html_e('Add rounded border', 'wp-whatsapp-chat'); ?></option>
21
+ <option value="no" <?php selected($qlwapp['button']['rounded'], 'no'); ?>><?php esc_html_e('Remove rounded border', 'wp-whatsapp-chat'); ?></option>
22
+ </select>
23
+ <p class="description hidden"><?php esc_html_e('Add rounded border to the button.', 'wp-whatsapp-chat'); ?></p>
24
+ </td>
25
+ </tr>
26
+ <tr>
27
+ <th scope="row"><?php esc_html_e('Position', 'wp-whatsapp-chat'); ?></th>
28
+ <td>
29
+ <select name="<?php echo esc_attr(QLWAPP_DOMAIN); ?>[button][position]" class="qlwapp-select2">
30
+ <option value="middle-left" <?php selected($qlwapp['button']['position'], 'middle-left'); ?>><?php esc_html_e('Middle Left', 'wp-whatsapp-chat'); ?></option>
31
+ <option value="middle-right" <?php selected($qlwapp['button']['position'], 'middle-right'); ?>><?php esc_html_e('Middle Right', 'wp-whatsapp-chat'); ?></option>
32
+ <option value="bottom-left" <?php selected($qlwapp['button']['position'], 'bottom-left'); ?>><?php esc_html_e('Bottom Left', 'wp-whatsapp-chat'); ?></option>
33
+ <option value="bottom-right" <?php selected($qlwapp['button']['position'], 'bottom-right'); ?>><?php esc_html_e('Bottom Right', 'wp-whatsapp-chat'); ?></option>
34
+ </select>
35
+ <p class="description hidden"><?php esc_html_e('Switch to change the button position.', 'wp-whatsapp-chat'); ?></p>
36
+ </td>
37
+ </tr>
38
+ <tr>
39
+ <th scope="row"><?php esc_html_e('Icon', 'wp-whatsapp-chat'); ?></th>
40
+ <td>
41
+ <div class="submit qlwapp-premium-field">
42
+ <?php submit_button(__('Add Icon', 'wp-whatsapp-chat'), 'secondary', null, false, array('id' => 'btn-add-icon')); ?>
43
+ <p class="description hidden"><small><?php esc_html_e('This is a premium feature', 'wp-whatsapp-chat'); ?></small></p>
44
+ </div>
45
+ <input type="text" name="<?php echo esc_attr(QLWAPP_DOMAIN); ?>[button][icon]" placeholder="<?php echo esc_html($this->defaults['button']['icon']); ?>" value="<?php echo esc_attr($qlwapp['button']['icon']); ?>" class="qlwapp-input"/>
46
+ </td>
47
+ </tr>
48
+ <tr>
49
+ <th scope="row"><?php esc_html_e('Discreet link', 'wp-whatsapp-chat'); ?></th>
50
+ <td>
51
+ <select name="<?php echo esc_attr(QLWAPP_DOMAIN); ?>[button][developer]" class="qlwapp-select2">
52
+ <option value="yes" <?php selected($qlwapp['button']['developer'], 'yes'); ?>><?php esc_html_e('Show developer link', 'wp-whatsapp-chat'); ?></option>
53
+ <option value="no" <?php selected($qlwapp['button']['developer'], 'no'); ?>><?php esc_html_e('Hide developer link', 'wp-whatsapp-chat'); ?></option>
54
+ </select>
55
+ <p class="description hidden"><?php esc_html_e('Leave a discrete link to developer to help and keep new updates and support.', 'wp-whatsapp-chat'); ?></p>
56
+ </td>
57
+ </tr>
58
+ <tr>
59
+ <th scope="row"><?php esc_html_e('Text', 'wp-whatsapp-chat'); ?></th>
60
+ <td>
61
+ <input type="text" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[button][text]'); ?>" placeholder="<?php echo esc_html($this->defaults['button']['text']); ?>" value="<?php echo esc_attr($qlwapp['button']['text']); ?>" class="qlwapp-input"/>
62
+ <p class="description hidden"><?php esc_html_e('Customize your text.', 'wp-whatsapp-chat'); ?></p>
63
+ </td>
64
+ </tr>
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($this->defaults['button']['phone']); ?>" value="<?php echo esc_attr($qlwapp['button']['phone']); ?>" class="qlwapp-input" pattern="[\+]\d[0-9]{6,15}quot;/>
69
+ <p class="description hidden"><?php esc_html_e('Full phone number in international format.', 'wp-whatsapp-chat'); ?></p>
70
+
71
+ </td>
72
+ </tr>
73
+ <!--<tr>
74
+ <th scope="row"><?php esc_html_e('Schedule', 'wp-whatsapp-chat'); ?></th>
75
+ <td>
76
+ <b><?php esc_html_e('From', 'wp-whatsapp-chat'); ?></b>
77
+ <input type="time" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[button][timefrom]'); ?>" placeholder="<?php echo esc_html($this->defaults['button']['timefrom']); ?>" value="<?php echo esc_html($qlwapp['button']['timefrom']); ?>" />
78
+ <b><?php esc_html_e('To', 'wp-whatsapp-chat'); ?></b>
79
+ <input type="time" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[button][timeto]'); ?>" placeholder="<?php echo esc_html($this->defaults['button']['timeto']); ?>" value="<?php echo esc_html($qlwapp['button']['timeto']); ?>" />
80
+ </td>
81
+ </tr>-->
82
+ <tr>
83
+ <th scope="row"><?php esc_html_e('Message', 'wp-whatsapp-chat'); ?></th>
84
+ <td>
85
+ <textarea maxlength="500" style="width:100%;height: 100px;padding: 8px;" name="<?php echo esc_attr(QLWAPP_DOMAIN); ?>[user][message]" placeholder="<?php echo esc_html($this->defaults['user']['message']); ?>" ><?php echo esc_html(trim($qlwapp['user']['message'])); ?></textarea>
86
+ <p class="description hidden"><?php esc_html_e('Message that will automatically appear in the text field of a chat.', 'wp-whatsapp-chat'); ?></p>
87
+ </td>
88
+ </tr>
89
+ </tbody>
90
+ </table>
91
+ <?php submit_button() ?>
92
</form>
includes/pages/colors.php CHANGED
@@ -19,28 +19,28 @@
19
<th scope="row"><?php esc_html_e('Link', 'wp-whatsapp-chat'); ?></th>
20
<td>
21
<input class="qlwapp-color-field" type="link" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[scheme][link]'); ?>" value="<?php echo esc_attr($qlwapp['scheme']['link']); ?>" />
22
- <p class="description"><small><?php esc_html_e('This is a premium feature', 'wp-whatsapp-chat'); ?></small></p>
23
</td>
24
</tr>
25
<tr class="qlwapp-premium-field">
26
<th scope="row"><?php esc_html_e('Message', 'wp-whatsapp-chat'); ?></th>
27
<td>
28
<input class="qlwapp-color-field" type="link" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[scheme][message]'); ?>" value="<?php echo esc_attr($qlwapp['scheme']['message']); ?>" />
29
- <p class="description"><small><?php esc_html_e('This is a premium feature', 'wp-whatsapp-chat'); ?></small></p>
30
</td>
31
</tr>
32
<tr class="qlwapp-premium-field">
33
<th scope="row"><?php esc_html_e('Label', 'wp-whatsapp-chat'); ?></th>
34
<td>
35
<input class="qlwapp-color-field" type="link" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[scheme][label]'); ?>" value="<?php echo esc_attr($qlwapp['scheme']['label']); ?>" />
36
- <p class="description"><small><?php esc_html_e('This is a premium feature', 'wp-whatsapp-chat'); ?></small></p>
37
</td>
38
</tr>
39
<tr class="qlwapp-premium-field">
40
<th scope="row"><?php esc_html_e('Name', 'wp-whatsapp-chat'); ?></th>
41
<td>
42
<input class="qlwapp-color-field" type="link" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[scheme][name]'); ?>" value="<?php echo esc_attr($qlwapp['scheme']['name']); ?>" />
43
- <p class="description"><small><?php esc_html_e('This is a premium feature', 'wp-whatsapp-chat'); ?></small></p>
44
</td>
45
</tr>
46
</tbody>
19
<th scope="row"><?php esc_html_e('Link', 'wp-whatsapp-chat'); ?></th>
20
<td>
21
<input class="qlwapp-color-field" type="link" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[scheme][link]'); ?>" value="<?php echo esc_attr($qlwapp['scheme']['link']); ?>" />
22
+ <p class="description hidden"><small><?php esc_html_e('This is a premium feature', 'wp-whatsapp-chat'); ?></small></p>
23
</td>
24
</tr>
25
<tr class="qlwapp-premium-field">
26
<th scope="row"><?php esc_html_e('Message', 'wp-whatsapp-chat'); ?></th>
27
<td>
28
<input class="qlwapp-color-field" type="link" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[scheme][message]'); ?>" value="<?php echo esc_attr($qlwapp['scheme']['message']); ?>" />
29
+ <p class="description hidden"><small><?php esc_html_e('This is a premium feature', 'wp-whatsapp-chat'); ?></small></p>
30
</td>
31
</tr>
32
<tr class="qlwapp-premium-field">
33
<th scope="row"><?php esc_html_e('Label', 'wp-whatsapp-chat'); ?></th>
34
<td>
35
<input class="qlwapp-color-field" type="link" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[scheme][label]'); ?>" value="<?php echo esc_attr($qlwapp['scheme']['label']); ?>" />
36
+ <p class="description hidden"><small><?php esc_html_e('This is a premium feature', 'wp-whatsapp-chat'); ?></small></p>
37
</td>
38
</tr>
39
<tr class="qlwapp-premium-field">
40
<th scope="row"><?php esc_html_e('Name', 'wp-whatsapp-chat'); ?></th>
41
<td>
42
<input class="qlwapp-color-field" type="link" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[scheme][name]'); ?>" value="<?php echo esc_attr($qlwapp['scheme']['name']); ?>" />
43
+ <p class="description hidden"><small><?php esc_html_e('This is a premium feature', 'wp-whatsapp-chat'); ?></small></p>
44
</td>
45
</tr>
46
</tbody>
includes/pages/display.php CHANGED
@@ -24,7 +24,7 @@
24
<option value="search" <?php echo selected(true, in_array('search', (array) $qlwapp['display']['target'])); ?>><?php echo esc_html__('Search', 'wp-whatsapp-chat'); ?></option>
25
<option value="error" <?php echo selected(true, in_array('error', (array) $qlwapp['display']['target'])); ?>><?php echo esc_html('404'); ?></option>
26
</select>
27
- <p class="description"><?php esc_html_e('If you select an option all the other will be excluded', 'wp-whatsapp-chat'); ?></p>
28
</td>
29
</tr>
30
<?php
@@ -69,7 +69,7 @@
69
}
70
?>
71
</select>
72
- <p class="description"><small><?php esc_html_e('This is a premium feature', 'wp-whatsapp-chat'); ?></small></p>
73
</td>
74
</tr>
75
<?php
24
<option value="search" <?php echo selected(true, in_array('search', (array) $qlwapp['display']['target'])); ?>><?php echo esc_html__('Search', 'wp-whatsapp-chat'); ?></option>
25
<option value="error" <?php echo selected(true, in_array('error', (array) $qlwapp['display']['target'])); ?>><?php echo esc_html('404'); ?></option>
26
</select>
27
+ <p class="description hidden"><?php esc_html_e('If you select an option all the other will be excluded', 'wp-whatsapp-chat'); ?></p>
28
</td>
29
</tr>
30
<?php
69
}
70
?>
71
</select>
72
+ <p class="description hidden"><small><?php esc_html_e('This is a premium feature', 'wp-whatsapp-chat'); ?></small></p>
73
</td>
74
</tr>
75
<?php
includes/pages/premium.php CHANGED
@@ -3,7 +3,7 @@
3
<div class="welcome-header">
4
<h1><?php esc_html_e('Premium', 'wp-whatsapp-chat'); ?></h1>
5
<div class="about-description">
6
- <?php esc_html_e('Unlock the power of our premium WhatsApp Chat plugin wich allows you to include unlimited agent accounts with their names and labels inside the box to provide a direct contact to the different support areas of your site.', 'wp-whatsapp-chat'); ?>
7
</div>
8
<br/>
9
<a style="background-color: #006cff;color: #ffffff;text-decoration: none;padding: 10px 30px;border-radius: 30px;margin: 10px 0 0 0;display: inline-block;" target="_blank" href="<?php echo esc_url(QLWAPP_PURCHASE_URL); ?>"><?php esc_html_e('Purchase Now', 'wp-whatsapp-chat'); ?></a>
@@ -13,19 +13,19 @@
13
<div class="feature-section">
14
<h3><?php esc_html_e('Multiple agents', 'wp-whatsapp-chat'); ?></h3>
15
<p>
16
- <?php esc_html_e('WhatsApp Chat allows you to include unlimited agent accounts with their names and labels inside the box to provide a direct contact to the different support areas of your site.', 'wp-whatsapp-chat'); ?>
17
</p>
18
</div>
19
<div class="feature-section">
20
<h3><?php esc_html_e('Customize colors', 'wp-whatsapp-chat'); ?></h3>
21
<p>
22
- <?php esc_html_e('Customize the colors to match site’s theme colors through the WordPress live customizer interface.', 'wp-whatsapp-chat'); ?>
23
</p>
24
</div>
25
<div class="feature-section">
26
<h3><?php esc_html_e('Custom icons', 'wp-whatsapp-chat'); ?></h3>
27
<p>
28
- <?php esc_html_e('Our plugin allows you to select between more than fourty icons to include in your Whatsapp button.', 'wp-whatsapp-chat'); ?>
29
</p>
30
</div>
31
</div>
@@ -52,7 +52,7 @@
52
<div class="feature-section">
53
<h3><?php esc_html_e('Custom agent message', 'wp-whatsapp-chat'); ?></h3>
54
<p>
55
- <?php esc_html_e('Allow you to set a custom message for each agent that will displayed on the chatbox.', 'wp-whatsapp-chat'); ?>
56
</p>
57
</div>
58
<div class="feature-section">
@@ -64,7 +64,7 @@
64
<div class="feature-section">
65
<h3><?php esc_html_e('Type user message', 'wp-whatsapp-chat'); ?></h3>
66
<p>
67
- <?php esc_html_e('Allow your users to type their own messages before send it to the agent phone number.', 'wp-whatsapp-chat'); ?>
68
</p>
69
</div>
70
</div>
3
<div class="welcome-header">
4
<h1><?php esc_html_e('Premium', 'wp-whatsapp-chat'); ?></h1>
5
<div class="about-description">
6
+ <?php esc_html_e('Unlock the power of our premium WhatsApp Chat plugin which allows you to include unlimited agent accounts with their names and labels inside the box to provide direct contact to the different support areas of your site.', 'wp-whatsapp-chat'); ?>
7
</div>
8
<br/>
9
<a style="background-color: #006cff;color: #ffffff;text-decoration: none;padding: 10px 30px;border-radius: 30px;margin: 10px 0 0 0;display: inline-block;" target="_blank" href="<?php echo esc_url(QLWAPP_PURCHASE_URL); ?>"><?php esc_html_e('Purchase Now', 'wp-whatsapp-chat'); ?></a>
13
<div class="feature-section">
14
<h3><?php esc_html_e('Multiple agents', 'wp-whatsapp-chat'); ?></h3>
15
<p>
16
+ <?php esc_html_e('WhatsApp Chat allows you to include unlimited agent accounts with their names and labels inside the box to provide direct contact to the different support areas of your site.', 'wp-whatsapp-chat'); ?>
17
</p>
18
</div>
19
<div class="feature-section">
20
<h3><?php esc_html_e('Customize colors', 'wp-whatsapp-chat'); ?></h3>
21
<p>
22
+ <?php esc_html_e('Customize the colors to match your site theme through the WordPress live customizer interface.', 'wp-whatsapp-chat'); ?>
23
</p>
24
</div>
25
<div class="feature-section">
26
<h3><?php esc_html_e('Custom icons', 'wp-whatsapp-chat'); ?></h3>
27
<p>
28
+ <?php esc_html_e('Our plugin allows you to select between more than forty icons to include in your Whatsapp button.', 'wp-whatsapp-chat'); ?>
29
</p>
30
</div>
31
</div>
52
<div class="feature-section">
53
<h3><?php esc_html_e('Custom agent message', 'wp-whatsapp-chat'); ?></h3>
54
<p>
55
+ <?php esc_html_e('Allow you to set a custom message for each agent that will be displayed on the chatbox.', 'wp-whatsapp-chat'); ?>
56
</p>
57
</div>
58
<div class="feature-section">
64
<div class="feature-section">
65
<h3><?php esc_html_e('Type user message', 'wp-whatsapp-chat'); ?></h3>
66
<p>
67
+ <?php esc_html_e('Allow your users to type their own messages before sending it to the agent phone number.', 'wp-whatsapp-chat'); ?>
68
</p>
69
</div>
70
</div>
includes/settings.php CHANGED
@@ -1,88 +1,88 @@
1
<?php
2
if (!defined('ABSPATH'))
3
- exit;
4
5
if (!class_exists('QLWAPP_Settings')) {
6
7
- class QLWAPP_Settings extends QLWAPP_Options {
8
9
- protected static $instance;
10
11
- function ajax_dismiss_notice() {
12
13
- if ($notice_id = ( isset($_POST['notice_id']) ) ? sanitize_key($_POST['notice_id']) : '') {
14
15
- update_user_meta(get_current_user_id(), $notice_id, true);
16
17
- wp_send_json($notice_id);
18
- }
19
20
- wp_die();
21
- }
22
23
- function add_action_links($links) {
24
25
- $links[] = '<a target="_blank" href="' . QLWAPP_PURCHASE_URL . '">' . esc_html__('Premium', 'wp-whatsapp-chat') . '</a>';
26
27
- $links[] = '<a href="' . admin_url('admin.php?page=' . QLWAPP_DOMAIN) . '">' . esc_html__('Settings', 'wp-whatsapp-chat') . '</a>';
28
29
- return $links;
30
- }
31
32
- function ajax_get_posts() {
33
34
- $data = array(
35
- array('none', esc_html__('Exclude from all', 'wp-whatsapp-chat'))
36
- );
37
38
- $posts = get_posts(array(
39
- 's' => $_GET['q'],
40
- 'post_type' => $_GET['name'],
41
- 'post_status' => 'publish',
42
- 'ignore_sticky_posts' => 1,
43
- 'posts_per_page' => 10
44
- ));
45
46
- foreach ($posts as $post) {
47
- $data[] = array($post->post_name, mb_substr($post->post_title, 0, 49));
48
- }
49
50
- wp_send_json($data);
51
52
- wp_die();
53
- }
54
55
- function add_menu() {
56
- add_menu_page(QLWAPP_PLUGIN_NAME, QLWAPP_PLUGIN_NAME, 'manage_options', QLWAPP_DOMAIN, array($this, 'settings_welcome'), 'dashicons-format-chat');
57
- add_submenu_page(QLWAPP_DOMAIN, __('Welcome', 'wp-whatsapp-chat'), esc_html__('Welcome', 'wp-whatsapp-chat'), 'manage_options', QLWAPP_DOMAIN, array($this, 'settings_welcome'));
58
- add_submenu_page(QLWAPP_DOMAIN, __('Button', 'wp-whatsapp-chat'), esc_html__('Button', 'wp-whatsapp-chat'), 'edit_posts', QLWAPP_DOMAIN . '_button', array($this, 'settings_button'));
59
- add_submenu_page(QLWAPP_DOMAIN, __('Box', 'wp-whatsapp-chat'), esc_html__('Box', 'wp-whatsapp-chat'), 'edit_posts', QLWAPP_DOMAIN . '_box', array($this, 'settings_box'));
60
- add_submenu_page(QLWAPP_DOMAIN, __('Display', 'wp-whatsapp-chat'), esc_html__('Display', 'wp-whatsapp-chat'), 'edit_posts', QLWAPP_DOMAIN . '_display', array($this, 'settings_display'));
61
- add_submenu_page(QLWAPP_DOMAIN, __('Colors', 'wp-whatsapp-chat'), esc_html__('Colors', 'wp-whatsapp-chat'), 'edit_posts', QLWAPP_DOMAIN . '_colors', array($this, 'settings_colors'));
62
- add_submenu_page(QLWAPP_DOMAIN, __('Premium', 'wp-whatsapp-chat'), sprintf('<i class="dashicons dashicons-awards"></i> %s', __('Premium', 'wp-whatsapp-chat')), 'edit_posts', QLWAPP_DOMAIN . '_premium', array($this, 'settings_premium'));
63
- }
64
65
- function settings_header() {
66
67
- global $submenu;
68
69
- if (isset($submenu[QLWAPP_DOMAIN])) {
70
- $welcome_menu_items = $submenu[QLWAPP_DOMAIN];
71
- }
72
73
- if (is_array($welcome_menu_items)) {
74
- ?>
75
- <div class="wrap about-wrap full-width-layout qlwrap">
76
77
- <h1><?php esc_html_e('WhatsApp Chat', 'wp-whatsapp-chat'); ?></h1>
78
79
- <p class="about-text"><?php esc_html_e('Thanks for using WhatsApp Chat! We will do our best to offer you the best and improved communication experience with your users.', 'wp-whatsapp-chat'); ?></p>
80
81
- <p class="about-text">
82
- <?php printf('<a href="%s" target="_blank">%s</a>', QLWAPP_DEMO_URL, esc_html__('Check out our demo', 'wp-whatsapp-chat')); ?></a>
83
- </p>
84
85
- <?php printf('<a href="%s" target="_blank"><div style="
86
background: #006bff url(%s) no-repeat;
87
background-position: top center;
88
background-size: 130px 130px;
@@ -100,374 +100,378 @@ if (!class_exists('QLWAPP_Settings')) {
100
right: 0;
101
" class="ql-badge">%s</div></a>', 'https://quadlayers.com/?utm_source=qlwapp_admin', plugins_url('/assets/img/quadlayers.jpg', QLWAPP_PLUGIN_FILE), esc_html__('QuadLayers', 'wp-whatsapp-chat')); ?>
102
103
- </div>
104
- <div class="wrap about-wrap full-width-layout qlwrap">
105
- <h2 class="nav-tab-wrapper">
106
- <?php
107
- foreach ($welcome_menu_items as $welcome_menu_item) {
108
- if (strpos($welcome_menu_item[2], '.php') !== false)
109
- continue;
110
- ?>
111
- <a href="<?php echo admin_url('admin.php?page=' . esc_attr($welcome_menu_item[2])); ?>" class="nav-tab<?php echo (isset($_GET['page']) && $_GET['page'] == $welcome_menu_item[2]) ? ' nav-tab-active' : ''; ?>"><?php echo $welcome_menu_item[0]; ?></a>
112
- <?php
113
}
114
- ?>
115
- </h2>
116
- </div>
117
- <?php
118
- }
119
- }
120
-
121
- function settings_sanitize($settings) {
122
-
123
- if (isset($settings['button']['layout'])) {
124
- $settings['button']['layout'] = sanitize_html_class($settings['button']['layout']);
125
- }
126
- if (isset($settings['button']['position'])) {
127
- $settings['button']['position'] = sanitize_html_class($settings['button']['position']);
128
- }
129
- if (isset($settings['button']['text'])) {
130
- $settings['button']['text'] = sanitize_text_field($settings['button']['text']);
131
- }
132
- if (isset($settings['button']['icon'])) {
133
- $settings['button']['icon'] = sanitize_html_class($settings['button']['icon']);
134
- }
135
- if (isset($settings['box']['header'])) {
136
- $settings['box']['header'] = wp_kses_post($settings['box']['header']);
137
- }
138
- if (isset($settings['box']['footer'])) {
139
- $settings['box']['footer'] = wp_kses_post($settings['box']['footer']);
140
- }
141
- if (isset($settings['contacts'])) {
142
- if (count($settings['contacts'])) {
143
- foreach ($settings['contacts'] as $id => $c) {
144
- $settings['contacts'][$id]['chat'] = (bool) $settings['contacts'][$id]['chat'];
145
- $settings['contacts'][$id]['avatar'] = sanitize_text_field($settings['contacts'][$id]['avatar']);
146
- $settings['contacts'][$id]['phone'] = sanitize_text_field($settings['contacts'][$id]['phone']);
147
- $settings['contacts'][$id]['firstname'] = sanitize_text_field($settings['contacts'][$id]['firstname']);
148
- $settings['contacts'][$id]['lastname'] = sanitize_text_field($settings['contacts'][$id]['lastname']);
149
- $settings['contacts'][$id]['label'] = sanitize_text_field($settings['contacts'][$id]['label']);
150
- $settings['contacts'][$id]['message'] = wp_kses_post($settings['contacts'][$id]['message']);
151
- //$settings['contacts'][$id]['message'] = stripslashes($settings['contacts'][$id]['message']);
152
- }
153
}
154
- }
155
156
- return $settings;
157
- }
158
159
- function add_settings_register() {
160
- register_setting(sanitize_key(QLWAPP_DOMAIN . '-group'), sanitize_key(QLWAPP_DOMAIN), array($this, 'settings_sanitize'));
161
- }
162
163
- function settings_welcome() {
164
165
- global $qlwapp;
166
- ?>
167
- <?php $this->settings_header(); ?>
168
- <div class="wrap about-wrap full-width-layout qlwrap">
169
- <?php include_once('pages/welcome.php'); ?>
170
- </div>
171
- <?php
172
- }
173
174
- function settings_button() {
175
176
- global $qlwapp;
177
- ?>
178
- <?php $this->settings_header(); ?>
179
- <div class="wrap about-wrap full-width-layout qlwrap">
180
- <?php include_once('pages/button.php'); ?>
181
- </div>
182
- <?php
183
- }
184
185
- function settings_box() {
186
187
- global $qlwapp;
188
- ?>
189
- <?php $this->settings_header(); ?>
190
- <div class="wrap about-wrap full-width-layout qlwrap">
191
- <?php include_once('pages/box.php'); ?>
192
- </div>
193
- <?php
194
- }
195
196
- function settings_display() {
197
198
- global $qlwapp;
199
- ?>
200
- <?php $this->settings_header(); ?>
201
- <div class="wrap about-wrap full-width-layout qlwrap">
202
- <?php include_once('pages/display.php'); ?>
203
- </div>
204
- <?php
205
- }
206
207
- function settings_colors() {
208
209
- global $qlwapp;
210
- ?>
211
- <?php $this->settings_header(); ?>
212
- <div class="wrap about-wrap full-width-layout qlwrap">
213
- <?php include_once('pages/colors.php'); ?>
214
- </div>
215
- <?php
216
- }
217
218
- function settings_premium() {
219
220
- global $qlwapp;
221
- ?>
222
- <?php $this->settings_header(); ?>
223
- <div class="wrap about-wrap full-width-layout qlwrap">
224
- <?php include_once('pages/premium.php'); ?>
225
- </div>
226
- <?php
227
- }
228
229
- function settings_contacts() {
230
- ?>
231
- <table class="form-table widefat" id="qlwapp-contact-form" data-editindex="-1">
232
- <?php $this->contact_table(); ?>
233
- </table>
234
- <?php
235
- }
236
237
- function contact_table($id = 0) {
238
- global $qlwapp;
239
- ?>
240
- <tr>
241
- <td>
242
- <div class="upload">
243
- <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']); ?>" />
244
- <div>
245
- <input type="hidden" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts][' . $id . '][avatar]'); ?>" id="cavatar" value="<?php echo esc_url($qlwapp['contacts'][$id]['avatar']); ?>" />
246
- <button type="button" class="upload_image_button button"><?php esc_html_e('Upload', 'wp-whatsapp-chat'); ?></button>
247
- <button type="button" class="remove_image_button button">&times;</button>
248
</div>
249
- </div>
250
- </td>
251
- <td>
252
- <table>
253
<tr>
254
- <td><b><?php esc_html_e('Firstname', 'wp-whatsapp-chat'); ?></b></td>
255
- <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>
256
- <td><b><?php esc_html_e('Lastname', 'wp-whatsapp-chat'); ?></b></td>
257
- <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>
258
</tr>
259
- <tr>
260
- <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']); ?>" /></td>
261
- <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>
262
</tr>
263
- </table>
264
- </td>
265
- </tr>
266
- <tr class="qlwapp-premium-field">
267
- <td><b><?php esc_html_e('Chat', 'wp-whatsapp-chat'); ?></b></td>
268
- <td>
269
- <p>
270
- <label><input type="radio" class="cchat" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts][' . $id . '][chat]'); ?>" value="1" <?php echo checked(true, (bool) $qlwapp['contacts'][$id]['chat']); ?>/><?php esc_html_e('Enabled', 'wp-whatsapp-chat'); ?></label>
271
- <label><input type="radio" class="cchat" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts][' . $id . '][chat]'); ?>" value="0" <?php echo checked(false, (bool) $qlwapp['contacts'][$id]['chat']); ?>/><?php esc_html_e('Disabled', 'wp-whatsapp-chat'); ?></label>
272
- </p>
273
- </td>
274
- </tr>
275
- <tr class="qlwapp-premium-field">
276
- <td colspan="2"><b><?php esc_html_e('Message', 'wp-whatsapp-chat'); ?></b></td>
277
- </tr>
278
- <tr class="qlwapp-premium-field">
279
- <td colspan="2"><?php wp_editor($qlwapp['contacts'][$id]['message'], 'cmessage', array('tinymce' => false, 'editor_height' => 150, 'textarea_name' => esc_attr(QLWAPP_DOMAIN . '[contacts][' . $id . '][message]'))); ?></td>
280
- </tr>
281
- <?php
282
- }
283
284
- function add_print_media_templates() {
285
- ?>
286
- <script type="text/html" id='tmpl-qlwapp-modal-backdrop'>
287
- <div class="media-modal-backdrop">&nbsp;</div>
288
- </script>
289
- <script type="text/html" id='tmpl-qlwapp-modal-window'>
290
- <div id="qlwapp_modal" class="media-modal wp-core-ui">
291
- <button type="button" class="media-modal-close close">
292
- <span class="media-modal-icon">
293
- <span class="screen-reader-text"><?php esc_html_e('Close media panel'); ?></span>
294
- </span>
295
- </button>
296
- <div class="media-frame mode-select wp-core-ui hide-menu">
297
- <div class="media-frame-title">
298
- <h1><?php esc_html_e('WhatsApp Chat', 'wp-whatsapp-chat'); ?><span class="dashicons dashicons-arrow-down"></span></h1>
299
- </div>
300
- <div class="media-frame-router">
301
- <div class="media-router">
302
- <a href="#" class="media-menu-item active"><?php esc_html_e('Select icon', 'wp-whatsapp-chat'); ?></a>
303
- </div>
304
- </div>
305
- <div class="media-modal-content">
306
- <div class="media-frame mode-select wp-core-ui">
307
- <div class="media-frame-menu">
308
- <div class="media-menu">
309
- <a href="#" class="media-menu-item active"><?php esc_html_e('Featured Image'); ?></a>
310
- </div>
311
- </div>
312
- <div class="media-frame-content" data-columns="10">
313
- <div class="attachments-browser">
314
- <input type="hidden" id="qlwapp_icon" value="{{ data.icon }}">
315
- <ul tabindex="-1" class="attachments">
316
- <?php foreach (explode(',', 'qlwf-chat,qlwf-chat1,qlwf-chat2,qlwf-comments,qlwf-chat3,qlwf-bubble1,qlwf-chat-alt-fill,qlwf-chat-alt-stroke,qlwf-comment-alt2-fill,qlwf-comment-alt2-stroke,qlwf-comment-fill,qlwf-comment-stroke,qlwf-comment,qlwf-comment-alt1-stroke,qlwf-chat4,qlwf-comments1,qlwf-chat5,qlwf-comment1,qlwf-bubble,qlwf-bubbles,qlwf-bubbles2,qlwf-bubble2,qlwf-bubbles3,qlwf-bubbles4,qlwf-whatsapp,qlwf-chat6,qlwf-mode_comment,qlwf-insert_comment,qlwf-chat_bubble_outline,qlwf-chat_bubble,qlwf-bubble_chart,qlwf-comment2,qlwf-chat7,qlwf-commenting-o,qlwf-commenting,qlwf-comments-o,qlwf-comment-o,qlwf-wechat,qlwf-comments2,qlwf-comment3,qlwf-chat8,qlwf-chat-bubble-dots,qlwf-bubbles1,qlwf-bubble3') as $id => $icon) : ?>
317
- <li tabindex="0" role="checkbox" aria-label="<?php echo esc_attr($icon); ?>" aria-checked="false" data-id="<?php echo esc_attr($id); ?>" class="attachment save-ready icon _<?php echo esc_attr(str_replace(' ', '_', trim($icon))); ?>">
318
- <div class="attachment-preview js--select-attachment type-image subtype-jpeg landscape">
319
- <div class="thumbnail">
320
- <i class="<?php echo esc_attr($icon); ?>"></i>
321
</div>
322
- </div>
323
- <button type="button" class="check" tabindex="-1">
324
- <span class="media-modal-icon"></span>
325
- <span class="screen-reader-text"><?php esc_html_e('Deselect'); ?></span>
326
- </button>
327
- </li>
328
- <?php endforeach; ?>
329
- </ul>
330
- </div>
331
- </div>
332
- <div class="media-frame-toolbar">
333
- <div class="media-toolbar">
334
- <div class="media-toolbar-secondary"></div>
335
- <div class="media-toolbar-primary search-form">
336
- <button type="button" class="button media-button button-large button-primary media-button-select save"><?php esc_html_e('Save'); ?></button>
337
- <button type="button" class="button media-button button-large button-secondary remove"><?php esc_html_e('Remove'); ?></button>
338
</div>
339
- </div>
340
</div>
341
- </div>
342
- </div>
343
- </div>
344
- </div>
345
- </script>
346
- <?php
347
- }
348
-
349
- function filter_pre_update_option($value, $old_value, $option) {
350
351
- global $qlwapp;
352
353
- if (isset($value['display'])) {
354
- unset($qlwapp['display']);
355
- }
356
357
- if (isset($value['contacts'])) {
358
- unset($qlwapp['contacts']);
359
- }
360
361
- return $this->wp_parse_args($value, $qlwapp);
362
- }
363
364
- function add_notices() {
365
366
- if (!get_transient('qlwapp-first-rating') && !get_user_meta(get_current_user_id(), 'qlwapp-user-rating', true)) {
367
- ?>
368
- <div id="qlwapp-admin-rating" class="qlwapp-notice notice is-dismissible" data-notice_id="qlwapp-user-rating">
369
- <div class="notice-container" style="padding-top: 10px; padding-bottom: 10px; display: flex; justify-content: left; align-items: center;">
370
- <div class="notice-image">
371
- <img style="border-radius:50%;max-width: 90px;" src="<?php echo plugins_url('/assets/img/logo.jpg', QLWAPP_PLUGIN_FILE); ?>" alt="<?php echo esc_html(QLWAPP_PLUGIN_NAME); ?>>">
372
- </div>
373
- <div class="notice-content" style="margin-left: 15px;">
374
- <p>
375
- <?php printf(esc_html__('Hello! Thank you for choosing the %s plugin!', 'wp-whatsapp-chat'), QLWAPP_PLUGIN_NAME); ?>
376
- <br/>
377
- <?php esc_html_e('Could you please give it a 5-star rating on WordPress? We know its a big favor, but we\'ve worked very much and very hard to release this great product. Your feedback will boost our motivation and help us promote and continue to improve this product.', 'wp-whatsapp-chat'); ?>
378
- </p>
379
- <a href="<?php echo esc_url(QLWAPP_REVIEW_URL); ?>" class="button-primary" target="_blank">
380
- <?php esc_html_e('Yes, of course!', 'wp-whatsapp-chat'); ?>
381
- </a>
382
- <a href="<?php echo esc_url(QLWAPP_SUPPORT_URL); ?>" class="button-secondary" target="_blank">
383
- <?php esc_html_e('Report a bug', 'wp-whatsapp-chat'); ?>
384
- </a>
385
- </div>
386
- </div>
387
- </div>
388
- <script>
389
- (function ($) {
390
- $('.qlwapp-notice').on('click', '.notice-dismiss', function (e) {
391
- e.preventDefault();
392
- var notice_id = $(e.delegateTarget).data('notice_id');
393
- $.ajax({
394
- type: 'POST',
395
- url: ajaxurl,
396
- data: {
397
- notice_id: notice_id,
398
- action: 'qlwapp_dismiss_notice',
399
- },
400
- success: function (response) {
401
- console.log(response);
402
- },
403
- });
404
- });
405
- })(jQuery);
406
- </script>
407
- <?php
408
- }
409
- }
410
411
- function add_css() {
412
- ?>
413
- <style>
414
- @font-face {
415
- font-family: 'qlwf-whatsapp';
416
- src: url(data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAAAYEAAsAAAAABbgAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABPUy8yAAABCAAAAGAAAABgDxIFKmNtYXAAAAFoAAAAVAAAAFQXVtKHZ2FzcAAAAbwAAAAIAAAACAAAABBnbHlmAAABxAAAAfwAAAH8pb7IGGhlYWQAAAPAAAAANgAAADYUXm9HaGhlYQAAA/gAAAAkAAAAJAfAA8ZobXR4AAAEHAAAABQAAAAUCgAAA2xvY2EAAAQwAAAADAAAAAwAKAESbWF4cAAABDwAAAAgAAAAIAAJAJluYW1lAAAEXAAAAYYAAAGGmUoJ+3Bvc3QAAAXkAAAAIAAAACAAAwAAAAMDAAGQAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAA6QADwP/AAEADwABAAAAAAQAAAAAAAAAAAAAAIAAAAAAAAwAAAAMAAAAcAAEAAwAAABwAAwABAAAAHAAEADgAAAAKAAgAAgACAAEAIOkA//3//wAAAAAAIOkA//3//wAB/+MXBAADAAEAAAAAAAAAAAAAAAEAAf//AA8AAQAAAAAAAAAAAAIAADc5AQAAAAABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAAAwAD/8AD/gPAACcATwCWAAABJicuAScmIyIHDgEHBhUUFhcDJR4BMzE4ATEyNz4BNzY1NCcuAScmATEiJi8BBzcnLgE1NDc+ATc2MzIXHgEXFhcWFx4BFxYVFAcOAQcGIxMuAScmIgcOAQcOAScuAScuAScmNjc+ATc+ATc2JicuAScuASMmIiMiBgcOARUUFhcWFx4BFxYXHgEXHgE3PgE3PgEnLgEnA2kkKSpbMTEzaVxdiSgoIiJIAQ03e0BpXF2KKCgKCiYbHP51OW0xD6ArCiAhIiFyTU1XKygpTCIjHh0XFyAICCEick1NV+cJRAkJDQcGHAYGDAkKOCQdJAYGBwUECgUEBQMDAQMCHQgHEAUGDAcGEwgJJC8FAhEQOCcnMBYkDhcoERI7CAgCAgMMCgMrJBwcJQoKKCiKXFxpQ4E6/vlHHx8oKIldXGkzMTFbKin9Fx4dCSmbEDJzPFdNTHMhIQgIHxcXHh4jIkwpKCtXTU1yISIBPAUhBAMKCSIHBgIFBRogGTYJCQwFBAwGBgkGBgwEBUcTEgMBBwkJMi8vTgYDFxY8IB8UCg0EBwEDAyMWFiIEBAcEAAAAAAEAAAABAAAmrdZpXw889QALBAAAAAAA2KCVZQAAAADYoJVlAAD/wAP+A8AAAAAIAAIAAAAAAAAAAQAAA8D/wAAABAAAAAAAA/4AAQAAAAAAAAAAAAAAAAAAAAUEAAAAAAAAAAAAAAACAAAABAAAAwAAAAAACgAUAB4A/gABAAAABQCXAAMAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAADgCuAAEAAAAAAAEABwAAAAEAAAAAAAIABwBgAAEAAAAAAAMABwA2AAEAAAAAAAQABwB1AAEAAAAAAAUACwAVAAEAAAAAAAYABwBLAAEAAAAAAAoAGgCKAAMAAQQJAAEADgAHAAMAAQQJAAIADgBnAAMAAQQJAAMADgA9AAMAAQQJAAQADgB8AAMAAQQJAAUAFgAgAAMAAQQJAAYADgBSAAMAAQQJAAoANACkaWNvbW9vbgBpAGMAbwBtAG8AbwBuVmVyc2lvbiAxLjAAVgBlAHIAcwBpAG8AbgAgADEALgAwaWNvbW9vbgBpAGMAbwBtAG8AbwBuaWNvbW9vbgBpAGMAbwBtAG8AbwBuUmVndWxhcgBSAGUAZwB1AGwAYQByaWNvbW9vbgBpAGMAbwBtAG8AbwBuRm9udCBnZW5lcmF0ZWQgYnkgSWNvTW9vbi4ARgBvAG4AdAAgAGcAZQBuAGUAcgBhAHQAZQBkACAAYgB5ACAASQBjAG8ATQBvAG8AbgAuAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==) format('woff');
417
- font-weight: normal;
418
- font-style: normal;
419
}
420
421
- #toplevel_page_qlwapp .dashicons-before.dashicons-format-chat:before {
422
- font-family: 'qlwf-whatsapp' !important;
423
- speak: none;
424
- font-style: normal;
425
- font-weight: normal;
426
- font-variant: normal;
427
- text-transform: none;
428
- line-height: 1;
429
- -webkit-font-smoothing: antialiased;
430
- -moz-osx-font-smoothing: grayscale;
431
- content: "\e900";
432
- font-size: 17px;
433
- line-height: 20px;
434
}
435
- </style>
436
- <?php
437
- }
438
439
- function add_js() {
440
- if (isset($_GET['page']) && strpos($_GET['page'], QLWAPP_DOMAIN) !== false) {
441
- wp_enqueue_style('qlwapp-admin', plugins_url('/assets/css/qlwapp-admin.min.css', QLWAPP_PLUGIN_FILE), array('wp-color-picker'), QLWAPP_PLUGIN_VERSION, 'all');
442
- wp_enqueue_media();
443
- wp_enqueue_script('qlwapp-select2', plugins_url('/assets/js/select2.min.js', QLWAPP_PLUGIN_FILE), array('jquery'), QLWAPP_PLUGIN_VERSION);
444
- wp_enqueue_script('qlwapp-admin', plugins_url('/assets/js/qlwapp-admin.min.js', QLWAPP_PLUGIN_FILE), array('jquery', 'wp-color-picker'), QLWAPP_PLUGIN_VERSION);
445
- }
446
- }
447
448
- function init() {
449
- add_action('wp_ajax_qlwapp_get_posts', array($this, 'ajax_get_posts'));
450
- add_action('wp_ajax_qlwapp_dismiss_notice', array($this, 'ajax_dismiss_notice'));
451
- add_action('admin_enqueue_scripts', array($this, 'add_js'));
452
- add_action('admin_notices', array($this, 'add_notices'));
453
- add_action('admin_head', array($this, 'add_css'));
454
- add_action('admin_menu', array($this, 'add_menu'));
455
- add_action('admin_init', array($this, 'add_settings_register'));
456
- add_action('print_media_templates', array($this, 'add_print_media_templates'));
457
- add_filter('pre_update_option_' . sanitize_key(QLWAPP_DOMAIN), array($this, 'filter_pre_update_option'), -1, 3);
458
- add_filter('plugin_action_links_' . plugin_basename(QLWAPP_PLUGIN_FILE), array($this, 'add_action_links'));
459
- }
460
461
- public static function instance() {
462
- if (!isset(self::$instance)) {
463
- self::$instance = new self();
464
- self::$instance->defaults();
465
- self::$instance->init();
466
- }
467
- return self::$instance;
468
}
469
470
- }
471
-
472
- QLWAPP_Settings::instance();
473
}
1
<?php
2
if (!defined('ABSPATH'))
3
+ exit;
4
5
if (!class_exists('QLWAPP_Settings')) {
6
7
+ class QLWAPP_Settings extends QLWAPP_Options {
8
9
+ protected static $instance;
10
11
+ function ajax_dismiss_notice() {
12
13
+ if ($notice_id = ( isset($_POST['notice_id']) ) ? sanitize_key($_POST['notice_id']) : '') {
14
15
+ update_user_meta(get_current_user_id(), $notice_id, true);
16
17
+ wp_send_json($notice_id);
18
+ }
19
20
+ wp_die();
21
+ }
22
23
+ function add_action_links($links) {
24
25
+ $links[] = '<a target="_blank" href="' . QLWAPP_PURCHASE_URL . '">' . esc_html__('Premium', 'wp-whatsapp-chat') . '</a>';
26
27
+ $links[] = '<a href="' . admin_url('admin.php?page=' . QLWAPP_DOMAIN) . '">' . esc_html__('Settings', 'wp-whatsapp-chat') . '</a>';
28
29
+ return $links;
30
+ }
31
32
+ function ajax_get_posts() {
33
34
+ $data = array(
35
+ array('none', esc_html__('Exclude from all', 'wp-whatsapp-chat'))
36
+ );
37
38
+ $posts = get_posts(array(
39
+ 's' => $_GET['q'],
40
+ 'post_type' => $_GET['name'],
41
+ 'post_status' => 'publish',
42
+ 'ignore_sticky_posts' => 1,
43
+ 'posts_per_page' => 10
44
+ ));
45
46
+ foreach ($posts as $post) {
47
+ $data[] = array($post->post_name, mb_substr($post->post_title, 0, 49));
48
+ }
49
50
+ wp_send_json($data);
51
52
+ wp_die();
53
+ }
54
55
+ function add_menu() {
56
+ add_menu_page(QLWAPP_PLUGIN_NAME, QLWAPP_PLUGIN_NAME, 'manage_options', QLWAPP_DOMAIN, array($this, 'settings_welcome'), 'dashicons-format-chat');
57
+ add_submenu_page(QLWAPP_DOMAIN, __('Welcome', 'wp-whatsapp-chat'), esc_html__('Welcome', 'wp-whatsapp-chat'), 'manage_options', QLWAPP_DOMAIN, array($this, 'settings_welcome'));
58
+ add_submenu_page(QLWAPP_DOMAIN, __('Button', 'wp-whatsapp-chat'), esc_html__('Button', 'wp-whatsapp-chat'), 'edit_posts', QLWAPP_DOMAIN . '_button', array($this, 'settings_button'));
59
+ add_submenu_page(QLWAPP_DOMAIN, __('Box', 'wp-whatsapp-chat'), esc_html__('Box', 'wp-whatsapp-chat'), 'edit_posts', QLWAPP_DOMAIN . '_box', array($this, 'settings_box'));
60
+ add_submenu_page(QLWAPP_DOMAIN, __('Display', 'wp-whatsapp-chat'), esc_html__('Display', 'wp-whatsapp-chat'), 'edit_posts', QLWAPP_DOMAIN . '_display', array($this, 'settings_display'));
61
+ add_submenu_page(QLWAPP_DOMAIN, __('Colors', 'wp-whatsapp-chat'), esc_html__('Colors', 'wp-whatsapp-chat'), 'edit_posts', QLWAPP_DOMAIN . '_colors', array($this, 'settings_colors'));
62
+ add_submenu_page(QLWAPP_DOMAIN, __('Premium', 'wp-whatsapp-chat'), sprintf('<i class="dashicons dashicons-awards"></i> %s', __('Premium', 'wp-whatsapp-chat')), 'edit_posts', QLWAPP_DOMAIN . '_premium', array($this, 'settings_premium'));
63
+ }
64
65
+ function settings_header() {
66
67
+ global $submenu;
68
69
+ if (isset($submenu[QLWAPP_DOMAIN])) {
70
+ $welcome_menu_items = $submenu[QLWAPP_DOMAIN];
71
+ }
72
73
+ if (is_array($welcome_menu_items)) {
74
+ ?>
75
+ <div class="wrap about-wrap full-width-layout qlwrap">
76
77
+ <h1><?php esc_html_e('WhatsApp Chat', 'wp-whatsapp-chat'); ?></h1>
78
79
+ <p class="about-text"><?php esc_html_e('Thanks for using WhatsApp Chat! We will do our best to offer you the best and improved communication experience with your users.', 'wp-whatsapp-chat'); ?></p>
80
81
+ <p class="about-text">
82
+ <?php printf('<a href="%s" target="_blank">%s</a>', QLWAPP_DEMO_URL, esc_html__('Check out our demo', 'wp-whatsapp-chat')); ?></a>
83
+ </p>
84
85
+ <?php printf('<a href="%s" target="_blank"><div style="
86
background: #006bff url(%s) no-repeat;
87
background-position: top center;
88
background-size: 130px 130px;
100
right: 0;
101
" class="ql-badge">%s</div></a>', 'https://quadlayers.com/?utm_source=qlwapp_admin', plugins_url('/assets/img/quadlayers.jpg', QLWAPP_PLUGIN_FILE), esc_html__('QuadLayers', 'wp-whatsapp-chat')); ?>
102
103
+ </div>
104
+ <div class="wrap about-wrap full-width-layout qlwrap">
105
+ <h2 class="nav-tab-wrapper">
106
+ <?php
107
+ foreach ($welcome_menu_items as $welcome_menu_item) {
108
+ if (strpos($welcome_menu_item[2], '.php') !== false)
109
+ continue;
110
+ ?>
111
+ <a href="<?php echo admin_url('admin.php?page=' . esc_attr($welcome_menu_item[2])); ?>" class="nav-tab<?php echo (isset($_GET['page']) && $_GET['page'] == $welcome_menu_item[2]) ? ' nav-tab-active' : ''; ?>"><?php echo $welcome_menu_item[0]; ?></a>
112
+ <?php
113
+ }
114
+ ?>
115
+ </h2>
116
+ </div>
117
+ <?php
118
}
119
}
120
121
+ function settings_sanitize($settings) {
122
123
+ if (isset($settings['button']['layout'])) {
124
+ $settings['button']['layout'] = sanitize_html_class($settings['button']['layout']);
125
+ }
126
+ if (isset($settings['button']['position'])) {
127
+ $settings['button']['position'] = sanitize_html_class($settings['button']['position']);
128
+ }
129
+ if (isset($settings['button']['text'])) {
130
+ $settings['button']['text'] = sanitize_text_field($settings['button']['text']);
131
+ }
132
+ if (isset($settings['button']['icon'])) {
133
+ $settings['button']['icon'] = sanitize_html_class($settings['button']['icon']);
134
+ }
135
+ if (isset($settings['box']['header'])) {
136
+ $settings['box']['header'] = wp_kses_post($settings['box']['header']);
137
+ }
138
+ if (isset($settings['box']['footer'])) {
139
+ $settings['box']['footer'] = wp_kses_post($settings['box']['footer']);
140
+ }
141
+ if (isset($settings['contacts'])) {
142
+ if (count($settings['contacts'])) {
143
+ foreach ($settings['contacts'] as $id => $c) {
144
+ $settings['contacts'][$id]['chat'] = (bool) $settings['contacts'][$id]['chat'];
145
+ $settings['contacts'][$id]['avatar'] = sanitize_text_field($settings['contacts'][$id]['avatar']);
146
+ $settings['contacts'][$id]['phone'] = sanitize_text_field($settings['contacts'][$id]['phone']);
147
+ $settings['contacts'][$id]['firstname'] = sanitize_text_field($settings['contacts'][$id]['firstname']);
148
+ $settings['contacts'][$id]['lastname'] = sanitize_text_field($settings['contacts'][$id]['lastname']);
149
+ $settings['contacts'][$id]['label'] = sanitize_text_field($settings['contacts'][$id]['label']);
150
+ $settings['contacts'][$id]['message'] = wp_kses_post($settings['contacts'][$id]['message']);
151
+ //$settings['contacts'][$id]['message'] = stripslashes($settings['contacts'][$id]['message']);
152
+ }
153
+ }
154
+ }
155
156
+ return $settings;
157
+ }
158
159
+ function add_settings_register() {
160
+ register_setting(sanitize_key(QLWAPP_DOMAIN . '-group'), sanitize_key(QLWAPP_DOMAIN), array($this, 'settings_sanitize'));
161
+ }
162
163
+ function settings_welcome() {
164
165
+ global $qlwapp;
166
+ ?>
167
+ <?php $this->settings_header(); ?>
168
+ <div class="wrap about-wrap full-width-layout qlwrap">
169
+ <?php include_once('pages/welcome.php'); ?>
170
+ </div>
171
+ <?php
172
+ }
173
174
+ function settings_button() {
175
176
+ global $qlwapp;
177
+ ?>
178
+ <?php $this->settings_header(); ?>
179
+ <div class="wrap about-wrap full-width-layout qlwrap">
180
+ <?php include_once('pages/button.php'); ?>
181
+ </div>
182
+ <?php
183
+ }
184
185
+ function settings_box() {
186
187
+ global $qlwapp;
188
+ ?>
189
+ <?php $this->settings_header(); ?>
190
+ <div class="wrap about-wrap full-width-layout qlwrap">
191
+ <?php include_once('pages/box.php'); ?>
192
+ </div>
193
+ <?php
194
+ }
195
196
+ function settings_display() {
197
198
+ global $qlwapp;
199
+ ?>
200
+ <?php $this->settings_header(); ?>
201
+ <div class="wrap about-wrap full-width-layout qlwrap">
202
+ <?php include_once('pages/display.php'); ?>
203
+ </div>
204
+ <?php
205
+ }
206
207
+ function settings_colors() {
208
209
+ global $qlwapp;
210
+ ?>
211
+ <?php $this->settings_header(); ?>
212
+ <div class="wrap about-wrap full-width-layout qlwrap">
213
+ <?php include_once('pages/colors.php'); ?>
214
+ </div>
215
+ <?php
216
+ }
217
218
+ function settings_premium() {
219
220
+ global $qlwapp;
221
+ ?>
222
+ <?php $this->settings_header(); ?>
223
+ <div class="wrap about-wrap full-width-layout qlwrap">
224
+ <?php include_once('pages/premium.php'); ?>
225
</div>
226
+ <?php
227
+ }
228
+
229
+ function settings_contacts() {
230
+ ?>
231
+ <table class="form-table widefat" id="qlwapp-contact-form" data-editindex="-1">
232
+ <?php $this->contact_table(); ?>
233
+ </table>
234
+ <?php
235
+ }
236
+
237
+ function contact_table($id = 0) {
238
+ global $qlwapp;
239
+ ?>
240
<tr>
241
+ <td>
242
+ <div class="upload">
243
+ <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']); ?>" />
244
+ <div>
245
+ <input type="hidden" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts][' . $id . '][avatar]'); ?>" id="cavatar" value="<?php echo esc_url($qlwapp['contacts'][$id]['avatar']); ?>" />
246
+ <button type="button" class="upload_image_button button"><?php esc_html_e('Upload', 'wp-whatsapp-chat'); ?></button>
247
+ <button type="button" class="remove_image_button button">&times;</button>
248
+ </div>
249
+ </div>
250
+ </td>
251
+ <td>
252
+ <table>
253
+ <tr>
254
+ <td><b><?php esc_html_e('Firstname', 'wp-whatsapp-chat'); ?></b></td>
255
+ <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>
256
+ <td><b><?php esc_html_e('Lastname', 'wp-whatsapp-chat'); ?></b></td>
257
+ <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>
258
+ </tr>
259
+ <tr>
260
+ <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']); ?>" pattern="[\+]\d[0-9]{6,15}quot;/></td>
261
+ <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>
262
+ </tr>
263
+ <!--<tr>
264
+ <td><b><?php esc_html_e('From', 'wp-whatsapp-chat'); ?></b></td><td><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']); ?>" /></td>
265
+ <td><b><?php esc_html_e('To', 'wp-whatsapp-chat'); ?></b></td><td><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']); ?>" /></td>
266
+ </tr>-->
267
+ </table>
268
+ </td>
269
</tr>
270
+ <tr class="qlwapp-premium-field">
271
+ <td><b><?php esc_html_e('Chat', 'wp-whatsapp-chat'); ?></b></td>
272
+ <td>
273
+ <p>
274
+ <label><input type="radio" class="cchat" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts][' . $id . '][chat]'); ?>" value="1" <?php echo checked(true, (bool) $qlwapp['contacts'][$id]['chat']); ?>/><?php esc_html_e('Enabled', 'wp-whatsapp-chat'); ?></label>
275
+ <label><input type="radio" class="cchat" name="<?php echo esc_attr(QLWAPP_DOMAIN . '[contacts][' . $id . '][chat]'); ?>" value="0" <?php echo checked(false, (bool) $qlwapp['contacts'][$id]['chat']); ?>/><?php esc_html_e('Disabled', 'wp-whatsapp-chat'); ?></label>
276
+ </p>
277
+ </td>
278
</tr>
279
+ <tr class="qlwapp-premium-field">
280
+ <td colspan="2"><b><?php esc_html_e('Message', 'wp-whatsapp-chat'); ?></b></td>
281
+ </tr>
282
+ <tr class="qlwapp-premium-field">
283
+ <td colspan="2"><?php wp_editor($qlwapp['contacts'][$id]['message'], 'cmessage', array('tinymce' => false, 'editor_height' => 150, 'textarea_name' => esc_attr(QLWAPP_DOMAIN . '[contacts][' . $id . '][message]'))); ?></td>
284
+ </tr>
285
+ <?php
286
+ }
287
288
+ function add_print_media_templates() {
289
+ ?>
290
+ <script type="text/html" id='tmpl-qlwapp-modal-backdrop'>
291
+ <div class="media-modal-backdrop">&nbsp;</div>
292
+ </script>
293
+ <script type="text/html" id='tmpl-qlwapp-modal-window'>
294
+ <div id="qlwapp_modal" class="media-modal wp-core-ui">
295
+ <button type="button" class="media-modal-close close">
296
+ <span class="media-modal-icon">
297
+ <span class="screen-reader-text"><?php esc_html_e('Close media panel'); ?></span>
298
+ </span>
299
+ </button>
300
+ <div class="media-frame mode-select wp-core-ui hide-menu">
301
+ <div class="media-frame-title">
302
+ <h1><?php esc_html_e('WhatsApp Chat', 'wp-whatsapp-chat'); ?><span class="dashicons dashicons-arrow-down"></span></h1>
303
+ </div>
304
+ <div class="media-frame-router">
305
+ <div class="media-router">
306
+ <a href="#" class="media-menu-item active"><?php esc_html_e('Select icon', 'wp-whatsapp-chat'); ?></a>
307
</div>
308
+ </div>
309
+ <div class="media-modal-content">
310
+ <div class="media-frame mode-select wp-core-ui">
311
+ <div class="media-frame-menu">
312
+ <div class="media-menu">
313
+ <a href="#" class="media-menu-item active"><?php esc_html_e('Featured Image'); ?></a>
314
+ </div>
315
+ </div>
316
+ <div class="media-frame-content" data-columns="10">
317
+ <div class="attachments-browser">
318
+ <input type="hidden" id="qlwapp_icon" value="{{ data.icon }}">
319
+ <ul tabindex="-1" class="attachments">
320
+ <?php foreach (explode(',', 'qlwf-chat,qlwf-chat1,qlwf-chat2,qlwf-comments,qlwf-chat3,qlwf-bubble1,qlwf-chat-alt-fill,qlwf-chat-alt-stroke,qlwf-comment-alt2-fill,qlwf-comment-alt2-stroke,qlwf-comment-fill,qlwf-comment-stroke,qlwf-comment,qlwf-comment-alt1-stroke,qlwf-chat4,qlwf-comments1,qlwf-chat5,qlwf-comment1,qlwf-bubble,qlwf-bubbles,qlwf-bubbles2,qlwf-bubble2,qlwf-bubbles3,qlwf-bubbles4,qlwf-whatsapp,qlwf-chat6,qlwf-mode_comment,qlwf-insert_comment,qlwf-chat_bubble_outline,qlwf-chat_bubble,qlwf-bubble_chart,qlwf-comment2,qlwf-chat7,qlwf-commenting-o,qlwf-commenting,qlwf-comments-o,qlwf-comment-o,qlwf-wechat,qlwf-comments2,qlwf-comment3,qlwf-chat8,qlwf-chat-bubble-dots,qlwf-bubbles1,qlwf-bubble3') as $id => $icon) : ?>
321
+ <li tabindex="0" role="checkbox" aria-label="<?php echo esc_attr($icon); ?>" aria-checked="false" data-id="<?php echo esc_attr($id); ?>" class="attachment save-ready icon _<?php echo esc_attr(str_replace(' ', '_', trim($icon))); ?>">
322
+ <div class="attachment-preview js--select-attachment type-image subtype-jpeg landscape">
323
+ <div class="thumbnail">
324
+ <i class="<?php echo esc_attr($icon); ?>"></i>
325
+ </div>
326
+ </div>
327
+ <button type="button" class="check" tabindex="-1">
328
+ <span class="media-modal-icon"></span>
329
+ <span class="screen-reader-text"><?php esc_html_e('Deselect'); ?></span>
330
+ </button>
331
+ </li>
332
+ <?php endforeach; ?>
333
+ </ul>
334
+ </div>
335
+ </div>
336
+ <div class="media-frame-toolbar">
337
+ <div class="media-toolbar">
338
+ <div class="media-toolbar-secondary"></div>
339
+ <div class="media-toolbar-primary search-form">
340
+ <button type="button" class="button media-button button-large button-primary media-button-select save"><?php esc_html_e('Save'); ?></button>
341
+ <button type="button" class="button media-button button-large button-secondary remove"><?php esc_html_e('Remove'); ?></button>
342
+ </div>
343
+ </div>
344
+ </div>
345
+ </div>
346
+ </div>
347
</div>
348
</div>
349
+ </script>
350
+ <?php
351
+ }
352
353
+ function filter_pre_update_option($value, $old_value, $option) {
354
355
+ global $qlwapp;
356
357
+ if (isset($value['display'])) {
358
+ unset($qlwapp['display']);
359
+ }
360
361
+ if (isset($value['contacts'])) {
362
+ unset($qlwapp['contacts']);
363
+ }
364
365
+ return $this->wp_parse_args($value, $qlwapp);
366
+ }
367
368
+ function add_notices() {
369
+
370
+ if (!get_transient('qlwapp-first-rating') && !get_user_meta(get_current_user_id(), 'qlwapp-user-rating', true)) {
371
+ ?>
372
+ <div id="qlwapp-admin-rating" class="qlwapp-notice notice is-dismissible" data-notice_id="qlwapp-user-rating">
373
+ <div class="notice-container" style="padding-top: 10px; padding-bottom: 10px; display: flex; justify-content: left; align-items: center;">
374
+ <div class="notice-image">
375
+ <img style="border-radius:50%;max-width: 90px;" src="<?php echo plugins_url('/assets/img/logo.jpg', QLWAPP_PLUGIN_FILE); ?>" alt="<?php echo esc_html(QLWAPP_PLUGIN_NAME); ?>>">
376
+ </div>
377
+ <div class="notice-content" style="margin-left: 15px;">
378
+ <p>
379
+ <?php printf(esc_html__('Hello! Thank you for choosing the %s plugin!', 'wp-whatsapp-chat'), QLWAPP_PLUGIN_NAME); ?>
380
+ <br/>
381
+ <?php esc_html_e('Could you please give it a 5-star rating on WordPress? We know its a big favor, but we\'ve worked very much and very hard to release this great product. Your feedback will boost our motivation and help us promote and continue to improve this product.', 'wp-whatsapp-chat'); ?>
382
+ </p>
383
+ <a href="<?php echo esc_url(QLWAPP_REVIEW_URL); ?>" class="button-primary" target="_blank">
384
+ <?php esc_html_e('Yes, of course!', 'wp-whatsapp-chat'); ?>
385
+ </a>
386
+ <a href="<?php echo esc_url(QLWAPP_SUPPORT_URL); ?>" class="button-secondary" target="_blank">
387
+ <?php esc_html_e('Report a bug', 'wp-whatsapp-chat'); ?>
388
+ </a>
389
+ </div>
390
+ </div>
391
+ </div>
392
+ <script>
393
+ (function ($) {
394
+ $('.qlwapp-notice').on('click', '.notice-dismiss', function (e) {
395
+ e.preventDefault();
396
+ var notice_id = $(e.delegateTarget).data('notice_id');
397
+ $.ajax({
398
+ type: 'POST',
399
+ url: ajaxurl,
400
+ data: {
401
+ notice_id: notice_id,
402
+ action: 'qlwapp_dismiss_notice',
403
+ },
404
+ success: function (response) {
405
+ console.log(response);
406
+ },
407
+ });
408
+ });
409
+ })(jQuery);
410
+ </script>
411
+ <?php
412
+ }
413
+ }
414
415
+ function add_css() {
416
+ ?>
417
+ <style>
418
+ @font-face {
419
+ font-family: 'qlwf-whatsapp';
420
+ src: url(data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAAAYEAAsAAAAABbgAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABPUy8yAAABCAAAAGAAAABgDxIFKmNtYXAAAAFoAAAAVAAAAFQXVtKHZ2FzcAAAAbwAAAAIAAAACAAAABBnbHlmAAABxAAAAfwAAAH8pb7IGGhlYWQAAAPAAAAANgAAADYUXm9HaGhlYQAAA/gAAAAkAAAAJAfAA8ZobXR4AAAEHAAAABQAAAAUCgAAA2xvY2EAAAQwAAAADAAAAAwAKAESbWF4cAAABDwAAAAgAAAAIAAJAJluYW1lAAAEXAAAAYYAAAGGmUoJ+3Bvc3QAAAXkAAAAIAAAACAAAwAAAAMDAAGQAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAA6QADwP/AAEADwABAAAAAAQAAAAAAAAAAAAAAIAAAAAAAAwAAAAMAAAAcAAEAAwAAABwAAwABAAAAHAAEADgAAAAKAAgAAgACAAEAIOkA//3//wAAAAAAIOkA//3//wAB/+MXBAADAAEAAAAAAAAAAAAAAAEAAf//AA8AAQAAAAAAAAAAAAIAADc5AQAAAAABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAAAwAD/8AD/gPAACcATwCWAAABJicuAScmIyIHDgEHBhUUFhcDJR4BMzE4ATEyNz4BNzY1NCcuAScmATEiJi8BBzcnLgE1NDc+ATc2MzIXHgEXFhcWFx4BFxYVFAcOAQcGIxMuAScmIgcOAQcOAScuAScuAScmNjc+ATc+ATc2JicuAScuASMmIiMiBgcOARUUFhcWFx4BFxYXHgEXHgE3PgE3PgEnLgEnA2kkKSpbMTEzaVxdiSgoIiJIAQ03e0BpXF2KKCgKCiYbHP51OW0xD6ArCiAhIiFyTU1XKygpTCIjHh0XFyAICCEick1NV+cJRAkJDQcGHAYGDAkKOCQdJAYGBwUECgUEBQMDAQMCHQgHEAUGDAcGEwgJJC8FAhEQOCcnMBYkDhcoERI7CAgCAgMMCgMrJBwcJQoKKCiKXFxpQ4E6/vlHHx8oKIldXGkzMTFbKin9Fx4dCSmbEDJzPFdNTHMhIQgIHxcXHh4jIkwpKCtXTU1yISIBPAUhBAMKCSIHBgIFBRogGTYJCQwFBAwGBgkGBgwEBUcTEgMBBwkJMi8vTgYDFxY8IB8UCg0EBwEDAyMWFiIEBAcEAAAAAAEAAAABAAAmrdZpXw889QALBAAAAAAA2KCVZQAAAADYoJVlAAD/wAP+A8AAAAAIAAIAAAAAAAAAAQAAA8D/wAAABAAAAAAAA/4AAQAAAAAAAAAAAAAAAAAAAAUEAAAAAAAAAAAAAAACAAAABAAAAwAAAAAACgAUAB4A/gABAAAABQCXAAMAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAADgCuAAEAAAAAAAEABwAAAAEAAAAAAAIABwBgAAEAAAAAAAMABwA2AAEAAAAAAAQABwB1AAEAAAAAAAUACwAVAAEAAAAAAAYABwBLAAEAAAAAAAoAGgCKAAMAAQQJAAEADgAHAAMAAQQJAAIADgBnAAMAAQQJAAMADgA9AAMAAQQJAAQADgB8AAMAAQQJAAUAFgAgAAMAAQQJAAYADgBSAAMAAQQJAAoANACkaWNvbW9vbgBpAGMAbwBtAG8AbwBuVmVyc2lvbiAxLjAAVgBlAHIAcwBpAG8AbgAgADEALgAwaWNvbW9vbgBpAGMAbwBtAG8AbwBuaWNvbW9vbgBpAGMAbwBtAG8AbwBuUmVndWxhcgBSAGUAZwB1AGwAYQByaWNvbW9vbgBpAGMAbwBtAG8AbwBuRm9udCBnZW5lcmF0ZWQgYnkgSWNvTW9vbi4ARgBvAG4AdAAgAGcAZQBuAGUAcgBhAHQAZQBkACAAYgB5ACAASQBjAG8ATQBvAG8AbgAuAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==) format('woff');
421
+ font-weight: normal;
422
+ font-style: normal;
423
+ }
424
+
425
+ #toplevel_page_qlwapp .dashicons-before.dashicons-format-chat:before {
426
+ font-family: 'qlwf-whatsapp' !important;
427
+ speak: none;
428
+ font-style: normal;
429
+ font-weight: normal;
430
+ font-variant: normal;
431
+ text-transform: none;
432
+ line-height: 1;
433
+ -webkit-font-smoothing: antialiased;
434
+ -moz-osx-font-smoothing: grayscale;
435
+ content: "\e900";
436
+ font-size: 17px;
437
+ line-height: 20px;
438
+ }
439
+ </style>
440
+ <?php
441
}
442
443
+ function add_js() {
444
+ if (isset($_GET['page']) && strpos($_GET['page'], QLWAPP_DOMAIN) !== false) {
445
+ wp_enqueue_style('qlwapp-admin', plugins_url('/assets/css/qlwapp-admin.min.css', QLWAPP_PLUGIN_FILE), array('wp-color-picker'), QLWAPP_PLUGIN_VERSION, 'all');
446
+ wp_enqueue_media();
447
+ wp_enqueue_script('qlwapp-select2', plugins_url('/assets/js/select2.min.js', QLWAPP_PLUGIN_FILE), array('jquery'), QLWAPP_PLUGIN_VERSION);
448
+ wp_enqueue_script('qlwapp-admin', plugins_url('/assets/js/qlwapp-admin.min.js', QLWAPP_PLUGIN_FILE), array('jquery', 'wp-color-picker'), QLWAPP_PLUGIN_VERSION, true);
449
+ }
450
}
451
452
+ function init() {
453
+ add_action('wp_ajax_qlwapp_get_posts', array($this, 'ajax_get_posts'));
454
+ add_action('wp_ajax_qlwapp_dismiss_notice', array($this, 'ajax_dismiss_notice'));
455
+ add_action('admin_enqueue_scripts', array($this, 'add_js'));
456
+ add_action('admin_notices', array($this, 'add_notices'));
457
+ add_action('admin_head', array($this, 'add_css'));
458
+ add_action('admin_menu', array($this, 'add_menu'));
459
+ add_action('admin_init', array($this, 'add_settings_register'));
460
+ add_action('print_media_templates', array($this, 'add_print_media_templates'));
461
+ add_filter('pre_update_option_' . sanitize_key(QLWAPP_DOMAIN), array($this, 'filter_pre_update_option'), -1, 3);
462
+ add_filter('plugin_action_links_' . plugin_basename(QLWAPP_PLUGIN_FILE), array($this, 'add_action_links'));
463
+ }
464
465
+ public static function instance() {
466
+ if (!isset(self::$instance)) {
467
+ self::$instance = new self();
468
+ self::$instance->defaults();
469
+ self::$instance->init();
470
+ }
471
+ return self::$instance;
472
+ }
473
474
}
475
476
+ QLWAPP_Settings::instance();
477
}
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: whatsapp, button, chat, support, contact, click to chat, directly message
5
Requires at least: 4.6
6
Tested up to: 5.2
7
Requires PHP: 5.3
8
- Stable tag: 4.2.9
9
License: GPLv2 or later
10
License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
5
Requires at least: 4.6
6
Tested up to: 5.2
7
Requires PHP: 5.3
8
+ Stable tag: 4.3.0
9
License: GPLv2 or later
10
License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
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.2.9
7
* Author: WhatsApp Chat
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.2.9');
22
}
23
if (!defined('QLWAPP_PLUGIN_FILE')) {
24
define('QLWAPP_PLUGIN_FILE', __FILE__);
@@ -72,6 +72,9 @@ if (!class_exists('QLWAPP')) {
72
opacity: 0.5;
73
pointer-events: none;
74
}
75
</style>
76
<?php
77
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.3.0
7
* Author: WhatsApp Chat
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.3.0');
22
}
23
if (!defined('QLWAPP_PLUGIN_FILE')) {
24
define('QLWAPP_PLUGIN_FILE', __FILE__);
72
opacity: 0.5;
73
pointer-events: none;
74
}
75
+ .qlwapp-premium-field .description {
76
+ display: block!important;
77
+ }
78
</style>
79
<?php
80
wpml-config.xml ADDED
@@ -0,0 +1,27 @@
1
+ <wpml-config>
2
+ <admin-texts>
3
+ <key name="qlwapp">
4
+ <key name="box">
5
+ <key name="header"></key>
6
+ <key name="footer"></key>
7
+ </key>
8
+ <key name="chat">
9
+ <key name="response"></key>
10
+ </key>
11
+ <key name="button">
12
+ <key name="text"></key>
13
+ <key name="phone"></key>
14
+ </key>
15
+ <key name="user">
16
+ <key name="message"></key>
17
+ </key>
18
+ <key name="contacts">
19
+ <key name="*">
20
+ <key name="label"></key>
21
+ <key name="phone"></key>
22
+ <key name="message"></key>
23
+ </key>
24
+ </key>
25
+ </key>
26
+ </admin-texts>
27
+ </wpml-config>