From 580c3f4ffe9608d2beb56d418c68b3b112420e76 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 10 Nov 2019 12:49:51 +0000 Subject: another bulk of composer updates (cherry picked from commit 6685381fd8db507493c3d7c1793f8c05c681bbce) --- .../sabre/dav/lib/CalDAV/Notifications/Plugin.php | 71 +++++++++------------- 1 file changed, 30 insertions(+), 41 deletions(-) (limited to 'vendor/sabre/dav/lib/CalDAV/Notifications/Plugin.php') 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 @@ 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/', ]; - } - } -- cgit v1.2.3