PluginProbe
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution with eCommerce Templates & Woo Widgets / 4.7.3
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution with eCommerce Templates & Woo Widgets v4.7.3
4.9.5 4.9.4 4.9.3 4.9.2 4.9.1 4.9.0 2.0.0 2.1.0 2.2.0 2.2.1 2.2.2 2.3.0 2.4.0 2.5.0 2.5.1 3.0.0 3.1.0 3.1.1 4.0.0 4.0.1 4.1.0 4.1.1 4.2.0 4.2.1 4.3.0 All 85 releases
shopengine / trunk / utils / elementor-data-map.php
elementor-data-map.php
58 lines 892 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace ShopEngine\Utils;
4
5 class Elementor_Data_Map {
6
7 private $_el = [];
8
9 public function get_elementor_data($post_id) {
10
11 $dt = get_post_meta($post_id, '_elementor_data', true);
12
13 return json_decode($dt);
14 }
15
16 public function get_widget_data($widget_name, $data = false, $post_id = null) {
17
18 if($data === false && !empty($post_id)) {
19
20 $data = $this->get_elementor_data($post_id);
21 }
22
23 if(!empty($data) && is_array($data)) {
24
25 $this->_el = [];
26
27 $this->search_el($data, $widget_name);
28
29 return $this->_el;
30 }
31
32 return [];
33 }
34
35 private function search_el($data, $name) {
36
37 if(!is_array($data)) {
38
39 return;
40 }
41
42 foreach($data as $k => $v) {
43
44 if(!empty($v->elements) && is_array($v->elements)) {
45
46 $this->search_el($v->elements, $name);
47
48 } else {
49
50 if($v->elType == 'widget' && $v->widgetType == $name) {
51
52 $this->_el[] = $v;
53 }
54 }
55 }
56 }
57 }
58