PluginProbe ʕ •ᴥ•ʔ
Bopo – WooCommerce Product Bundle Builder / trunk
Bopo – WooCommerce Product Bundle Builder vtrunk
bopo-woo-product-bundle-builder / includes / data.php
bopo-woo-product-bundle-builder / includes Last commit date
elementor 1 year ago data.php 4 years ago functions.php 1 year ago helper.php 1 year ago includes.php 4 years ago support.php 2 months ago
data.php
144 lines
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit;
4 }
5
6 class VI_WOO_BOPO_BUNDLE_DATA {
7 private $params;
8 private $default;
9 protected static $instance = null;
10
11 public function __construct() {
12 global $bopobb_settings;
13 if ( ! $bopobb_settings ) {
14 $bopobb_settings = get_option( 'woo_bopo_bundle_params', array() );
15 }
16 $this->default = array(
17 //Bundle
18 'bopobb_item_view' => array(
19 array(
20 'product_quantity',
21 1,
22 ),
23 array(
24 'product_stock',
25 1,
26 ),
27 array(
28 'product_ratting',
29 1,
30 ),
31 array(
32 'product_description',
33 0,
34 ),
35 ),
36 'bopobb-first-product' => 0,
37 'bopobb_view_quantity' => 1,
38 'bopobb_view_stock' => 1,
39 'bopobb_view_ratting' => 0,
40 'bopobb_view_description' => 0,
41 'bopobb_link_individual' => 0,
42 'bopobb_price_by' => 'subtotal',
43 'bopobb_price_saved' => 'saved',
44 'bopobb_coupon_res' => 'bundled',
45 'bopobb_custom_css' => '',
46
47 //swap button
48 'bopobb_swap_text' => 'Change',
49 'bopobb_swap_pos' => 1,
50 'bopobb_swap_background' => '#446084',
51 'bopobb_swap_color' => '#ffffff',
52
53 //popup
54 'bopobb_popup_title' => 'Please select your product',
55 'bopobb_popup_background' => '#ffffff',
56 'bopobb_popup_color' => '#000000',
57 'bopobb_popup_fontsize' => '',
58 'bopobb_popup_page_items' => 32,
59
60 'bopobb_swap_icon' => array(
61 "bopobb_swap_icon-share-files",
62 "bopobb_swap_icon-ab-testing",
63 "bopobb_swap_icon-ab-testing-1",
64 "bopobb_swap_icon-compare",
65 "bopobb_swap_icon-compare-1",
66 "bopobb_swap_icon-compare-2",
67 "bopobb_swap_icon-comparative",
68 "bopobb_swap_icon-risk",
69 "bopobb_swap_icon-compare-3",
70 "bopobb_swap_icon-compare-4",
71 "bopobb_swap_icon-compare-5",
72 "bopobb_swap_icon-decision",
73 "bopobb_swap_icon-advantages",
74 "bopobb_swap_icon-computer",
75 "bopobb_swap_icon-diagram",
76 "bopobb_swap_icon-balance",
77 "bopobb_swap_icon-file",
78 "bopobb_swap_icon-lists",
79 "bopobb_swap_icon-website",
80 "bopobb_swap_icon-skill",
81 "bopobb_swap_icon-file-1",
82 "bopobb_swap_icon-phone",
83 "bopobb_swap_icon-compare-6",
84 "bopobb_swap_icon-compare-7"
85 ),
86
87 'bopobb_limit_item' => 2,
88 'bopobb_single_template' => 1,
89 'bopobb_template_title' => array(
90 'vertical-bundle',
91 'horizontal-bundle'
92 ),
93 'bopobb_type_include' => array(
94 'simple',
95 'variable'
96 ),
97 'bopobb_type_exclude' => array(
98 'bundle',
99 'bopobb',
100 'variable',
101 'composite',
102 'grouped',
103 'external'
104 ),
105 );
106 $this->params = apply_filters( 'woo_bopo_bundle_params', wp_parse_args( $bopobb_settings, $this->default ) );
107 }
108
109 /**
110 * Get params of setting
111 * @return mixed
112 */
113 public function get_params( $name = "" ) {
114 if ( ! $name ) {
115 return $this->params;
116 } elseif ( isset( $this->params[ $name ] ) ) {
117 return apply_filters( 'woo_bopo_bundle_params' . $name, $this->params[ $name ] );
118 } else {
119 return false;
120 }
121 }
122
123 /**
124 * Get default param setting
125 * @return mixed
126 */
127 public function get_default( $name = "" ) {
128 if ( ! $name ) {
129 return $this->default;
130 } elseif ( isset( $this->default[ $name ] ) ) {
131 return apply_filters( 'woo_bopo_bundle_params' . $name, $this->default[ $name ] );
132 } else {
133 return false;
134 }
135 }
136
137 public static function get_instance( $new = false ) {
138 if ( $new || null === self::$instance ) {
139 self::$instance = new self;
140 }
141
142 return self::$instance;
143 }
144 }