PluginProbe
Elementor Website Builder – more than just a page builder / 3.4.3
Elementor Website Builder – more than just a page builder v3.4.3
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/common/modules/ajax/module.php +14 -10 4.1.0-dev13.4.3 View file →
@@ -3,9 +3,8 @@
3 3
4 4 use Elementor\Core\Base\Module as BaseModule;
5 5 use Elementor\Core\Utils\Exceptions;
6 6 use Elementor\Plugin;
7 -use Elementor\Utils;
8 7
9 8 if ( ! defined( 'ABSPATH' ) ) {
10 9 exit; // Exit if accessed directly.
11 10 }
@@ -152,12 +151,9 @@
152 151 * @param self $this An instance of ajax manager.
153 152 */
154 153 do_action( 'elementor/ajax/register_actions', $this );
155 154
156 - if ( ! empty( $_REQUEST['actions'] ) ) {
157 - // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, each action should sanitize its own data.
158 - $this->requests = json_decode( wp_unslash( $_REQUEST['actions'] ), true );
159 - }
155 + $this->requests = json_decode( stripslashes( $_REQUEST['actions'] ), true );
160 156
161 157 foreach ( $this->requests as $id => $action_data ) {
162 158 $this->current_action_id = $id;
163 159
@@ -171,10 +167,9 @@
171 167 $action_data['data']['editor_post_id'] = $editor_post_id;
172 168 }
173 169
174 170 try {
175 - $data = $action_data['data'] ?? [];
176 - $results = call_user_func( $this->ajax_actions[ $action_data['action'] ]['callback'], $data, $this );
171 + $results = call_user_func( $this->ajax_actions[ $action_data['action'] ]['callback'], $action_data['data'], $this );
177 172
178 173 if ( false === $results ) {
179 174 $this->add_response_data( false );
180 175 } else {
@@ -233,9 +228,9 @@
233 228 *
234 229 * @return bool True if request nonce verified, False otherwise.
235 230 */
236 231 public function verify_request_nonce() {
237 - return wp_verify_nonce( Utils::get_super_global_value( $_REQUEST, '_nonce' ), self::NONCE_KEY );
232 + return ! empty( $_REQUEST['_nonce'] ) && wp_verify_nonce( $_REQUEST['_nonce'], self::NONCE_KEY );
238 233 }
239 234
240 235 protected function get_init_settings() {
241 236 return [
@@ -265,10 +260,19 @@
265 260 while ( ob_get_status() ) {
266 261 ob_end_clean();
267 262 }
268 263
269 - header( 'Content-Type: application/json; charset=UTF-8' );
270 - echo $json; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
264 + if ( function_exists( 'gzencode' ) ) {
265 + $response = gzencode( $json );
266 +
267 + header( 'Content-Type: application/json; charset=utf-8' );
268 + header( 'Content-Encoding: gzip' );
269 + header( 'Content-Length: ' . strlen( $response ) );
270 +
271 + echo $response; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
272 + } else {
273 + echo $json; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
274 + }
271 275
272 276 wp_die( '', '', [ 'response' => null ] );
273 277 }
274 278