css
3 weeks ago
img
3 weeks ago
js
3 weeks ago
partials
3 weeks ago
class-accesscontrol.php
3 weeks ago
class-adv-order-filter.php
3 weeks ago
class-analytics.php
3 weeks ago
class-order-tip-promotion.php
3 weeks ago
class-pi-dtt-labels.php
3 weeks ago
class-pi-dtt-order-table.php
3 weeks ago
conflict-fixer.php
3 weeks ago
menu.php
3 weeks ago
options-accesscontrol.php
3 weeks ago
options-addons.php
3 weeks ago
options-date.php
3 weeks ago
options-limit.php
3 weeks ago
options-pickup.php
3 weeks ago
options-time-slot.php
3 weeks ago
options-time.php
3 weeks ago
options.php
3 weeks ago
options-accesscontrol.php
93 lines
| 1 | <?php |
| 2 | if ( ! defined( 'ABSPATH' ) ) exit; |
| 3 | |
| 4 | class pisol_dtt_option_accesscontrol{ |
| 5 | |
| 6 | private $settings = array(); |
| 7 | |
| 8 | private $active_tab; |
| 9 | |
| 10 | private $this_tab = 'accesscontrol'; |
| 11 | |
| 12 | private $tab_name = "Access control"; |
| 13 | |
| 14 | private $setting_key = 'pisol_dtt_accesscontrol'; |
| 15 | |
| 16 | private $pro_version = false; |
| 17 | |
| 18 | public $tab; |
| 19 | |
| 20 | public $preparation_days; |
| 21 | |
| 22 | function __construct(){ |
| 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'=>'color-setting', 'class'=> 'bg-dark opacity-75 text-light', 'class_title'=>'text-light font-weight-light h4', 'label' => __('📦 Access control','pisol-dtt'), 'type'=>'setting_category'), |
| 30 | |
| 31 | array('field'=>'pi_dtt_allow_shop_manager', 'default'=> 0, 'type'=>'switch', 'label'=>__('Give access to store manager','pisol-dtt'),'desc'=>__('Allow store manager to make changes in the setting of this plugin','pisol-dtt')), |
| 32 | |
| 33 | ); |
| 34 | |
| 35 | |
| 36 | if($this->this_tab == $this->active_tab){ |
| 37 | add_action('pisol_dtt_tab_content', array($this,'tab_content')); |
| 38 | } |
| 39 | |
| 40 | add_action('pisol_dtt_tab', array($this,'tab'),8); |
| 41 | |
| 42 | $this->register_settings(); |
| 43 | |
| 44 | if(PISOL_DTT_FREE_RESET_SETTING){ |
| 45 | $this->delete_settings(); |
| 46 | } |
| 47 | |
| 48 | } |
| 49 | |
| 50 | function delete_settings(){ |
| 51 | foreach($this->settings as $setting){ |
| 52 | delete_option( $setting['field'] ); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | function register_settings(){ |
| 57 | |
| 58 | foreach($this->settings as $setting){ |
| 59 | pisol_class_form::register_setting( $this->setting_key, $setting); |
| 60 | } |
| 61 | |
| 62 | } |
| 63 | |
| 64 | function tab(){ |
| 65 | $page = sanitize_text_field(filter_input( INPUT_GET, 'page')); |
| 66 | $this->tab_name = __('Access control','pisol-dtt'); |
| 67 | ?> |
| 68 | <a class=" pi-side-menu <?php echo ($this->active_tab == $this->this_tab ? 'bg-primary' : 'bg-secondary'); ?>" href="<?php echo esc_url( admin_url( 'admin.php?page='.$page.'&tab='.$this->this_tab ) ); ?>"> |
| 69 | <span class="dashicons dashicons-universal-access"></span> <?php echo esc_html($this->tab_name); ?> |
| 70 | </a> |
| 71 | <?php |
| 72 | } |
| 73 | |
| 74 | function tab_content(){ |
| 75 | ?> |
| 76 | <form method="post" action="options.php" class="pisol-setting-form"> |
| 77 | <?php settings_fields( $this->setting_key ); ?> |
| 78 | <?php |
| 79 | foreach($this->settings as $setting){ |
| 80 | new pisol_class_form($setting, $this->setting_key); |
| 81 | } |
| 82 | ?> |
| 83 | <input type="submit" name="submit" id="submit" class="btn btn-primary btn-md my-3" value="<?php echo esc_attr__('Save Changes','pisol-dtt'); ?>"> |
| 84 | </form> |
| 85 | <?php |
| 86 | } |
| 87 | |
| 88 | } |
| 89 | |
| 90 | add_action('wp_loaded',function(){ |
| 91 | new pisol_dtt_option_accesscontrol(); |
| 92 | }); |
| 93 |