Plugin
CardDAV plugin.
The CardDAV plugin adds CardDAV functionality to the WebDAV server
- Full name:
\Sabre\CardDAV\Plugin
- Parent class:
\Sabre\DAV\ServerPlugin
Constants
Constant | Visibility | Type | Value |
---|---|---|---|
ADDRESSBOOK_ROOT |
public | 'addressbooks' | |
NS_CARDDAV |
public | 'urn:ietf:params:xml:ns:carddav' |
Properties
directories
Add urls to this property to have them automatically exposed as 'directories' to the user.
server
Server class.
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.
Methods
initialize
Initializes the plugin.
Parameters:
Parameter | Type | Description |
---|---|---|
$server |
\Sabre\DAV\Server |
getFeatures
Returns a list of supported features.
This is used in the DAV: header in the OPTIONS and PROPFIND requests.
getSupportedReportSet
Returns a list of reports this plugin supports.
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:
Parameter | Type | Description |
---|---|---|
$uri |
string |
propFindEarly
Adds all CardDAV-specific properties.
Parameters:
Parameter | Type | Description |
---|---|---|
$propFind |
\Sabre\DAV\PropFind | |
$node |
\Sabre\DAV\INode |
report
This functions handles REPORT requests specific to CardDAV.
Parameters:
Parameter | Type | Description |
---|---|---|
$reportName |
string | |
$dom |
\DOMNode | |
$path |
mixed |
getAddressbookHomeForPrincipal
Returns the addressbook home for a given principal.
Parameters:
Parameter | Type | Description |
---|---|---|
$principal |
string |
addressbookMultiGetReport
This function handles the addressbook-multiget REPORT.
public addressbookMultiGetReport(\Sabre\CardDAV\Xml\Request\AddressBookMultiGetReport $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:
Parameter | Type | Description |
---|---|---|
$report |
\Sabre\CardDAV\Xml\Request\AddressBookMultiGetReport |
beforeWriteContent
This method is triggered before a file gets updated with new content.
public beforeWriteContent(string $path, \Sabre\DAV\IFile $node, resource& $data, bool& $modified): mixed
This plugin uses this method to ensure that Card nodes receive valid vcard data.
Parameters:
Parameter | Type | Description |
---|---|---|
$path |
string | |
$node |
\Sabre\DAV\IFile | |
$data |
resource | |
$modified |
bool | should be set to true, if this event handler changed &$data |
beforeCreateFile
This method is triggered before a new file is created.
public beforeCreateFile(string $path, resource& $data, \Sabre\DAV\ICollection $parentNode, bool& $modified): mixed
This plugin uses this method to ensure that Card nodes receive valid vcard data.
Parameters:
Parameter | Type | Description |
---|---|---|
$path |
string | |
$data |
resource | |
$parentNode |
\Sabre\DAV\ICollection | |
$modified |
bool | should be set to true, if this event handler changed &$data |
validateVCard
Checks if the submitted iCalendar data is in fact, valid.
An exception is thrown if it's not.
Parameters:
Parameter | Type | Description |
---|---|---|
$data |
resource|string | |
$modified |
bool | should be set to true, if this event handler changed &$data |
addressbookQueryReport
This function handles the addressbook-query REPORT.
This report is used by the client to filter an addressbook based on a complex query.
Parameters:
Parameter | Type | Description |
---|---|---|
$report |
\Sabre\CardDAV\Xml\Request\AddressBookQueryReport |
validateFilters
Validates if a vcard makes it throught a list of filters.
Parameters:
Parameter | Type | Description |
---|---|---|
$vcardData |
string | |
$filters |
array | |
$test |
string | anyof or allof (which means OR or AND) |
validateParamFilters
Validates if a param-filter can be applied to a specific property.
Parameters:
Parameter | Type | Description |
---|---|---|
$vProperties |
array | |
$filters |
array | |
$test |
string |
validateTextMatches
Validates if a text-filter can be applied to a specific property.
Parameters:
Parameter | Type | Description |
---|---|---|
$texts |
array | |
$filters |
array | |
$test |
string |
propFindLate
This event is triggered when fetching properties.
This event is scheduled late in the process, after most work for propfind has been done.
Parameters:
Parameter | Type | Description |
---|---|---|
$propFind |
\Sabre\DAV\PropFind | |
$node |
\Sabre\DAV\INode |
htmlActionsPanel
This method is used to generate HTML output for the Sabre\DAV\Browser\Plugin. This allows us to generate an interface users can use to create new addressbooks.
Parameters:
Parameter | Type | Description |
---|---|---|
$node |
\Sabre\DAV\INode | |
$output |
string |
httpAfterGet
This event is triggered after GET requests.
public httpAfterGet(\Sabre\HTTP\RequestInterface $request, \Sabre\HTTP\ResponseInterface $response): mixed
This is used to transform data into jCal, if this was requested.
Parameters:
Parameter | Type | Description |
---|---|---|
$request |
\Sabre\HTTP\RequestInterface | |
$response |
\Sabre\HTTP\ResponseInterface |
negotiateVCard
This helper function performs the content-type negotiation for vcards.
It will return one of the following strings: 1. vcard3 2. vcard4 3. jcard
It defaults to vcard3.
Parameters:
Parameter | Type | Description |
---|---|---|
$input |
string | |
$mimeType |
string |
convertVCard
Converts a vcard blob to a different version, or jcard.
protected convertVCard(string|resource $data, string $target, array $propertiesFilter = null): string
Parameters:
Parameter | Type | Description |
---|---|---|
$data |
string|resource | |
$target |
string | |
$propertiesFilter |
array |
getPluginName
Returns a plugin name.
Using this name other plugins will be able to access other plugins using DAV\Server::getPlugin
getPluginInfo
Returns a bunch of meta-data about the plugin.
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.
Inherited methods
initialize
This initializes the plugin.
This function is called by Sabre\DAV\Server, after addPlugin is called.
This method should set up the required event subscriptions.
- This method is abstract.
Parameters:
Parameter | Type | Description |
---|---|---|
$server |
\Sabre\DAV\Server |
getFeatures
This method should return a list of server-features.
This is for example 'versioning' and is added to the DAV: header in an OPTIONS response.
getHTTPMethods
Use this method to tell the server this plugin defines additional HTTP methods.
This method is passed a uri. It should only return HTTP methods that are available for the specified uri.
Parameters:
Parameter | Type | Description |
---|---|---|
$path |
string |
getPluginName
Returns a plugin name.
Using this name other plugins will be able to access other plugins using \Sabre\DAV\Server::getPlugin
getSupportedReportSet
Returns a list of reports this plugin supports.
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:
Parameter | Type | Description |
---|---|---|
$uri |
string |
getPluginInfo
Returns a bunch of meta-data about the plugin.
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.
Automatically generated on 2025-03-18