ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\DAV\Mount\Plugin Class Reference

This plugin provides support for RFC4709: Mounting WebDAV servers. More...

+ Inheritance diagram for Sabre\DAV\Mount\Plugin:
+ Collaboration diagram for Sabre\DAV\Mount\Plugin:

Public Member Functions

 initialize (DAV\Server $server)
 Initializes the plugin and registers event handles. More...
 
 httpGet (RequestInterface $request, ResponseInterface $response)
 'beforeMethod' event handles. More...
 
 davMount (ResponseInterface $response, $uri)
 Generates the davmount response. More...
 
- Public Member Functions inherited from Sabre\DAV\ServerPlugin
 initialize (Server $server)
 This initializes the plugin. More...
 
 getFeatures ()
 This method should return a list of server-features. More...
 
 getHTTPMethods ($path)
 Use this method to tell the server this plugin defines additional HTTP methods. More...
 
 getPluginName ()
 Returns a plugin name. More...
 
 getSupportedReportSet ($uri)
 Returns a list of reports this plugin supports. More...
 
 getPluginInfo ()
 Returns a bunch of meta-data about the plugin. More...
 

Protected Attributes

 $server
 

Detailed Description

This plugin provides support for RFC4709: Mounting WebDAV servers.

Simply append ?mount to any collection to generate the davmount response.

Author
Evert Pot (http://evertpot.com/) http://sabre.io/license/ Modified BSD License

Definition at line 18 of file Plugin.php.

Member Function Documentation

◆ davMount()

Sabre\DAV\Mount\Plugin::davMount ( ResponseInterface  $response,
  $uri 
)

Generates the davmount response.

Parameters
ResponseInterface$response
string$uriabsolute uri
Returns
void

Definition at line 72 of file Plugin.php.

References Sabre\HTTP\MessageInterface\setBody(), Sabre\HTTP\MessageInterface\setHeader(), and Sabre\HTTP\ResponseInterface\setStatus().

Referenced by Sabre\DAV\Mount\Plugin\httpGet().

72  {
73 
74  $response->setStatus(200);
75  $response->setHeader('Content-Type', 'application/davmount+xml');
76  ob_start();
77  echo '<?xml version="1.0"?>', "\n";
78  echo "<dm:mount xmlns:dm=\"http://purl.org/NET/webdav/mount\">\n";
79  echo " <dm:url>", htmlspecialchars($uri, ENT_NOQUOTES, 'UTF-8'), "</dm:url>\n";
80  echo "</dm:mount>";
81  $response->setBody(ob_get_clean());
82 
83  }
$response
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ httpGet()

Sabre\DAV\Mount\Plugin::httpGet ( RequestInterface  $request,
ResponseInterface  $response 
)

'beforeMethod' event handles.

This event handles intercepts GET requests ending with ?mount

Parameters
RequestInterface$request
ResponseInterface$response
Returns
bool

Definition at line 48 of file Plugin.php.

References Sabre\DAV\Mount\Plugin\davMount(), Sabre\HTTP\RequestInterface\getAbsoluteUrl(), and Sabre\HTTP\RequestInterface\getQueryParameters().

48  {
49 
50  $queryParams = $request->getQueryParameters();
51  if (!array_key_exists('mount', $queryParams)) return;
52 
53  $currentUri = $request->getAbsoluteUrl();
54 
55  // Stripping off everything after the ?
56  list($currentUri) = explode('?', $currentUri);
57 
58  $this->davMount($response, $currentUri);
59 
60  // Returning false to break the event chain
61  return false;
62 
63  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
davMount(ResponseInterface $response, $uri)
Generates the davmount response.
Definition: Plugin.php:72
$response
+ Here is the call graph for this function:

◆ initialize()

Sabre\DAV\Mount\Plugin::initialize ( DAV\Server  $server)

Initializes the plugin and registers event handles.

Parameters
DAV\Server$server
Returns
void

Definition at line 33 of file Plugin.php.

References Sabre\DAV\Mount\Plugin\$server.

33  {
34 
35  $this->server = $server;
36  $this->server->on('method:GET', [$this, 'httpGet'], 90);
37 
38  }

Field Documentation

◆ $server

Sabre\DAV\Mount\Plugin::$server
protected

Definition at line 25 of file Plugin.php.

Referenced by Sabre\DAV\Mount\Plugin\initialize().


The documentation for this class was generated from the following file: