css
1 year ago
img
1 year ago
js
1 year ago
class-adv-order-filter.php
1 year ago
class-pi-dtt-labels.php
1 year ago
class-pi-dtt-order-table.php
1 year ago
conflict-fixer.php
1 year ago
menu.php
1 year ago
options-addons.php
1 year ago
options-date.php
1 year ago
options-limit.php
1 year ago
options-pickup.php
1 year ago
options-time-slot.php
1 year ago
options-time.php
1 year ago
options.php
1 year ago
class-pi-dtt-labels.php
127 lines
| 1 | <?php |
| 2 | if ( ! defined( 'WPINC' ) ) { |
| 3 | die; |
| 4 | } |
| 5 | class pisol_dtt_option_label{ |
| 6 | |
| 7 | private $settings = array(); |
| 8 | |
| 9 | private $active_tab; |
| 10 | |
| 11 | private $this_tab = 'label'; |
| 12 | |
| 13 | private $tab_name = "Labels"; |
| 14 | |
| 15 | private $setting_key = 'pisol_dtt_label'; |
| 16 | |
| 17 | private $calendar_themes = array( |
| 18 | 'black-tie', 'blitzer', 'cupertino', 'dark-hive', 'dot-luv', 'eggplant', 'excite-bike', 'flick', 'hot-sneaks', 'humanity', 'le-frog', 'mint-choc', 'overcast', 'pepper-grinder', 'redmond', 'smoothness', 'south-street', 'start', 'sunny', 'swanky-purse', 'trontastic', 'ui-darkness', 'ui-lightness', 'vader' |
| 19 | ); |
| 20 | |
| 21 | |
| 22 | function __construct(){ |
| 23 | |
| 24 | $this->active_tab = (isset($_GET['tab'])) ? sanitize_text_field($_GET['tab']) : 'default'; |
| 25 | |
| 26 | $this->settings = array( |
| 27 | |
| 28 | array('field'=>'color-setting', 'class'=> 'bg-primary text-light', 'class_title'=>'text-light font-weight-light h4', 'label'=>__('Checkout form labels','pisol-dtt'), 'type'=>'setting_category'), |
| 29 | |
| 30 | array('field'=>'pi_show_delivery_type_label', 'label'=>__('Show "Delivery type" label','pisol-dtt'),'desc'=>__('using this you can show or hide the "Delivery type *" shown on top of the delivery type selection option','pisol-dtt'), 'type'=>'switch', 'default'=>1), |
| 31 | |
| 32 | |
| 33 | array('field'=>'color-setting', 'class'=> 'bg-primary text-light hide-pro', 'class_title'=>'text-light font-weight-light h4', 'label'=>__('Date and time label for email/order success page/backend (when delivery method: pickup)','pisol-dtt'), 'type'=>'setting_category'), |
| 34 | array('field'=>'pi_date_field_label_pickup', 'label'=>__('Date field label','pisol-dtt'), 'desc'=>__('This label is used for email, order detail page','pisol-dtt'), 'type'=>'text', 'default'=>__('Pickup Date','pisol-dtt'), 'pro'=>true), |
| 35 | |
| 36 | array('field'=>'pi_time_field_label_pickup', 'label'=>__('Time field label','pisol-dtt'), 'desc'=>__('This label is used for email, order detail page','pisol-dtt'), 'type'=>'text', 'default'=>__('Pickup Time','pisol-dtt'), 'pro'=>true), |
| 37 | |
| 38 | |
| 39 | array('field'=>'color-setting', 'class'=> 'bg-primary text-light hide-pro', 'class_title'=>'text-light font-weight-light h4', 'label'=>__('Date and time label for email/order success page/backend (when delivery method: delivery)','pisol-dtt'), 'type'=>'setting_category'), |
| 40 | array('field'=>'pi_date_field_label_delivery', 'label'=>__('Date field label','pisol-dtt'), 'desc'=>__('This label is used for email, order detail page','pisol-dtt'), 'type'=>'text', 'default'=>__('Delivery Date','pisol-dtt'), 'pro'=>true), |
| 41 | array('field'=>'pi_time_field_label_delivery', 'label'=>__('Time field label','pisol-dtt'), 'desc'=>__('This label is used for email, order detail page','pisol-dtt'), 'type'=>'text', 'default'=>__('Delivery Time','pisol-dtt'), 'pro'=>true), |
| 42 | |
| 43 | array('field'=>'color-setting1', 'class'=> 'bg-primary text-light hide-pro', 'class_title'=>'text-light font-weight-light h4', 'label'=>__('Extra message that you can show for Date and time field','pisol-dtt'), 'type'=>'setting_category'), |
| 44 | array('field'=>'pi_extra_message_delivery', 'label'=>__('Message shown when delivery type is selected','pisol-dtt'), 'desc'=>__('Message shown when delivery type is selected, Leave empty if you don\'t want to show message','pisol-dtt'), 'type'=>'text', 'default'=>"" , 'pro'=>true), |
| 45 | array('field'=>'pi_extra_message_pickup', 'label'=>__('Message shown when pickup type is selected','pisol-dtt'), 'desc'=>__('Message shown when pickup type is selected, , Leave empty if you don\'t want to show message','pisol-dtt'), 'type'=>'text', 'default'=>"", 'pro'=>true), |
| 46 | |
| 47 | array('field'=>"pi_extra_message_position",'type'=>'select', 'label'=>__('Position of the message','pisol-dtt'), 'desc'=>__('position of the message can be above the delivery type button or below the date and time option','pisol-dtt'), 'default'=>'before', 'value'=>array('before'=>__('Before delivery type selection option','pisol-dtt'), 'between'=>__('Between delivery type and date time selection option','pisol-dtt'),'after'=>__('After date and time option','pisol-dtt')), 'pro'=>true), |
| 48 | |
| 49 | array('field'=>'pi_extra_message_bg_color', 'default'=>'#cccccc', 'type'=>'color', 'label'=>__('Message box background color','pisol-dtt'),'desc'=>'', 'pro'=>true), |
| 50 | array('field'=>'pi_extra_message_text_color', 'default'=>'#000000', 'type'=>'color', 'label'=>__('Message box text color','pisol-dtt'),'desc'=>'', 'pro'=>true), |
| 51 | |
| 52 | |
| 53 | |
| 54 | array('field'=>'color-setting', 'class'=> 'bg-primary text-light', 'class_title'=>'text-light font-weight-light h4', 'label'=>__('Delivery type button on checkout form','pisol-dtt'), 'type'=>'setting_category'), |
| 55 | array('field'=>'pi_pickup_label', 'label'=>__('Pickup label','pisol-dtt'), 'desc'=>__('The text that will be shown on the pickup button on the checkout page','pisol-dtt'), 'type'=>'text', 'default'=>'Pickup'), |
| 56 | array('field'=>'pi_delivery_label', 'label'=>__('Delivery label','pisol-dtt'), 'desc'=>__('The text that will be shown on the delivery button on the checkout page','pisol-dtt'), 'type'=>'text', 'default'=>'Delivery'), |
| 57 | array('field'=>'pi_button_bg_color', 'default'=>'#cccccc', 'type'=>'color', 'label'=>__('Pickup / Delivery button background color','pisol-dtt'),'desc'=>__('Background color when the delivery type is not selected','pisol-dtt')), |
| 58 | array('field'=>'pi_active_button_bg_color', 'default'=>'#000000', 'type'=>'color', 'label'=>__('Pickup / Delivery active button background color','pisol-dtt'),'desc'=>__('Background color when the particular delivery type is selected','pisol-dtt')), |
| 59 | |
| 60 | array('field'=>'pi_button_text_color', 'default'=>'#000000', 'type'=>'color', 'label'=>__('Pickup / Delivery button text color','pisol-dtt'),'desc'=>__('Text color when the delivery type is not selected','pisol-dtt')), |
| 61 | array('field'=>'pi_active_button_text_color', 'default'=>'#ffffff', 'type'=>'color', 'label'=>__('Pickup / Delivery active button text color','pisol-dtt'),'desc'=>__('Text color when the particular delivery type is selected','pisol-dtt')), |
| 62 | |
| 63 | |
| 64 | ); |
| 65 | |
| 66 | |
| 67 | if($this->this_tab == $this->active_tab){ |
| 68 | add_action('pisol_dtt_tab_content', array($this,'tab_content')); |
| 69 | } |
| 70 | |
| 71 | add_action('pisol_dtt_tab', array($this,'tab'),3); |
| 72 | |
| 73 | $this->register_settings(); |
| 74 | |
| 75 | } |
| 76 | |
| 77 | function calendarStyles(){ |
| 78 | $result = array(); |
| 79 | foreach($this->calendar_themes as $theme){ |
| 80 | $result[$theme] = ucfirst($theme); |
| 81 | } |
| 82 | return $result; |
| 83 | } |
| 84 | |
| 85 | function register_settings(){ |
| 86 | |
| 87 | foreach($this->settings as $setting){ |
| 88 | pisol_class_form::register_setting( $this->setting_key, $setting); |
| 89 | } |
| 90 | |
| 91 | } |
| 92 | |
| 93 | function delete_settings(){ |
| 94 | foreach($this->settings as $setting){ |
| 95 | delete_option( $setting['field'] ); |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | function tab(){ |
| 100 | $this->tab_name = __('Labels', 'pisol-dtt'); |
| 101 | ?> |
| 102 | <a class=" pi-side-menu <?php echo ($this->active_tab == $this->this_tab ? 'bg-primary' : 'bg-secondary'); ?>" href="<?php echo esc_url(admin_url( 'admin.php?page='.esc_attr($_GET['page']).'&tab='.esc_attr($this->this_tab) )); ?>"> |
| 103 | <span class="dashicons dashicons-tag"></span> <?php echo esc_html($this->tab_name); ?> |
| 104 | </a> |
| 105 | <?php |
| 106 | } |
| 107 | |
| 108 | function tab_content(){ |
| 109 | ?> |
| 110 | <form method="post" action="options.php" class="pisol-setting-form"> |
| 111 | <?php settings_fields( $this->setting_key ); ?> |
| 112 | <?php |
| 113 | foreach($this->settings as $setting){ |
| 114 | new pisol_class_form($setting, $this->setting_key); |
| 115 | } |
| 116 | ?> |
| 117 | <input type="submit" name="submit" id="submit" class="btn btn-primary btn-md my-3" value="<?php echo esc_attr__('Save Changes','pisol-dtt'); ?>"> |
| 118 | </form> |
| 119 | <?php |
| 120 | } |
| 121 | |
| 122 | |
| 123 | } |
| 124 | |
| 125 | new pisol_dtt_option_label(); |
| 126 | |
| 127 |