| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly //FixIn: 9.8.0.4 | |
| 3 | +if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly // FixIn: 9.8.0.4. | |
| 4 | 4 | |
| 5 | 5 | |
| 6 | 6 | if ( ! defined( 'WPBC_FULL_DAY_TIME_IN' ) ) { define( 'WPBC_FULL_DAY_TIME_IN' , 1 ); } // = +1 sec. '00:00:01' |
| 7 | 7 | if ( ! defined( 'WPBC_FULL_DAY_TIME_OUT' ) ) { define( 'WPBC_FULL_DAY_TIME_OUT' , 86392 ); } // = 24 * 60 * 60 = 86400 - 10 sec. + 2 sec. '23:59:52' |
| @@ -262,9 +262,9 @@ | ||
| 262 | 262 | $in_seconds += 10; |
| 263 | 263 | } |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | - $sql_date = date( $sql_date_format, $in_seconds ); | |
| 266 | + $sql_date = gmdate( $sql_date_format, $in_seconds ); | |
| 267 | 267 | |
| 268 | 268 | return $sql_date; |
| 269 | 269 | } |
| 270 | 270 | |
| @@ -439,8 +439,9 @@ | ||
| 439 | 439 | |
| 440 | 440 | if ( $in_seconds >= 86400 ) { |
| 441 | 441 | // if we have 24:00 then instead of 00:00 show 24:00 ... Please check more here https://www.php.net/manual/en/datetime.format.php |
| 442 | 442 | $time_format = str_replace( array( 'H', 'G' ), '24', $time_format ); |
| 443 | + //$in_seconds--; // It will decrees time on 1 second and show time as 11:59PM instead of 12:00AM | |
| 443 | 444 | } |
| 444 | 445 | |
| 445 | 446 | $s_tm = date_i18n( $time_format, $in_seconds ); |
| 446 | 447 | |
| @@ -1119,11 +1120,11 @@ | ||
| 1119 | 1120 | |
| 1120 | 1121 | // For debugging only ! ------------------------------------------------------------------------------- |
| 1121 | 1122 | $test_unexpected = explode( '-', $all_seconds__key__time_range ); |
| 1122 | 1123 | if ( count( $test_unexpected ) > 2 ) { |
| 1124 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 1123 | 1125 | echo "WPBC. Unexpected situation. We have more than 2 times for the booking {$a_booking_id}: {$all_seconds__key__time_range}"; |
| 1124 | - debuge( '$a_only_date, $a_resource_id, $a_booking_id, $all_seconds_for_this_booking_arr', | |
| 1125 | - $a_only_date, $a_resource_id, $a_booking_id, $all_seconds_for_this_booking_arr, __FILE__, __LINE__ ); | |
| 1126 | + debuge( '$a_only_date, $a_resource_id, $a_booking_id, $all_seconds_for_this_booking_arr', $a_only_date, $a_resource_id, $a_booking_id, $all_seconds_for_this_booking_arr, __FILE__, __LINE__ ); | |
| 1126 | 1127 | } |
| 1127 | 1128 | // For debugging only ! ------------------------------------------------------------------------------- |
| 1128 | 1129 | |
| 1129 | 1130 | $result__arr[ $a_only_date ][ $a_resource_id ][ $all_seconds__key__time_range ] = $a_booking_obj; |
| @@ -1395,8 +1396,9 @@ | ||
| 1395 | 1396 | |
| 1396 | 1397 | $times_arr___by_dates[ $only_date_key ] = array( '00:00:00', $time_only_24hours ); |
| 1397 | 1398 | |
| 1398 | 1399 | } else { // Unexpected ? |
| 1400 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 1399 | 1401 | echo "WPBC. Unexpected data value: {$time_only_24hours} Timestamp ended with value different than: 1|2 for the day {$only_date_key} in one booking "; |
| 1400 | 1402 | } |
| 1401 | 1403 | |
| 1402 | 1404 | } |
| @@ -1414,8 +1416,9 @@ | ||
| 1414 | 1416 | |
| 1415 | 1417 | } else { |
| 1416 | 1418 | |
| 1417 | 1419 | // Something wrong ???? Check it. |
| 1420 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 1418 | 1421 | echo "WPBC. Unexpected data value. We have more than 2 time slots for single day {$only_date_key} in one booking "; |
| 1419 | 1422 | debuge( $times_arr___by_dates, __FILE__, __LINE__ ); |
| 1420 | 1423 | } |
| 1421 | 1424 | } |
| @@ -1494,10 +1497,10 @@ | ||
| 1494 | 1497 | // Remove this date |
| 1495 | 1498 | if ( isset( $sql_dates_arr[ $check_in_timestamp ] ) ) { unset( $sql_dates_arr[ $check_in_timestamp ] ); } |
| 1496 | 1499 | |
| 1497 | 1500 | // Add new date: see definition of WPBC_FULL_DAY_TIME_IN <- 00:00:01 |
| 1498 | - $real__check_in__date_sql = date( 'Y-m-d', $check_in_timestamp ) . ' 00:00:01'; | |
| 1499 | - $real__check_in_timestamp_new = wpbc_convert__sql_date__to_seconds( date( 'Y-m-d', $check_in_timestamp ) . ' 00:00:01', $is_apply__check_in_out__10s ); | |
| 1501 | + $real__check_in__date_sql = gmdate( 'Y-m-d', $check_in_timestamp ) . ' 00:00:01'; | |
| 1502 | + $real__check_in_timestamp_new = wpbc_convert__sql_date__to_seconds( gmdate( 'Y-m-d', $check_in_timestamp ) . ' 00:00:01', $is_apply__check_in_out__10s ); | |
| 1500 | 1503 | $sql_dates_arr[ $real__check_in_timestamp_new ] = $real__check_in__date_sql; |
| 1501 | 1504 | |
| 1502 | 1505 | |
| 1503 | 1506 | // CHECK_OUT date, - highest timestamp: ------------------------------------------------------------------ |
| @@ -1506,10 +1509,10 @@ | ||
| 1506 | 1509 | if ( isset( $sql_dates_arr[ $check_out_timestamp ] ) ) { |
| 1507 | 1510 | unset( $sql_dates_arr[ $check_out_timestamp ] ); |
| 1508 | 1511 | } |
| 1509 | 1512 | // Add new date: see definition of WPBC_FULL_DAY_TIME_OUT <- 23:59:52 |
| 1510 | - $real__check_out__date_sql = date( 'Y-m-d', $check_out_timestamp ) . ' 24:00:02'; | |
| 1511 | - $real__check_out_timestamp_new = wpbc_convert__sql_date__to_seconds( date( 'Y-m-d', $check_out_timestamp ) . ' 23:59:52', $is_apply__check_in_out__10s ); | |
| 1513 | + $real__check_out__date_sql = gmdate( 'Y-m-d', $check_out_timestamp ) . ' 24:00:02'; | |
| 1514 | + $real__check_out_timestamp_new = wpbc_convert__sql_date__to_seconds( gmdate( 'Y-m-d', $check_out_timestamp ) . ' 23:59:52', $is_apply__check_in_out__10s ); | |
| 1512 | 1515 | $sql_dates_arr[ $real__check_out_timestamp_new ] = $real__check_out__date_sql; |
| 1513 | 1516 | |
| 1514 | 1517 | // Sort such dates again, because we changed the order --------------------------------------------------- |
| 1515 | 1518 | ksort( $sql_dates_arr ); |