PluginProbe ʕ •ᴥ•ʔ
PiWeb Delivery & Pickup Date Time for WooCommerce / 3.0.49.11
PiWeb Delivery & Pickup Date Time for WooCommerce v3.0.49.11
3.0.63 3.0.62 3.0.61 3.0.60 3.0.49.49 3.0.49.6 3.0.49.60 3.0.49.61 3.0.49.62 3.0.49.63 3.0.49.64 3.0.49.66 3.0.49.67 3.0.49.69 3.0.49.7 3.0.49.70 3.0.49.72 3.0.49.73 3.0.49.74 3.0.49.76 3.0.49.77 3.0.49.79 3.0.49.9 3.0.49.90 3.0.49.91 3.0.49.92 3.0.49.93 3.0.49.94 3.0.49.96 3.0.49.97 3.0.49.99 trunk 1.0 1.1 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 2.9.17 3.0.47 3.0.49 3.0.49.1 3.0.49.10 3.0.49.11 3.0.49.12 3.0.49.13 3.0.49.16 3.0.49.17 3.0.49.19 3.0.49.2 3.0.49.20 3.0.49.21 3.0.49.22 3.0.49.23 3.0.49.24 3.0.49.26 3.0.49.27 3.0.49.29 3.0.49.3 3.0.49.30 3.0.49.31 3.0.49.32 3.0.49.33 3.0.49.34 3.0.49.36 3.0.49.37 3.0.49.39 3.0.49.4 3.0.49.40 3.0.49.41 3.0.49.42 3.0.49.43 3.0.49.44 3.0.49.46 3.0.49.47
pi-woocommerce-order-date-time-and-type / admin / options-time-slot.php
pi-woocommerce-order-date-time-and-type / admin Last commit date
css 1 year ago img 1 year ago js 1 year ago class-adv-order-filter.php 1 year ago class-pi-dtt-labels.php 1 year ago class-pi-dtt-order-table.php 1 year ago conflict-fixer.php 1 year ago menu.php 1 year ago options-addons.php 1 year ago options-date.php 1 year ago options-limit.php 1 year ago options-pickup.php 1 year ago options-time-slot.php 1 year ago options-time.php 1 year ago options.php 1 year ago
options-time-slot.php
232 lines
1 <?php
2
3 class pisol_dtt_option_time_slot{
4
5 private $settings = array();
6
7 private $active_tab;
8
9 private $this_tab = 'pi_time_slot';
10
11 private $tab_name = "Time Slot";
12
13 private $setting_key = 'pisol_time_slot';
14
15 private $pro_version = false;
16
17 public $tab;
18
19
20 function __construct(){
21
22 $this->pro_version = pi_dtt_pro_check();
23
24 $this->tab = sanitize_text_field(filter_input( INPUT_GET, 'tab'));
25 $this->active_tab = $this->tab != "" ? $this->tab : 'default';
26
27 $this->settings = array(
28
29 array('field'=>'pi_general_time_slot_delivery', 'sanitize_callback'=> [__CLASS__,'sanitize_time_slot']),
30 array('field'=>'pi_general_time_slot_pickup', 'sanitize_callback'=> [__CLASS__,'sanitize_time_slot'])
31
32 );
33
34
35 if($this->this_tab == $this->active_tab){
36 add_action('pisol_dtt_tab_content', array($this,'tab_content'));
37 }
38
39 add_action('pisol_dtt_tab', array($this,'tab'),3);
40
41 $this->register_settings();
42
43
44 }
45
46 function register_settings(){
47
48 foreach($this->settings as $setting){
49 pisol_class_form::register_setting( $this->setting_key, $setting);
50 }
51
52 }
53
54 function tab(){
55 $page = sanitize_text_field(filter_input( INPUT_GET, 'page'));
56 ?>
57 <a class=" pi-side-menu <?php echo ($this->active_tab == $this->this_tab ? 'bg-primary' : 'bg-secondary'); ?> " href="<?php echo admin_url( 'admin.php?page='.$page.'&tab='.$this->this_tab ); ?>">
58 <span class="dashicons dashicons-dashboard"></span> <?php _e( $this->tab_name, 'pisol-dtt' ); ?>
59 </a>
60 <?php
61 }
62
63 function tab_content(){
64 ?>
65 <form method="post" action="options.php" class="pisol-setting-form">
66 <?php settings_fields( $this->setting_key ); ?>
67 <?php
68 echo '<script>';
69 foreach($this->settings as $setting){
70 $val = pisol_dtt_get_setting($setting['field'], array());
71 if(!is_array($val) || count($val) < 1){
72 $val = array();
73 }
74 ?>
75 var <?php echo $setting['field']; ?> = <?php echo json_encode(array_values($val)); ?>;
76 <?php
77 }
78 echo '</script>';
79 ?>
80 <?php
81 foreach($this->settings as $setting){
82 new pisol_class_form($setting, $this->setting_key);
83 }
84
85 $this->timesForm(__('General Time Slot (this will be applied for all days of the week)', 'pisol-dtt' ), 'pi_general_time_slot_delivery', 'pi_general_time_slot_pickup');
86
87 $this->proFeatureRow(__('Monday (Set different time slot for Monday)', 'pisol-dtt' ), 'pi_monday_time_slot_delivery', 'pi_monday_time_slot_pickup','monday1');
88 $this->proFeatureRow(__('Tuesday (Set different time slot for Tuesday)', 'pisol-dtt' ), 'pi_tuesday_time_slot_delivery', 'pi_tuesday_time_slot_pickup','tuesday1');
89 $this->proFeatureRow(__('Wednesday (Set different time slot for Wednesday)', 'pisol-dtt' ), 'pi_wednesday_time_slot_delivery', 'pi_wednesday_time_slot_pickup','wednesday1');
90 $this->proFeatureRow(__('Thursday (Set different time slot for Thursday)', 'pisol-dtt' ), 'pi_Thursday_time_slot_delivery', 'pi_Thursday_time_slot_pickup','Thursday1');
91 $this->proFeatureRow(__('Friday (Set different time slot for Friday)', 'pisol-dtt' ), 'pi_Friday_time_slot_delivery', 'pi_Friday_time_slot_pickup','Friday1');
92 $this->proFeatureRow(__('Saturday (Set different time slot for Saturday)', 'pisol-dtt' ), 'pi_Saturday_time_slot_delivery', 'pi_Saturday_time_slot_pickup','Saturday1');
93 $this->proFeatureRow(__('Sunday (Set different time slot for Sunday)', 'pisol-dtt' ), 'pi_Sunday_time_slot_delivery', 'pi_Sunday_time_slot_pickup','Sunday1');
94
95
96 ?>
97 <input type="submit" name="submit" id="submit" class="btn btn-primary btn-md my-3" value="<?php echo __('Save Changes','pisol-dtt'); ?>">
98 </form>
99 <?php
100 }
101
102 function timesForm($label, $field_delivery, $field_pickup, $overwrite_day = ""){
103 if(empty($overwrite_day)){
104 $bg = 'bg-primary';
105 $hide="";
106 }else{
107 $bg = 'bg-dark';
108 $overwrite_value = pisol_dtt_get_setting('pi_different_slot_for_'.$overwrite_day, "");
109 $checked ="";
110 $hide =' style="display:none;" ';
111 if(!empty($overwrite_value)){
112 $checked = ' checked="checked" ';
113 $hide="";
114 }
115 }
116 ?>
117 <div id="row_sunday" class="row py-2 border-bottom align-items-center <?php echo $bg; ?> text-light">
118 <div class="col-9">
119 <?php if(empty($overwrite_day)){ ?>
120 <h5 class="mt-0 mb-0 py-2 text-light font-weight-light h4"><label for="pi_different_slot_for_<?php echo $overwrite_day; ?>"><?php echo $label; ?></label></h5>
121 <?php }else{ ?>
122 <h5 class="mt-0 mb-0 text-light font-weight-light h5"><label for="pi_different_slot_for_<?php echo $overwrite_day; ?>"><?php echo $label; ?></label></h5>
123 <?php } ?>
124 </div>
125 <?php if(!empty($overwrite_day)): ?>
126 <div class="col-3 text-right">
127 <div class="custom-control custom-switch">
128 <input type="checkbox" class="custom-control-input" name="pi_different_slot_for_<?php echo $overwrite_day; ?>" id="pi_different_slot_for_<?php echo $overwrite_day; ?>" <?php echo $checked; ?>>
129 <label class="custom-control-label" for="pi_different_slot_for_<?php echo $overwrite_day; ?>"></label>
130 </div>
131 </div>
132 <?php endif; ?>
133 </div>
134
135 <div class="row mb-2 pt-2" id="pi_slots_for_<?php echo $overwrite_day; ?>" <?php echo $hide; ?>>
136 <div class="col-12 col-md-6">
137 <div class="row align-items-center">
138 <div class="col-7 mt-2">
139 <strong><?php _e('Delivery Time slots', 'pisol-dtt' ); ?></strong>
140 </div>
141 <div class="col">
142 <a class="btn btn-primary btn-sm pi_add_time_slot text-light" data-slot="<?php echo $field_delivery; ?>" ><?php _e('Add Time Slot', 'pisol-dtt' ); ?></a>
143 </div>
144 </div>
145 <div class="row align-items-center">
146 <div class="col-12 mt-2">
147 <div id="<?php echo $field_delivery; ?>_container">
148
149 </div>
150 </div>
151 </div>
152 </div>
153
154
155 <div class="col-12 col-md-6">
156 <div class="row align-items-center">
157 <div class="col-7 mt-2">
158 <strong><?php _e('Pickup Time slots', 'pisol-dtt' ); ?></strong>
159 </div>
160 <div class="col">
161 <a class="btn btn-primary btn-sm pi_add_time_slot text-light" data-slot="<?php echo $field_pickup; ?>" ><?php _e('Add Time Slot', 'pisol-dtt' ); ?></a>
162 </div>
163 </div>
164 <div class="row align-items-center">
165 <div class="col-12 mt-2">
166 <div id="<?php echo $field_pickup; ?>_container">
167
168 </div>
169 </div>
170 </div>
171 </div>
172 </div>
173 <?php
174 }
175
176 function proFeatureRow($label, $field_delivery, $field_pickup, $overwrite_day = ""){
177 if(empty($overwrite_day)){
178 $bg = 'bg-primary';
179 $hide="";
180 }else{
181 $bg = 'bg-dark';
182 $overwrite_value = pisol_dtt_get_setting('pi_different_slot_for_'.$overwrite_day, "");
183 $checked ="";
184 $hide =' style="display:none;" ';
185 if(!empty($overwrite_value)){
186 $checked = ' checked="checked" ';
187 $hide="";
188 }
189 }
190 ?>
191 <div id="row_sunday" class="row py-2 border-bottom align-items-center free-version <?php echo $bg; ?> text-light">
192 <div class="col-9">
193 <?php if(empty($overwrite_day)){ ?>
194 <h5 class="mt-0 mb-0 py-2 text-light font-weight-light h4"><label for="pi_different_slot_for_<?php echo $overwrite_day; ?>"><?php echo $label; ?></label></h5>
195 <?php }else{ ?>
196 <h5 class="mt-0 mb-0 text-light font-weight-light h5"><label for="pi_different_slot_for_<?php echo $overwrite_day; ?>"><?php echo $label; ?></label></h5>
197 <?php } ?>
198 </div>
199 <?php if(!empty($overwrite_day)): ?>
200 <div class="col-3 text-right">
201 <div class="custom-control custom-switch">
202 <input type="checkbox" class="custom-control-input" name="pi_different_slot_for_<?php echo $overwrite_day; ?>" id="pi_different_slot_for_<?php echo $overwrite_day; ?>" <?php echo $checked; ?>>
203 <label class="custom-control-label" for="pi_different_slot_for_<?php echo $overwrite_day; ?>"></label>
204 </div>
205 </div>
206 <?php endif; ?>
207 </div>
208 <?php
209 }
210
211 static function sanitize_time_slot($inputs){
212 if(!is_array($inputs) || empty($inputs)){
213 return array();
214 }
215
216 foreach($inputs as $key => $values){
217 $inputs[$key]['from'] = isset($values['from']) ? sanitize_text_field($values['from']) : "";
218 $inputs[$key]['to'] = isset($values['to']) ? sanitize_text_field($values['to']) : "";
219 $inputs[$key]['order_limit'] = !empty($values['order_limit']) ? abs(intval($values['order_limit'])) : "";
220
221 if(empty($values['from']) && empty($values['to'])){
222 unset($inputs[$key]);
223 }
224
225 }
226
227 return array_values($inputs);
228 }
229 }
230
231 new pisol_dtt_option_time_slot();
232