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-email.php
121 lines
| 1 | <?php |
| 2 | |
| 3 | class Class_Pi_Eqw_Email{ |
| 4 | |
| 5 | public $plugin_name; |
| 6 | |
| 7 | private $settings = array(); |
| 8 | |
| 9 | private $active_tab; |
| 10 | |
| 11 | private $this_tab = 'email'; |
| 12 | |
| 13 | private $tab_name = "Email setting"; |
| 14 | |
| 15 | private $setting_key = 'pi_eqw_email_setting'; |
| 16 | |
| 17 | public $tab; |
| 18 | |
| 19 | |
| 20 | function __construct($plugin_name){ |
| 21 | $this->plugin_name = $plugin_name; |
| 22 | |
| 23 | $this->settings = array( |
| 24 | |
| 25 | |
| 26 | array('field'=>'pi_eqw_email', 'label'=>__('Email id','pisol-enquiry-quotation-woocommerce'),'type'=>'text', 'desc'=>__('Email id that will receive the enquiry, <strong class="text-danger">In PRO version you can add multiple email separated with coma like this text@email.com, text2@email.com </strong>','pisol-enquiry-quotation-woocommerce'),'default'=> get_option('admin_email')), |
| 27 | |
| 28 | array('field'=>'pi_eqw_email_subject', 'label'=>__('Subject of the email','pisol-enquiry-quotation-woocommerce'),'type'=>'text', 'default'=>__('New enquiry received'), 'desc'=>__('subject of the email', 'pisol-enquiry-quotation-woocommerce')), |
| 29 | |
| 30 | array('field'=>'pi_eqw_show_message_as_row', 'label'=>__('Show product message as row in email','pisol-enquiry-quotation-woocommerce'),'type'=>'switch','default'=> 1, 'desc'=>__('Show message as row in the email else it will be shown as a columns in the product row','pisol-enquiry-quotation-woocommerce')), |
| 31 | |
| 32 | array('field'=>'pi_eqw_email_template', 'label'=>__('Use WooCommerce email template','pisol-enquiry-quotation-woocommerce'),'type'=>'switch','default'=> 1, 'desc'=>__('Use Woocommerce email template all the colors will be as per woocommerce email template ','pisol-enquiry-quotation-woocommerce')), |
| 33 | |
| 34 | array('field'=>'pi_enq_add_img_url', 'label'=>__('Enable this option If product and logo image are not shown in the email or You dont want image attached in email','pisol-enquiry-quotation-woocommerce'),'type'=>'switch','default'=>0, 'desc'=>__('Enable this option only if you are having issue in seeing image inside the enquiry email or You dont want image to be send as attachment in the email','pisol-enquiry-quotation-woocommerce')), |
| 35 | |
| 36 | array('field'=>'pi_eqw_email_to_customer', 'label'=>__('Send enquiry email to customer as well','pisol-enquiry-quotation-woocommerce'),'type'=>'switch','default'=>1, 'desc'=>__('Will send the enquiry email copy to customer as well','pisol-enquiry-quotation-woocommerce'), 'pro'=>true), |
| 37 | |
| 38 | array('field'=>'pi_eqw_customer_email_subject', 'label'=>__('Subject of the email to customer','pisol-enquiry-quotation-woocommerce'),'type'=>'text', 'default'=>__('Your enquiry is submitted'), 'desc'=>__('Subject of the enquiry email send to customer', 'pisol-enquiry-quotation-woocommerce'), 'pro'=>true), |
| 39 | array('field'=>'pi_eqw_company_logo', 'label'=>__('Logo added in the email','pisol-enquiry-quotation-woocommerce'),'type'=>'image', 'desc'=>__('This is the image that will be added inside the email copy, sed to you and the customer', 'pisol-enquiry-quotation-woocommerce'),'pro'=>true), |
| 40 | |
| 41 | array('field'=>'title', 'class'=> 'hide-pro bg-primary text-light', 'class_title'=>'text-light font-weight-light h4', 'label'=>__('Custom message for customer email', 'pisol-enquiry-quotation-woocommerce'), 'type'=>'setting_category'), |
| 42 | |
| 43 | array('field'=>'pi_eqw_customer_email_above_product_table', 'label'=>__('Above product table','pisol-enquiry-quotation-woocommerce'),'type'=>'textarea', 'default'=>"", 'desc'=>__('This message will appear above the product table','pisol-enquiry-quotation-woocommerce'),'pro'=>true), |
| 44 | |
| 45 | array('field'=>'pi_eqw_customer_email_below_product_table', 'label'=>__('Below product table','pisol-enquiry-quotation-woocommerce'),'type'=>'textarea', 'default'=>"", 'desc'=>__('This message will appear below the product table','pisol-enquiry-quotation-woocommerce'),'pro'=>true), |
| 46 | |
| 47 | array('field'=>'pi_eqw_customer_email_below_customer_detail', 'label'=>__('Below customer detail','pisol-enquiry-quotation-woocommerce'),'type'=>'textarea', 'default'=>"", 'desc'=>__('This message will appear below the customer detail table','pisol-enquiry-quotation-woocommerce'),'pro'=>true), |
| 48 | |
| 49 | array('field'=>'title', 'class'=> 'hide-pro bg-primary text-light', 'class_title'=>'text-light font-weight-light h4', 'label'=>__('Custom message for admin email', 'pisol-enquiry-quotation-woocommerce'), 'type'=>'setting_category'), |
| 50 | |
| 51 | array('field'=>'pi_eqw_admin_email_above_product_table', 'label'=>__('Above product table','pisol-enquiry-quotation-woocommerce'),'type'=>'textarea', 'default'=>"", 'desc'=>__('This message will appear above the product table','pisol-enquiry-quotation-woocommerce'),'pro'=>true), |
| 52 | |
| 53 | array('field'=>'pi_eqw_admin_email_below_product_table', 'label'=>__('Below product table','pisol-enquiry-quotation-woocommerce'),'type'=>'textarea', 'default'=>"", 'desc'=>__('This message will appear below the product table','pisol-enquiry-quotation-woocommerce'),'pro'=>true), |
| 54 | |
| 55 | array('field'=>'pi_eqw_admin_email_below_customer_detail', 'label'=>__('Below customer detail','pisol-enquiry-quotation-woocommerce'),'type'=>'textarea', 'default'=>"", 'desc'=>__('This message will appear below the customer detail table','pisol-enquiry-quotation-woocommerce'),'pro'=>true) |
| 56 | |
| 57 | |
| 58 | ); |
| 59 | |
| 60 | $this->tab = sanitize_text_field(filter_input( INPUT_GET, 'tab')); |
| 61 | $this->active_tab = $this->tab != "" ? $this->tab : 'default'; |
| 62 | |
| 63 | if($this->this_tab == $this->active_tab){ |
| 64 | add_action($this->plugin_name.'_tab_content', array($this,'tab_content')); |
| 65 | } |
| 66 | |
| 67 | |
| 68 | add_action($this->plugin_name.'_tab', array($this,'tab'),3); |
| 69 | |
| 70 | |
| 71 | $this->register_settings(); |
| 72 | |
| 73 | if(PI_EQW_DELETE_SETTING){ |
| 74 | $this->delete_settings(); |
| 75 | } |
| 76 | |
| 77 | |
| 78 | } |
| 79 | |
| 80 | |
| 81 | function delete_settings(){ |
| 82 | foreach($this->settings as $setting){ |
| 83 | delete_option( $setting['field'] ); |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | function register_settings(){ |
| 88 | |
| 89 | foreach($this->settings as $setting){ |
| 90 | register_setting( $this->setting_key, $setting['field']); |
| 91 | } |
| 92 | |
| 93 | } |
| 94 | |
| 95 | function tab(){ |
| 96 | $page = sanitize_text_field(filter_input( INPUT_GET, 'page')); |
| 97 | $this->tab_name = __('Email setting','pisol-enquiry-quotation-woocommerce'); |
| 98 | ?> |
| 99 | <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 ) ); ?>"> |
| 100 | <?php echo esc_html( $this->tab_name); ?> |
| 101 | </a> |
| 102 | <?php |
| 103 | } |
| 104 | |
| 105 | function tab_content(){ |
| 106 | ?> |
| 107 | <form method="post" action="options.php" class="pisol-setting-form"> |
| 108 | <?php settings_fields( $this->setting_key ); ?> |
| 109 | <?php |
| 110 | foreach($this->settings as $setting){ |
| 111 | new pisol_class_form_eqw($setting, $this->setting_key); |
| 112 | } |
| 113 | ?> |
| 114 | <input type="submit" class="mt-3 btn btn-primary btn-sm" value="Save Option" /> |
| 115 | </form> |
| 116 | <?php |
| 117 | } |
| 118 | |
| 119 | } |
| 120 | |
| 121 |