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) --- vendor/sabre/dav/lib/CardDAV/VCFExportPlugin.php | 74 ++++++++++++------------ 1 file changed, 37 insertions(+), 37 deletions(-) (limited to 'vendor/sabre/dav/lib/CardDAV/VCFExportPlugin.php') diff --git a/vendor/sabre/dav/lib/CardDAV/VCFExportPlugin.php b/vendor/sabre/dav/lib/CardDAV/VCFExportPlugin.php index 2d61db6ac..194927c53 100644 --- a/vendor/sabre/dav/lib/CardDAV/VCFExportPlugin.php +++ b/vendor/sabre/dav/lib/CardDAV/VCFExportPlugin.php @@ -1,5 +1,7 @@ server = $server; $this->server->on('method:GET', [$this, 'httpGet'], 90); - $server->on('browserButtonActions', function($path, $node, &$actions) { + $server->on('browserButtonActions', function ($path, $node, &$actions) { if ($node instanceof IAddressBook) { - $actions .= ''; + $actions .= ''; } }); } @@ -48,20 +49,25 @@ class VCFExportPlugin extends DAV\ServerPlugin { /** * Intercepts GET requests on addressbook urls ending with ?export. * - * @param RequestInterface $request + * @param RequestInterface $request * @param ResponseInterface $response + * * @return bool */ - function httpGet(RequestInterface $request, ResponseInterface $response) { - + public function httpGet(RequestInterface $request, ResponseInterface $response) + { $queryParams = $request->getQueryParameters(); - if (!array_key_exists('export', $queryParams)) return; + if (!array_key_exists('export', $queryParams)) { + return; + } $path = $request->getPath(); $node = $this->server->tree->getNodeForPath($path); - if (!($node instanceof IAddressBook)) return; + if (!($node instanceof IAddressBook)) { + return; + } $this->server->transactionType = 'get-addressbook-export'; @@ -71,7 +77,7 @@ class VCFExportPlugin extends DAV\ServerPlugin { } $nodes = $this->server->getPropertiesForPath($path, [ - '{' . Plugin::NS_CARDDAV . '}address-data', + '{'.Plugin::NS_CARDDAV.'}address-data', ], 1); $format = 'text/directory'; @@ -91,9 +97,9 @@ class VCFExportPlugin extends DAV\ServerPlugin { '', $node->getName() ); - $filename .= '-' . date('Y-m-d') . $filenameExtension; + $filename .= '-'.date('Y-m-d').$filenameExtension; - $response->setHeader('Content-Disposition', 'attachment; filename="' . $filename . '"'); + $response->setHeader('Content-Disposition', 'attachment; filename="'.$filename.'"'); $response->setHeader('Content-Type', $format); $response->setStatus(200); @@ -101,25 +107,24 @@ class VCFExportPlugin extends DAV\ServerPlugin { // Returning false to break the event chain return false; - } /** - * Merges all vcard objects, and builds one big vcf export + * Merges all vcard objects, and builds one big vcf export. * * @param array $nodes + * * @return string */ - function generateVCF(array $nodes) { - - $output = ""; + public function generateVCF(array $nodes) + { + $output = ''; foreach ($nodes as $node) { - - if (!isset($node[200]['{' . Plugin::NS_CARDDAV . '}address-data'])) { + if (!isset($node[200]['{'.Plugin::NS_CARDDAV.'}address-data'])) { continue; } - $nodeData = $node[200]['{' . Plugin::NS_CARDDAV . '}address-data']; + $nodeData = $node[200]['{'.Plugin::NS_CARDDAV.'}address-data']; // Parsing this node so VObject can clean up the output. $vcard = VObject\Reader::read($nodeData); @@ -127,11 +132,9 @@ class VCFExportPlugin extends DAV\ServerPlugin { // Destroy circular references to PHP will GC the object. $vcard->destroy(); - } return $output; - } /** @@ -142,10 +145,9 @@ class VCFExportPlugin extends DAV\ServerPlugin { * * @return string */ - function getPluginName() { - + public function getPluginName() + { return 'vcf-export'; - } /** @@ -159,14 +161,12 @@ class VCFExportPlugin extends DAV\ServerPlugin { * * @return array */ - function getPluginInfo() { - + public function getPluginInfo() + { return [ - 'name' => $this->getPluginName(), + 'name' => $this->getPluginName(), 'description' => 'Adds the ability to export CardDAV addressbooks as a single vCard file.', - 'link' => 'http://sabre.io/dav/vcf-export-plugin/', + 'link' => 'http://sabre.io/dav/vcf-export-plugin/', ]; - } - } -- cgit v1.2.3