PluginProbe
Elementor Website Builder – more than just a page builder / 3.28.0-dev2
Elementor Website Builder – more than just a page builder v3.28.0-dev2
4.3.2 4.3.1 4.3.0 4.3.0-beta3 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 All 455 releases
← All changes | app/modules/onboarding/features-usage.php +1 -48 4.3.2 → 3.28.0-dev2 View file →
@@ -34,61 +34,14 @@
34 34 if ( empty( $post_data['features'] ) ) {
35 35 return;
36 36 }
37 37
38 - $sanitized_features = $this->sanitize_features( $post_data['features'] );
38 + update_option( static::ONBOARDING_FEATURES_OPTION, $post_data['features'] );
39 39
40 - if ( null === $sanitized_features ) {
41 - return [
42 - 'status' => 'error',
43 - 'payload' => [
44 - 'error_message' => esc_html__( 'There was a problem saving your selected features.', 'elementor' ),
45 - ],
46 - ];
47 - }
48 -
49 - update_option( static::ONBOARDING_FEATURES_OPTION, $sanitized_features );
50 -
51 40 return [
52 41 'status' => 'success',
53 42 'payload' => [],
54 43 ];
55 - }
56 -
57 - /**
58 - * Sanitize the features selection payload.
59 - *
60 - * Expects an associative array of known tiers, each holding a list of
61 - * free-text feature labels (see assets/js/utils/utils.js), e.g.:
62 - * [ 'essential' => [ 'Templates & Theme Builder' ], 'advanced' => [], 'one' => [] ].
63 - *
64 - * @param mixed $features
65 - *
66 - * @return array|null Sanitized array, or null if the payload shape is invalid.
67 - */
68 - private function sanitize_features( $features ) {
69 - if ( ! is_array( $features ) ) {
70 - return null;
71 - }
72 -
73 - $allowed_tiers = [ 'essential', 'advanced', 'one' ];
74 - $sanitized = [];
75 -
76 - foreach ( $features as $tier => $selected_labels ) {
77 - if ( ! in_array( $tier, $allowed_tiers, true ) || ! is_array( $selected_labels ) ) {
78 - return null;
79 - }
80 -
81 - $sanitized[ $tier ] = array_values( array_map( function ( $label ) {
82 - return is_string( $label ) ? sanitize_text_field( $label ) : null;
83 - }, $selected_labels ) );
84 -
85 - if ( in_array( null, $sanitized[ $tier ], true ) ) {
86 - return null;
87 - }
88 - }
89 -
90 - return $sanitized;
91 44 }
92 45
93 46 private function get_usage_data() {
94 47 return get_option( static::ONBOARDING_FEATURES_OPTION, [] );