ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\DAV\Browser\HtmlOutputHelper Class Reference

This class provides a few utility functions for easily generating HTML for the browser plugin. More...

+ Collaboration diagram for Sabre\DAV\Browser\HtmlOutputHelper:

Public Member Functions

 __construct ($baseUri, array $namespaceMap)
 Creates the object. More...
 
 fullUrl ($path)
 Generates a 'full' url based on a relative one. More...
 
 h ($input)
 Escape string for HTML output. More...
 
 link ($url, $label=null)
 Generates a full -tag. More...
 
 xmlName ($element)
 This method takes an xml element in clark-notation, and turns it into a shortened version with a prefix, if it was a known namespace. More...
 

Protected Attributes

 $baseUri
 
 $namespaceMap
 

Detailed Description

This class provides a few utility functions for easily generating HTML for the browser plugin.

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

Definition at line 16 of file HtmlOutputHelper.php.

Constructor & Destructor Documentation

◆ __construct()

Sabre\DAV\Browser\HtmlOutputHelper::__construct (   $baseUri,
array  $namespaceMap 
)

Creates the object.

baseUri must point to the root of the application. This will be used to easily generate links.

The namespaceMap contains an array with the list of xml namespaces and their prefixes. WebDAV uses a lot of XML with complex namespaces, so that can be used to make output a lot shorter.

Parameters
string$baseUri
array$namespaceMap

Definition at line 45 of file HtmlOutputHelper.php.

References Sabre\DAV\Browser\HtmlOutputHelper\$baseUri, and Sabre\DAV\Browser\HtmlOutputHelper\$namespaceMap.

45  {
46 
47  $this->baseUri = $baseUri;
48  $this->namespaceMap = $namespaceMap;
49 
50  }

Member Function Documentation

◆ fullUrl()

Sabre\DAV\Browser\HtmlOutputHelper::fullUrl (   $path)

Generates a 'full' url based on a relative one.

For relative urls, the base of the application is taken as the reference url, not the 'current url of the current request'.

Absolute urls are left alone.

Parameters
string$path
Returns
string

Definition at line 63 of file HtmlOutputHelper.php.

References $path, and Sabre\Uri\resolve().

Referenced by Sabre\DAV\Browser\HtmlOutputHelper\link().

63  {
64 
65  return Uri\resolve($this->baseUri, $path);
66 
67  }
$path
Definition: aliased.php:25
resolve($basePath, $newPath)
This file contains all the uri handling functions.
Definition: functions.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ h()

Sabre\DAV\Browser\HtmlOutputHelper::h (   $input)

Escape string for HTML output.

Parameters
string$input
Returns
string

Definition at line 75 of file HtmlOutputHelper.php.

References $input.

Referenced by Sabre\DAV\Browser\HtmlOutputHelper\link(), Sabre\DAVACL\Xml\Property\SupportedPrivilegeSet\toHtml(), and Sabre\DAV\Browser\HtmlOutputHelper\xmlName().

75  {
76 
77  return htmlspecialchars($input, ENT_COMPAT, 'UTF-8');
78 
79  }
+ Here is the caller graph for this function:

◆ link()

Sabre\DAV\Browser\HtmlOutputHelper::link (   $url,
  $label = null 
)

Generates a full -tag.

Url is automatically expanded. If label is not specified, we re-use the url.

Parameters
string$url
string$label
Returns
string

Definition at line 91 of file HtmlOutputHelper.php.

References $url, Sabre\DAV\Browser\HtmlOutputHelper\fullUrl(), and Sabre\DAV\Browser\HtmlOutputHelper\h().

Referenced by Sabre\DAV\Xml\Property\Href\toHtml(), and Sabre\DAVACL\Xml\Property\Acl\toHtml().

91  {
92 
93  $url = $this->h($this->fullUrl($url));
94  return '<a href="' . $url . '">' . ($label ? $this->h($label) : $url) . '</a>';
95 
96  }
fullUrl($path)
Generates a &#39;full&#39; url based on a relative one.
$url
h($input)
Escape string for HTML output.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xmlName()

Sabre\DAV\Browser\HtmlOutputHelper::xmlName (   $element)

This method takes an xml element in clark-notation, and turns it into a shortened version with a prefix, if it was a known namespace.

Parameters
string$element
Returns
string

Definition at line 105 of file HtmlOutputHelper.php.

References Sabre\DAV\Browser\HtmlOutputHelper\h().

Referenced by Sabre\DAVACL\Xml\Property\SupportedPrivilegeSet\toHtml(), and Sabre\DAVACL\Xml\Property\Acl\toHtml().

105  {
106 
107  list($ns, $localName) = XmlService::parseClarkNotation($element);
108  if (isset($this->namespaceMap[$ns])) {
109  $propName = $this->namespaceMap[$ns] . ':' . $localName;
110  } else {
111  $propName = $element;
112  }
113  return "<span title=\"" . $this->h($element) . "\">" . $this->h($propName) . "</span>";
114 
115  }
h($input)
Escape string for HTML output.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $baseUri

Sabre\DAV\Browser\HtmlOutputHelper::$baseUri
protected

Definition at line 23 of file HtmlOutputHelper.php.

Referenced by Sabre\DAV\Browser\HtmlOutputHelper\__construct().

◆ $namespaceMap

Sabre\DAV\Browser\HtmlOutputHelper::$namespaceMap
protected

Definition at line 30 of file HtmlOutputHelper.php.

Referenced by Sabre\DAV\Browser\HtmlOutputHelper\__construct().


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