PluginProbe
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution / 1.5.22
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution v1.5.22
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 / Services / CalendarEventService.php

CalendarEventService.php in Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution 1.5.22, at app/Services/CalendarEventService.php

45 lines 1.3 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\Services;
4
5 use FluentBooking\App\Models\Calendar;
6
7 class CalendarEventService
8 {
9 public static function processEvent($calendarEvent)
10 {
11 $calendarEvent->payment_html = $calendarEvent->getPaymentHtml();
12
13 $calendarEvent->public_url = $calendarEvent->getPublicUrl();
14
15 $calendarEvent->durations = $calendarEvent->getAvailableDurations();
16
17 $calendarEvent->description = $calendarEvent->getDescription();
18
19 $calendarEvent->short_description = Helper::excerpt($calendarEvent->description);
20
21 $calendarEvent->locations = $calendarEvent->defaultLocationHtml();
22
23 do_action_ref_array('fluent_booking/processed_event', [&$calendarEvent]);
24
25 return $calendarEvent;
26 }
27
28 public static function processEvents(Calendar $calendar, $calendarEvents)
29 {
30 $eventOrder = $calendar->getMeta('event_order');
31
32 if (!empty($eventOrder)) {
33 $calendarEvents = $calendarEvents->sortBy(function($event) use ($eventOrder) {
34 return array_search($event->id, $eventOrder);
35 })->values();
36 }
37
38 foreach ($calendarEvents as $calendarEvent) {
39 $calendarEvent = self::processEvent($calendarEvent);
40 }
41
42 return $calendarEvents;
43 }
44 }
45