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/atomic-widgets/cache-validity/cache-validity.php +71 -6 4.2.13.34.1 View file →
@@ -1,15 +1,80 @@
1 1 <?php
2 2
3 3 namespace Elementor\Modules\AtomicWidgets\CacheValidity;
4 4
5 -use Elementor\Modules\AtomicWidgets\Styles\CacheValidity\Cache_Validity as New_Cache_Validity;
5 +use Elementor\Modules\AtomicWidgets\CacheValidity\Cache_Validity_Item;
6 6
7 7 if ( ! defined( 'ABSPATH' ) ) {
8 8 exit; // Exit if accessed directly.
9 9 }
10 10
11 -// TODO: Remove this class after 3.37 is released.
12 -/**
13 - * @deprecated 3.35 Use \Elementor\Modules\AtomicWidgets\Styles\CacheValidity\Cache_Validity instead.
14 - */
15 -class Cache_Validity extends New_Cache_Validity {}
11 +
12 +class Cache_Validity {
13 + /**
14 + * @param array<string> $keys
15 + * @return bool
16 + */
17 + public function is_valid( $keys ): bool {
18 + $root = array_shift( $keys );
19 + $cache_item = new Cache_Validity_Item( $root );
20 +
21 + $item = $cache_item->get( $keys );
22 +
23 + if ( ! $item ) {
24 + return false;
25 + }
26 +
27 + return $item['state'] ?? false;
28 + }
29 +
30 + /**
31 + * @param array<string> $keys
32 + * @return mixed | null
33 + */
34 + public function get_meta( array $keys ) {
35 + $root = array_shift( $keys );
36 + $cache_item = new Cache_Validity_Item( $root );
37 +
38 + $item = $cache_item->get( $keys );
39 +
40 + if ( ! $item || is_bool( $item ) ) {
41 + return null;
42 + }
43 +
44 + return $item['meta'] ?? null;
45 + }
46 +
47 + /**
48 + * @param array<string> $keys
49 + * @param mixed | null $meta
50 + * @return void
51 + */
52 + public function validate( $keys, $meta = null ): void {
53 + $root = array_shift( $keys );
54 + $cache_item = new Cache_Validity_Item( $root );
55 +
56 + $cache_item->validate( $keys, $meta );
57 + }
58 +
59 + /**
60 + * @param array<string> $keys
61 + * @return void
62 + */
63 + public function invalidate( array $keys ): void {
64 + $root = array_shift( $keys );
65 + $cache_item = new Cache_Validity_Item( $root );
66 +
67 + $cache_item->invalidate( $keys );
68 + }
69 +
70 + /**
71 + * @param array<string> $keys
72 + * @return array{state: boolean, meta: array<string, mixed> | null, children: array<string, self>} | null
73 + */
74 + public function get_node( array $keys ): ?array {
75 + $root = array_shift( $keys );
76 + $cache_item = new Cache_Validity_Item( $root );
77 +
78 + return $cache_item->get( $keys );
79 + }
80 +}