PluginProbe
Order Tracking – WordPress Status Tracking Plugin / 3.2.2
Order Tracking – WordPress Status Tracking Plugin v3.2.2
3.5.4 3.5.3 3.5.2 3.5.1 3.5.0 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.3.0 3.3.1 3.3.10 3.3.11 3.3.12 3.3.13 3.3.14 3.3.15 All 235 releases
order-tracking / includes / DeactivationSurvey.class.php

DeactivationSurvey.class.php in Order Tracking – WordPress Status Tracking Plugin 3.2.2, at includes/DeactivationSurvey.class.php

84 lines 3.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) exit;
3
4 if ( ! class_exists( 'ewdotpDeactivationSurvey' ) ) {
5 /**
6 * Class to handle plugin deactivation survey
7 *
8 * @since 3.0.0
9 */
10 class ewdotpDeactivationSurvey {
11
12 public function __construct() {
13 add_action( 'current_screen', array( $this, 'maybe_add_survey' ) );
14 }
15
16 public function maybe_add_survey() {
17 if ( in_array( get_current_screen()->id, array( 'plugins', 'plugins-network' ), true) ) {
18 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_deactivation_scripts') );
19 add_action( 'admin_footer', array( $this, 'add_deactivation_html') );
20 }
21 }
22
23 public function enqueue_deactivation_scripts() {
24 wp_enqueue_style( 'ewd-otp-deactivation-css', EWD_OTP_PLUGIN_URL . '/assets/css/plugin-deactivation.css' );
25 wp_enqueue_script( 'ewd-otp-deactivation-js', EWD_OTP_PLUGIN_URL . '/assets/js/plugin-deactivation.js', array( 'jquery' ) );
26
27 wp_localize_script( 'ewd-otp-deactivation-js', 'ewd_otp_deactivation_data', array( 'site_url' => site_url() ) );
28 }
29
30 public function add_deactivation_html() {
31
32 $install_time = get_option( 'ewd-otp-installation-time' );
33
34 $options = array(
35 1 => array(
36 'title' => esc_html__( 'I no longer need the plugin', 'order-tracking' ),
37 ),
38 2 => array(
39 'title' => esc_html__( 'I\'m switching to a different plugin', 'order-tracking' ),
40 'details' => esc_html__( 'Please share which plugin', 'order-tracking' ),
41 ),
42 3 => array(
43 'title' => esc_html__( 'I couldn\'t get the plugin to work', 'order-tracking' ),
44 'details' => esc_html__( 'Please share what wasn\'t working', 'order-tracking' ),
45 ),
46 4 => array(
47 'title' => esc_html__( 'It\'s a temporary deactivation', 'order-tracking' ),
48 ),
49 5 => array(
50 'title' => esc_html__( 'Other', 'order-tracking' ),
51 'details' => esc_html__( 'Please share the reason', 'order-tracking' ),
52 ),
53 );
54 ?>
55 <div class="ewd-otp-deactivate-survey-modal" id="ewd-otp-deactivate-survey-order-tracking">
56 <div class="ewd-otp-deactivate-survey-wrap">
57 <form class="ewd-otp-deactivate-survey" method="post" data-installtime="<?php echo $install_time; ?>">
58 <span class="ewd-otp-deactivate-survey-title"><span class="dashicons dashicons-testimonial"></span><?php echo ' ' . __( 'Quick Feedback', 'order-tracking' ); ?></span>
59 <span class="ewd-otp-deactivate-survey-desc"><?php echo __('If you have a moment, please share why you are deactivating Order Tracking:', 'order-tracking' ); ?></span>
60 <div class="ewd-otp-deactivate-survey-options">
61 <?php foreach ( $options as $id => $option ) : ?>
62 <div class="ewd-otp-deactivate-survey-option">
63 <label for="ewd-otp-deactivate-survey-option-order-tracking-<?php echo $id; ?>" class="ewd-otp-deactivate-survey-option-label">
64 <input id="ewd-otp-deactivate-survey-option-order-tracking-<?php echo $id; ?>" class="ewd-otp-deactivate-survey-option-input" type="radio" name="code" value="<?php echo $id; ?>" />
65 <span class="ewd-otp-deactivate-survey-option-reason"><?php echo $option['title']; ?></span>
66 </label>
67 <?php if ( ! empty( $option['details'] ) ) : ?>
68 <input class="ewd-otp-deactivate-survey-option-details" type="text" placeholder="<?php echo $option['details']; ?>" />
69 <?php endif; ?>
70 </div>
71 <?php endforeach; ?>
72 </div>
73 <div class="ewd-otp-deactivate-survey-footer">
74 <button type="submit" class="ewd-otp-deactivate-survey-submit button button-primary button-large"><?php _e('Submit and Deactivate', 'order-tracking' ); ?></button>
75 <a href="#" class="ewd-otp-deactivate-survey-deactivate"><?php _e('Skip and Deactivate', 'order-tracking' ); ?></a>
76 </div>
77 </form>
78 </div>
79 </div>
80 <?php
81 }
82 }
83
84 }