PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.6.5
ShopBuilder – WooCommerce Builder For Elementor v2.6.5
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/Models/Base/ListModel.php +15 -8 2.1.22.6.5 View file →
@@ -13,17 +13,18 @@
13 13
14 14 protected $title;
15 15 protected $short_title;
16 16 protected $description;
17 - private $full_list = [];
18 - private $active_list = [];
17 + private $full_list = [];
18 + private $active_list = [];
19 19 private $inactive_list = [];
20 - private $db_options = [];
21 - protected $categories = [];
20 + private $db_options = [];
21 + protected $categories = [];
22 22
23 23 public function __construct() {
24 24 $this->db_options = DataModel::source()->get_option( $this->list_id, [] );
25 25 $raw_list = apply_filters( 'rtsb/' . $this->list_id . '/list', $this->raw_list() );
26 +
26 27 if ( ! empty( $raw_list ) ) {
27 28 foreach ( $raw_list as $name => $item ) {
28 29
29 30 if ( ! empty( $item['package'] ) && $item['package'] === 'pro-disabled' ) {
@@ -42,9 +43,15 @@
42 43
43 44 if ( ! empty( $item['fields'] ) ) {
44 45 foreach ( $item['fields'] as $field_key => $field ) {
45 46 $the_value = $this->db_options[ $name ][ $field_key ] ?? ( $item['fields'][ $field_key ]['value'] ?? '' );
46 - $sanitized_value = Fns::stripslashes_value( $the_value );
47 + if ( 'repeaters' === $field['type'] && empty( $the_value ) && ! empty( $field['defaults'] ) ) {
48 + $repeater_defaults = array_values( $field['defaults'] );
49 + $the_value = wp_json_encode( $repeater_defaults );
50 + } elseif ( 'repeaters' === $field['type'] && ! empty( $the_value ) ) {
51 + $the_value = json_decode( $the_value );
52 + }
53 + $sanitized_value = Fns::stripslashes_value( $the_value );
47 54 $item['fields'][ $field_key ]['value'] = $sanitized_value;
48 55 }
49 56 }
50 57 $this->full_list[ $name ] = $item;
@@ -73,14 +80,14 @@
73 80 return isset( $this->active_list[ $key ] );
74 81 }
75 82
76 83 /**
77 - * @param mixed $list true | anything
84 + * @param mixed $list true | anything
78 85 * @param string $filter_type full|active|inactive
79 86 *
80 87 * @return mixed
81 88 */
82 - public function get_list( $list = true, $filter_type = 'full' ) { //
89 + public function get_list( $list = true, $filter_type = 'full' ) {
83 90 if ( $list !== true && isset( $this->full_list[ $list ] ) ) {
84 91 return $this->full_list[ $list ];
85 92 }
86 93
@@ -111,5 +118,5 @@
111 118 return $this->db_options;
112 119 }
113 120
114 121 abstract protected function raw_list();
115 -}
122 +}