PluginProbe ʕ •ᴥ•ʔ
PiWeb Product Enquiry or product catalog for WooCommerce / 2.2.34.43
PiWeb Product Enquiry or product catalog for WooCommerce v2.2.34.43
2.2.34.43 2.2.34.42 2.2.34.41 2.2.34.40 2.2.34.39 trunk 2.2.22 2.2.26 2.2.33.16 2.2.33.17 2.2.33.19 2.2.33.20 2.2.33.21 2.2.33.22 2.2.33.23 2.2.33.24 2.2.33.26 2.2.33.27 2.2.33.29 2.2.33.30 2.2.33.31 2.2.33.32 2.2.33.33 2.2.33.34 2.2.33.36 2.2.33.37 2.2.33.39 2.2.33.40 2.2.33.41 2.2.33.42 2.2.33.43 2.2.33.44 2.2.33.46 2.2.33.47 2.2.33.49 2.2.34.0 2.2.34.1 2.2.34.10 2.2.34.11 2.2.34.12 2.2.34.13 2.2.34.14 2.2.34.16 2.2.34.17 2.2.34.19 2.2.34.2 2.2.34.20 2.2.34.21 2.2.34.22 2.2.34.23 2.2.34.24 2.2.34.26 2.2.34.27 2.2.34.29 2.2.34.3 2.2.34.30 2.2.34.31 2.2.34.32 2.2.34.33 2.2.34.34 2.2.34.36 2.2.34.37 2.2.34.4 2.2.34.6 2.2.34.7 2.2.34.9
enquiry-quotation-for-woocommerce / admin / class-eqw-option.php
enquiry-quotation-for-woocommerce / admin Last commit date
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-option.php
153 lines
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) exit;
3
4 class Class_Pi_Eqw_Option{
5
6 public $plugin_name;
7
8 private $settings = array();
9
10 private $active_tab;
11
12 private $this_tab = 'default';
13
14 private $tab_name = 'Enquiry Button';
15
16 private $setting_key = 'pi_eqw_basic_setting';
17
18 public $tab;
19
20 function __construct($plugin_name){
21 $this->plugin_name = $plugin_name;
22
23 add_action('init', array($this,'init'));
24
25 $this->tab = sanitize_text_field(filter_input( INPUT_GET, 'tab'));
26 $this->active_tab = $this->tab != "" ? $this->tab : 'default';
27
28 if($this->this_tab == $this->active_tab){
29 add_action($this->plugin_name.'_tab_content', array($this,'tab_content'));
30 }
31
32 add_action($this->plugin_name.'_tab', array($this,'tab'),1);
33 }
34
35 function init(){
36 $this->settings = array(
37
38 array('field'=>'title', 'class'=> 'hide-pro bg-dark opacity-75 text-light', 'class_title'=>'text-light font-weight-light h4', 'label'=>'Enable enquiry for specific roles of users only', 'type'=>'setting_category'),
39
40 array('field'=>'pi_eqw_show_enquiry_button_to_role2', 'type'=>'multiselect', 'default'=>array('guest'),'label'=>__('Show enquiry button for user with role', 'pisol-enquiry-quotation-woocommerce'),'desc'=>__('select roles to whom the enquiry button will be shown', 'pisol-enquiry-quotation-woocommerce'), 'value'=>$this->allUserRoles(), 'pro'=>true),
41
42 array('field'=>'title', 'class'=> 'bg-dark opacity-75 text-light', 'class_title'=>'text-light font-weight-light h4', 'label'=>__('Enquiry button on shop / category page','pisol-enquiry-quotation-woocommerce'), 'type'=>'setting_category'),
43
44 array('field'=>'pi_eqw_enquiry_loop', 'label'=>__('Enquiry button on shop / category page', 'pisol-enquiry-quotation-woocommerce'),'type'=>'switch', 'default'=>1, 'desc'=>__('This will show enquiry button on loop product like shop, category page', 'pisol-enquiry-quotation-woocommerce')),
45
46 array('field'=>'pi_eqw_enquiry_loop_pro', 'label'=>__('Show button on Variable Product', 'pisol-enquiry-quotation-woocommerce'),'type'=>'switch', 'default'=>0, 'desc'=>__('This will show enquiry button on variable product', 'pisol-enquiry-quotation-woocommerce'), 'pro'=>true),
47
48 array('field'=>'pi_eqw_loop_show_on_out_of_stock_pro', 'label'=>__('Show enquiry option only when product is out of stock', 'pisol-enquiry-quotation-woocommerce'),'type'=>'switch', 'default'=>0, 'desc'=>__('On shop / category product page', 'pisol-enquiry-quotation-woocommerce'), 'pro'=>true),
49
50 array('field'=>'pi_eqw_enquiry_loop_position', 'label'=>__('Position on shop/category page', 'pisol-enquiry-quotation-woocommerce'),'type'=>'select', 'default'=> 'woocommerce_after_shop_loop_item', 'value'=>array('woocommerce_after_shop_loop_item'=>__('At the end of product', 'pisol-enquiry-quotation-woocommerce'), 'woocommerce_before_shop_loop_item'=>__('At the start of the product', 'pisol-enquiry-quotation-woocommerce'), 'woocommerce_before_shop_loop_item_title'=>__('Before product title', 'pisol-enquiry-quotation-woocommerce'), 'woocommerce_after_shop_loop_item_title'=>__('After product title', 'pisol-enquiry-quotation-woocommerce')), 'desc'=>__('Enquiry button position on shop / category page','pisol-enquiry-quotation-woocommerce'), 'pro'=>true),
51
52 array('field'=>'pi_eqw_enquiry_loop_bg_color', 'type'=>'color', 'default'=>'#ee6443','label'=>__('Background color','pisol-enquiry-quotation-woocommerce'),'desc'=>__('Background color of the button on the shop / category page','pisol-enquiry-quotation-woocommerce')),
53
54 array('field'=>'pi_eqw_enquiry_loop_text_color', 'type'=>'color', 'default'=>'#ffffff','label'=>__('Text color','pisol-enquiry-quotation-woocommerce'),'desc'=>__('Text color of the button on the shop / category page','pisol-enquiry-quotation-woocommerce')),
55
56 array('field'=>'pisol_eqw_loop_button_size','desc'=>'Enquiry button width on product page (PX), if left blank it will be 100% width ', 'label'=>__('Enquiry button width on product page', 'pisol-enquiry-quotation-woocommerce'),'type'=>'number', 'default'=>'220', 'min'=>100, 'placeholder'=>'px'),
57
58 array('field'=>'pisol_eqw_loop_button_font_size','desc'=>'Enquiry button font size (PX)', 'label'=>__('Enquiry button font size on product page','pisol-enquiry-quotation-woocommerce'),'type'=>'number', 'default'=>'16', 'placeholder'=>'px', 'min'=>12),
59
60 array('field'=>'pi_eqw_enquiry_loop_button_text', 'type'=>'text', 'default'=>__('Add to Enquiry','pisol-enquiry-quotation-woocommerce'),'label'=>__('Enquiry button text','pisol-enquiry-quotation-woocommerce'),'desc'=>__('Text shown in the enquiry button','pisol-enquiry-quotation-woocommerce')),
61
62
63 array('field'=>'title', 'class'=> 'bg-dark opacity-75 text-light', 'class_title'=>'text-light font-weight-light h4', 'label'=>__('Enquiry button on single product page','pisol-enquiry-quotation-woocommerce'), 'type'=>'setting_category'),
64
65 array('field'=>'pi_eqw_enquiry_single', 'label'=>__('Enquiry button on single product page','pisol-enquiry-quotation-woocommerce'),'type'=>'switch', 'default'=>1, 'desc'=>__('This will show enquiry button on single product page','pisol-enquiry-quotation-woocommerce')),
66
67 array('field'=>'pi_eqw_enquiry_single_pro', 'label'=>__('Show button on Variable Product','pisol-enquiry-quotation-woocommerce'),'type'=>'switch', 'default'=>0, 'desc'=>__('This will show enquiry button on variable product','pisol-enquiry-quotation-woocommerce'), 'pro'=>true),
68
69 array('field'=>'pi_eqw_single_show_on_out_of_stock_pro', 'label'=>__('Show enquiry option Only when product is out of stock','pisol-enquiry-quotation-woocommerce'),'type'=>'switch', 'default'=>0, 'desc'=>__('On single product page','pisol-enquiry-quotation-woocommerce'), 'pro'=>true),
70
71 array('field'=>'pi_eqw_enquiry_single_position', 'label'=>__('Position on single product page','pisol-enquiry-quotation-woocommerce'),'type'=>'select', 'default'=> 52, 'value'=> array(4 =>__('Before summary','pisol-enquiry-quotation-woocommerce'), 52 => __('After Summary','pisol-enquiry-quotation-woocommerce'), 36 => __('After add to cart button','pisol-enquiry-quotation-woocommerce'), 29 => __('Before add to cart button','pisol-enquiry-quotation-woocommerce')), 'desc'=>__('Enquiry button position on single product page','pisol-enquiry-quotation-woocommerce'), 'pro'=>true),
72
73 array('field'=>'pi_eqw_enquiry_single_bg_color', 'type'=>'color', 'default'=>'#ee6443','label'=>__('Background color','pisol-enquiry-quotation-woocommerce'),'desc'=>__('Background color of the button on the shop / category page','pisol-enquiry-quotation-woocommerce')),
74
75 array('field'=>'pi_eqw_enquiry_single_text_color', 'type'=>'color', 'default'=>'#ffffff','label'=>__('Text color','pisol-enquiry-quotation-woocommerce'),'desc'=>__('Text color of the button on the shop / category page','pisol-enquiry-quotation-woocommerce')),
76
77 array('field'=>'pisol_eqw_button_size','desc'=>'Enquiry button width on product page (PX), if left blank it will be 100% width ', 'label'=>__('Enquiry button width on product page', 'pisol-enquiry-quotation-woocommerce'),'type'=>'number', 'default'=>'220', 'min'=>100, 'placeholder'=>'px'),
78
79 array('field'=>'pisol_eqw_button_font_size','desc'=>'Enquiry button font size (PX)', 'label'=>__('Enquiry button font size on product page','pisol-enquiry-quotation-woocommerce'),'type'=>'number', 'default'=>'16', 'placeholder'=>'px', 'min'=>12),
80
81 array('field'=>'pi_eqw_enquiry_single_button_text', 'type'=>'text', 'default'=>__('Add to Enquiry','pisol-enquiry-quotation-woocommerce'),'label'=>__('Enquiry button text','pisol-enquiry-quotation-woocommerce'),'desc'=>__('Text shown in the enquiry button','pisol-enquiry-quotation-woocommerce')),
82
83 array('field'=>'title', 'class'=> 'bg-dark opacity-75 text-light', 'class_title'=>'text-light font-weight-light h4', 'label'=>__('If you notice change in enquiry button after upgrading to v2.1.2, then enable the below option to fall back to old way of position','pisol-enquiry-quotation-woocommerce'), 'type'=>'setting_category'),
84
85 array('field'=>'pi_eqw_trouble_shoot_position', 'label'=>__('Fall back to old position hook','pisol-enquiry-quotation-woocommerce'),'type'=>'switch', 'default'=>0, 'desc'=>__('We have changed the single product page hook in v2.1.2 this is done to improve compatibility, but if you face any issue like enquiry button not showing after upgrading to v2.1.2 then enable this option to fall back to old hook','pisol-enquiry-quotation-woocommerce')),
86
87 array('field'=>'title', 'class'=> 'hide-pro bg-dark opacity-75 text-light', 'class_title'=>'text-light font-weight-light h4', 'label'=>__('Processing image','pisol-enquiry-quotation-woocommerce'), 'type'=>'setting_category'),
88
89 array('field'=>'pisol_eqw_loading_img', 'type'=>'image','label'=>__('Processing image','pisol-enquiry-quotation-woocommerce'),'desc'=>__('Image is shown as loading image','pisol-enquiry-quotation-woocommerce'), 'pro'=>true),
90
91
92 );
93 $this->register_settings();
94
95 if(PI_EQW_DELETE_SETTING){
96 $this->delete_settings();
97 }
98 }
99
100 function allUserRoles(){
101 $wp_roles = new WP_Roles();
102 $roles = array();
103 foreach($wp_roles->roles as $key => $role){
104 $roles[$key] = $role['name'];
105 }
106 $roles['guest'] = 'Guest Customer';
107 return $roles;
108 }
109
110
111 function delete_settings(){
112 foreach($this->settings as $setting){
113 delete_option( $setting['field'] );
114 }
115 }
116
117 function register_settings(){
118
119 foreach($this->settings as $setting){
120 register_setting( $this->setting_key, $setting['field']);
121 }
122
123 }
124
125 function tab(){
126 $page = sanitize_text_field(filter_input( INPUT_GET, 'page'));
127 $this->tab_name = __('Enquiry Button','pisol-enquiry-quotation-woocommerce');
128 ?>
129 <a class=" 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 ) ); ?>">
130 <span class="dashicons dashicons-format-chat"></span> <?php echo esc_html( $this->tab_name); ?>
131 </a>
132 <?php
133 }
134
135 function tab_content(){
136
137 ?>
138 <form method="post" action="options.php" class="pisol-setting-form">
139 <?php settings_fields( $this->setting_key ); ?>
140 <?php
141 foreach($this->settings as $setting){
142 new pisol_class_form_eqw($setting, $this->setting_key);
143 }
144 ?>
145 <input type="submit" class="my-3 btn btn-primary btn-md" value="<?php echo esc_attr__('Save Option', 'pisol-enquiry-quotation-woocommerce'); ?>" />
146 </form>
147 <?php
148 }
149
150
151 }
152
153