40        $this->server->on(
'method:GET', [$this, 
'httpGet'], 90);
 
   41        $server->on(
'browserButtonActions', 
function(
$path, $node, &$actions) {
 
   43                $actions .= 
'<a href="' . htmlspecialchars(
$path, ENT_QUOTES, 
'UTF-8') . 
'?export"><span class="oi" data-glyph="book"></span></a>';
 
   57        $queryParams = 
$request->getQueryParameters();
 
   58        if (!array_key_exists(
'export', $queryParams)) 
return;
 
   62        $node = $this->server->tree->getNodeForPath(
$path);
 
   66        $this->server->transactionType = 
'get-addressbook-export';
 
   69        if (
$aclPlugin = $this->server->getPlugin(
'acl')) {
 
   73        $nodes = $this->server->getPropertiesForPath(
$path, [
 
   80        $filenameExtension = 
null;
 
   83            case 'text/directory':
 
   85                $filenameExtension = 
'.vcf';
 
   90            '/[^a-zA-Z0-9-_ ]/um',
 
   94        $filename .= 
'-' . date(
'Y-m-d') . $filenameExtension;
 
   96        $response->setHeader(
'Content-Disposition', 
'attachment; filename="' . 
$filename . 
'"');
 
  117        foreach (
$nodes as $node) {
 
  126            $output .= $vcard->serialize();
 
  166            'description' => 
'Adds the ability to export CardDAV addressbooks as a single vCard file.',
 
  167            'link'        => 
'http://sabre.io/dav/vcf-export-plugin/',
 
foreach($paths as $path) $request
An exception for terminatinating execution or to throw for unit testing.
const NS_CARDDAV
xml namespace for CardDAV elements
initialize(DAV\Server $server)
Initializes the plugin and registers event handlers.
generateVCF(array $nodes)
Merges all vcard objects, and builds one big vcf export.
getPluginName()
Returns a plugin name.
httpGet(RequestInterface $request, ResponseInterface $response)
Intercepts GET requests on addressbook urls ending with ?export.
getPluginInfo()
Returns a bunch of meta-data about the plugin.
The baseclass for all server plugins.
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
The RequestInterface represents a HTTP request.
This interface represents a HTTP response.