css
1 year ago
img
1 year ago
js
1 year ago
partials
1 year ago
class-eqw-advance.php
1 year ago
class-eqw-cart.php
1 year ago
class-eqw-email.php
1 year ago
class-eqw-enquiry.php
1 year ago
class-eqw-form-control.php
1 year ago
class-eqw-menu.php
1 year ago
class-eqw-option.php
1 year ago
class-eqw-product-options.php
1 year ago
class-pisol-enquiry-quotation-woocommerce-admin.php
1 year ago
index.php
1 year ago
plugins.php
1 year ago
class-eqw-cart.php
98 lines
| 1 | <?php |
| 2 | |
| 3 | class Class_Pi_Eqw_Cart{ |
| 4 | |
| 5 | public $plugin_name; |
| 6 | |
| 7 | private $settings = array(); |
| 8 | |
| 9 | private $active_tab; |
| 10 | |
| 11 | private $this_tab = 'cart'; |
| 12 | |
| 13 | private $tab_name = "Dynamic Cart (PRO)"; |
| 14 | |
| 15 | private $setting_key = 'pi_eqw_cart_setting'; |
| 16 | public $tab; |
| 17 | |
| 18 | function __construct($plugin_name){ |
| 19 | $this->plugin_name = $plugin_name; |
| 20 | |
| 21 | $this->settings = array( |
| 22 | |
| 23 | array('field'=>'pi_eqw_enable_cart', 'label'=>__('Enable cart icon','pisol-enquiry-quotation-woocommerce'),'type'=>'switch', 'default'=>1, 'desc'=>__('This will show a dynamically updating cart button on each page in the corner','pisol-enquiry-quotation-woocommerce'), 'pro'=>true), |
| 24 | |
| 25 | array('field'=>'pi_eqw_use_shortcode', 'label'=>__('Insert icon using Short code [enquiry_cart_icon]','pisol-enquiry-quotation-woocommerce'),'type'=>'switch', 'default'=>0, 'desc'=>__('This will allow you to insert the icon using shortcode [enquiry_cart_icon], when you enable this auto insertion will be disabled','pisol-enquiry-quotation-woocommerce'), 'pro'=>true), |
| 26 | |
| 27 | array('field'=>'pisol_eqw_cart_img', 'type'=>'image','label'=>__('Dynamic Cart icon','pisol-enquiry-quotation-woocommerce'),'desc'=>__('Dynamic Cart icon','pisol-enquiry-quotation-woocommerce'),'pro'=>true), |
| 28 | ); |
| 29 | |
| 30 | $this->active_tab = (isset($_GET['tab'])) ? sanitize_text_field($_GET['tab']) : 'default'; |
| 31 | |
| 32 | if($this->this_tab == $this->active_tab){ |
| 33 | add_action($this->plugin_name.'_tab_content', array($this,'tab_content')); |
| 34 | } |
| 35 | |
| 36 | |
| 37 | add_action($this->plugin_name.'_tab', array($this,'tab'),4); |
| 38 | |
| 39 | |
| 40 | $this->register_settings(); |
| 41 | |
| 42 | if(PI_EQW_DELETE_SETTING){ |
| 43 | $this->delete_settings(); |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | function pages(){ |
| 48 | $pages = array(0 => 'Select page for Enquiry cart'); |
| 49 | $obj = get_pages(); |
| 50 | foreach($obj as $page){ |
| 51 | $pages[$page->ID] = $page->post_title; |
| 52 | } |
| 53 | return $pages; |
| 54 | |
| 55 | } |
| 56 | |
| 57 | |
| 58 | function delete_settings(){ |
| 59 | foreach($this->settings as $setting){ |
| 60 | delete_option( $setting['field'] ); |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | function register_settings(){ |
| 65 | |
| 66 | foreach($this->settings as $setting){ |
| 67 | register_setting( $this->setting_key, $setting['field']); |
| 68 | } |
| 69 | |
| 70 | } |
| 71 | |
| 72 | function tab(){ |
| 73 | $this->tab_name = __('Dynamic Cart (PRO)','pisol-enquiry-quotation-woocommerce'); |
| 74 | ?> |
| 75 | <a class="hide-pro px-3 text-light d-flex align-items-center border-left border-right <?php echo ($this->active_tab == $this->this_tab ? 'bg-primary' : 'bg-secondary'); ?>" href="<?php echo esc_url( admin_url( 'admin.php?page='.sanitize_text_field($_GET['page']).'&tab='.$this->this_tab ) ); ?>"> |
| 76 | <?php echo esc_html( $this->tab_name); ?> |
| 77 | </a> |
| 78 | <?php |
| 79 | } |
| 80 | |
| 81 | function tab_content(){ |
| 82 | |
| 83 | ?> |
| 84 | <form method="post" action="options.php" class="pisol-setting-form"> |
| 85 | <?php settings_fields( $this->setting_key ); ?> |
| 86 | <?php |
| 87 | foreach($this->settings as $setting){ |
| 88 | new pisol_class_form_eqw($setting, $this->setting_key); |
| 89 | } |
| 90 | ?> |
| 91 | <input type="submit" class="mt-3 btn btn-primary btn-sm" value="Save Option" /> |
| 92 | </form> |
| 93 | <?php |
| 94 | } |
| 95 | |
| 96 | |
| 97 | } |
| 98 |