PluginProbe
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services / 3.2.0
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services v3.2.0
8.7.8 8.7.7 8.7.6 8.7.5 8.7.4 8.7.3 8.7.2 8.7.1 8.7.0 8.6.9 8.6.8 8.6.7 8.6.6 8.6.5 8.6.4 8.6.2 8.6.1 8.6.0 8.5.9 8.5.8 8.5.7 8.5.6 8.5.5 8.5.4 8.5.3 All 534 releases
← All changes | class-plugin-deactivate-feedback.php +26 -44 8.6.03.2.0 View file →
@@ -4,11 +4,11 @@
4 4 if ( ! defined( 'ABSPATH' ) ) {
5 5 exit;
6 6 }
7 7
8 -if( ! class_exists( 'Qcld_Wp_Usage_Feedback') ) {
8 +if( ! class_exists( 'Wp_Usage_Feedback') ) {
9 9
10 - class Qcld_Wp_Usage_Feedback {
10 + class Wp_Usage_Feedback {
11 11
12 12 private $wpbot_version = '1.0.0';
13 13 private $home_url = '';
14 14 private $plugin_file = '';
@@ -58,9 +58,9 @@
58 58
59 59 // Deactivation
60 60 add_filter( 'plugin_action_links_' . plugin_basename( $this->plugin_file ), array( $this, 'filter_action_links' ) );
61 61 add_action( 'admin_footer-plugins.php', array( $this, 'goodbye_ajax' ) );
62 - add_action( 'wp_ajax_qcld_goodbye_form', array( $this, 'qcld_goodbye_form_callback' ) );
62 + add_action( 'wp_ajax_goodbye_form', array( $this, 'goodbye_form_callback' ) );
63 63
64 64
65 65 }
66 66
@@ -126,9 +126,9 @@
126 126 $plugin = $this->plugin_data();
127 127 if( empty( $plugin ) ) {
128 128 // We can't find the plugin data
129 129 // Send a message back to our home site
130 - $body['message'] .= __( 'We can\'t detect any plugin information. This is most probably because you have not included the code in the plugin main file.', 'chatbot' );
130 + $body['message'] .= __( 'We can\'t detect any plugin information. This is most probably because you have not included the code in the plugin main file.', 'wpchatbot' );
131 131 $body['status'] = 'Data not found'; // Never translated
132 132 } else {
133 133 if( isset( $plugin['Name'] ) ) {
134 134 $body['plugin'] = sanitize_text_field( $plugin['Name'] );
@@ -205,19 +205,19 @@
205 205 * @since 1.0.0
206 206 */
207 207 public function form_default_text() {
208 208 $form = array();
209 - $form['heading'] = __( 'Sorry to see you go', 'chatbot' );
210 - $form['body'] = '';
209 + $form['heading'] = __( 'Sorry to see you go', 'wpchatbot' );
210 + $form['body'] = __( 'Before you deactivate the plugin, would you quickly give us your reason for doing so?', 'wpchatbot' );
211 211 $form['options'] = array(
212 - __( 'Found a Bug', 'chatbot' ),
213 - __( 'Need More Features', 'chatbot' ),
214 - __( 'Deactivating Temporarily', 'chatbot' ),
215 - __( 'Upgrading to Pro', 'chatbot' ),
212 + __( 'Found a Bug', 'wpchatbot' ),
213 + __( 'Need More Features', 'wpchatbot' ),
214 + __( 'Deactivating Temporarily', 'wpchatbot' ),
215 + __( 'Upgrading to Pro', 'wpchatbot' ),
216 216
217 217 );
218 - $form['email'] = __( 'Please provide email so we can contact with bug fixes', 'chatbot' );
219 - $form['details'] = __( 'Please provide some details so we can improve the plugin', 'chatbot' );
218 + $form['email'] = __( 'Please provide your email so we can contact you if needed.', 'wpchatbot' );
219 + $form['details'] = __( 'Please provide some details so we can improve the plugin', 'wpchatbot' );
220 220 return $form;
221 221 }
222 222
223 223 /**
@@ -247,22 +247,18 @@
247 247 $html = '<div class="wpb-goodbye-form-head"><strong>' . esc_html( $form['heading'] ) . '</strong></div>';
248 248 $html .= '<div class="wpb-goodbye-form-body"><p>' . esc_html( $form['body'] ) . '</p>';
249 249 if( is_array( $form['options'] ) ) {
250 250 $html .= '<div class="wpb-goodbye-options"><p>';
251 - /*
252 251 foreach( $form['options'] as $option ) {
253 252 $html .= '<input type="radio" name="wpb-goodbye-options" id="' . str_replace( " ", "", esc_attr( $option ) ) . '" value="' . esc_attr( $option ) . '"> <label for="' . str_replace( " ", "", esc_attr( $option ) ) . '">' . esc_attr( $option ) . '</label><br>';
254 253 }
255 - */
256 - $html .= '</p><div id="wpb_additional_content" style=""><label for="wpb-goodbye-reasons">' . esc_html( $form['email'] ) .'</label><br><input type="email" name="wpb-goodbye-email" id="wpb-goodbye-email" value="'.get_option('admin_email').'" /> (Optional)';
254 + $html .= '</p><div id="wpb_additional_content" style="display:none;"><label for="wpb-goodbye-reasons">' . esc_html( $form['email'] ) .'</label><br><input type="email" name="wpb-goodbye-email" id="wpb-goodbye-email" value="'.get_option('admin_email').'" /> (Optional)';
257 255
258 - $html .= '<br><label for="wpb-goodbye-reasons">' . esc_html( $form['details'] ) .'</label><textarea name="wpb-goodbye-reasons" id="wpb-goodbye-reasons" rows="2" style="width:100%"></textarea><div id="wpbot_deactivation_error"></div></div>';
259 -
256 + $html .= '<br><label for="wpb-goodbye-reasons">' . esc_html( $form['details'] ) .'</label><textarea name="wpb-goodbye-reasons" id="wpb-goodbye-reasons" rows="2" style="width:100%"></textarea></div>';
260 257 $html .= '</div><!-- .wpb-goodbye-options -->';
261 258 }
262 259 $html .= '</div><!-- .wpb-goodbye-form-body -->';
263 - $html .= '<p class="deactivating-spinner"><span class="spinner"></span> ' . __( 'Submitting form', 'chatbot' ) . '</p>';
264 -
260 + $html .= '<p class="deactivating-spinner"><span class="spinner"></span> ' . __( 'Submitting form', 'wpbot-plugin' ) . '</p>';
265 261 ?>
266 262 <div class="wpb-goodbye-form-bg"></div>
267 263 <style type="text/css">
268 264 .wpb-form-active .wpb-goodbye-form-bg {
@@ -316,19 +312,13 @@
316 312 visibility: visible;
317 313 }
318 314 .wpb-goodbye-form-footer {
319 315 padding: 8px 18px;
320 - min-height: 40px;
321 316 }
322 - #wpbot_deactivation_error{color:red}
323 - .wpbot_submit_deactivate{float:right}
324 - .wpbot_just_deactivate{float: left;
325 - font-size: 12px;
326 - }
327 317 </style>
328 318 <script>
329 319 jQuery(document).ready(function($){
330 - $('input[type=radio]').on('change', function() {
320 + $('input[type=radio]').live('change', function() {
331 321 if($(this).val()=='Deactivating Temporarily' || $(this).val()=='Upgrading to Pro'){
332 322 $('#wpb_additional_content').hide();
333 323 }else{
334 324 $('#wpb_additional_content').show();
@@ -340,27 +330,16 @@
340 330 // We'll send the user to this deactivation link when they've completed or dismissed the form
341 331 var url = document.getElementById("wpb-goodbye-link-<?php echo esc_attr( $this->plugin_name ); ?>");
342 332 $('body').toggleClass('wpb-form-active');
343 333 $("#wpb-goodbye-form-<?php echo esc_attr( $this->plugin_name ); ?>").fadeIn();
344 - $("#wpb-goodbye-form-<?php echo esc_attr( $this->plugin_name ); ?>").html( '<?php echo wp_kses_post( $html ); ?>' + '<div class="wpb-goodbye-form-footer"><p><a class="wpbot_just_deactivate" href="'+url+'">Just Deactivate</a> <a id="wpb-submit-form" class="button primary wpbot_submit_deactivate" href="#">Submit and Deactivate</a></p></div>');
345 - $('#wpb-goodbye-reasons').focus();
334 + $("#wpb-goodbye-form-<?php echo esc_attr( $this->plugin_name ); ?>").html( '<?php echo $html; ?>' + '<div class="wpb-goodbye-form-footer"><p><a id="wpb-submit-form" class="button primary" href="#">Submit and Deactivate</a>&nbsp;<a class="secondary button" href="'+url+'">Just Deactivate</a></p></div>');
346 335 $('#wpb-submit-form').on('click', function(e){
347 -
348 -
349 - e.preventDefault();
350 -
351 - if($('#wpb-goodbye-reasons').val()==''){
352 - jQuery('#wpbot_deactivation_error').html('Please provide some details to improve the plugin for you!');
353 - $('#wpb-goodbye-reasons').focus();
354 - return;
355 - }
356 -
357 336 // As soon as we click, the body of the form should disappear
358 337 $("#wpb-goodbye-form-<?php echo esc_attr( $this->plugin_name ); ?> .wpb-goodbye-form-body").fadeOut();
359 338 $("#wpb-goodbye-form-<?php echo esc_attr( $this->plugin_name ); ?> .wpb-goodbye-form-footer").fadeOut();
360 339 // Fade in spinner
361 340 $("#wpb-goodbye-form-<?php echo esc_attr( $this->plugin_name ); ?> .deactivating-spinner").fadeIn();
362 -
341 + e.preventDefault();
363 342 var values = new Array();
364 343 $.each($("input[name='wpb-goodbye-options[]']:checked"), function(){
365 344 values.push($(this).val());
366 345 });
@@ -366,13 +345,13 @@
366 345 });
367 346 var email = $('#wpb-goodbye-email').val();
368 347 var details = $('#wpb-goodbye-reasons').val();
369 348 var data = {
370 - 'action': 'qcld_goodbye_form',
349 + 'action': 'goodbye_form',
371 350 'values': values,
372 351 'details': details,
373 352 'email': email,
374 - 'security': "<?php echo sanitize_key( wp_create_nonce( 'wpbot_goodbye_form' ) ); ?>",
353 + 'security': "<?php echo wp_create_nonce ( 'wpbot_goodbye_form' ); ?>",
375 354 'dataType': "json"
376 355 }
377 356
378 357 $.post(
@@ -397,13 +376,16 @@
397 376 /**
398 377 * AJAX callback when the form is submitted
399 378 * @since 1.0.0
400 379 */
401 - public function qcld_goodbye_form_callback() {
380 + public function goodbye_form_callback() {
402 381 check_ajax_referer( 'wpbot_goodbye_form', 'security' );
403 -
382 + if( isset( $_POST['values'] ) ) {
383 + $values = json_encode( wp_unslash( $_POST['values'] ) );
384 + update_option( 'wpbot_deactivation_reason_' . $this->plugin_name, $values );
385 + }
404 386 if( isset( $_POST['details'] ) ) {
405 - $details = sanitize_text_field(wp_unslash($_POST['details']));
387 + $details = sanitize_text_field( $_POST['details'] );
406 388 update_option( 'wpbot_deactivation_details_' . $this->plugin_name, $details );
407 389 }
408 390
409 391 echo 'success';