diff options
author | Mario <mario@mariovavti.com> | 2019-11-10 12:49:51 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2019-11-10 14:10:03 +0100 |
commit | 580c3f4ffe9608d2beb56d418c68b3b112420e76 (patch) | |
tree | 82335d01179ac361d3f547a4b8e8c598d302e9f3 /vendor/sabre/dav/lib/CalDAV/Notifications/Plugin.php | |
parent | d22766f458a8539a40a57f3946459a9be1f21cd6 (diff) | |
download | volse-hubzilla-580c3f4ffe9608d2beb56d418c68b3b112420e76.tar.gz volse-hubzilla-580c3f4ffe9608d2beb56d418c68b3b112420e76.tar.bz2 volse-hubzilla-580c3f4ffe9608d2beb56d418c68b3b112420e76.zip |
another bulk of composer updates
(cherry picked from commit 6685381fd8db507493c3d7c1793f8c05c681bbce)
Diffstat (limited to 'vendor/sabre/dav/lib/CalDAV/Notifications/Plugin.php')
-rw-r--r-- | vendor/sabre/dav/lib/CalDAV/Notifications/Plugin.php | 71 |
1 files changed, 30 insertions, 41 deletions
diff --git a/vendor/sabre/dav/lib/CalDAV/Notifications/Plugin.php b/vendor/sabre/dav/lib/CalDAV/Notifications/Plugin.php index e742351f5..182b70c8e 100644 --- a/vendor/sabre/dav/lib/CalDAV/Notifications/Plugin.php +++ b/vendor/sabre/dav/lib/CalDAV/Notifications/Plugin.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV\Notifications; use Sabre\DAV; @@ -12,7 +14,7 @@ use Sabre\HTTP\RequestInterface; use Sabre\HTTP\ResponseInterface; /** - * Notifications plugin + * Notifications plugin. * * This plugin implements several features required by the caldav-notification * draft specification. @@ -24,10 +26,10 @@ use Sabre\HTTP\ResponseInterface; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class Plugin extends ServerPlugin { - +class Plugin extends ServerPlugin +{ /** - * This is the namespace for the proprietary calendarserver extensions + * This is the namespace for the proprietary calendarserver extensions. */ const NS_CALENDARSERVER = 'http://calendarserver.org/ns/'; @@ -46,10 +48,9 @@ class Plugin extends ServerPlugin { * * @return string */ - function getPluginName() { - + public function getPluginName() + { return 'notifications'; - } /** @@ -61,58 +62,49 @@ class Plugin extends ServerPlugin { * This method should set up the required event subscriptions. * * @param Server $server - * @return void */ - function initialize(Server $server) { - + public function initialize(Server $server) + { $this->server = $server; $server->on('method:GET', [$this, 'httpGet'], 90); - $server->on('propFind', [$this, 'propFind']); + $server->on('propFind', [$this, 'propFind']); $server->xml->namespaceMap[self::NS_CALENDARSERVER] = 'cs'; - $server->resourceTypeMapping['\\Sabre\\CalDAV\\Notifications\\ICollection'] = '{' . self::NS_CALENDARSERVER . '}notification'; + $server->resourceTypeMapping['\\Sabre\\CalDAV\\Notifications\\ICollection'] = '{'.self::NS_CALENDARSERVER.'}notification'; array_push($server->protectedProperties, - '{' . self::NS_CALENDARSERVER . '}notification-URL', - '{' . self::NS_CALENDARSERVER . '}notificationtype' + '{'.self::NS_CALENDARSERVER.'}notification-URL', + '{'.self::NS_CALENDARSERVER.'}notificationtype' ); - } /** - * PropFind + * PropFind. * - * @param PropFind $propFind + * @param PropFind $propFind * @param BaseINode $node - * @return void */ - function propFind(PropFind $propFind, BaseINode $node) { - + public function propFind(PropFind $propFind, BaseINode $node) + { $caldavPlugin = $this->server->getPlugin('caldav'); if ($node instanceof DAVACL\IPrincipal) { - $principalUrl = $node->getPrincipalUrl(); // notification-URL property - $propFind->handle('{' . self::NS_CALENDARSERVER . '}notification-URL', function() use ($principalUrl, $caldavPlugin) { + $propFind->handle('{'.self::NS_CALENDARSERVER.'}notification-URL', function () use ($principalUrl, $caldavPlugin) { + $notificationPath = $caldavPlugin->getCalendarHomeForPrincipal($principalUrl).'/notifications/'; - $notificationPath = $caldavPlugin->getCalendarHomeForPrincipal($principalUrl) . '/notifications/'; return new DAV\Xml\Property\Href($notificationPath); - }); - } if ($node instanceof INode) { - $propFind->handle( - '{' . self::NS_CALENDARSERVER . '}notificationtype', + '{'.self::NS_CALENDARSERVER.'}notificationtype', [$node, 'getNotificationType'] ); - } - } /** @@ -121,12 +113,11 @@ class Plugin extends ServerPlugin { * We use this to intercept GET calls to notification nodes, and return the * proper response. * - * @param RequestInterface $request + * @param RequestInterface $request * @param ResponseInterface $response - * @return void */ - function httpGet(RequestInterface $request, ResponseInterface $response) { - + public function httpGet(RequestInterface $request, ResponseInterface $response) + { $path = $request->getPath(); try { @@ -135,8 +126,9 @@ class Plugin extends ServerPlugin { return; } - if (!$node instanceof INode) + if (!$node instanceof INode) { return; + } $writer = $this->server->xml->getWriter(); $writer->contextUri = $this->server->getBaseUri(); @@ -153,7 +145,6 @@ class Plugin extends ServerPlugin { // Return false to break the event chain. return false; - } /** @@ -167,14 +158,12 @@ class Plugin extends ServerPlugin { * * @return array */ - function getPluginInfo() { - + public function getPluginInfo() + { return [ - 'name' => $this->getPluginName(), + 'name' => $this->getPluginName(), 'description' => 'Adds support for caldav-notifications, which is required to enable caldav-sharing.', - 'link' => 'http://sabre.io/dav/caldav-sharing/', + 'link' => 'http://sabre.io/dav/caldav-sharing/', ]; - } - } |