ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
enshrined\svgSanitize\data\XPath Class Reference
+ Inheritance diagram for enshrined\svgSanitize\data\XPath:
+ Collaboration diagram for enshrined\svgSanitize\data\XPath:

Public Member Functions

 __construct (\DOMDocument $doc)
 
 createNodeName ($nodeName)
 

Data Fields

const DEFAULT_NAMESPACE_PREFIX = 'svg'
 

Protected Member Functions

 handleDefaultNamespace ()
 

Protected Attributes

 $defaultNamespaceURI
 

Detailed Description

Definition at line 4 of file XPath.php.

Constructor & Destructor Documentation

◆ __construct()

enshrined\svgSanitize\data\XPath::__construct ( \DOMDocument  $doc)

Definition at line 13 of file XPath.php.

References enshrined\svgSanitize\data\XPath\handleDefaultNamespace().

14  {
15  parent::__construct($doc);
16  $this->handleDefaultNamespace();
17  }
+ Here is the call graph for this function:

Member Function Documentation

◆ createNodeName()

enshrined\svgSanitize\data\XPath::createNodeName (   $nodeName)
Parameters
string$nodeName
Returns
string

Definition at line 23 of file XPath.php.

24  {
25  if (empty($this->defaultNamespaceURI)) {
26  return $nodeName;
27  }
28  return self::DEFAULT_NAMESPACE_PREFIX . ':' . $nodeName;
29  }

◆ handleDefaultNamespace()

enshrined\svgSanitize\data\XPath::handleDefaultNamespace ( )
protected

Definition at line 31 of file XPath.php.

References string.

Referenced by enshrined\svgSanitize\data\XPath\__construct().

32  {
33  $rootElements = $this->getRootElements();
34 
35  if (count($rootElements) !== 1) {
36  throw new \LogicException(
37  sprintf('Got %d svg elements, expected exactly one', count($rootElements)),
38  1570870568
39  );
40  }
41  $this->defaultNamespaceURI = (string)$rootElements[0]->namespaceURI;
42 
43  if ($this->defaultNamespaceURI !== '') {
44  $this->registerNamespace(self::DEFAULT_NAMESPACE_PREFIX, $this->defaultNamespaceURI);
45  }
46  }
Add rich text string
+ Here is the caller graph for this function:

Field Documentation

◆ $defaultNamespaceURI

enshrined\svgSanitize\data\XPath::$defaultNamespaceURI
protected

Definition at line 11 of file XPath.php.

◆ DEFAULT_NAMESPACE_PREFIX

const enshrined\svgSanitize\data\XPath::DEFAULT_NAMESPACE_PREFIX = 'svg'

Definition at line 6 of file XPath.php.


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