PluginProbe
Orderable – Restaurant & Food Ordering System / 1.19.0
Orderable – Restaurant & Food Ordering System v1.19.0
0.1.4 0.1.5 0.2.0 1.0.0 1.1.0 1.1.1 1.10.0 1.10.1 1.11.0 1.12.0 1.12.1 1.12.2 1.13.0 1.14.0 1.15.0 1.16.0 1.17.0 1.17.1 1.18.0 1.19.0 1.19.1 1.19.2 1.2.0 1.20.0 1.20.1 All 44 releases
orderable / inc / modules / timings / class-timings-settings.php

class-timings-settings.php in Orderable – Restaurant & Food Ordering System 1.19.0, at inc/modules/timings/class-timings-settings.php

158 lines 4.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Timings settings.
4 *
5 * @package Orderable/Classes
6 */
7
8 defined( 'ABSPATH' ) || exit;
9
10 /**
11 * Timings settings class.
12 */
13 class Orderable_Timings_Settings {
14 /**
15 * Open hours settings key.
16 *
17 * @var string
18 */
19 public static $open_hours_key = 'store_general_open_hours';
20
21 /**
22 * Service hours settings key.
23 *
24 * @var string
25 * @deprecated 1.8.0 No longer used.
26 */
27 public static $service_hours_key = 'store_general_service_hours';
28
29 /**
30 * Holidays settings key.
31 *
32 * @var string
33 */
34 public static $holidays_key = 'holidays';
35
36 /**
37 * Init.
38 */
39 public static function run() {
40 }
41
42 /**
43 * Get time field.
44 *
45 * @param string $name
46 * @param array $values
47 *
48 * @return false|string
49 */
50 public static function get_time_field( $name, $values = array() ) {
51 $defaults = array(
52 'hour' => '',
53 'minute' => '',
54 'period' => '',
55 );
56
57 $values = wp_parse_args( $values, $defaults );
58
59 $hours = array( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 );
60 $minutes = array( '00', '05', '10', '15', '20', '25', '30', '35', '40', '45', '50', '55' );
61
62 ob_start();
63 ?>
64 <span class="orderable-time">
65 <select class="orderable-time__select orderable-time__select--hour" name="<?php echo esc_attr( $name ); ?>[hour]">
66 <?php foreach ( $hours as $hour ) { ?>
67 <option value="<?php echo esc_attr( $hour ); ?>" <?php selected( $values['hour'], $hour ); ?>><?php echo esc_html( $hour ); ?></option>
68 <?php } ?>
69 </select>
70 <select class="orderable-time__select orderable-time__select--minute" name="<?php echo esc_attr( $name ); ?>[minute]">
71 <?php foreach ( $minutes as $minute ) { ?>
72 <option value="<?php echo esc_attr( $minute ); ?>" <?php selected( $values['minute'], $minute ); ?>><?php echo esc_html( $minute ); ?></option>
73 <?php } ?>
74 </select>
75 <select class="orderable-time__select orderable-time__select--period" name="<?php echo esc_attr( $name ); ?>[period]">
76 <option value="AM" <?php selected( $values['period'], 'AM' ); ?>>AM</option>
77 <option value="PM" <?php selected( $values['period'], 'PM' ); ?>>PM</option>
78 </select>
79 </span>
80 <?php
81
82 return ob_get_clean();
83 }
84
85 /**
86 * Get max orders field.
87 *
88 * @param string $name
89 * @param array $settings
90 *
91 * @return mixed|void
92 */
93 public static function get_max_orders_field( $name, $settings = array() ) {
94 ob_start();
95 ?>
96 <strong class="orderable-table__rwd-labels"><?php esc_html_e( 'Max Orders (Day)', 'orderable' ); ?></strong>
97 <?php echo Orderable_Helpers::get_pro_button( 'max-orders' ); ?>
98 <?php
99
100 return apply_filters( 'orderable_get_max_orders_field', ob_get_clean(), $name, $settings );
101 }
102
103 /**
104 * Get time slot fields.
105 *
106 * @param string $name
107 * @param array $settings
108 *
109 * @return mixed|void
110 */
111 public static function get_time_slot_fields( $name, $settings = array() ) {
112 ob_start();
113 ?>
114 <tr data-orderable-period="time-slots" class="orderable-table__no-td-border"
115 <?php
116 if ( 'all-day' === $settings['period'] ) {
117 echo 'style="display: none;"';
118 }
119 ?>
120 >
121 <th class="orderable-table__column orderable-table__column--medium"><?php esc_html_e( 'Hours', 'orderable' ); ?></th>
122 <td class="orderable-table__column orderable-table__column--time" rowspan="4" style="text-align: center;">
123 <?php echo Orderable_Helpers::get_pro_button( 'time-slots' ); ?>
124 </td>
125 </tr>
126 <tr data-orderable-period="time-slots"
127 <?php
128 if ( 'all-day' === $settings['period'] ) {
129 echo 'style="display: none;"';
130 }
131 ?>
132 >
133 <th class="orderable-table__column orderable-table__column--medium"><?php esc_html_e( 'Frequency (Mins)', 'orderable' ); ?></th>
134 </tr>
135 <tr data-orderable-period="time-slots"
136 <?php
137 if ( 'all-day' === $settings['period'] ) {
138 echo 'style="display: none;"';
139 }
140 ?>
141 >
142 <th class="orderable-table__column orderable-table__column--medium"><?php esc_html_e( 'Lead Time (Mins)', 'orderable' ); ?></th>
143 </tr>
144 <tr data-orderable-period="time-slots"
145 <?php
146 if ( 'all-day' === $settings['period'] ) {
147 echo 'style="display: none;"';
148 }
149 ?>
150 >
151 <th class="orderable-table__column orderable-table__column--medium"><?php esc_html_e( 'Max Orders (Slot)', 'orderable' ); ?></th>
152 </tr>
153 <?php
154
155 return apply_filters( 'orderable_get_time_slot_fields', ob_get_clean(), $name, $settings );
156 }
157 }
158