PluginProbe
Elementor Website Builder – more than just a page builder / 3.0.13
Elementor Website Builder – more than just a page builder v3.0.13
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
← All changes | core/admin/feedback.php +45 -22 4.2.03.0.13 View file →
@@ -2,11 +2,9 @@
2 2 namespace Elementor\Core\Admin;
3 3
4 4 use Elementor\Api;
5 5 use Elementor\Core\Base\Module;
6 -use Elementor\Plugin;
7 6 use Elementor\Tracker;
8 -use Elementor\Utils;
9 7
10 8 if ( ! defined( 'ABSPATH' ) ) {
11 9 exit; // Exit if accessed directly.
12 10 }
@@ -23,8 +21,10 @@
23 21 return;
24 22 }
25 23
26 24 add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_feedback_dialog_scripts' ] );
25 +
26 + add_filter( 'elementor/admin/localize_settings', [ $this, 'localize_feedback_dialog_settings' ] );
27 27 } );
28 28
29 29 // Ajax.
30 30 add_action( 'wp_ajax_elementor_deactivate_feedback', [ $this, 'ajax_elementor_deactivate_feedback' ] );
@@ -54,9 +54,9 @@
54 54 */
55 55 public function enqueue_feedback_dialog_scripts() {
56 56 add_action( 'admin_footer', [ $this, 'print_deactivate_feedback_dialog' ] );
57 57
58 - $suffix = Utils::is_script_debug() ? '' : '.min';
58 + $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
59 59
60 60 wp_register_script(
61 61 'elementor-admin-feedback',
62 62 ELEMENTOR_ASSETS_URL . 'js/admin-feedback' . $suffix . '.js',
@@ -61,9 +61,8 @@
61 61 'elementor-admin-feedback',
62 62 ELEMENTOR_ASSETS_URL . 'js/admin-feedback' . $suffix . '.js',
63 63 [
64 64 'elementor-common',
65 - 'wp-i18n',
66 65 ],
67 66 ELEMENTOR_VERSION,
68 67 true
69 68 );
@@ -68,10 +67,19 @@
68 67 true
69 68 );
70 69
71 70 wp_enqueue_script( 'elementor-admin-feedback' );
71 + }
72 72
73 - wp_set_script_translations( 'elementor-admin-feedback', 'elementor' );
73 + /**
74 + * @since 2.3.0
75 + * @access public
76 + */
77 + public function localize_feedback_dialog_settings( $localized_settings ) {
78 + $localized_settings['i18n']['submit_n_deactivate'] = __( 'Submit & Deactivate', 'elementor' );
79 + $localized_settings['i18n']['skip_n_deactivate'] = __( 'Skip & Deactivate', 'elementor' );
80 +
81 + return $localized_settings;
74 82 }
75 83
76 84 /**
77 85 * Print deactivate feedback dialog.
@@ -85,31 +93,31 @@
85 93 */
86 94 public function print_deactivate_feedback_dialog() {
87 95 $deactivate_reasons = [
88 96 'no_longer_needed' => [
89 - 'title' => esc_html__( 'I no longer need the plugin', 'elementor' ),
97 + 'title' => __( 'I no longer need the plugin', 'elementor' ),
90 98 'input_placeholder' => '',
91 99 ],
92 100 'found_a_better_plugin' => [
93 - 'title' => esc_html__( 'I found a better plugin', 'elementor' ),
94 - 'input_placeholder' => esc_html__( 'Please share which plugin', 'elementor' ),
101 + 'title' => __( 'I found a better plugin', 'elementor' ),
102 + 'input_placeholder' => __( 'Please share which plugin', 'elementor' ),
95 103 ],
96 104 'couldnt_get_the_plugin_to_work' => [
97 - 'title' => esc_html__( 'I couldn\'t get the plugin to work', 'elementor' ),
105 + 'title' => __( 'I couldn\'t get the plugin to work', 'elementor' ),
98 106 'input_placeholder' => '',
99 107 ],
100 108 'temporary_deactivation' => [
101 - 'title' => esc_html__( 'It\'s a temporary deactivation', 'elementor' ),
109 + 'title' => __( 'It\'s a temporary deactivation', 'elementor' ),
102 110 'input_placeholder' => '',
103 111 ],
104 112 'elementor_pro' => [
105 - 'title' => esc_html__( 'I have Elementor Pro', 'elementor' ),
113 + 'title' => __( 'I have Elementor Pro', 'elementor' ),
106 114 'input_placeholder' => '',
107 - 'alert' => esc_html__( 'Wait! Don\'t deactivate Elementor. You have to activate both Elementor and Elementor Pro in order for the plugin to work.', 'elementor' ),
115 + 'alert' => __( 'Wait! Don\'t deactivate Elementor. You have to activate both Elementor and Elementor Pro in order for the plugin to work.', 'elementor' ),
108 116 ],
109 117 'other' => [
110 - 'title' => esc_html__( 'Other', 'elementor' ),
111 - 'input_placeholder' => esc_html__( 'Please share the reason', 'elementor' ),
118 + 'title' => __( 'Other', 'elementor' ),
119 + 'input_placeholder' => __( 'Please share the reason', 'elementor' ),
112 120 ],
113 121 ];
114 122
115 123 ?>
@@ -115,9 +123,9 @@
115 123 ?>
116 124 <div id="elementor-deactivate-feedback-dialog-wrapper">
117 125 <div id="elementor-deactivate-feedback-dialog-header">
118 126 <i class="eicon-elementor-square" aria-hidden="true"></i>
119 - <span id="elementor-deactivate-feedback-dialog-header-title"><?php echo esc_html__( 'Quick Feedback', 'elementor' ); ?></span>
127 + <span id="elementor-deactivate-feedback-dialog-header-title"><?php echo __( 'Quick Feedback', 'elementor' ); ?></span>
120 128 </div>
121 129 <form id="elementor-deactivate-feedback-dialog-form" method="post">
122 130 <?php
123 131 wp_nonce_field( '_elementor_deactivate_feedback_nonce' );
@@ -123,9 +131,9 @@
123 131 wp_nonce_field( '_elementor_deactivate_feedback_nonce' );
124 132 ?>
125 133 <input type="hidden" name="action" value="elementor_deactivate_feedback" />
126 134
127 - <div id="elementor-deactivate-feedback-dialog-form-caption"><?php echo esc_html__( 'If you have a moment, please share why you are deactivating Elementor:', 'elementor' ); ?></div>
135 + <div id="elementor-deactivate-feedback-dialog-form-caption"><?php echo __( 'If you have a moment, please share why you are deactivating Elementor:', 'elementor' ); ?></div>
128 136 <div id="elementor-deactivate-feedback-dialog-form-body">
129 137 <?php foreach ( $deactivate_reasons as $reason_key => $reason ) : ?>
130 138 <div class="elementor-deactivate-feedback-dialog-input-wrapper">
131 139 <input id="elementor-deactivate-feedback-<?php echo esc_attr( $reason_key ); ?>" class="elementor-deactivate-feedback-dialog-input" type="radio" name="reason_key" value="<?php echo esc_attr( $reason_key ); ?>" />
@@ -154,23 +162,38 @@
154 162 * @since 1.0.0
155 163 * @access public
156 164 */
157 165 public function ajax_elementor_deactivate_feedback() {
158 - $wpnonce = Utils::get_super_global_value( $_POST, '_wpnonce' ); // phpcs:ignore -- Nonce verification is made in `wp_verify_nonce()`.
159 - if ( ! wp_verify_nonce( $wpnonce, '_elementor_deactivate_feedback_nonce' ) ) {
166 + if ( ! isset( $_POST['_wpnonce'] ) || ! wp_verify_nonce( $_POST['_wpnonce'], '_elementor_deactivate_feedback_nonce' ) ) {
160 167 wp_send_json_error();
161 168 }
162 169
163 - if ( ! current_user_can( 'activate_plugins' ) ) {
164 - wp_send_json_error( 'Permission denied' );
170 + $reason_text = '';
171 + $reason_key = '';
172 +
173 + if ( ! empty( $_POST['reason_key'] ) ) {
174 + $reason_key = $_POST['reason_key'];
165 175 }
166 176
167 - $reason_key = Utils::get_super_global_value( $_POST, 'reason_key' ) ?? '';
168 - $reason_text = Utils::get_super_global_value( $_POST, "reason_{$reason_key}" ) ?? '';
177 + if ( ! empty( $_POST[ "reason_{$reason_key}" ] ) ) {
178 + $reason_text = $_POST[ "reason_{$reason_key}" ];
179 + }
169 180
170 181 Api::send_feedback( $reason_key, $reason_text );
171 182
172 183 wp_send_json_success();
184 + }
185 +
186 + /**
187 + * @since 2.3.0
188 + * @access protected
189 + */
190 + protected function get_init_settings() {
191 + if ( ! $this->is_plugins_screen() ) {
192 + return [];
193 + }
194 +
195 + return [ 'is_tracker_opted_in' => Tracker::is_allow_track() ];
173 196 }
174 197
175 198 /**
176 199 * @since 2.3.0