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-form-control.php
91 lines
| 1 | <?php |
| 2 | |
| 3 | class Class_Pi_Eqw_Form_Control{ |
| 4 | |
| 5 | public $plugin_name; |
| 6 | |
| 7 | private $settings = array(); |
| 8 | |
| 9 | private $active_tab; |
| 10 | |
| 11 | private $this_tab = 'form_control'; |
| 12 | |
| 13 | private $tab_name = "Form builder (PRO)"; |
| 14 | |
| 15 | private $setting_key = 'pi_eqw_form_control'; |
| 16 | |
| 17 | public $tab; |
| 18 | |
| 19 | |
| 20 | function __construct($plugin_name){ |
| 21 | $this->plugin_name = $plugin_name; |
| 22 | |
| 23 | $this->settings = array( |
| 24 | |
| 25 | array('field'=>'title', 'class'=> 'bg-primary text-light', 'class_title'=>'text-light font-weight-light h4', 'label'=>__('Making enquiry form field as required.','pisol-enquiry-quotation-woocommerce'), 'type'=>'setting_category'), |
| 26 | array('field'=>'pi_eqw_name_required','type'=>'switch','label'=>__('Name Field','pisol-enquiry-quotation-woocommerce'),'default'=>1,'pro'=>true), |
| 27 | array('field'=>'pi_eqw_email_required','type'=>'switch','label'=>__('Email Field','pisol-enquiry-quotation-woocommerce'),'default'=>1,'pro'=>true), |
| 28 | array('field'=>'pi_eqw_phone_required','type'=>'switch','label'=>__('Phone Field','pisol-enquiry-quotation-woocommerce'),'default'=>1,'pro'=>true), |
| 29 | array('field'=>'pi_eqw_subject_required','type'=>'switch','label'=>__('Subject Field','pisol-enquiry-quotation-woocommerce'),'default'=>1,'pro'=>true), |
| 30 | array('field'=>'pi_eqw_message_required','type'=>'switch','label'=>__('Message Field','pisol-enquiry-quotation-woocommerce'),'default'=>1,'pro'=>true), |
| 31 | |
| 32 | array('field'=>'title2', 'class'=> 'bg-primary text-light', 'class_title'=>'text-light font-weight-light h4', 'label'=>__('Terms & Condition option','pisol-enquiry-quotation-woocommerce'), 'type'=>"setting_category"), |
| 33 | array('field'=>'pi_eqw_enable_tandc','type'=>'switch','label'=>__('Enable Terms & Condition','pisol-enquiry-quotation-woocommerce'),'default'=>0, 'desc'=>__('This will show the terms and condition selection option on the enquiry form, user must select this option to submit the enquiry','pisol-enquiry-quotation-woocommerce'),'pro'=>true), |
| 34 | array('field'=>'pi_eqw_tandc_label','type'=>'textarea','label'=>__('Terms and Condition Text','pisol-enquiry-quotation-woocommerce'),'default'=>"We accept Terms & Conditions", 'desc'=>__('This will be the test shown next to the terms and condition text','pisol-enquiry-quotation-woocommerce'),'pro'=>true), |
| 35 | |
| 36 | ); |
| 37 | |
| 38 | $this->tab = sanitize_text_field(filter_input( INPUT_GET, 'tab')); |
| 39 | $this->active_tab = $this->tab != "" ? $this->tab : 'default'; |
| 40 | |
| 41 | if($this->this_tab == $this->active_tab){ |
| 42 | add_action($this->plugin_name.'_tab_content', array($this,'tab_content')); |
| 43 | } |
| 44 | |
| 45 | |
| 46 | add_action($this->plugin_name.'_tab', array($this,'tab'),3); |
| 47 | |
| 48 | |
| 49 | $this->register_settings(); |
| 50 | |
| 51 | if(PI_EQW_DELETE_SETTING){ |
| 52 | $this->delete_settings(); |
| 53 | } |
| 54 | |
| 55 | |
| 56 | } |
| 57 | |
| 58 | |
| 59 | function delete_settings(){ |
| 60 | foreach($this->settings as $setting){ |
| 61 | delete_option( $setting['field'] ); |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | function register_settings(){ |
| 66 | |
| 67 | foreach($this->settings as $setting){ |
| 68 | register_setting( $this->setting_key, $setting['field']); |
| 69 | } |
| 70 | |
| 71 | } |
| 72 | |
| 73 | function tab(){ |
| 74 | $page = sanitize_text_field(filter_input( INPUT_GET, 'page')); |
| 75 | $this->tab_name = __('Form builder (PRO)','pisol-enquiry-quotation-woocommerce'); |
| 76 | ?> |
| 77 | <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='.$page.'&tab='.$this->this_tab ) ); ?>"> |
| 78 | <?php echo esc_html( $this->tab_name); ?> |
| 79 | </a> |
| 80 | <?php |
| 81 | } |
| 82 | |
| 83 | function tab_content(){ |
| 84 | ?> |
| 85 | <div class="free-version"> |
| 86 | <img class="img-fluid" src="<?php echo esc_url( plugin_dir_url( __FILE__ ) ); ?>img/form-control.png"> |
| 87 | </div> |
| 88 | <?php |
| 89 | } |
| 90 | } |
| 91 |