PluginProbe
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution / 2.2.5
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution v2.2.5
2.4.0 2.3.0 2.2.5 2.2.0 2.1.2 2.1.1 trunk 1.10.0 1.10.01 1.10.02 1.5.0 1.5.01 1.5.02 1.5.1 1.5.10 1.5.20 1.5.21 1.5.22 1.5.23 1.5.24 1.5.25 1.6.0 1.7.0 1.7.1 1.7.2 All 33 releases
fluent-booking / app / Hooks / Handlers / TimeSlotServiceHandler.php

TimeSlotServiceHandler.php in Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution 2.2.5, at app/Hooks/Handlers/TimeSlotServiceHandler.php

46 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentBooking\App\Hooks\Handlers;
4
5 use FluentBooking\App\Services\TimeSlotService;
6
7 class TimeSlotServiceHandler
8 {
9 public static function initService($calendar, $calendarEvent)
10 {
11 if ($calendarEvent->isProEvent()) {
12 if (!defined('FLUENT_BOOKING_PRO_DIR_FILE')) {
13 return new \WP_Error('pro_plugin_required', __('Pro plugin is required for this event.', 'fluent-booking'));
14 }
15
16 if ($calendarEvent->isRoundRobin()) {
17 return new \FluentBookingPro\App\Services\RoundRobinTimeSlotService($calendar, $calendarEvent);
18 }
19
20 if ($calendarEvent->isCollective()) {
21 return new \FluentBookingPro\App\Services\CollectiveTimeSlotService($calendar, $calendarEvent);
22 }
23
24 if ($calendarEvent->isOneOffEvent()) {
25 return new \FluentBookingPro\App\Modules\SingleEvent\SingleTimeSlotService($calendar, $calendarEvent);
26 }
27
28 if ($calendarEvent->allowMultiBooking()) {
29 return new \FluentBookingPro\App\Services\MultiTimeSlotService($calendar, $calendarEvent);
30 }
31 }
32
33 return new TimeSlotService($calendar, $calendarEvent);
34 }
35
36 public static function sendError($error, $calendarEvent, $timeZone)
37 {
38 wp_send_json([
39 'error' => true,
40 'message' => $error->get_error_message(),
41 'available_slots' => [],
42 'timezone' => $timeZone,
43 'max_lookup_date' => $calendarEvent->getMaxLookUpDate()
44 ], 200);
45 }
46 }