PluginProbe
Photo Gallery by Re Gallery: Responsive Image Gallery with AI SEO / trunk
Photo Gallery by Re Gallery: Responsive Image Gallery with AI SEO vtrunk
1.20.14 1.20.13 1.20.12 1.20.11 1.20.10 1.20.9 1.20.8 1.20.7 1.20.6 1.20.5 1.20.4 1.20.3 1.20.2 1.20.1 1.20.0 1.19.2 1.19.1 1.19.0 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.11.0 All 135 releases
regallery / includes / deactivate.php

deactivate.php in Photo Gallery by Re Gallery: Responsive Image Gallery with AI SEO trunk, at includes/deactivate.php

133 lines 5.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 defined('ABSPATH') || die('Access Denied');
3
4 class REACG_Deactivate {
5 private $obj;
6
7 public function __construct($that) {
8 $this->obj = $that;
9
10 $request_uri = !empty($_SERVER['REQUEST_URI']) ? sanitize_text_field(wp_unslash($_SERVER['REQUEST_URI'])) : '';
11 if ( strpos($request_uri, "plugins.php") !== FALSE ) {
12 $this->enqueue_scripts();
13 add_action('admin_footer', array( $this, 'content' ));
14 }
15
16 add_filter('plugin_action_links_' . $this->obj->main_file, array( $this, 'action_links' ));
17
18 add_filter("plugin_row_meta", array($this, 'meta_links'), 10, 2);
19 }
20
21 public function content() {
22 $reasons = [
23 1 => __("It is hard to use", "regallery"),
24 2 => __("I didn't find the features I needed", "regallery"),
25 3 => __("It's a temporary deactivation", "regallery"),
26 4 => __("I'd like someone from the Re Gallery team to contact me", "regallery"),
27 ];
28 $current_user = wp_get_current_user();
29 $email = $current_user->exists() ? $current_user->user_email : "";
30 ?>
31 <div id="reacg-deactivate-popup-overlay" class="reacg-form-popup-overlay" style="display: none;">
32 <div class="reacg-popup" data-version="<?php echo esc_attr($this->obj->version); ?>">
33 <div class="reacg-popup-header">
34 <?php esc_html_e("Quick feedback", 'regallery'); ?>
35 <span class="reacg-popup-close dashicons dashicons-no"></span>
36 </div>
37 <div class="reacg-popup-body">
38 <div class="reacg-note-wrapper">
39 <?php esc_html_e("We are sorry to see you go!", 'regallery'); ?>😔
40 <?php esc_html_e("If you have a moment, please share your thoughts: it helps us improve and make things better for everyone.", 'regallery'); ?>
41 </div>
42 <div class="reacg-reasonType-wrapper">
43 <?php
44 foreach ( $reasons as $key => $reason ) {
45 ?>
46 <div>
47 <label>
48 <input $key === 4 ? checked="checked" : '' type="radio" class="reacg-reasonType" name="reacg-reasonType" value="<?php echo esc_attr($key); ?>" alt="<?php echo esc_attr($reason); ?>" />
49 <?php echo esc_attr($reason); ?>
50 </label>
51 </div>
52 <?php
53 }
54 ?>
55 </div>
56 <div class="reacg-reason-wrapper">
57 <label>
58 <strong><?php esc_html_e("Would you like to tell us more?", 'regallery'); ?></strong>
59 <textarea class="reacg-reason" rows="4" placeholder="<?php esc_html_e("What were you trying to accomplish? Was there a feature you expected, something that was confusing, or anything we could do better?", 'regallery'); ?>"></textarea>
60 </label>
61 </div>
62 </div>
63 <div class="reacg-popup-footer">
64 <div class="reacg-email-wrapper">
65 <input type="email" name="reacg-email" placeholder="<?php esc_html_e("Please enter your email", 'regallery'); ?>" value="<?php echo esc_attr(sanitize_email($email)); ?>" />
66 </div>
67 <div class="reacg-agreement-wrapper">
68 <label>
69 <input type="checkbox" class="reacg-agreement" />
70 <?php esc_html_e("By submitting this form your email and website URL will be collected!", 'regallery'); ?>
71 </label>
72 </div>
73 <div class="reacg-buttons-wrapper">
74 <a class="button button-primary reacg-submit" disabled="disabled">
75 <?php esc_html_e("Submit and Deactivate", 'regallery'); ?>
76 </a>
77 <span class="spinner"></span>
78 <a class="button reacg-skip">
79 <?php esc_html_e("Skip and Deactivate", 'regallery'); ?>
80 </a>
81 </div>
82 </div>
83 </div>
84 </div>
85 <?php
86 }
87
88 public function enqueue_scripts() {
89 wp_enqueue_style($this->obj->prefix . '_deactive', $this->obj->plugin_url . '/assets/css/deactivation.css', [], $this->obj->version);
90 wp_enqueue_script($this->obj->prefix . '_deactive', $this->obj->plugin_url . '/assets/js/deactivation.js', ['jquery'], $this->obj->version, TRUE);
91 wp_localize_script($this->obj->prefix . '_deactive', 'reacg_deactivation', array(
92 'core_rest_url_v2' => $this->obj->core_rest_url_v2,
93 ));
94 }
95
96 /**
97 * Add the plugin meta links.
98 *
99 * @param $meta_fields
100 * @param $file
101 *
102 * @return mixed
103 */
104 public function meta_links($meta_fields, $file) {
105 if ( $this->obj->main_file === $file ) {
106 $meta_fields[] = "<a href='" . esc_url(REACG_WP_PLUGIN_SUPPORT_URL) . "' target='_blank'>" . esc_html__('Ask a question', 'regallery') . "</a>";
107
108 $rating = "<a class='reacg-rating' href='" . esc_url(REACG_WP_PLUGIN_REVIEW_URL) . "' target='_blank' title='" . esc_html__('Rate', 'regallery') . "'>";
109 $rating .= str_repeat("<span class='dashicons dashicons-star-filled'></span>", 5);
110 $rating .= "</a>";
111 $meta_fields[] = $rating;
112 }
113
114 return $meta_fields;
115 }
116
117 /**
118 * Add action links to the plugin.
119 *
120 * @param $links
121 *
122 * @return array
123 */
124 function action_links( $links ) {
125 $additional_links = [
126 "<a href='" . esc_url(add_query_arg(['utm_medium' => 'plugins_list', 'utm_campaign' => 'faq'], REACG_WEBSITE_URL_UTM . '#faq')) . "' target='_blank'>" . esc_html__('FAQ', 'regallery') . "</a>",
127 "<a href='" . esc_url(REACG_WP_PLUGIN_SUPPORT_URL) . "' target='_blank'>" . esc_html__('Help', 'regallery') . "</a>",
128 !REACG_PLAYGROUND ? "<a href='" . esc_url(add_query_arg(['utm_medium' => 'plugins_list', 'utm_campaign' => 'upgrade'], REACG_PRICING_URL_UTM)) . "' target='_blank' class='reacg-upgrade reacg-hidden'>" . REACG_BUY_NOW_TEXT . "</a>" : "",
129 ];
130 return array_merge( $links, $additional_links );
131 }
132 }
133