PluginProbe
Booking Calendar / 11.8.3
Booking Calendar v11.8.3
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 10.11 10.11.2 All 203 releases
← All changes | core/wpbc-dates.php +207 -53 10.1.311.8.3 View file →
@@ -1,4 +1,4 @@
1 1 <?php
2 2 /**
3 3 * @version 1.0
4 4 * @package Booking Calendar
@@ -64,9 +64,9 @@
64 64 if ( $start_end_time !== false ) {
65 65 $start_time = $start_end_time[0]; // array('00','00','01');
66 66 $end_time = $start_end_time[1]; // array('00','00','01');
67 67
68 - if ( ( '00' == $start_time[0] ) && ( '00' == $start_time[1] ) ) { //FixIn: 8.7.8.8
68 + if ( ( '00' == $start_time[0] ) && ( '00' == $start_time[1] ) ) { // FixIn: 8.7.8.8.
69 69 $start_time = array( '00', '00', '00' );
70 70 $end_time = array( '00', '00', '00' );
71 71 } else {
72 72 if ( count( $only_days ) == 1 ) { // add end date if selected 1 day only and times is exist
@@ -135,10 +135,40 @@
135 135 return $time_m_h . ':' . $time_m_m;
136 136 }
137 137
138 138
139 -/**
140 - * Get Times from booking Form, if these times fields exist
139 +/**
140 + * Parse a duration field value into numeric hours and minutes.
141 + *
142 + * Duration values come from serialized front-end form data. Placeholder or
143 + * otherwise malformed values must not reach arithmetic because PHP 8 throws
144 + * a TypeError when a non-numeric string is multiplied by an integer.
145 + *
146 + * @param string $duration_time_value Duration in `HH:MM` format.
147 + *
148 + * @return array|false Numeric hours and minutes, or false for an invalid duration.
149 + */
150 +function wpbc_parse_duration_time_value( $duration_time_value ) {
151 +
152 + $duration_time_value = trim( (string) $duration_time_value );
153 +
154 + if ( ! preg_match( '/^([0-9]+):([0-9]{1,2})$/', $duration_time_value, $duration_time_matches ) ) {
155 + return false;
156 + }
157 +
158 + $duration_hours = intval( $duration_time_matches[1] );
159 + $duration_minutes = intval( $duration_time_matches[2] );
160 +
161 + if ( 59 < $duration_minutes ) {
162 + return false;
163 + }
164 +
165 + return array( $duration_hours, $duration_minutes );
166 +}
167 +
168 +
169 +/**
170 + * Get Times from booking Form, if these times fields exist
141 171 *
142 172 * @param type $booking_form_data
143 173 * @param type $booking_type
144 174 * @return mixed
@@ -201,9 +231,9 @@
201 231 if ( $start_time == '' ) {
202 232 $start_time = '00:00';
203 233 }
204 234
205 - $start_time = wpbc_check_min_max_available_times( $start_time, '00:01', '23:59' ); //FixIn: 8.7.11.1
235 + $start_time = wpbc_check_min_max_available_times( $start_time, '00:01', '23:59' ); // FixIn: 8.7.11.1.
206 236
207 237 $start_time = explode( ':', $start_time );
208 238
209 239 $start_time[2] = '01';
@@ -223,9 +253,9 @@
223 253 if ( $end_time == '' ) {
224 254 $end_time = '00:00';
225 255 }
226 256
227 - $end_time = wpbc_check_min_max_available_times( $end_time, '00:01', '23:59' ); //FixIn: 8.7.11.1
257 + $end_time = wpbc_check_min_max_available_times( $end_time, '00:01', '23:59' ); // FixIn: 8.7.11.1.
228 258
229 259 $is_time_exist = true;
230 260
231 261 $end_time = explode( ':', $end_time );
@@ -233,34 +263,36 @@
233 263 } else {
234 264 $end_time = explode( ':', $end_time );
235 265 }
236 266
237 - if ( strpos( $booking_form_data, 'durationtime' . $booking_type ) !== false ) { // Get END TIME From form request
238 - $pos1 = strpos( $booking_form_data, 'durationtime' . $booking_type ); // Find start time pos
239 - $pos1 = strpos( $booking_form_data, '^', $pos1 ) + 1; // Find TIME pos
240 - $pos2 = strpos( $booking_form_data, '~', $pos1 ); // Find TIME length
267 + if ( strpos( $booking_form_data, 'durationtime' . $booking_type ) !== false ) { // Get END TIME From form request
268 + $pos1 = strpos( $booking_form_data, 'durationtime' . $booking_type ); // Find start time pos
269 + $pos1 = strpos( $booking_form_data, '^', $pos1 ) + 1; // Find TIME pos
270 + $pos2 = strpos( $booking_form_data, '~', $pos1 ); // Find TIME length
241 271 if ( $pos2 === false ) {
242 272 $pos2 = strlen( $booking_form_data );
243 273 }
244 - $pos2 = $pos2 - $pos1;
245 - $end_time = substr( $booking_form_data, $pos1, $pos2 );
274 + $pos2 = $pos2 - $pos1;
275 + $duration_time_value = substr( $booking_form_data, $pos1, $pos2 );
276 + $duration_time_parts = wpbc_parse_duration_time_value( $duration_time_value );
277 +
278 + if ( false !== $duration_time_parts ) {
279 + $is_time_exist = true;
280 +
281 + // Get the selected start time and add the validated duration to calculate the end time.
282 + $new_end_time = mktime( intval( $start_time[0] ), intval( $start_time[1] ) );
283 + $new_end_time += $duration_time_parts[0] * 60 * 60;
284 + $new_end_time += $duration_time_parts[1] * 60;
285 + $end_time = gmdate( 'H:i', $new_end_time );
286 +
287 + if ( '00:00' === $end_time ) {
288 + $end_time = '23:59';
289 + }
290 + $end_time = explode( ':', $end_time );
291 + $end_time[2] = '02';
292 + }
293 + }
246 294
247 - $is_time_exist = true;
248 -
249 - $end_time = explode( ':', $end_time );
250 -
251 - // Here we are get start time and add duration for end time
252 - $new_end_time = mktime( intval( $start_time[0] ), intval( $start_time[1] ) );
253 - $new_end_time = $new_end_time + $end_time[0] * 60 * 60 + $end_time[1] * 60;
254 - $end_time = date( 'H:i', $new_end_time );
255 -
256 - if ( $end_time == '00:00' ) {
257 - $end_time = '23:59';
258 - }
259 - $end_time = explode( ':', $end_time );
260 - $end_time[2] = '02';
261 - }
262 -
263 295 }
264 296
265 297 if ( $is_time_exist ) {
266 298 return array( $start_time, $end_time );
@@ -277,9 +309,9 @@
277 309 * @param string $time_format = "g:i A"
278 310 */
279 311 function wpbc_time_slot_in_format( $timeslot, $time_format = false ){
280 312
281 - //FixIn: 8.9.3.1
313 + // FixIn: 8.9.3.1.
282 314 if ( ( empty( $timeslot ) ) ) {
283 315 return '';
284 316 }
285 317 $value_times = explode( '-', $timeslot );
@@ -318,9 +350,10 @@
318 350 function wpbc_db__get_sql_dates__in_booking__as_str( $booking_id_str ) {
319 351
320 352 global $wpdb;
321 353
322 - $dates_result = $wpdb->get_results( "SELECT DISTINCT booking_date FROM {$wpdb->prefix}bookingdates WHERE booking_id IN ({$booking_id_str}) ORDER BY booking_date" );
354 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
355 + $dates_result = $wpdb->get_results( "SELECT DISTINCT booking_date FROM {$wpdb->prefix}bookingdates WHERE booking_id IN ({$booking_id_str}) ORDER BY booking_date" );
323 356
324 357 $dates_str = array();
325 358
326 359 foreach ( $dates_result as $my_date ) {
@@ -334,8 +367,40 @@
334 367 }
335 368
336 369
337 370 /**
371 + * Get Only Dates array from Dates Dimes string with comma seperated values
372 + *
373 + * @param $dates_ymd_his_csv -> '2023-10-09 12:00:01, 2023-10-09 20:00:02'
374 + *
375 + * @return array|string[] -> '2023-10-09, 2023-10-09'
376 + *
377 + *
378 + * Usually it called like in this Example:
379 + * $dates_ymd_his_csv = wpbc_db__get_sql_dates__in_booking__as_str( $booking_id_str ); // '100' | '10,7' - booking ID
380 + * $dates_only_arr = wpbc_get_only_dates__from_dates_ymd_his_csv__as_arr( $dates_ymd_his_csv ); // -> '2023-10-09, 2023-10-09'
381 + */
382 + function wpbc_get_only_dates__from_dates_ymd_his_csv__as_arr( $dates_ymd_his_csv ){
383 +
384 +
385 + // FixIn: 10.1.5.6.
386 + $dates_only_arr = wpbc_get_dates_arr__from_dates_comma_separated( array(
387 + 'dates_separator' => ', ', // ', '
388 + 'dates' => $dates_ymd_his_csv, // '2023-04-04 12:03:00, 2023-04-07 2024-06-30:00'
389 + ) );
390 + // Get Only Dates
391 + $dates_only_arr = array_map( function ( $date_sql_ymd_his ) {
392 + $date_sql_ymd_his = trim( $date_sql_ymd_his );
393 + $date_sql_ymd_his = substr( $date_sql_ymd_his, 0, 10 );
394 + return $date_sql_ymd_his;
395 + }
396 + , $dates_only_arr
397 + );
398 + $dates_only_arr = array_unique( $dates_only_arr );
399 + return $dates_only_arr;
400 + }
401 +
402 + /**
338 403 * Get Time in 24 hours (military) format, from possible AM/PM format
339 404 *
340 405 * @param string $time_str - '01:20 PM'
341 406 * @return string - '13:20'
@@ -356,9 +421,9 @@
356 421 $time_str_plus = 12;
357 422 }
358 423
359 424 $time_str = explode( ':', trim( $time_str ) );
360 - //FixIn: 9.9.0.4
425 + // FixIn: 9.9.0.4.
361 426 $time_str[0] = intval( $time_str[0] ) + $time_str_plus;
362 427 $time_str[1] = intval( $time_str[1] );
363 428
364 429 if ($time_str[0] < 10 ) $time_str[0] = '0' . $time_str[0];
@@ -376,9 +441,9 @@
376 441 *
377 442 * @return int - number of days
378 443 */
379 444 function wpbc_get_difference_in_days( $day1, $day2 ) {
380 - return floor( ( strtotime( $day1 ) - strtotime( $day2 ) ) / 86400 ); //FixIn: 8.2.1.11
445 + return floor( ( strtotime( $day1 ) - strtotime( $day2 ) ) / 86400 ); // FixIn: 8.2.1.11.
381 446 }
382 447
383 448
384 449 /**
@@ -430,13 +495,13 @@
430 495
431 496 $aryRange=array();
432 497
433 498 if ( $iDateTo >= $iDateFrom ) {
434 - array_push( $aryRange, date( 'd.m.Y', $iDateFrom ) ); // first entry
499 + array_push( $aryRange, gmdate( 'd.m.Y', $iDateFrom ) ); // first entry
435 500
436 501 while ($iDateFrom<$iDateTo) {
437 502 $iDateFrom+=86400; // add 24 hours
438 - array_push( $aryRange, date( 'd.m.Y', $iDateFrom ) );
503 + array_push( $aryRange, gmdate( 'd.m.Y', $iDateFrom ) );
439 504 }
440 505 }
441 506
442 507 $aryRange = implode(', ', $aryRange);
@@ -565,9 +630,9 @@
565 630 * @return int : Unix timestamp for a date like this 2015-02-30
566 631 */
567 632 function wpbc_get_tommorow_day( $nowday ){
568 633
569 - $nowday_d = date( 'm.d.Y', mysql2date( 'U', $nowday ) );
634 + $nowday_d = gmdate( 'm.d.Y', mysql2date( 'U', $nowday ) );
570 635 $previos_array = explode( '.', $nowday_d );
571 636 $tommorow_day = mktime( 0, 0, 0, intval($previos_array[0]), ( intval($previos_array[1]) + 1 ), intval($previos_array[2]) ) ;
572 637 return $tommorow_day;
573 638 }
@@ -580,10 +645,10 @@
580 645 * @return boolean : true | false
581 646 */
582 647 function wpbc_is_today_date( $some_day ) {
583 648
584 - $some_day_d = date( 'm.d.Y', mysql2date( 'U', $some_day ) );
585 - $today_day = date( 'm.d.Y' );
649 + $some_day_d = gmdate( 'm.d.Y', mysql2date( 'U', $some_day ) );
650 + $today_day = gmdate( 'm.d.Y' );
586 651
587 652 if ( $today_day == $some_day_d ) {
588 653 return true;
589 654 } else {
@@ -591,18 +656,38 @@
591 656 }
592 657 }
593 658
594 659
595 -//FixIn: 8.8.1.2
596 660 /**
661 + * Check if this date is Tomorrow day
662 + *
663 + * @param string $some_day : '2024-08-18'
664 + * @return boolean : true | false
665 + */
666 +function wpbc_is_tomorrow_date( $some_day ) {
667 +
668 + $some_day_d = gmdate( 'Y-m-d 00:00:00', mysql2date( 'U', $some_day ) );
669 + $today_day = gmdate( 'Y-m-d 00:00:00' );
670 + $tomorrow_day = gmdate( 'Y-m-d 00:00:00', strtotime( '+1 day', strtotime( $today_day ) ) );
671 +
672 + if ( $tomorrow_day == $some_day_d ) {
673 + return true;
674 + } else {
675 + return false;
676 + }
677 +}
678 +
679 +
680 +// FixIn: 8.8.1.2.
681 +/**
597 682 * Check if this date in past
598 683 *
599 684 * @param string $some_day : '2015-05-29'
600 685 * @return boolean : true | false
601 686 */
602 -function wpbc_is_date_in_past( $some_day ) {
687 +function wpbc_is_date_in_past( $some_day ) {
603 688
604 - $some_day_d = date( 'm.d.Y', mysql2date( 'U', $some_day ) );
689 + $some_day_d = gmdate( 'm.d.Y', mysql2date( 'U', $some_day ) );
605 690 $some_array = explode( '.', $some_day_d );
606 691 $some_day = mktime( 0, 0, 0, intval($some_array[0]), ( intval($some_array[1]) + 1 ), intval($some_array[2]) );
607 692
608 693 $today_day = time();
@@ -611,12 +696,74 @@
611 696 return true;
612 697 } else {
613 698 return false;
614 699 }
700 +}
701 +
702 +
703 +/**
704 + * Check whether a booking can still be changed by a visitor.
705 + *
706 + * Visitor edit and cancellation actions must fail closed when the booking does
707 + * not exist, is in the trash, has no dates, or its final booked date has
708 + * already passed. The comparison deliberately uses wpbc_is_date_in_past() so
709 + * the rule remains compatible with the established date-based front-end edit
710 + * restriction and does not unexpectedly expire time-slot bookings mid-day.
711 + *
712 + * @param int $booking_id Booking ID resolved from a verified visitor hash.
713 + *
714 + * @return bool True when at least one booked date is current or future.
715 + */
716 +function wpbc_is_visitor_booking_action_allowed( $booking_id ) {
717 + global $wpdb;
718 +
719 + $booking_id = absint( $booking_id );
720 + if ( empty( $booking_id ) ) {
721 + return false;
722 + }
723 +
724 + $last_booking_date = $wpdb->get_var(
725 + $wpdb->prepare(
726 + // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
727 + "SELECT MAX(dt.booking_date)
728 + FROM {$wpdb->prefix}bookingdates AS dt
729 + INNER JOIN {$wpdb->prefix}booking AS bk ON bk.booking_id = dt.booking_id
730 + WHERE bk.booking_id = %d AND bk.trash = 0",
731 + $booking_id
732 + )
733 + ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
734 +
735 + if ( empty( $last_booking_date ) || ! is_string( $last_booking_date ) ) {
736 + return false;
737 + }
738 +
739 + return ! wpbc_is_date_in_past( $last_booking_date );
740 +}
741 +
742 +
743 +/**
744 + * Check if the booking was made without calendar ( no booking date submited.)
745 + *
746 + * @param $is_no_date
747 + * @param $date
748 + *
749 + * @return mixed|true
750 + */
751 +function wpbc_maybe_no_booking_date( $is_no_date, $date_ymd ) {
752 +
753 + if ( ( ! empty( $date_ymd ) ) && ( is_array( $date_ymd ) ) ) {
754 + $date_ymd = $date_ymd[0];
755 + }
756 + // FixIn: 2981-01-13 13 Jan 2981.
757 + if ( '2981-01-13' === gmdate( 'Y-m-d', mysql2date( 'U', $date_ymd ) ) ) {
758 + $is_no_date = true;
759 + }
760 +
761 + return $is_no_date;
615 762 }
763 +add_filter( 'wpbc_maybe_no_booking_date', 'wpbc_maybe_no_booking_date', 10, 2 );
616 764
617 765
618 -
619 766 //TODO: refactor it, by replacig date_i18n to wp_loc_date... (check depndencies of this function in other usage functions...)
620 767 /**
621 768 * Change date / time format
622 769 *
@@ -626,8 +773,13 @@
626 773 * @return array( 'DATE in custom Format', 'TIME in custom Format' )
627 774 */
628 775 function wpbc_get_date_in_correct_format( $dt, $date_format = false, $time_format = false ) {
629 776
777 + $is_no_date = apply_filters( 'wpbc_maybe_no_booking_date', false, $dt );
778 + if ( $is_no_date ) {
779 + return array( '---', '' );
780 + }
781 +
630 782 if ( $date_format === false ) $date_format = get_bk_option( 'booking_date_format');
631 783 if ( empty( $date_format ) ) $date_format = "m / d / Y, D";
632 784
633 785 if ( $time_format === false ) $time_format = get_bk_option( 'booking_time_format');
@@ -632,9 +784,9 @@
632 784
633 785 if ( $time_format === false ) $time_format = get_bk_option( 'booking_time_format');
634 786 if ( empty( $time_format ) ) $time_format = get_option( 'time_format' ); //'h:i a'; //FixIn: TimeFree 2 - in Booking Calendar Free version show by default times hints in AM/PM format
635 787
636 - $my_time = date( 'H:i:s' , mysql2date( 'U', $dt ) );
788 + $my_time = gmdate( 'H:i:s' , mysql2date( 'U', $dt ) );
637 789 if ( $my_time == '00:00:00' ) $time_format = '';
638 790
639 791 $bk_date = date_i18n( $date_format, mysql2date( 'U', $dt ) );
640 792 $bk_time = date_i18n( ' ' . $time_format , mysql2date( 'U', $dt ) );
@@ -691,9 +843,9 @@
691 843 }
692 844 return $short_dates_content;
693 845 }
694 846
695 -//FixIn: 9.6.3.5
847 +// FixIn: 9.6.3.5.
696 848
697 849 /**
698 850 * Get booking dates from DB for specific calendar
699 851 *
@@ -753,9 +905,9 @@
753 905
754 906 // W H E R E
755 907 $sql_where = '';
756 908 $sql_where .= ( '' != $params['approved'] ) ? " AND ( dt.approved = {$params['approved']} ) " : ''; // Approved (1) or Pending (0) or All // int
757 - $sql_where .= " AND dt.booking_date >= CURDATE() "; // Only actual bookings
909 + $sql_where .= " AND dt.booking_date >= " . wpbc_sql_date_math_expr_explicit('', 'curdate') . " "; // Only actual bookings
758 910 $sql_where .= " AND bk.trash != 1 "; // Not in Trash // int
759 911 $sql_where .= " AND bk.booking_type IN ( {$params['resource_id']} ) "; // For specific calendar (booking resource) // int
760 912 $sql_where .= ( '' != $params['skip_booking_id'] ) ? " AND dt.booking_id NOT IN ( {$params['skip_booking_id']} ) " : '' ; // Skip some bookings ? Usually, during booking edit.
761 913
@@ -767,10 +919,12 @@
767 919 * Array( [0] => stdClass Object ( [booking_date] => 2022-12-27 00:00:00, [approved] => 0, [booking_id] => 187 )
768 920 [1] => stdClass Object ( [booking_date] => 2022-12-28 00:00:00, [approved] => 1, [booking_id] => 26 )
769 921 ...
770 922 */
771 - $result_arr = $wpdb->get_results( $sql . $sql_where . $sql_order );
772 923
924 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
925 + $result_arr = $wpdb->get_results( $sql . $sql_where . $sql_order );
926 +
773 927 // P A R S E
774 928 $prior_check_out_date = false;
775 929 $dates_arr = array();
776 930 foreach ( $result_arr as $sql_date ) {
@@ -780,9 +934,9 @@
780 934 $resource_id = $resource_id[0];
781 935 if (
782 936 ( ! class_exists( 'wpdev_bk_biz_l' ) )
783 937 || ( ( class_exists( 'wpdev_bk_biz_l' ) ) && ( ! wpbc_is_this_parent_resource( $resource_id ) ) )
784 - ){ //FixIn: 9.1.2.7
938 + ){ // FixIn: 9.1.2.7.
785 939 list( $blocked_days_range, $prior_check_out_date ) = apply_filters( 'wpbc_get_extended_block_dates_filter', array( $blocked_days_range, $prior_check_out_date ) );
786 940 }
787 941
788 942 foreach ( $blocked_days_range as $date_ymd_his ) {
@@ -791,13 +945,13 @@
791 945
792 946
793 947 $date_as_int = strtotime( $sql_date->booking_date );
794 948
795 - $date_key = date( 'Y-m-d', $date_as_int );
949 + $date_key = gmdate( 'Y-m-d', $date_as_int );
796 950 $date_seconds = $date_as_int - strtotime( $date_key );
797 951
798 952 // Transform '2022-09-01' to 9-1-2022
799 - $date_key__for_calendar = date( 'n-j-Y', $date_as_int ); // j - Day of the month without leading zeros 1 to 31 ; n - Number of month, without leading zeros 1 to 12
953 + $date_key__for_calendar = gmdate( 'n-j-Y', $date_as_int ); // j - Day of the month without leading zeros 1 to 31 ; n - Number of month, without leading zeros 1 to 12
800 954
801 955 if ( empty( $dates_arr[ $date_key__for_calendar ] ) ) {
802 956 $dates_arr[ $date_key__for_calendar ] = array();
803 957 }
@@ -843,16 +997,16 @@
843 997 ...
844 998 */
845 999 function wpbc__sql__get_season_availability( $params ){
846 1000
847 - //FixIn: 9.5.4.4
1001 + // FixIn: 9.5.4.4.
848 1002 $max_days_count = 365;
849 1003 $max_monthes_in_calendar = get_bk_option( 'booking_max_monthes_in_calendar' );
850 1004
851 1005 if ( strpos( $max_monthes_in_calendar, 'm' ) !== false ) {
852 - $max_days_count = intval( str_replace( 'm', '', $max_monthes_in_calendar ) ) * 31 + 5; //FixIn: 9.6.1.1
1006 + $max_days_count = intval( str_replace( 'm', '', $max_monthes_in_calendar ) ) * 31 + 5; // FixIn: 9.6.1.1.
853 1007 } else {
854 - $max_days_count = intval( str_replace( 'y', '', $max_monthes_in_calendar ) ) * 365 + 15; //FixIn: 9.6.1.1
1008 + $max_days_count = intval( str_replace( 'y', '', $max_monthes_in_calendar ) ) * 365 + 15; // FixIn: 9.6.1.1.
855 1009 }
856 1010
857 1011 $defaults = array(
858 1012 'resource_id' => 1 // int or dcv
@@ -868,9 +1022,9 @@
868 1022 $is_all_days_available = true;
869 1023
870 1024 $season_filters_id_arr = array();
871 1025
872 - if ( ( class_exists( 'wpdev_bk_biz_m' ) ) && ( function_exists( 'wpbc_get_resource_meta' ) ) ) { // BM and higher //FixIn: 9.9.0.13
1026 + if ( ( class_exists( 'wpdev_bk_biz_m' ) ) && ( function_exists( 'wpbc_get_resource_meta' ) ) ) { // BM and higher // FixIn: 9.9.0.13.
873 1027
874 1028 // S Q L
875 1029 $availability_res = wpbc_get_resource_meta( $params['resource_id'], 'availability' );
876 1030
@@ -906,9 +1060,9 @@
906 1060 $days_availability = array();
907 1061
908 1062 for( $i = 0; $i < $params['count']; $i++) {
909 1063
910 - $date_y_m_d = date( 'Y-m-d', strtotime( '+' . $i . 'days', strtotime( $params['from'] ) ) );
1064 + $date_y_m_d = gmdate( 'Y-m-d', strtotime( '+' . $i . 'days', strtotime( $params['from'] ) ) );
911 1065
912 1066 $days_availability[ $date_y_m_d ] = $is_all_days_available;
913 1067
914 1068 $date_arr = explode( '-', $date_y_m_d );
@@ -927,5 +1081,5 @@
927 1081
928 1082 }
929 1083
930 1084 return $days_availability;
931 - }
1085 + }