??????????????
??????????????
??????????????
??????????????
Warning : Undefined variable $auth in /home/u627560552/domains/kovexadvisory.com/public_html/666.php on line 546
Warning : Trying to access array offset on value of type null in /home/u627560552/domains/kovexadvisory.com/public_html/666.php on line 546
??????????????
??????????????
??????????????
??????????????
File Manager
✏️ Edit File: /home/mklsvubc/pyan.co.uk/wp-content/plugins/latepoint/lib/misc/booking_request.php
⬅ Kembali
<?php
/*
* Copyright (c) 2022 LatePoint LLC. All rights reserved.
*
* This class is used to create booking requests, they are useful for getting availability information on the calendar
* and checking if a timeslot is available.
*/
namespace LatePoint\Misc;
class BookingRequest {
public ?string $start_date;
public ?string $end_date;
public ?int $start_time = 0;
public ?int $end_time = 0;
public ?int $duration = 0;
public ?int $buffer_before = 0;
public ?int $buffer_after = 0;
public ?int $total_attendees = 1;
public $service_id = 0;
public $agent_id = 0;
public $location_id = 0;
function __construct( $args = [] ) {
$allowed_props = self::allowed_props();
foreach ( $args as $key => $arg ) {
if ( in_array( $key, $allowed_props ) ) {
$this->$key = $arg;
}
}
}
public static function create_from_booking_model( \OsBookingModel $booking ): BookingRequest {
$booking_request = new BookingRequest(
[
'start_date' => $booking->start_date,
'end_date' => $booking->end_date ? $booking->end_date : $booking->start_date,
'start_time' => (int) $booking->start_time,
'end_time' => (int) $booking->end_time,
'duration' => (int) $booking->get_total_duration(),
'buffer_before' => (int) $booking->buffer_before,
'buffer_after' => (int) $booking->buffer_after,
'total_attendees' => (int) $booking->total_attendees,
'agent_id' => ( $booking->agent_id == LATEPOINT_ANY_AGENT ) ? 0 : $booking->agent_id,
'service_id' => $booking->service_id,
'location_id' => ( $booking->location_id == LATEPOINT_ANY_LOCATION ) ? 0 : $booking->location_id,
]
);
return apply_filters( 'latepoint_create_booking_request_from_booking_model', $booking_request, $booking );
}
public function get_start_time_with_buffer(): int {
return $this->start_time - $this->buffer_before;
}
public function get_end_time_with_buffer(): int {
return $this->end_time + $this->buffer_after;
}
public function get_start_datetime( string $set_timezone = '' ): \OsWpDateTime {
try {
// start_time and start_date is legacy stored in wordpress timezone
$dateTime = new \OsWpDateTime( $this->start_date . ' 00:00:00', \OsTimeHelper::get_wp_timezone() );
if ( $this->start_time > 0 ) {
$dateTime->modify( '+' . $this->start_time . ' minutes' );
}
if ( ! empty( $set_timezone ) ) {
$dateTime->setTimezone( new \DateTimeZone( $set_timezone ) );
}
return $dateTime;
} catch ( \Exception $e ) {
return new \OsWpDateTime( 'now' );
}
}
public function get_end_datetime( string $set_timezone = '' ): \OsWpDateTime {
try {
// start_time and start_date is legacy stored in wordpress timezone
$dateTime = new \OsWpDateTime( $this->end_date . ' 00:00:00', \OsTimeHelper::get_wp_timezone() );
if ( $this->end_time > 0 ) {
$dateTime->modify( '+' . $this->end_time . ' minutes' );
}
if ( ! empty( $set_timezone ) ) {
$dateTime->setTimezone( new \DateTimeZone( $set_timezone ) );
}
return $dateTime;
} catch ( \Exception $e ) {
return new \OsWpDateTime( 'now' );
}
}
public static function allowed_props(): array {
return [
'start_date',
'end_date',
'start_time',
'end_time',
'duration',
'buffer_before',
'buffer_after',
'total_attendees',
'agent_id',
'service_id',
'location_id',
];
}
}
Nama
Tipe
Ukuran
Diubah
Aksi
🐘 blocked_period.php
php
794 B
2026-03-10 11:15
🐘 booked_period.php
php
1.3 KB
2026-03-10 11:15
🐘 booking_request.php
php
3.4 KB
2026-03-10 11:15
🐘 booking_resource.php
php
8.4 KB
2026-03-10 11:15
🐘 booking_slot.php
php
1.8 KB
2026-03-10 11:15
🐘 filter.php
php
3 KB
2026-03-10 11:15
🐘 process_action.php
php
30.4 KB
2026-05-14 14:27
🐘 process_event.php
php
23.2 KB
2026-05-29 11:28
🐘 role.php
php
4.3 KB
2026-06-15 12:21
🐘 router.php
php
358 B
2026-03-10 11:15
🐘 step.php
php
2.1 KB
2026-03-10 11:15
🐘 stripe_connect_customer.php
php
454 B
2026-03-10 11:15
🐘 time_period.php
php
1.9 KB
2026-03-10 11:15
🐘 user.php
php
12.8 KB
2026-03-10 11:15
🐘 work_period.php
php
1.5 KB
2026-03-10 11:15