PluginProbe ʕ •ᴥ•ʔ
WP STAGING – WordPress Backups, Restore, Migration & Clone / 3.0.2
WP STAGING – WordPress Backups, Restore, Migration & Clone v3.0.2
4.11.2 4.11.1 4.11.0 4.10.0 4.9.5 4.9.4 4.9.3 4.9.2 4.9.1 4.9.0 4.8.1 trunk 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.10.0 3.2.0 3.3.1 3.3.2 3.3.3 3.4.1 3.4.3 3.5.0 3.6.0 3.7.1 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.8.7 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 4.0.0 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.2.0 4.2.1 4.3.0 4.3.1 4.3.2 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.7.2 4.7.3 4.8.0
wp-staging / Backend / Feedback / Feedback.php
wp-staging / Backend / Feedback Last commit date
Feedback.php 3 years ago
Feedback.php
78 lines
1 <?php
2
3 namespace WPStaging\Backend\Feedback;
4
5 use WP_User;
6
7 class Feedback
8 {
9
10 /**
11 * Current page is plugins.php
12 * @global array $pagenow
13 * @return bool
14 */
15 private function isPluginsPage()
16 {
17 global $pagenow;
18 return ( $pagenow === 'plugins.php' );
19 }
20
21 /**
22 * Load feedback form
23 *
24 * @todo check if this is being used, remove otherwise.
25 */
26 public function loadForm()
27 {
28
29 $screen = get_current_screen();
30 if (!is_admin() && !$this->isPluginsPage()) {
31 return;
32 }
33
34 $current_user = wp_get_current_user();
35 if (!($current_user instanceof WP_User)) {
36 $email = '';
37 } else {
38 $email = trim($current_user->user_email);
39 }
40
41 include WPSTG_PLUGIN_DIR . 'Backend/views/feedback/deactivate-feedback.php';
42 }
43
44 /**
45 * @return void
46 */
47 public function sendMail()
48 {
49
50 if (!empty($_POST['data'])) {
51 // phpcs:ignore
52 parse_str($_POST['data'], $form); // This is a js serialised string. It needs to be parsed first. It will be sanitised on the next lines after parsing it.
53 }
54
55 $text = '';
56 if (!empty($form['wpstg_disable_text'])) {
57 $text = sanitize_text_field(implode("\n\r", (array)$form['wpstg_disable_text']));
58 }
59
60 $headers = [];
61
62 $from = isset($form['wpstg_disable_from']) ? sanitize_email($form['wpstg_disable_from']) : '';
63 if ($from) {
64 $headers[] = "From: $from";
65 $headers[] = "Reply-To: $from";
66 }
67
68 $subject = isset($form['wpstg_disable_reason']) ? 'WP Staging Free: ' . sanitize_text_field($form['wpstg_disable_reason']) : 'WP Staging Free: (no reason given)';
69
70 $success = wp_mail('feedback@wp-staging.com', $subject, $text, $headers);
71
72 if ($success) {
73 wp_die(1);
74 }
75 wp_die(0);
76 }
77 }
78