PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.6.2
ShopBuilder – WooCommerce Builder For Elementor v2.6.2
3.4.2 3.4.1 3.4.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 All 63 releases
← All changes | app/Helpers/ElementorDataMap.php +11 -2 2.0.32.6.2 View file →
@@ -9,8 +9,13 @@
9 9 * Singleton
10 10 */
11 11 use SingletonTrait;
12 12
13 + /**
14 + * @var array
15 + */
16 + private static $cache = [];
17 +
13 18 /***
14 19 * Elementor Data key
15 20 */
16 21 private const ELEMENTOR_DATA_KEY = '_elementor_data';
@@ -37,8 +42,12 @@
37 42 *
38 43 * @return array
39 44 */
40 45 public function get_widget_data( string $widget_name, ?array $data = null, ?int $post_id = null ): array {
46 + $cache_key = 'get_widget_data_' . $widget_name . '_' . $post_id;
47 + if ( isset( self::$cache[ $cache_key ] ) ) {
48 + return self::$cache[ $cache_key ];
49 + }
41 50 if ( ! $data && $post_id ) {
42 51 $data = $this->get_elementor_data( $post_id );
43 52 }
44 53
@@ -46,9 +55,9 @@
46 55 return [];
47 56 }
48 57
49 58 $this->search_el( $data, $widget_name );
50 -
59 + self::$cache[ $cache_key ] = $this->eldata;
51 60 return $this->eldata;
52 61 }
53 62
54 63 /***
@@ -65,9 +74,9 @@
65 74
66 75 if ( ! empty( $value['elements'] ) && is_array( $value['elements'] ) ) {
67 76 $this->search_el( $value['elements'], $name );
68 77 } else {
69 - if ( $value['elType'] === 'widget' && $value['widgetType'] === $name ) {
78 + if ( 'widget' === $value['elType'] && $value['widgetType'] === $name ) {
70 79 $this->eldata[] = $value;
71 80 }
72 81 }
73 82 }