PluginProbe
Booking Calendar / 11.9
Booking Calendar v11.9
11.9 11.8.4 11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 All 205 releases
← All changes | core/lib/wpbc-calendar-legend.php +166 -52 10.1.3 → 11.9 View file →
@@ -1,8 +1,11 @@
1 1 <?php
2 2
3 +if ( ! defined( 'ABSPATH' ) ) {
4 + exit; // Exit if accessed directly.
5 +}
3 6
4 -//FixIn: 9.4.3.6
7 +// FixIn: 9.4.3.6.
5 8
6 9
7 10 /**
8 11 * Get html content of " Calendar Legend Items " , based on General Settings configuration.
@@ -8,9 +11,9 @@
8 11 * Get html content of " Calendar Legend Items " , based on General Settings configuration.
9 12 *
10 13 * @return string HTML content of legend items
11 14 */
12 -function wpbc_get_calendar_legend() {
15 +function wpbc_get_calendar_legend( $resource_id = 0 ) {
13 16
14 17 $calendar_legend_html = '';
15 18
16 19 if ( get_bk_option( 'booking_is_show_legend' ) == 'On' ) {
@@ -22,17 +25,18 @@
22 25 if ( 'On' == get_bk_option( 'booking_legend_is_show_item_approved' ) ) { $items_sort[] = 'approved'; }
23 26
24 27 if ( 'On' == get_bk_option( 'booking_legend_is_show_item_pending' ) ) { $items_sort[] = 'pending'; }
25 28
26 - if ( ( class_exists( 'wpdev_bk_biz_s' ) )
27 - && ( 'On' == get_bk_option( 'booking_legend_is_show_item_partially' ) ) ) { $items_sort[] = 'partially'; }
29 + if ( //FixIn: 10.1.5.5 ( class_exists( 'wpdev_bk_biz_s' ) ) &&
30 + ( 'On' == get_bk_option( 'booking_legend_is_show_item_partially' ) ) ) { $items_sort[] = 'partially'; }
28 31
29 - if ( 'On' == get_bk_option( 'booking_legend_is_show_item_unavailable' ) ) { $items_sort[] = 'unavailable'; } //FixIn: 9.9.0.5
32 + if ( 'On' == get_bk_option( 'booking_legend_is_show_item_unavailable' ) ) { $items_sort[] = 'unavailable'; } // FixIn: 9.9.0.5.
30 33
31 34 $calendar_legend_html = wpbc_get_calendar_legend__content_html( array(
32 35 'is_vertical' => ( 'On' != get_bk_option( 'booking_legend_is_vertical' ) ) ? false : true
33 - , 'text_for_day_cell' => ( 'On' != get_bk_option( 'booking_legend_is_show_numbers' ) ) ? '&nbsp;' : date( 'd' )
36 + , 'text_for_day_cell' => ( 'On' != get_bk_option( 'booking_legend_is_show_numbers' ) ) ? '&nbsp;' : gmdate( 'd' )
34 37 , 'items' => $items_sort
38 + , 'resource_id' => absint( $resource_id )
35 39 ) );
36 40 }
37 41
38 42 return $calendar_legend_html;
@@ -42,9 +46,9 @@
42 46 function wpbc_get_calendar_legend__content_html( $params ) {
43 47
44 48 $defaults = array(
45 49 'is_vertical' => ( 'On' != get_bk_option( 'booking_legend_is_vertical' ) ) ? false : true
46 - , 'text_for_day_cell' => ( 'On' != get_bk_option( 'booking_legend_is_show_numbers' ) ) ? '&nbsp;' : date( 'd' )
50 + , 'text_for_day_cell' => ( 'On' != get_bk_option( 'booking_legend_is_show_numbers' ) ) ? '&nbsp;' : gmdate( 'd' )
47 51 , 'items' => array(
48 52 'available'
49 53 , 'approved'
50 54 , 'pending'
@@ -50,27 +54,94 @@
50 54 , 'pending'
51 55 , 'partially'
52 56 )
53 57 , 'unavailable_day_cell_tag' => 'span'
58 + , 'resource_id' => 0
54 59 , 'titles' => array()
55 60 );
56 61 $params = wp_parse_args( $params, $defaults );
57 62
63 + $legend_arr = array();
58 64
59 - // Content for Partially booked item - "time slot" or "change over days"
60 - if(1){
65 + // Available.
66 + if ( 1 ) {
67 + $key = 'available';
68 + $day_cell_tag = 'a';
69 +
70 + $legend_arr[ $key ] = '<div class="datepick-inline wpbc_calendar_legend_table_width_height">';
71 + $legend_arr[ $key ] .= '<table class="datepick wpbc_calendar" style=""><tbody><tr>';
72 + $legend_arr[ $key ] .= '<td class="datepick-days-cell date_available wpbc_calendar_legend_day_cell_height">';
73 + $legend_arr[ $key ] .= '<div class="wpbc-cell-box">';
74 + $legend_arr[ $key ] .= ' <div class="date-cell-content">';
75 + $legend_arr[ $key ] .= ' <div class="date-content-top"></div>';
76 + $legend_arr[ $key ] .= ' <' . $day_cell_tag . '>' . esc_html( $params['text_for_day_cell'] ) . '</' . $day_cell_tag . '>';
77 + $legend_arr[ $key ] .= ' <div class="date-content-bottom"></div>';
78 + $legend_arr[ $key ] .= ' </div>';
79 + $legend_arr[ $key ] .= '</div>';
80 + $legend_arr[ $key ] .= '</td></tr></tbody></table>';
81 + $legend_arr[ $key ] .= '</div>';
82 + }
83 +
84 + // Pending.
85 + if ( 1 ) {
86 + $key = 'pending';
87 + $day_cell_tag = 'span';
88 +
89 + $legend_arr[ $key ] = '<div class="datepick-inline wpbc_calendar_legend_table_width_height">';
90 + $legend_arr[ $key ] .= '<table class="datepick wpbc_calendar" style=""><tbody><tr>';
91 + $legend_arr[ $key ] .= '<td class="datepick-days-cell datepick-unselectable date_user_unavailable full_day_booking date2approve wpbc_calendar_legend_day_cell_height">';
92 + $legend_arr[ $key ] .= '<div class="wpbc-cell-box">';
93 + $legend_arr[ $key ] .= ' <div class="date-cell-content">';
94 + $legend_arr[ $key ] .= ' <div class="date-content-top"></div>';
95 + $legend_arr[ $key ] .= ' <' . $day_cell_tag . '>' . esc_html( $params['text_for_day_cell'] ) . '</' . $day_cell_tag . '>';
96 + $legend_arr[ $key ] .= ' <div class="date-content-bottom"></div>';
97 + $legend_arr[ $key ] .= ' </div>';
98 + $legend_arr[ $key ] .= '</div>';
99 + $legend_arr[ $key ] .= '</td></tr></tbody></table>';
100 + $legend_arr[ $key ] .= '</div>';
101 + }
102 +
103 + // Approved.
104 + if ( 1 ) {
105 + $key = 'approved';
106 + $day_cell_tag = 'span';
107 +
108 + $legend_arr[ $key ] = '<div class="datepick-inline wpbc_calendar_legend_table_width_height">';
109 + $legend_arr[ $key ] .= '<table class="datepick wpbc_calendar" style=""><tbody><tr>';
110 + $legend_arr[ $key ] .= '<td class="datepick-days-cell datepick-unselectable date_user_unavailable full_day_booking date_approved wpbc_calendar_legend_day_cell_height">';
111 + $legend_arr[ $key ] .= '<div class="wpbc-cell-box">';
112 + $legend_arr[ $key ] .= ' <div class="date-cell-content">';
113 + $legend_arr[ $key ] .= ' <div class="date-content-top"></div>';
114 + $legend_arr[ $key ] .= ' <' . $day_cell_tag . '>' . esc_html( $params['text_for_day_cell'] ) . '</' . $day_cell_tag . '>';
115 + $legend_arr[ $key ] .= ' <div class="date-content-bottom"></div>';
116 + $legend_arr[ $key ] .= ' </div>';
117 + $legend_arr[ $key ] .= '</div>';
118 + $legend_arr[ $key ] .= '</td></tr></tbody></table>';
119 + $legend_arr[ $key ] .= '</div>';
120 + }
121 +
122 +
123 + // Content for Partially booked item - "time slot" or "change over days".
124 + if ( 1 ) {
61 125 $my_partially = '';
62 - $booking_timeslot_day_bg_as_available = ( 'On' === get_bk_option( 'booking_timeslot_day_bg_as_available' ) ) ? ' wpbc_timeslot_day_bg_as_available' : '';
63 - $booking_timeslot_day_bg_as_available .= ( 'Off' !== get_bk_option( 'booking_change_over_days_triangles' ) ) ? ' wpbc_change_over_triangle' : '';
64 126
127 + $booking_change_over_triangle = ( 'Off' !== get_bk_option( 'booking_change_over_days_triangles' ) ) ? ' wpbc_change_over_triangle' : '';
65 128
66 - $my_partially .= '<span class="' . $booking_timeslot_day_bg_as_available . '">';
67 - $my_partially .= '<div class="datepick-inline" style="width:30px !important;border: 0;box-shadow: none;float: left;min-width: 30px;padding: 0;">'; //FixIn: 9.3.1.4
68 - $my_partially .= '<table class="datepick" style=""><tbody><tr>';
69 - if ( ( function_exists( 'wpbc_is_booking_used_check_in_out_time' ) ) && ( wpbc_is_booking_used_check_in_out_time() ) ) { //FixIn: 8.9.4.10
70 - $my_partially .= '<td class="datepick-days-cell date_available date_approved timespartly check_in_time check_in_time_date_approved" style="height: 30px !important;">';
129 +
130 + $my_partially .= '<span class="' . $booking_change_over_triangle . '">';
131 + $my_partially .= '<div class="datepick-inline wpbc_calendar_legend_table_width_height">'; // FixIn: 9.3.1.4.
132 + $my_partially .= '<table class="datepick wpbc_calendar" style=""><tbody><tr>';
133 + $is_change_over_legend = null;
134 + if ( function_exists( 'wpbc_settings_calendar__preview_is_changeover_enabled' ) ) {
135 + $is_change_over_legend = wpbc_settings_calendar__preview_is_changeover_enabled( $params['resource_id'], false );
136 + }
137 + if ( null === $is_change_over_legend ) {
138 + $is_change_over_legend = ( function_exists( 'wpbc_is_booking_used_check_in_out_time' ) ) && ( wpbc_is_booking_used_check_in_out_time( false, $params['resource_id'] ) ); // FixIn: 8.9.4.10.
139 + }
140 + if ( $is_change_over_legend ) {
141 + $my_partially .= '<td class="datepick-days-cell date_available date_approved timespartly check_in_time check_out_time check_in_time_date_approved check_out_time_date2approve wpbc_calendar_legend_day_cell_height">';
71 142 } else {
72 - $my_partially .= '<td class="datepick-days-cell date_available date2approve timespartly times_clock" style="height: 30px !important;">';
143 + $my_partially .= '<td class="datepick-days-cell date_available date2approve timespartly times_clock wpbc_calendar_legend_day_cell_height">';
73 144 }
74 145 $my_partially .= '<div class="wpbc-cell-box">';
75 146 $my_partially .= ' <div class="wpbc-diagonal-el">';
76 147 $my_partially .= ' <div class="wpbc-co-out"><svg height="100%" width="100%" viewBox="0 0 100 100" preserveAspectRatio="none"><polygon points="0,0 0,99 99,0"></polygon><polygon points="0,0 0,100 49,100 49,0"></polygon></svg></div>';
@@ -77,9 +148,9 @@
77 148 $my_partially .= ' <div class="wpbc-co-in"><svg height="100%" width="100%" viewBox="0 0 98 98" preserveAspectRatio="none"><polygon points="0,99 99,99 99,0"></polygon><polygon points="50,98 98,98 98,0 50,0"></polygon></svg></div>';
78 149 $my_partially .= ' </div>';
79 150 $my_partially .= ' <div class="date-cell-content">';
80 151 $my_partially .= ' <div class="date-content-top"><div class="wpbc_time_dots">·</div></div>';
81 - $my_partially .= ' <a>' . $params['text_for_day_cell'] . '</a>';
152 + $my_partially .= ' <a>' . esc_html( $params['text_for_day_cell'] ) . '</a>';
82 153 $my_partially .= ' <div class="date-content-bottom"></div>';
83 154 $my_partially .= ' </div>';
84 155 $my_partially .= '</div>';
85 156 $my_partially .= '</td></tr></tbody></table>';
@@ -86,17 +157,17 @@
86 157 $my_partially .= '</div>';
87 158 $my_partially .= '</span>';
88 159 }
89 160
90 - // Unavailable
91 - if (1){
92 - $my_unavailable = '<div class="datepick-inline" style="width:30px !important;border: 0;box-shadow: none;float: left;min-width: 30px;padding: 0;">'; //FixIn: 9.3.1.4
93 - $my_unavailable .= '<table class="datepick" style=""><tbody><tr>';
94 - $my_unavailable .= '<td class="datepick-days-cell datepick-unselectable date_user_unavailable" style="height: 30px !important;">';
161 + // Unavailable.
162 + if ( 1 ) {
163 + $my_unavailable = '<div class="datepick-inline wpbc_calendar_legend_table_width_height">'; // FixIn: 9.3.1.4.
164 + $my_unavailable .= '<table class="datepick wpbc_calendar" style=""><tbody><tr>';
165 + $my_unavailable .= '<td class="datepick-days-cell datepick-unselectable date_user_unavailable wpbc_calendar_legend_day_cell_height">';
95 166 $my_unavailable .= '<div class="wpbc-cell-box">';
96 167 $my_unavailable .= ' <div class="date-cell-content">';
97 168 $my_unavailable .= ' <div class="date-content-top"></div>';
98 - $my_unavailable .= ' <'.$params['unavailable_day_cell_tag'].'>' . $params['text_for_day_cell'] . '</'.$params['unavailable_day_cell_tag'].'>';
169 + $my_unavailable .= ' <' . $params['unavailable_day_cell_tag'] . '>' . esc_html( $params['text_for_day_cell'] ) . '</' . $params['unavailable_day_cell_tag'] . '>';
99 170 $my_unavailable .= ' <div class="date-content-bottom"></div>';
100 171 $my_unavailable .= ' </div>';
101 172 $my_unavailable .= '</div>';
102 173 $my_unavailable .= '</td></tr></tbody></table>';
@@ -102,40 +173,72 @@
102 173 $my_unavailable .= '</td></tr></tbody></table>';
103 174 $my_unavailable .= '</div>';
104 175 }
105 176
106 - // Resource Unavailable
107 - if (1){
108 - $my_resource_unavailable = '<div class="datepick-inline" style="width:30px !important;border: 0;box-shadow: none;float: left;min-width: 30px;padding: 0;">'; //FixIn: 9.3.1.4
109 - $my_resource_unavailable .= '<table class="datepick" style=""><tbody><tr>';
110 - $my_resource_unavailable .= '<td class="datepick-days-cell resource_unavailable date_user_unavailable" style="height: 30px !important;">';
177 + // Resource Unavailable.
178 + if ( 1 ) {
179 + $my_resource_unavailable = '<div class="datepick-inline wpbc_calendar_legend_table_width_height">'; // FixIn: 9.3.1.4.
180 + $my_resource_unavailable .= '<table class="datepick wpbc_calendar" style=""><tbody><tr>';
181 + $my_resource_unavailable .= '<td class="datepick-days-cell resource_unavailable date_user_unavailable wpbc_calendar_legend_day_cell_height">';
111 182 $my_resource_unavailable .= '<div class="wpbc-cell-box">';
112 183 $my_resource_unavailable .= ' <div class="date-cell-content">';
113 184 $my_resource_unavailable .= ' <div class="date-content-top"></div>';
114 - $my_resource_unavailable .= ' <'.$params['unavailable_day_cell_tag'].'>' . $params['text_for_day_cell'] . '</'.$params['unavailable_day_cell_tag'].'>';
185 + $my_resource_unavailable .= ' <' . $params['unavailable_day_cell_tag'] . '>' . esc_html( $params['text_for_day_cell'] ) . '</' . $params['unavailable_day_cell_tag'] . '>';
115 186 $my_resource_unavailable .= ' <div class="date-content-bottom"></div>';
116 187 $my_resource_unavailable .= ' </div>';
117 188 $my_resource_unavailable .= '</div>';
118 189 $my_resource_unavailable .= '</td></tr></tbody></table>';
119 - $my_resource_unavailable .= '</div>';
120 - }
190 + $my_resource_unavailable .= '</div>';
191 + }
192 +
193 + // Some Resources unavailable in an aggregate calendar.
194 + if ( 1 ) {
195 + $my_resources_partially_unavailable = '<div class="datepick-inline wpbc_calendar_legend_table_width_height">';
196 + $my_resources_partially_unavailable .= '<table class="datepick wpbc_calendar" style=""><tbody><tr>';
197 + $my_resources_partially_unavailable .= '<td class="datepick-days-cell date_available wpbc_resources_partially_unavailable wpbc_calendar_legend_day_cell_height">';
198 + $my_resources_partially_unavailable .= '<div class="wpbc-cell-box">';
199 + $my_resources_partially_unavailable .= ' <div class="date-cell-content">';
200 + $my_resources_partially_unavailable .= ' <div class="date-content-top"></div>';
201 + $my_resources_partially_unavailable .= ' <span>' . esc_html( $params['text_for_day_cell'] ) . '</span>';
202 + $my_resources_partially_unavailable .= ' <div class="date-content-bottom"></div>';
203 + $my_resources_partially_unavailable .= ' </div>';
204 + $my_resources_partially_unavailable .= '</div>';
205 + $my_resources_partially_unavailable .= '</td></tr></tbody></table>';
206 + $my_resources_partially_unavailable .= '</div>';
207 + }
208 +
209 + // One or more Resources have bookings in an aggregate calendar.
210 + if ( 1 ) {
211 + $my_resources_have_bookings = '<div class="datepick-inline wpbc_calendar_legend_table_width_height">';
212 + $my_resources_have_bookings .= '<table class="datepick wpbc_calendar" style=""><tbody><tr>';
213 + $my_resources_have_bookings .= '<td class="datepick-days-cell date_available wpbc_resources_have_bookings wpbc_calendar_legend_day_cell_height">';
214 + $my_resources_have_bookings .= '<div class="wpbc-cell-box">';
215 + $my_resources_have_bookings .= ' <div class="date-cell-content">';
216 + $my_resources_have_bookings .= ' <div class="date-content-top"></div>';
217 + $my_resources_have_bookings .= ' <span>' . esc_html( $params['text_for_day_cell'] ) . '</span>';
218 + $my_resources_have_bookings .= ' <div class="date-content-bottom"></div>';
219 + $my_resources_have_bookings .= ' </div>';
220 + $my_resources_have_bookings .= '</div>';
221 + $my_resources_have_bookings .= '</td></tr></tbody></table>';
222 + $my_resources_have_bookings .= '</div>';
223 + }
121 224
122 225
123 226
124 227 $items_arr = array( 'available' => array(
125 228 'title' => ( ! empty( $params['titles']['available'] ) ) ? $params['titles']['available'] : wpbc_lang( get_bk_option( 'booking_legend_text_for_item_available' ) )
126 - , 'text_for_day_cell' => '<a>' . $params['text_for_day_cell'] . '</a>'
127 - , 'css_class' => 'block_free datepick-days-cell'
229 + , 'text_for_day_cell' => $legend_arr['available'] // '<a>' . $params['text_for_day_cell'] . '</a>'.
230 + , 'css_class' => '' // 'block_free datepick-days-cell'
128 231 )
129 232 , 'approved' => array(
130 233 'title' => ( ! empty( $params['titles']['approved'] ) ) ? $params['titles']['approved'] : wpbc_lang( get_bk_option( 'booking_legend_text_for_item_approved' ) )
131 - , 'text_for_day_cell' => $params['text_for_day_cell']
132 - , 'css_class' => 'block_booked date_approved'
234 + , 'text_for_day_cell' => $legend_arr['approved'] // $params['text_for_day_cell'].
235 + , 'css_class' => '' //'block_booked date_approved'
133 236 )
134 237 , 'pending' => array(
135 238 'title' => ( ! empty( $params['titles']['pending'] ) ) ? $params['titles']['pending'] : wpbc_lang( get_bk_option( 'booking_legend_text_for_item_pending' ) )
136 - , 'text_for_day_cell' => $params['text_for_day_cell']
137 - , 'css_class' => 'block_pending date2approve'
239 + , 'text_for_day_cell' => $legend_arr['pending'] // $params['text_for_day_cell'].
240 + , 'css_class' => '' //'block_pending date2approve'
138 241 )
139 242 , 'partially' => array(
140 243 'title' => ( ! empty( $params['titles']['partially'] ) )
141 244 ? $params['titles']['partially']
@@ -146,9 +249,9 @@
146 249 )
147 250 , 'text_for_day_cell' => $my_partially
148 251 , 'css_class' => ''
149 252 )
150 - , 'unavailable' => array( //FixIn: 9.9.0.5
253 + , 'unavailable' => array( // FixIn: 9.9.0.5.
151 254 'title' => ( ! empty( $params['titles']['unavailable'] ) )
152 255 ? $params['titles']['unavailable']
153 256 : (
154 257 ( ! empty ( wpbc_lang( get_bk_option( 'booking_legend_text_for_item_unavailable' ) ) ) )
@@ -155,16 +258,26 @@
155 258 ? wpbc_lang( get_bk_option( 'booking_legend_text_for_item_unavailable' ) )
156 259 : __( 'Unavailable', 'booking' )
157 260 )
158 261 , 'text_for_day_cell' => $my_unavailable
159 - , 'css_class' => 'datepick-days-cell datepick-unselectable date_user_unavailable'
262 + , 'css_class' => '' //'datepick-days-cell datepick-unselectable date_user_unavailable'
160 263 )
161 - , 'resource_unavailable' => array(
162 - 'title' => ( ! empty( $params['titles']['resource_unavailable'] ) ) ? $params['titles']['resource_unavailable'] : __( 'Resource unavailable days', 'booking' )
163 - , 'text_for_day_cell' => $my_resource_unavailable
164 - , 'css_class' => 'datepick-days-cell resource_unavailable date_user_unavailable'
165 - )
166 - );
264 + , 'resource_unavailable' => array(
265 + 'title' => ( ! empty( $params['titles']['resource_unavailable'] ) ) ? $params['titles']['resource_unavailable'] : __( 'Resource unavailable days', 'booking' )
266 + , 'text_for_day_cell' => $my_resource_unavailable
267 + , 'css_class' => '' //'datepick-days-cell resource_unavailable date_user_unavailable'
268 + )
269 + , 'resources_partially_unavailable' => array(
270 + 'title' => ( ! empty( $params['titles']['resources_partially_unavailable'] ) ) ? $params['titles']['resources_partially_unavailable'] : __( 'Some booking items unavailable', 'booking' )
271 + , 'text_for_day_cell' => $my_resources_partially_unavailable
272 + , 'css_class' => ''
273 + )
274 + , 'resources_have_bookings' => array(
275 + 'title' => ( ! empty( $params['titles']['resources_have_bookings'] ) ) ? $params['titles']['resources_have_bookings'] : __( 'Bookings exist for one or more booking items', 'booking' )
276 + , 'text_for_day_cell' => $my_resources_have_bookings
277 + , 'css_class' => ''
278 + )
279 + );
167 280
168 281 $calendar_legend_html = '<div class="block_hints datepick ' . ( ( $params['is_vertical'] ) ? ' block_hints_vertical ' : '' ) . '">';
169 282
170 283 foreach ( $params['items'] as $item_name ) {
@@ -172,9 +285,9 @@
172 285 if ( ! empty( $items_arr[ $item_name ] ) ) {
173 286 $calendar_legend_html .= '<div class="wpdev_hint_with_text">'
174 287 . '<div class="' . $items_arr[ $item_name ]['css_class'] . '">' . $items_arr[ $item_name ]['text_for_day_cell'] . '</div>'
175 288 . '<div class="block_text">' . '- ' . '</div>'
176 - . '<div class="block_text">' . $items_arr[ $item_name ]['title'] . '</div>'
289 + . '<div class="block_text">' . esc_html( $items_arr[ $item_name ]['title'] ) . '</div>'
177 290 . '</div>';
178 291 }
179 292 }
180 293
@@ -195,9 +308,9 @@
195 308 * Example of shortcode parameters:
196 309 * [legend_items items="available,unavailable,pending,approved,partially" text_for_day_cell="31"]
197 310 * [legend_items is_vertical="1"]
198 311 * [legend_items]
199 - * [legend_items items="resource_unavailable,available,unavailable,pending,approved,partially" text_for_day_cell="31" titles="resource_unavailable={Resource unavailable days} unavailable={Season unavailable}"]
312 + * [legend_items items="resource_unavailable,resources_partially_unavailable,resources_have_bookings,available,unavailable,pending,approved,partially" text_for_day_cell="31" titles="resource_unavailable={Resource unavailable days} unavailable={Season unavailable}"]
200 313 *
201 314 * PHP code example with escaping single and double quotes:
202 315 * echo wpbc_replace_shortcodes_in_booking_form__legend_items( '[legend_items'
203 316 . ' items="unavailable,available,pending,approved,partially"'
@@ -204,9 +317,9 @@
204 317 . ' titles="'
205 318 .' unavailable={' . htmlspecialchars( __( "Unavailable day's", 'booking' ), ENT_QUOTES ) . '}'
206 319 .' pending={' . htmlspecialchars( __( "Pending", 'booking' ), ENT_QUOTES ) . '}'
207 320 .'"'
208 - . ' text_for_day_cell="' . date( 'd' ) . '"'
321 + . ' text_for_day_cell="' . gmdate( 'd' ) . '"'
209 322 . ' unavailable_day_cell_tag="a"'
210 323 .']' );
211 324 */
212 325 function wpbc_replace_shortcodes_in_booking_form__legend_items( $return_form, $resource_id = 1, $my_booking_form = '' ) {
@@ -220,9 +333,9 @@
220 333
221 334 $shortcode_params = wpbc_get_params_of_shortcode_in_string( 'legend_items', $return_form , $pos );
222 335
223 336 if ( ( isset( $shortcode_params['text_for_day_cell'] ) ) && ( empty( $shortcode_params['text_for_day_cell'] ) ) ) {
224 - $shortcode_params['text_for_day_cell'] = date( 'd' );
337 + $shortcode_params['text_for_day_cell'] = gmdate( 'd' );
225 338 }
226 339
227 340 $shortcode_titles_params = array();
228 341 if ( ! empty( $shortcode_params['titles'] ) ){
@@ -237,9 +350,9 @@
237 350 $calendar_legend_html = wpbc_get_calendar_legend__content_html( array(
238 351 'is_vertical' => ( ! empty( $shortcode_params['is_vertical'] ) ) ? true : false
239 352 , 'text_for_day_cell' => ( ! empty( $shortcode_params['text_for_day_cell'] ) )
240 353 ? $shortcode_params['text_for_day_cell']
241 - : ( ( 'On' != get_bk_option( 'booking_legend_is_show_numbers' ) ) ? '&nbsp;' : date( 'd' ) )
354 + : ( ( 'On' != get_bk_option( 'booking_legend_is_show_numbers' ) ) ? '&nbsp;' : gmdate( 'd' ) )
242 355 , 'items' => ( ! empty( $shortcode_params['items'] ) )
243 356 ? explode( ',',$shortcode_params['items'] )
244 357 : array(
245 358 'available'
@@ -250,8 +363,9 @@
250 363 )
251 364 , 'unavailable_day_cell_tag' => ( ! empty( $shortcode_params['unavailable_day_cell_tag'] ) )
252 365 ? $shortcode_params['unavailable_day_cell_tag']
253 366 : 'span'
367 + , 'resource_id' => absint( $resource_id )
254 368 , 'titles' => $shortcode_titles_params
255 369 ) );
256 370
257 371 $return_form = substr( $return_form, 0, ( $shortcode_params['start'] - 1 ) )
@@ -262,5 +376,5 @@
262 376 }
263 377
264 378 return $return_form;
265 379 }
266 -add_filter( 'wpbc_replace_shortcodes_in_booking_form', 'wpbc_replace_shortcodes_in_booking_form__legend_items', 10, 3 );
380 +add_filter( 'wpbc_replace_shortcodes_in_booking_form', 'wpbc_replace_shortcodes_in_booking_form__legend_items', 10, 3 );