PluginProbe
Elementor Website Builder – more than just a page builder / 3.34.1
Elementor Website Builder – more than just a page builder v3.34.1
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 | modules/components/save-components-validator.php +6 -5 4.2.13.34.1 View file →
@@ -9,8 +9,10 @@
9 9 exit; // Exit if accessed directly.
10 10 }
11 11
12 12 class Save_Components_Validator {
13 + const MAX_COMPONENTS = 50;
14 +
13 15 private Collection $components;
14 16
15 17 public function __construct( Collection $components ) {
16 18 $this->components = $components;
@@ -39,12 +41,11 @@
39 41 ];
40 42 }
41 43
42 44 private function validate_count( Collection $data ): array {
43 - $non_archived_components = $this->components->filter( fn ( $component ) => ! $component['is_archived'] );
44 - $count = $non_archived_components->count() + $data->count();
45 + $count = $this->components->count() + $data->count();
45 46
46 - if ( $count > Components_REST_API::MAX_COMPONENTS ) {
47 + if ( $count > self::MAX_COMPONENTS ) {
47 48 return [ esc_html__( 'Maximum number of components exceeded.', 'elementor' ) ];
48 49 }
49 50
50 51 return [];
@@ -58,11 +59,11 @@
58 59 $title = $component['title'];
59 60 $uid = $component['uid'];
60 61
61 62 $is_title_exists = $this->components->some(
62 - fn ( $component ) => ! $component['is_archived'] && $component['title'] === $title
63 + fn ( $component ) => $component['title'] === $title
63 64 ) || $data->filter(
64 - fn ( $component ) => ! $component['title'] === $title
65 + fn ( $component ) => $component['title'] === $title
65 66 )->count() > 1;
66 67
67 68 if ( $is_title_exists ) {
68 69 $errors[] = [