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