| @@ -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'] = __( '', '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 email so we can contact with bug fixes', '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 | /** |
| @@ -259,10 +259,9 @@ | ||
| 259 | 259 | |
| 260 | 260 | $html .= '</div><!-- .wpb-goodbye-options -->'; |
| 261 | 261 | } |
| 262 | 262 | $html .= '</div><!-- .wpb-goodbye-form-body -->'; |
| 263 | - $html .= '<p class="deactivating-spinner"><span class="spinner"></span> ' . __( 'Submitting form', 'chatbot' ) . '</p>'; | |
| 264 | - | |
| 263 | + $html .= '<p class="deactivating-spinner"><span class="spinner"></span> ' . __( 'Submitting form', 'wpbot-plugin' ) . '</p>'; | |
| 265 | 264 | ?> |
| 266 | 265 | <div class="wpb-goodbye-form-bg"></div> |
| 267 | 266 | <style type="text/css"> |
| 268 | 267 | .wpb-form-active .wpb-goodbye-form-bg { |
| @@ -326,9 +325,9 @@ | ||
| 326 | 325 | } |
| 327 | 326 | </style> |
| 328 | 327 | <script> |
| 329 | 328 | jQuery(document).ready(function($){ |
| 330 | - $('input[type=radio]').on('change', function() { | |
| 329 | + $('input[type=radio]').live('change', function() { | |
| 331 | 330 | if($(this).val()=='Deactivating Temporarily' || $(this).val()=='Upgrading to Pro'){ |
| 332 | 331 | $('#wpb_additional_content').hide(); |
| 333 | 332 | }else{ |
| 334 | 333 | $('#wpb_additional_content').show(); |
| @@ -340,9 +339,9 @@ | ||
| 340 | 339 | // We'll send the user to this deactivation link when they've completed or dismissed the form |
| 341 | 340 | var url = document.getElementById("wpb-goodbye-link-<?php echo esc_attr( $this->plugin_name ); ?>"); |
| 342 | 341 | $('body').toggleClass('wpb-form-active'); |
| 343 | 342 | $("#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>'); | |
| 343 | + $("#wpb-goodbye-form-<?php echo esc_attr( $this->plugin_name ); ?>").html( '<?php echo $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 | 344 | $('#wpb-goodbye-reasons').focus(); |
| 346 | 345 | $('#wpb-submit-form').on('click', function(e){ |
| 347 | 346 | |
| 348 | 347 | |
| @@ -366,13 +365,13 @@ | ||
| 366 | 365 | }); |
| 367 | 366 | var email = $('#wpb-goodbye-email').val(); |
| 368 | 367 | var details = $('#wpb-goodbye-reasons').val(); |
| 369 | 368 | var data = { |
| 370 | - 'action': 'qcld_goodbye_form', | |
| 369 | + 'action': 'goodbye_form', | |
| 371 | 370 | 'values': values, |
| 372 | 371 | 'details': details, |
| 373 | 372 | 'email': email, |
| 374 | - 'security': "<?php echo sanitize_key( wp_create_nonce( 'wpbot_goodbye_form' ) ); ?>", | |
| 373 | + 'security': "<?php echo wp_create_nonce ( 'wpbot_goodbye_form' ); ?>", | |
| 375 | 374 | 'dataType': "json" |
| 376 | 375 | } |
| 377 | 376 | |
| 378 | 377 | $.post( |
| @@ -397,13 +396,16 @@ | ||
| 397 | 396 | /** |
| 398 | 397 | * AJAX callback when the form is submitted |
| 399 | 398 | * @since 1.0.0 |
| 400 | 399 | */ |
| 401 | - public function qcld_goodbye_form_callback() { | |
| 400 | + public function goodbye_form_callback() { | |
| 402 | 401 | check_ajax_referer( 'wpbot_goodbye_form', 'security' ); |
| 403 | - | |
| 402 | + if( isset( $_POST['values'] ) ) { | |
| 403 | + $values = json_encode( wp_unslash( $_POST['values'] ) ); | |
| 404 | + update_option( 'wpbot_deactivation_reason_' . $this->plugin_name, $values ); | |
| 405 | + } | |
| 404 | 406 | if( isset( $_POST['details'] ) ) { |
| 405 | - $details = sanitize_text_field(wp_unslash($_POST['details'])); | |
| 407 | + $details = sanitize_text_field( $_POST['details'] ); | |
| 406 | 408 | update_option( 'wpbot_deactivation_details_' . $this->plugin_name, $details ); |
| 407 | 409 | } |
| 408 | 410 | |
| 409 | 411 | echo 'success'; |