PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.1.13
ShopBuilder – WooCommerce Builder For Elementor v2.1.13
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 +13 -8 2.1.52.1.13 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,13 @@
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 + }
51 + $sanitized_value = Fns::stripslashes_value( $the_value );
47 52 $item['fields'][ $field_key ]['value'] = $sanitized_value;
48 53 }
49 54 }
50 55 $this->full_list[ $name ] = $item;
@@ -73,14 +78,14 @@
73 78 return isset( $this->active_list[ $key ] );
74 79 }
75 80
76 81 /**
77 - * @param mixed $list true | anything
82 + * @param mixed $list true | anything
78 83 * @param string $filter_type full|active|inactive
79 84 *
80 85 * @return mixed
81 86 */
82 - public function get_list( $list = true, $filter_type = 'full' ) { //
87 + public function get_list( $list = true, $filter_type = 'full' ) {
83 88 if ( $list !== true && isset( $this->full_list[ $list ] ) ) {
84 89 return $this->full_list[ $list ];
85 90 }
86 91
@@ -111,5 +116,5 @@
111 116 return $this->db_options;
112 117 }
113 118
114 119 abstract protected function raw_list();
115 -}
120 +}