Plugin
extends ServerPlugin
in package
CalDAV plugin.
This plugin provides functionality added by CalDAV (RFC 4791) It implements new reports, and the MKCALENDAR method.
Tags
Table of Contents
- CALENDAR_ROOT = 'calendars'
- The hardcoded root for calendar objects. It is unfortunate that we're stuck with it, but it will have to do for now.
- NS_CALDAV = 'urn:ietf:params:xml:ns:caldav'
- This is the official CalDAV namespace.
- NS_CALENDARSERVER = 'http://calendarserver.org/ns/'
- This is the namespace for the proprietary calendarserver extensions.
- $maxResourceSize : mixed
- The default PDO storage uses a MySQL MEDIUMBLOB for iCalendar data, which can hold up to 2^24 = 16777216 bytes. This is plenty. We're capping it to 10M here.
- $server : Server
- Reference to server object.
- beforeCreateFile() : mixed
- This method is triggered before a new file is created.
- beforeWriteContent() : mixed
- This method is triggered before a file gets updated with new content.
- calendarMultiGetReport() : mixed
- This function handles the calendar-multiget REPORT.
- calendarQueryReport() : mixed
- This function handles the calendar-query REPORT.
- getCalendarHomeForPrincipal() : string
- Returns the path to a principal's calendar home.
- getFeatures() : array<string|int, mixed>
- Returns a list of features for the DAV: HTTP header.
- getHTTPMethods() : array<string|int, mixed>
- Use this method to tell the server this plugin defines additional HTTP methods.
- getPluginInfo() : array<string|int, mixed>
- Returns a bunch of meta-data about the plugin.
- getPluginName() : string
- Returns a plugin name.
- getSupportedPrivilegeSet() : mixed
- This method is triggered whenever a subsystem reqeuests the privileges that are supported on a particular node.
- getSupportedReportSet() : array<string|int, mixed>
- Returns a list of reports this plugin supports.
- htmlActionsPanel() : bool
- This method is used to generate HTML output for the DAV\Browser\Plugin. This allows us to generate an interface users can use to create new calendars.
- httpAfterGet() : mixed
- This event is triggered after GET requests.
- httpMkCalendar() : bool
- This function handles the MKCALENDAR HTTP method, which creates a new calendar.
- initialize() : mixed
- Initializes the plugin.
- propFind() : mixed
- PropFind.
- report() : bool
- This functions handles REPORT requests specific to CalDAV.
- freeBusyQueryReport() : mixed
- This method is responsible for parsing the request and generating the response for the CALDAV:free-busy-query REPORT.
- validateICalendar() : mixed
- Checks if the submitted iCalendar data is in fact, valid.
Constants
CALENDAR_ROOT
The hardcoded root for calendar objects. It is unfortunate that we're stuck with it, but it will have to do for now.
public
mixed
CALENDAR_ROOT
= 'calendars'
NS_CALDAV
This is the official CalDAV namespace.
public
mixed
NS_CALDAV
= 'urn:ietf:params:xml:ns:caldav'
NS_CALENDARSERVER
This is the namespace for the proprietary calendarserver extensions.
public
mixed
NS_CALENDARSERVER
= 'http://calendarserver.org/ns/'
Properties
$maxResourceSize
The default PDO storage uses a MySQL MEDIUMBLOB for iCalendar data, which can hold up to 2^24 = 16777216 bytes. This is plenty. We're capping it to 10M here.
protected
mixed
$maxResourceSize
= 10000000
$server
Reference to server object.
protected
Server
$server
Methods
beforeCreateFile()
This method is triggered before a new file is created.
public
beforeCreateFile(string $path, resource &$data, ICollection $parentNode, bool &$modified) : mixed
This plugin uses this method to ensure that newly created calendar objects contain valid calendar data.
Parameters
- $path : string
- $data : resource
- $parentNode : ICollection
- $modified : bool
-
should be set to true, if this event handler changed &$data
Return values
mixed —beforeWriteContent()
This method is triggered before a file gets updated with new content.
public
beforeWriteContent(string $path, IFile $node, resource &$data, bool &$modified) : mixed
This plugin uses this method to ensure that CalDAV objects receive valid calendar data.
Parameters
- $path : string
- $node : IFile
- $data : resource
- $modified : bool
-
should be set to true, if this event handler changed &$data
Return values
mixed —calendarMultiGetReport()
This function handles the calendar-multiget REPORT.
public
calendarMultiGetReport(CalendarMultiGetReport $report) : mixed
This report is used by the client to fetch the content of a series of urls. Effectively avoiding a lot of redundant requests.
Parameters
- $report : CalendarMultiGetReport
Return values
mixed —calendarQueryReport()
This function handles the calendar-query REPORT.
public
calendarQueryReport(CalendarQueryReport $report) : mixed
This report is used by clients to request calendar objects based on complex conditions.
Parameters
- $report : CalendarQueryReport
Return values
mixed —getCalendarHomeForPrincipal()
Returns the path to a principal's calendar home.
public
getCalendarHomeForPrincipal(string $principalUrl) : string
The return url must not end with a slash. This function should return null in case a principal did not have a calendar home.
Parameters
- $principalUrl : string
Return values
string —getFeatures()
Returns a list of features for the DAV: HTTP header.
public
getFeatures() : array<string|int, mixed>
Return values
array<string|int, mixed> —getHTTPMethods()
Use this method to tell the server this plugin defines additional HTTP methods.
public
getHTTPMethods(string $uri) : array<string|int, mixed>
This method is passed a uri. It should only return HTTP methods that are available for the specified uri.
Parameters
- $uri : string
Return values
array<string|int, mixed> —getPluginInfo()
Returns a bunch of meta-data about the plugin.
public
getPluginInfo() : array<string|int, mixed>
Providing this information is optional, and is mainly displayed by the Browser plugin.
The description key in the returned array may contain html and will not be sanitized.
Return values
array<string|int, mixed> —getPluginName()
Returns a plugin name.
public
getPluginName() : string
Using this name other plugins will be able to access other plugins using DAV\Server::getPlugin
Return values
string —getSupportedPrivilegeSet()
This method is triggered whenever a subsystem reqeuests the privileges that are supported on a particular node.
public
getSupportedPrivilegeSet(INode $node, array<string|int, mixed> &$supportedPrivilegeSet) : mixed
Parameters
- $node : INode
- $supportedPrivilegeSet : array<string|int, mixed>
Return values
mixed —getSupportedReportSet()
Returns a list of reports this plugin supports.
public
getSupportedReportSet(string $uri) : array<string|int, mixed>
This will be used in the {DAV:}supported-report-set property. Note that you still need to subscribe to the 'report' event to actually implement them
Parameters
- $uri : string
Return values
array<string|int, mixed> —htmlActionsPanel()
This method is used to generate HTML output for the DAV\Browser\Plugin. This allows us to generate an interface users can use to create new calendars.
public
htmlActionsPanel(INode $node, string &$output) : bool
Parameters
- $node : INode
- $output : string
Return values
bool —httpAfterGet()
This event is triggered after GET requests.
public
httpAfterGet(RequestInterface $request, ResponseInterface $response) : mixed
This is used to transform data into jCal, if this was requested.
Parameters
- $request : RequestInterface
- $response : ResponseInterface
Return values
mixed —httpMkCalendar()
This function handles the MKCALENDAR HTTP method, which creates a new calendar.
public
httpMkCalendar(RequestInterface $request, ResponseInterface $response) : bool
Parameters
- $request : RequestInterface
- $response : ResponseInterface
Return values
bool —initialize()
Initializes the plugin.
public
initialize(Server $server) : mixed
Parameters
- $server : Server
Return values
mixed —propFind()
PropFind.
public
propFind(PropFind $propFind, INode $node) : mixed
This method handler is invoked before any after properties for a resource are fetched. This allows us to add in any CalDAV specific properties.
Parameters
Return values
mixed —report()
This functions handles REPORT requests specific to CalDAV.
public
report(string $reportName, mixed $report, mixed $path) : bool
Parameters
- $reportName : string
- $report : mixed
- $path : mixed
Return values
bool —freeBusyQueryReport()
This method is responsible for parsing the request and generating the response for the CALDAV:free-busy-query REPORT.
protected
freeBusyQueryReport(FreeBusyQueryReport $report) : mixed
Parameters
- $report : FreeBusyQueryReport
Return values
mixed —validateICalendar()
Checks if the submitted iCalendar data is in fact, valid.
protected
validateICalendar(resource|string &$data, string $path, bool &$modified, RequestInterface $request, ResponseInterface $response, bool $isNew) : mixed
An exception is thrown if it's not.
Parameters
- $data : resource|string
- $path : string
- $modified : bool
-
should be set to true, if this event handler changed &$data
- $request : RequestInterface
-
the http request
- $response : ResponseInterface
-
the http response
- $isNew : bool
-
is the item a new one, or an update