PluginProbe
Elementor Website Builder – more than just a page builder / 4.2.3
Elementor Website Builder – more than just a page builder v4.2.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
elementor / modules / interactions / validators / breakpoints-value.php

breakpoints-value.php in Elementor Website Builder – more than just a page builder 4.2.3, at modules/interactions/validators/breakpoints-value.php

70 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Elementor\Modules\Interactions\Validators;
4
5 use Elementor\Modules\Interactions\Validators\String_Value as StringValueValidator;
6
7 if ( ! defined( 'ABSPATH' ) ) {
8 exit; // Exit if accessed directly.
9 }
10
11 class Breakpoints_Value {
12 public static function is_valid( $breakpoints_prop_value ) {
13 if ( ! is_array( $breakpoints_prop_value ) ) {
14 return false;
15 }
16
17 if ( ! isset( $breakpoints_prop_value['$$type'] ) || 'interaction-breakpoints' !== $breakpoints_prop_value['$$type'] ) {
18 return false;
19 }
20
21 if ( ! isset( $breakpoints_prop_value['value'] ) || ! is_array( $breakpoints_prop_value['value'] ) ) {
22 return false;
23 }
24
25 return self::validate_value( $breakpoints_prop_value['value'] );
26 }
27
28 private static function validate_value( $value ) {
29 if ( ! is_array( $value ) ) {
30 return false;
31 }
32
33 if ( ! isset( $value['excluded'] ) || ! is_array( $value['excluded'] ) ) {
34 return false;
35 }
36
37 return self::validate_excluded( $value['excluded'] );
38 }
39
40 private static function validate_excluded( $excluded ) {
41 if ( ! is_array( $excluded ) ) {
42 return false;
43 }
44
45 if ( ! isset( $excluded['$$type'] ) || 'excluded-breakpoints' !== $excluded['$$type'] ) {
46 return false;
47 }
48
49 if ( ! isset( $excluded['value'] ) || ! is_array( $excluded['value'] ) ) {
50 return false;
51 }
52
53 return self::validate_excluded_value( $excluded['value'] );
54 }
55
56 private static function validate_excluded_value( $value ) {
57 if ( ! is_array( $value ) ) {
58 return false;
59 }
60
61 foreach ( $value as $breakpoint_value ) {
62 if ( ! StringValueValidator::is_valid( $breakpoint_value ) ) {
63 return false;
64 }
65 }
66
67 return true;
68 }
69 }
70