Version Description
- Security update
Download this release
Release Info
Developer | galdub |
Plugin | Floating Chat Widget: Contact Chat Icons, Telegram Chat, Line, WeChat, Email, SMS, Call Button – Chaty |
Version | 2.0.6 |
Comparing to | |
See all releases |
Code changes from version 2.0.5 to 2.0.6
- admin/class-admin-base.php +119 -105
- cht-icons.php +1 -1
- readme.txt +4 -1
- views/modals/chaty-deactivate-form.php +29 -87
- views/parts/help.php +1 -0
- views/parts/section3.php +1 -1
admin/class-admin-base.php
CHANGED
@@ -40,7 +40,6 @@ class CHT_Admin_Base
|
|
40 |
add_action('updated_option', array($this, 'cht_clear_all_caches'));
|
41 |
|
42 |
/* Send message to owner */
|
43 |
-
add_action( 'wp_ajax_nopriv_wcp_admin_send_message_to_owner', array( $this, 'wcp_admin_send_message_to_owner' ) );
|
44 |
add_action( 'wp_ajax_wcp_admin_send_message_to_owner', array( $this, 'wcp_admin_send_message_to_owner' ) );
|
45 |
|
46 |
/* ADD Upgrade link to plugin */
|
@@ -53,86 +52,75 @@ class CHT_Admin_Base
|
|
53 |
public function chaty_plugin_deactivate() {
|
54 |
global $current_user;
|
55 |
$postData = $_POST;
|
56 |
-
$
|
57 |
-
$
|
58 |
-
$
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
$message = "
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
$message2 = $postData['reason_detail'];
|
76 |
-
}
|
77 |
-
$email = get_option( 'admin_email' );
|
78 |
-
$domain = site_url();
|
79 |
-
$user_name = $current_user->first_name." ".$current_user->last_name;
|
80 |
-
$subject = "Chaty was removed from {$domain} because {$message}";
|
81 |
-
if($message2 != "") {
|
82 |
-
$subject .= ": ".$message2;
|
83 |
}
|
84 |
-
$
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
</tr>
|
112 |
-
<?php if($message2 != "") { ?>
|
113 |
<tr>
|
114 |
-
<th>
|
115 |
-
<td><?php echo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
</tr>
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
</
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
</table>
|
127 |
-
<?php
|
128 |
-
$content = ob_get_clean();
|
129 |
-
$to = "contact+removed@premio.io";
|
130 |
-
$status = wp_mail($to, $subject, $content, $headers);
|
131 |
-
if($status) {
|
132 |
$response['status'] = 1;
|
133 |
-
} else {
|
134 |
-
$response['status'] = 0;
|
135 |
-
$response['message'] = "Not able to send mail";
|
136 |
}
|
137 |
echo json_encode($response);
|
138 |
die;
|
@@ -186,6 +174,21 @@ class CHT_Admin_Base
|
|
186 |
);
|
187 |
$errorArray[] = $error;
|
188 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
if(empty($errorArray)) {
|
190 |
global $current_user;
|
191 |
$text_message = $postData['textarea_text'];
|
@@ -439,6 +442,12 @@ class CHT_Admin_Base
|
|
439 |
}
|
440 |
}
|
441 |
|
|
|
|
|
|
|
|
|
|
|
|
|
442 |
public function cht_register_inputs()
|
443 |
{
|
444 |
/**
|
@@ -478,35 +487,40 @@ class CHT_Admin_Base
|
|
478 |
/**
|
479 |
* Registering settings fields
|
480 |
*/
|
481 |
-
// register field section one
|
482 |
-
foreach ($this->socials as $social) {
|
483 |
-
register_setting( $this->plugin_slug, 'cht_social_' . $social['slug']);
|
484 |
-
}
|
485 |
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
510 |
}
|
511 |
|
512 |
public function device(){
|
40 |
add_action('updated_option', array($this, 'cht_clear_all_caches'));
|
41 |
|
42 |
/* Send message to owner */
|
|
|
43 |
add_action( 'wp_ajax_wcp_admin_send_message_to_owner', array( $this, 'wcp_admin_send_message_to_owner' ) );
|
44 |
|
45 |
/* ADD Upgrade link to plugin */
|
52 |
public function chaty_plugin_deactivate() {
|
53 |
global $current_user;
|
54 |
$postData = $_POST;
|
55 |
+
$errorCounter = 0;
|
56 |
+
$response = array();
|
57 |
+
$response['status'] = 0;
|
58 |
+
$response['message'] = "";
|
59 |
+
$response['valid'] = 1;
|
60 |
+
if(!isset($postData['reason']) || empty($postData['reason'])) {
|
61 |
+
$errorCounter++;
|
62 |
+
$response['message'] = "Please provide reason";
|
63 |
+
} else if (!isset($postData['nonce']) || empty($postData['nonce'])) {
|
64 |
+
$response['message'] = __("Your request is not valid", CHT_OPT);
|
65 |
+
$errorCounter++;
|
66 |
+
$response['valid'] = 0;
|
67 |
+
} else {
|
68 |
+
$nonce = self::chaty_sanitize_options($postData['nonce']);
|
69 |
+
if(!wp_verify_nonce($nonce, 'chaty_deactivate_nonce')) {
|
70 |
+
$response['message'] = __("Your request is not valid", CHT_OPT);
|
71 |
+
$errorCounter++;
|
72 |
+
$response['valid'] = 0;
|
73 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
}
|
75 |
+
if($errorCounter == 0) {
|
76 |
+
global $current_user;
|
77 |
+
$postData = $_POST;
|
78 |
+
$email = get_option('admin_email');
|
79 |
+
$domain = site_url();
|
80 |
+
$user_name = $current_user->first_name . " " . $current_user->last_name;
|
81 |
+
$subject = "Chaty was removed from {$domain}";
|
82 |
+
$headers = "MIME-Version: 1.0\r\n";
|
83 |
+
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
|
84 |
+
$headers .= 'From: ' . $user_name . ' <' . $email . '>' . PHP_EOL;
|
85 |
+
$headers .= 'Reply-To: ' . $user_name . ' <' . $email . '>' . PHP_EOL;
|
86 |
+
$headers .= 'X-Mailer: PHP/' . phpversion();
|
87 |
+
ob_start();
|
88 |
+
?>
|
89 |
+
<table border="0" cellspacing="0" cellpadding="5">
|
90 |
+
<tr>
|
91 |
+
<th>Plugin</th>
|
92 |
+
<td>Chaty</td>
|
93 |
+
</tr>
|
94 |
+
<tr>
|
95 |
+
<th>Plugin Version</th>
|
96 |
+
<td><?php echo CHT_CURRENT_VERSION ?></td>
|
97 |
+
</tr>
|
98 |
+
<tr>
|
99 |
+
<th>Domain</th>
|
100 |
+
<td><?php echo $domain ?></td>
|
101 |
+
</tr>
|
|
|
|
|
102 |
<tr>
|
103 |
+
<th>Email</th>
|
104 |
+
<td><?php echo $email ?></td>
|
105 |
+
</tr>
|
106 |
+
<tr>
|
107 |
+
<th>Reason</th>
|
108 |
+
<td><?php echo nl2br($postData['reason']) ?></td>
|
109 |
+
</tr>
|
110 |
+
<tr>
|
111 |
+
<th>WordPress Version</th>
|
112 |
+
<td><?php echo get_bloginfo('version') ?></td>
|
113 |
</tr>
|
114 |
+
<tr>
|
115 |
+
<th>PHP Version</th>
|
116 |
+
<td><?php echo PHP_VERSION ?></td>
|
117 |
+
</tr>
|
118 |
+
</table>
|
119 |
+
<?php
|
120 |
+
$content = ob_get_clean();
|
121 |
+
$to = "contact+removed@premio.io";
|
122 |
+
wp_mail($to, $subject, $content, $headers);
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
$response['status'] = 1;
|
|
|
|
|
|
|
124 |
}
|
125 |
echo json_encode($response);
|
126 |
die;
|
174 |
);
|
175 |
$errorArray[] = $error;
|
176 |
}
|
177 |
+
if(empty($errorArray)) {
|
178 |
+
if(!isset($_REQUEST['nonce']) || empty($_REQUEST['nonce'])) {
|
179 |
+
$error = array(
|
180 |
+
'key' => "nonce",
|
181 |
+
"message" => "Your request is not valid"
|
182 |
+
);
|
183 |
+
$errorArray[] = $error;
|
184 |
+
} else if(!wp_verify_nonce($_REQUEST['nonce'], "chaty_send_message_to_owner")) {
|
185 |
+
$error = array(
|
186 |
+
'key' => "nonce",
|
187 |
+
"message" => "Your request is not valid"
|
188 |
+
);
|
189 |
+
$errorArray[] = $error;
|
190 |
+
}
|
191 |
+
}
|
192 |
if(empty($errorArray)) {
|
193 |
global $current_user;
|
194 |
$text_message = $postData['textarea_text'];
|
442 |
}
|
443 |
}
|
444 |
|
445 |
+
public static function chaty_sanitize_options($value) {
|
446 |
+
$value = stripslashes($value);
|
447 |
+
$value = filter_var($value, FILTER_SANITIZE_STRING);
|
448 |
+
return $value;
|
449 |
+
}
|
450 |
+
|
451 |
public function cht_register_inputs()
|
452 |
{
|
453 |
/**
|
487 |
/**
|
488 |
* Registering settings fields
|
489 |
*/
|
|
|
|
|
|
|
|
|
490 |
|
491 |
+
/*check for nonce*/
|
492 |
+
if(isset($_REQUEST['nonce']) && !empty($_REQUEST['nonce']) && wp_verify_nonce($_REQUEST['nonce'], "chaty_plugin_nonce")) {
|
493 |
+
|
494 |
+
// register field section one
|
495 |
+
foreach ($this->socials as $social) {
|
496 |
+
register_setting($this->plugin_slug, 'cht_social_' . $social['slug']);
|
497 |
+
}
|
498 |
+
|
499 |
+
// register field section two
|
500 |
+
register_setting($this->plugin_slug, 'cht_devices', 'chaty_sanitize_options');
|
501 |
+
register_setting($this->plugin_slug, 'cht_color', 'chaty_sanitize_options');
|
502 |
+
register_setting($this->plugin_slug, 'cht_custom_color', 'chaty_sanitize_options');
|
503 |
+
register_setting($this->plugin_slug, 'cht_position', 'chaty_sanitize_options');
|
504 |
+
register_setting($this->plugin_slug, 'positionSide', 'chaty_sanitize_options');
|
505 |
+
register_setting($this->plugin_slug, 'cht_bottom_spacing', 'chaty_sanitize_options');
|
506 |
+
register_setting($this->plugin_slug, 'cht_side_spacing', 'chaty_sanitize_options');
|
507 |
+
register_setting($this->plugin_slug, 'cht_cta', 'chaty_sanitize_options');
|
508 |
+
register_setting($this->plugin_slug, 'cht_credit', 'chaty_sanitize_options');
|
509 |
+
register_setting($this->plugin_slug, 'cht_cta_switcher', 'chaty_sanitize_options');
|
510 |
+
register_setting($this->plugin_slug, 'cht_widget_size', 'chaty_sanitize_options');
|
511 |
+
register_setting($this->plugin_slug, 'cht_widget_img', 'chaty_sanitize_options');
|
512 |
+
register_setting($this->plugin_slug, 'widget_icon', 'chaty_sanitize_options');
|
513 |
+
add_action('pre_update_option_cht_widget_img', array($this, 'uploadCustomWidget'), 10, 3);
|
514 |
+
|
515 |
+
// register field section three
|
516 |
+
register_setting($this->plugin_slug, 'cht_active', 'chaty_sanitize_options');
|
517 |
+
|
518 |
+
// register field section token
|
519 |
+
register_setting($this->plugin_slug, 'cht_license_key', 'chaty_sanitize_options');
|
520 |
+
|
521 |
+
// register field section slug
|
522 |
+
register_setting($this->plugin_slug, 'cht_numb_slug', 'chaty_sanitize_options');
|
523 |
+
}
|
524 |
}
|
525 |
|
526 |
public function device(){
|
cht-icons.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
Description: Chat with your website visitors via their favorite channels. Show a chat icon on the bottom of your site and communicate with your customers.
|
6 |
Author: Premio
|
7 |
Author URI: https://premio.io/downloads/chaty/
|
8 |
-
Version: 2.0.
|
9 |
License: GPL2
|
10 |
*/
|
11 |
|
5 |
Description: Chat with your website visitors via their favorite channels. Show a chat icon on the bottom of your site and communicate with your customers.
|
6 |
Author: Premio
|
7 |
Author URI: https://premio.io/downloads/chaty/
|
8 |
+
Version: 2.0.6
|
9 |
License: GPL2
|
10 |
*/
|
11 |
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: galdub, tomeraharon, premio
|
|
3 |
Tags: whatsapp, facebook messenger, click to chat, chat, chat button, call now button
|
4 |
Requires at least: 3.1
|
5 |
Tested up to: 5.2
|
6 |
-
Stable tag: 2.0.
|
7 |
Plugin URI: https://premio.io/downloads/chaty/
|
8 |
|
9 |
FREE customizable live chat and call buttons. Let your visitors contact you via Facebook Messenger, Whatsapp, Telegram, Viber, Email, SMS and more.
|
@@ -132,6 +132,9 @@ Just follow our <a href="https://premio.io/wordpress-premio-pro-version-installa
|
|
132 |
|
133 |
== Changelog ==
|
134 |
|
|
|
|
|
|
|
135 |
= 2.0.5 =
|
136 |
* We're now fully compatible with WP-Rocket
|
137 |
|
3 |
Tags: whatsapp, facebook messenger, click to chat, chat, chat button, call now button
|
4 |
Requires at least: 3.1
|
5 |
Tested up to: 5.2
|
6 |
+
Stable tag: 2.0.6
|
7 |
Plugin URI: https://premio.io/downloads/chaty/
|
8 |
|
9 |
FREE customizable live chat and call buttons. Let your visitors contact you via Facebook Messenger, Whatsapp, Telegram, Viber, Email, SMS and more.
|
132 |
|
133 |
== Changelog ==
|
134 |
|
135 |
+
= 2.0.6 =
|
136 |
+
* Security update
|
137 |
+
|
138 |
= 2.0.5 =
|
139 |
* We're now fully compatible with WP-Rocket
|
140 |
|
views/modals/chaty-deactivate-form.php
CHANGED
@@ -112,88 +112,33 @@
|
|
112 |
color: #dd0000;
|
113 |
font-weight: 600;
|
114 |
}
|
115 |
-
|
|
|
|
|
116 |
</style>
|
117 |
|
118 |
<div class="chaty--popup-overlay">
|
119 |
<div class="chaty--serveypanel">
|
120 |
<form action="#" method="post" id="chaty--deactivate-form">
|
121 |
<div class="chaty--popup-header">
|
122 |
-
<h2><?php _e('Quick feedback about Chaty',
|
123 |
</div>
|
124 |
<div class="chaty--popup-body">
|
125 |
-
<h3><?php _e('Your feedback will help us improve the product, please tell us why did you decide to deactivate Chaty :)',
|
126 |
-
<
|
127 |
-
<
|
128 |
-
|
129 |
-
|
130 |
-
<input type="radio" name="chaty--selected-reason" value="1">
|
131 |
-
</span>
|
132 |
-
<span><?php _e('I don’t need it anymore', CHT_PRO_OPT); ?></span>
|
133 |
-
</label>
|
134 |
-
|
135 |
-
<div class="chaty--internal-message"></div>
|
136 |
-
</li>
|
137 |
-
<li class="chaty--reason" data-input-type="" data-input-placeholder="">
|
138 |
-
<label>
|
139 |
-
<span>
|
140 |
-
<input type="radio" name="chaty--selected-reason" value="2">
|
141 |
-
</span>
|
142 |
-
<span><?php _e('I found an alternative plugin', CHT_PRO_OPT); ?></span>
|
143 |
-
</label>
|
144 |
-
<div class="chaty--hidden-input">
|
145 |
-
<input class="" type="text" name="alt_plugin" id="alt_plugin" placeholder="<?php _e("What's the plugin's name?", CHT_PRO_OPT); ?>" />
|
146 |
-
</div>
|
147 |
-
<div class="chaty--internal-message"></div>
|
148 |
-
</li>
|
149 |
-
<li class="chaty--reason" data-input-type="" data-input-placeholder="">
|
150 |
-
<label>
|
151 |
-
<span>
|
152 |
-
<input type="radio" name="chaty--selected-reason" value="3">
|
153 |
-
</span>
|
154 |
-
<span><?php _e('It doesn’t work on my site', CHT_PRO_OPT); ?></span>
|
155 |
-
</label>
|
156 |
-
|
157 |
-
<div class="chaty--internal-message"></div>
|
158 |
-
</li>
|
159 |
-
<li class="chaty--reason" data-input-type="" data-input-placeholder="">
|
160 |
-
<label>
|
161 |
-
<span>
|
162 |
-
<input type="radio" name="chaty--selected-reason" value="4">
|
163 |
-
</span>
|
164 |
-
<span><?php _e('I’ll come back later', CHT_PRO_OPT); ?></span>
|
165 |
-
</label>
|
166 |
-
|
167 |
-
<div class="chaty--internal-message"></div>
|
168 |
-
</li>
|
169 |
-
<li class="chaty--reason" data-input-type="" data-input-placeholder="">
|
170 |
-
<label>
|
171 |
-
<span>
|
172 |
-
<input type="radio" name="chaty--selected-reason" value="5">
|
173 |
-
</span>
|
174 |
-
<span><?php _e('Other', CHT_PRO_OPT); ?></span>
|
175 |
-
</label>
|
176 |
-
<div class="chaty--hidden-input">
|
177 |
-
<input class="" type="text" name="other_reason" id="other_reason" placeholder="<?php _e("Would you like to share what's other reason?", CHT_PRO_OPT); ?>" />
|
178 |
-
</div>
|
179 |
-
<div class="chaty--internal-message"></div>
|
180 |
-
</li>
|
181 |
-
</ul>
|
182 |
</div>
|
183 |
<div class="chaty--popup-footer">
|
184 |
-
<label class="chaty--anonymous"
|
|
|
185 |
</label>
|
186 |
-
<input type="button" class="button button-secondary button-skip chaty--popup-skip-feedback"
|
187 |
-
value="Skip & Deactivate">
|
188 |
-
|
189 |
<div class="action-btns">
|
190 |
-
<span class="chaty--spinner"><img src="<?php echo admin_url('/images/spinner.gif'); ?>"
|
191 |
-
|
192 |
-
<
|
193 |
-
value="Submit & Deactivate" disabled="disabled">
|
194 |
-
<a href="#"
|
195 |
-
class="button button-primary chaty--popup-button-close"><?php _e('Cancel', CHT_PRO_OPT); ?></a>
|
196 |
-
|
197 |
</div>
|
198 |
</div>
|
199 |
</form>
|
@@ -232,26 +177,24 @@
|
|
232 |
$(this).closest("li").find('.chaty--hidden-input').show();
|
233 |
}
|
234 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
$('input[type="radio"][name="chaty--selected-reason"]').on('click', function (event) {
|
236 |
$(".chaty--popup-allow-deactivate").removeAttr('disabled');
|
237 |
});
|
238 |
$(document).on('submit', '#chaty--deactivate-form', function (event) {
|
239 |
event.preventDefault();
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
return false;
|
247 |
-
}
|
248 |
-
_reason_details = jQuery.trim(jQuery("#alt_plugin").val());
|
249 |
-
} else if (_reason == 5) {
|
250 |
-
if(jQuery.trim(jQuery("#other_reason").val()) == "") {
|
251 |
-
jQuery("#other_reason").after("<span class='chaty--error-message'>Please provide reason</span>");
|
252 |
-
return false;
|
253 |
-
}
|
254 |
-
_reason_details = jQuery.trim(jQuery("#other_reason").val());
|
255 |
}
|
256 |
|
257 |
jQuery('[name="chaty--selected-reason"]:checked').val();
|
@@ -262,8 +205,7 @@
|
|
262 |
data: {
|
263 |
action: 'chaty_plugin_deactivate',
|
264 |
reason: _reason,
|
265 |
-
|
266 |
-
reason_text: ''
|
267 |
},
|
268 |
beforeSend: function () {
|
269 |
$(".chaty--spinner").show();
|
112 |
color: #dd0000;
|
113 |
font-weight: 600;
|
114 |
}
|
115 |
+
.chaty--popup-body h3 {
|
116 |
+
line-height: 24px;
|
117 |
+
}
|
118 |
</style>
|
119 |
|
120 |
<div class="chaty--popup-overlay">
|
121 |
<div class="chaty--serveypanel">
|
122 |
<form action="#" method="post" id="chaty--deactivate-form">
|
123 |
<div class="chaty--popup-header">
|
124 |
+
<h2><?php _e('Quick feedback about Chaty', CHT_OPT); ?> 🙏</h2>
|
125 |
</div>
|
126 |
<div class="chaty--popup-body">
|
127 |
+
<h3><?php _e('Your feedback will help us improve the product, please tell us why did you decide to deactivate Chaty :)', CHT_OPT); ?></h3>
|
128 |
+
<div class="form-control">
|
129 |
+
<label></label>
|
130 |
+
<textarea placeholder="<?php echo _e("Your comment", CHT_OPT) ?>" id="chaty-deactivation-comment"></textarea>
|
131 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
</div>
|
133 |
<div class="chaty--popup-footer">
|
134 |
+
<label class="chaty--anonymous">
|
135 |
+
<input type="checkbox"/><?php _e('Anonymous feedback', CHT_OPT); ?>
|
136 |
</label>
|
137 |
+
<input type="button" class="button button-secondary button-skip chaty--popup-skip-feedback" value="Skip & Deactivate">
|
|
|
|
|
138 |
<div class="action-btns">
|
139 |
+
<span class="chaty--spinner"><img src="<?php echo admin_url('/images/spinner.gif'); ?>" alt=""></span>
|
140 |
+
<input type="submit" class="button button-secondary button-deactivate chaty--popup-allow-deactivate" value="Submit & Deactivate" disabled="disabled">
|
141 |
+
<a href="#" class="button button-primary chaty--popup-button-close"><?php _e('Cancel', CHT_OPT); ?></a>
|
|
|
|
|
|
|
|
|
142 |
</div>
|
143 |
</div>
|
144 |
</form>
|
177 |
$(this).closest("li").find('.chaty--hidden-input').show();
|
178 |
}
|
179 |
});
|
180 |
+
$(document).on("keyup", "#chaty-deactivation-comment", function(){
|
181 |
+
if($.trim($(this).val()) == "") {
|
182 |
+
$(".chaty--popup-allow-deactivate").attr("disabled", true);
|
183 |
+
} else {
|
184 |
+
$(".chaty--popup-allow-deactivate").attr("disabled", false);
|
185 |
+
}
|
186 |
+
});
|
187 |
$('input[type="radio"][name="chaty--selected-reason"]').on('click', function (event) {
|
188 |
$(".chaty--popup-allow-deactivate").removeAttr('disabled');
|
189 |
});
|
190 |
$(document).on('submit', '#chaty--deactivate-form', function (event) {
|
191 |
event.preventDefault();
|
192 |
+
_reason = "";
|
193 |
+
if(jQuery.trim(jQuery("#chaty-deactivation-comment").val()) == "") {
|
194 |
+
jQuery("#alt_plugin").after("<span class='chaty--error-message'>Please provide your feedback</span>");
|
195 |
+
return false;
|
196 |
+
} else {
|
197 |
+
_reason = jQuery.trim(jQuery("#chaty-deactivation-comment").val());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
}
|
199 |
|
200 |
jQuery('[name="chaty--selected-reason"]:checked').val();
|
205 |
data: {
|
206 |
action: 'chaty_plugin_deactivate',
|
207 |
reason: _reason,
|
208 |
+
nonce: '<?php echo wp_create_nonce("chaty_deactivate_nonce") ?>'
|
|
|
209 |
},
|
210 |
beforeSend: function () {
|
211 |
$(".chaty--spinner").show();
|
views/parts/help.php
CHANGED
@@ -14,6 +14,7 @@
|
|
14 |
<div class="form-button">
|
15 |
<button type="submit" class="chaty-help-button" ><?php echo __("Chat") ?></button>
|
16 |
<input type="hidden" name="action" value="wcp_admin_send_message_to_owner" >
|
|
|
17 |
</div>
|
18 |
</div>
|
19 |
</form>
|
14 |
<div class="form-button">
|
15 |
<button type="submit" class="chaty-help-button" ><?php echo __("Chat") ?></button>
|
16 |
<input type="hidden" name="action" value="wcp_admin_send_message_to_owner" >
|
17 |
+
<input type="hidden" id="nonce" name="nonce" value="<?php echo wp_create_nonce("chaty_send_message_to_owner") ?>">
|
18 |
</div>
|
19 |
</div>
|
20 |
</form>
|
views/parts/section3.php
CHANGED
@@ -16,7 +16,7 @@
|
|
16 |
</div>
|
17 |
</div>
|
18 |
</div>
|
19 |
-
|
20 |
<div class="text-center">
|
21 |
<button class="btn-save">
|
22 |
<?php _e('Save Changes', CHT_OPT); ?>
|
16 |
</div>
|
17 |
</div>
|
18 |
</div>
|
19 |
+
<input type="hidden" name="nonce" value="<?php echo wp_create_nonce("chaty_plugin_nonce") ?>">
|
20 |
<div class="text-center">
|
21 |
<button class="btn-save">
|
22 |
<?php _e('Save Changes', CHT_OPT); ?>
|