Plugin
extends ServerPlugin
in package
Browser Plugin.
This plugin provides a html representation, so that a WebDAV server may be accessed using a browser.
The class intercepts GET requests to collection resources and generates a simple html index.
Tags
Table of Contents
- $uninterestingProperties : array<string|int, mixed>
- A list of properties that are usually not interesting. This can cut down the browser output a bit by removing the properties that most people will likely not want to see.
- $enablePost : bool
- enablePost turns on the 'actions' panel, which allows people to create folders and upload files straight from a browser.
- $server : Server
- reference to server class.
- __construct() : mixed
- Creates the object.
- escapeHTML() : string
- Escapes a string for html.
- generateDirectoryIndex() : string
- Generates the html directory index for a given url.
- generateFooter() : string
- Generates the page footer.
- generateHeader() : string
- Generates the first block of HTML, including the <head> tag and page header.
- generatePluginListing() : string
- Generates the 'plugins' page.
- getFeatures() : array<string|int, mixed>
- This method should return a list of server-features.
- getHTTPMethods() : array<string|int, mixed>
- Use this method to tell the server this plugin defines additional HTTP methods.
- getPluginInfo() : array<string|int, mixed>
- Returns a bunch of meta-data about the plugin.
- getPluginName() : string
- Returns a plugin name.
- getSupportedReportSet() : array<string|int, mixed>
- Returns a list of reports this plugin supports.
- htmlActionsPanel() : mixed
- This method is used to generate the 'actions panel' output for collections.
- httpGet() : bool
- This method intercepts GET requests to collections and returns the html.
- httpGetEarly() : bool
- This method intercepts GET requests that have ?sabreAction=info appended to the URL.
- httpPOST() : bool
- Handles POST requests for tree operations.
- initialize() : mixed
- Initializes the plugin and subscribes to events.
- compareNodes() : int
- Sort helper function: compares two directory entries based on type and display name. Collections sort above other types.
- getAssetUrl() : string
- This method takes a path/name of an asset and turns it into url suiteable for http access.
- getLocalAssetPath() : string
- This method returns a local pathname to an asset.
- serveAsset() : mixed
- This method reads an asset from disk and generates a full http response.
- drawPropertyRow() : string
- Draws a table row for a property.
- drawPropertyValue() : string
- Draws a table row for a property.
- mapResourceType() : array<string|int, mixed>
- Maps a resource type to a human-readable string and icon.
Properties
$uninterestingProperties
A list of properties that are usually not interesting. This can cut down the browser output a bit by removing the properties that most people will likely not want to see.
public
array<string|int, mixed>
$uninterestingProperties
= [
'{DAV:}supportedlock',
'{DAV:}acl-restrictions',
// '{DAV:}supported-privilege-set',
'{DAV:}supported-method-set',
]
$enablePost
enablePost turns on the 'actions' panel, which allows people to create folders and upload files straight from a browser.
protected
bool
$enablePost
= true
$server
reference to server class.
protected
Server
$server
Methods
__construct()
Creates the object.
public
__construct([bool $enablePost = true ]) : mixed
By default it will allow file creation and uploads. Specify the first argument as false to disable this
Parameters
- $enablePost : bool = true
Return values
mixed —escapeHTML()
Escapes a string for html.
public
escapeHTML(string $value) : string
Parameters
- $value : string
Return values
string —generateDirectoryIndex()
Generates the html directory index for a given url.
public
generateDirectoryIndex(string $path) : string
Parameters
- $path : string
Return values
string —generateFooter()
Generates the page footer.
public
generateFooter() : string
Returns html.
Return values
string —generateHeader()
Generates the first block of HTML, including the <head> tag and page header.
public
generateHeader(string $title[, string $path = null ]) : string
Returns footer.
Parameters
- $title : string
- $path : string = null
Return values
string —generatePluginListing()
Generates the 'plugins' page.
public
generatePluginListing() : string
Return values
string —getFeatures()
This method should return a list of server-features.
public
getFeatures() : array<string|int, mixed>
This is for example 'versioning' and is added to the DAV: header in an OPTIONS response.
Return values
array<string|int, mixed> —getHTTPMethods()
Use this method to tell the server this plugin defines additional HTTP methods.
public
getHTTPMethods(string $path) : array<string|int, mixed>
This method is passed a uri. It should only return HTTP methods that are available for the specified uri.
Parameters
- $path : string
Return values
array<string|int, mixed> —getPluginInfo()
Returns a bunch of meta-data about the plugin.
public
getPluginInfo() : array<string|int, mixed>
Providing this information is optional, and is mainly displayed by the Browser plugin.
The description key in the returned array may contain html and will not be sanitized.
Return values
array<string|int, mixed> —getPluginName()
Returns a plugin name.
public
getPluginName() : string
Using this name other plugins will be able to access other plugins; using \Sabre\DAV\Server::getPlugin
Return values
string —getSupportedReportSet()
Returns a list of reports this plugin supports.
public
getSupportedReportSet(string $uri) : array<string|int, mixed>
This will be used in the {DAV:}supported-report-set property. Note that you still need to subscribe to the 'report' event to actually implement them
Parameters
- $uri : string
Return values
array<string|int, mixed> —htmlActionsPanel()
This method is used to generate the 'actions panel' output for collections.
public
htmlActionsPanel(INode $node, mixed &$output, string $path) : mixed
This specifically generates the interfaces for creating new files, and creating new directories.
Parameters
- $node : INode
- $output : mixed
- $path : string
Return values
mixed —httpGet()
This method intercepts GET requests to collections and returns the html.
public
httpGet(RequestInterface $request, ResponseInterface $response) : bool
Parameters
- $request : RequestInterface
- $response : ResponseInterface
Return values
bool —httpGetEarly()
This method intercepts GET requests that have ?sabreAction=info appended to the URL.
public
httpGetEarly(RequestInterface $request, ResponseInterface $response) : bool
Parameters
- $request : RequestInterface
- $response : ResponseInterface
Return values
bool —httpPOST()
Handles POST requests for tree operations.
public
httpPOST(RequestInterface $request, ResponseInterface $response) : bool
Parameters
- $request : RequestInterface
- $response : ResponseInterface
Return values
bool —initialize()
Initializes the plugin and subscribes to events.
public
initialize(Server $server) : mixed
Parameters
- $server : Server
Return values
mixed —compareNodes()
Sort helper function: compares two directory entries based on type and display name. Collections sort above other types.
protected
compareNodes(array<string|int, mixed> $a, array<string|int, mixed> $b) : int
Parameters
- $a : array<string|int, mixed>
- $b : array<string|int, mixed>
Return values
int —getAssetUrl()
This method takes a path/name of an asset and turns it into url suiteable for http access.
protected
getAssetUrl(string $assetName) : string
Parameters
- $assetName : string
Return values
string —getLocalAssetPath()
This method returns a local pathname to an asset.
protected
getLocalAssetPath(string $assetName) : string
Parameters
- $assetName : string
Tags
Return values
string —serveAsset()
This method reads an asset from disk and generates a full http response.
protected
serveAsset(string $assetName) : mixed
Parameters
- $assetName : string
Return values
mixed —drawPropertyRow()
Draws a table row for a property.
private
drawPropertyRow(string $name, mixed $value) : string
Parameters
- $name : string
- $value : mixed
Return values
string —drawPropertyValue()
Draws a table row for a property.
private
drawPropertyValue(HtmlOutputHelper $html, mixed $value) : string
Parameters
- $html : HtmlOutputHelper
- $value : mixed
Return values
string —mapResourceType()
Maps a resource type to a human-readable string and icon.
private
mapResourceType(array<string|int, mixed> $resourceTypes, INode $node) : array<string|int, mixed>
Parameters
- $resourceTypes : array<string|int, mixed>
- $node : INode