PluginProbe
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution / 1.5.21
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution v1.5.21
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 / vendor / wpfluent / caldav / src / Clients / NextCloud.php

NextCloud.php in Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution 1.5.21, at vendor/wpfluent/caldav/src/Clients/NextCloud.php

74 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentBooking\Package\CalDav\Clients;
4
5 use Exception;
6 use FluentBooking\Package\CalDav\ICal\XmlParser;
7 use FluentBooking\Package\CalDav\Entities\Calendar;
8
9 class NextCloud extends Client
10 {
11 public function getCalendars()
12 {
13 $url = $this->makeUrl("calendars/{$this->username}");
14
15 return parent::getCalendarsInfo($url);
16 }
17
18 public function getCalendar($calendarName)
19 {
20 $url = $this->buildUrlFrom($calendarName);
21
22 return parent::getCalendarInfo($url);
23 }
24
25 public function getEvents($calendarName, $dateRange = [])
26 {
27 $url = $this->buildUrlFrom($calendarName);
28
29 return parent::getEventsFrom($url, $dateRange);
30 }
31
32 public function getEvent($uid)
33 {
34 $url = $this->buildUrlFrom($uid);
35
36 return parent::getEventFrom($url);
37 }
38
39 public function addEvent($calendarName, $payload)
40 {
41 $url = $this->buildUrlFrom($calendarName);
42
43 return parent::addEventTo($url, $payload);
44 }
45
46 public function deleteEvent($url)
47 {
48 $url = $this->buildUrlFrom($url);
49
50 return parent::deleteEvent($url);
51 }
52
53 protected function getAuthCredential()
54 {
55 return 'Basic ' . base64_encode(
56 $this->username . ':' . $this->password
57 );
58 }
59
60 protected function buildUrlFrom($calendarName)
61 {
62 if (str_contains($calendarName, 'remote.php/dav/calendars')) {
63 $calendarName = str_replace('remote.php/dav/', '', $calendarName);
64 $url = $this->makeUrl($calendarName);
65 } else {
66 $url = $this->makeUrl(
67 "calendars/{$this->username}/{$calendarName}"
68 );
69 }
70
71 return $url;
72 }
73 }
74