| @@ -77,31 +77,11 @@ | ||
| 77 | 77 | 'context' => [ 'edit' ], |
| 78 | 78 | ], |
| 79 | 79 | ], |
| 80 | 80 | 'auth_callback' => [ $this, 'check_edit_permission' ], |
| 81 | - 'sanitize_callback' => [ $this, 'sanitize_elementor_data' ], | |
| 82 | 81 | ]); |
| 83 | 82 | } |
| 84 | 83 | |
| 85 | - public function sanitize_elementor_data( $value ) { | |
| 86 | - if ( current_user_can( 'unfiltered_html' ) ) { | |
| 87 | - return $value; | |
| 88 | - } | |
| 89 | - | |
| 90 | - if ( ! is_string( $value ) ) { | |
| 91 | - return Utils::kses_post_deep( $value ); | |
| 92 | - } | |
| 93 | - | |
| 94 | - $elementor_data = json_decode( $value, true ); | |
| 95 | - | |
| 96 | - if ( JSON_ERROR_NONE !== json_last_error() || empty( $elementor_data ) ) { | |
| 97 | - // Not valid Elementor JSON (or empty): treat the whole string as HTML to be safe. | |
| 98 | - return wp_kses_post( $value ); | |
| 99 | - } | |
| 100 | - | |
| 101 | - return wp_json_encode( Utils::kses_post_deep( $elementor_data ) ); | |
| 102 | - } | |
| 103 | - | |
| 104 | 84 | private function register_page_settings_meta( string $post_type ): void { |
| 105 | 85 | register_meta( 'post', '_elementor_page_settings', [ |
| 106 | 86 | 'single' => true, |
| 107 | 87 | 'object_subtype' => $post_type, |
| @@ -123,18 +103,9 @@ | ||
| 123 | 103 | 'context' => [ 'edit' ], |
| 124 | 104 | ], |
| 125 | 105 | ], |
| 126 | 106 | 'auth_callback' => [ $this, 'check_edit_permission' ], |
| 127 | - 'sanitize_callback' => [ $this, 'sanitize_page_settings' ], | |
| 128 | 107 | ]); |
| 129 | - } | |
| 130 | - | |
| 131 | - public function sanitize_page_settings( $value ) { | |
| 132 | - if ( current_user_can( 'unfiltered_html' ) ) { | |
| 133 | - return $value; | |
| 134 | - } | |
| 135 | - | |
| 136 | - return Utils::kses_post_deep( $value ); | |
| 137 | 108 | } |
| 138 | 109 | |
| 139 | 110 | private function register_conditions_meta( string $post_type ): void { |
| 140 | 111 | register_meta( 'post', '_elementor_conditions', [ |