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

Public Member Functions

 __construct ()
 
 setXMLOptions ($xmlOptions)
 Set XML options to use when saving XML See: DOMDocument::saveXML. More...
 
 getXMLOptions ()
 Get XML options to use when saving XML See: DOMDocument::saveXML. More...
 
 getAllowedTags ()
 Get the array of allowed tags. More...
 
 setAllowedTags (TagInterface $allowedTags)
 Set custom allowed tags. More...
 
 getAllowedAttrs ()
 Get the array of allowed attributes. More...
 
 setAllowedAttrs (AttributeInterface $allowedAttrs)
 Set custom allowed attributes. More...
 
 removeRemoteReferences ($removeRemoteRefs=false)
 Should we remove references to remote files? More...
 
 getXmlIssues ()
 Get XML issues. More...
 
 sanitize ($dirty)
 Sanitize the passed string. More...
 
 minify ($shouldMinify=false)
 Should we minify the output? More...
 
 removeXMLTag ($removeXMLTag=false)
 Should we remove the XML tag in the header? More...
 
 useThreshold ($useThreshold=1000)
 Whether `<use ... More...
 
 setUseNestingLimit ($limit)
 Set the nesting limit for <use> tags. More...
 

Protected Member Functions

 resetInternal ()
 Set up the DOMDocument. More...
 
 setUpBefore ()
 Set up libXML before we start. More...
 
 resetAfter ()
 Reset the class after use. More...
 
 removeDoctype ()
 Remove the XML Doctype It may be caught later on output but that seems to be buggy, so we need to make sure it's gone. More...
 
 cleanAttributesOnWhitelist (\DOMElement $element)
 Only allow attributes that are on the whitelist. More...
 
 cleanXlinkHrefs (\DOMElement $element)
 Clean the xlink:hrefs of script and data embeds. More...
 
 cleanHrefs (\DOMElement $element)
 Clean the hrefs of script and data embeds. More...
 
 isHrefSafeValue ($value)
 Only allow whitelisted starts to be within the href. More...
 
 removeNonPrintableCharacters ($value)
 Removes non-printable ASCII characters from string & trims it. More...
 
 hasRemoteReference ($value)
 Does this attribute value have a remote reference? More...
 
 isAriaAttribute ($attributeName)
 Check to see if an attribute is an aria attribute or not. More...
 
 isDataAttribute ($attributeName)
 Check to see if an attribute is an data attribute or not. More...
 
 isUseTagDirty (\DOMElement $element)
 Make sure our use tag is only referencing internal resources. More...
 
 isUseTagExceedingThreshold (\DOMElement $element)
 Determines whether `<use ... More...
 

Protected Attributes

 $xmlDocument
 
 $allowedTags
 
 $allowedAttrs
 
 $xmlLoaderValue
 
 $minifyXML = false
 
 $removeRemoteReferences = false
 
 $useThreshold = 1000
 
 $removeXMLTag = false
 
 $xmlOptions = LIBXML_NOEMPTYTAG
 
 $xmlIssues = array()
 
 $elementReferenceResolver
 
 $useNestingLimit = 15
 

Detailed Description

Definition at line 18 of file Sanitizer.php.

Constructor & Destructor Documentation

◆ __construct()

enshrined\svgSanitize\Sanitizer::__construct ( )

Definition at line 84 of file Sanitizer.php.

References enshrined\svgSanitize\data\AllowedAttributes\getAttributes(), and enshrined\svgSanitize\data\AllowedTags\getTags().

85  {
86  // Load default tags/attributes
87  $this->allowedAttrs = array_map('strtolower', AllowedAttributes::getAttributes());
88  $this->allowedTags = array_map('strtolower', AllowedTags::getTags());
89  }
static getTags()
Returns an array of tags.
Definition: AllowedTags.php:20
static getAttributes()
Returns an array of attributes.
+ Here is the call graph for this function:

Member Function Documentation

◆ cleanAttributesOnWhitelist()

enshrined\svgSanitize\Sanitizer::cleanAttributesOnWhitelist ( \DOMElement  $element)
protected

Only allow attributes that are on the whitelist.

Parameters
\DOMElement$element

This is used for when a namespace isn't imported properly. Such as xlink:href when the xlink namespace isn't imported. We have to do this as the link is still ran in this case.

Definition at line 347 of file Sanitizer.php.

References $x, array, enshrined\svgSanitize\Sanitizer\hasRemoteReference(), enshrined\svgSanitize\Sanitizer\isAriaAttribute(), enshrined\svgSanitize\Sanitizer\isDataAttribute(), enshrined\svgSanitize\Sanitizer\isHrefSafeValue(), and enshrined\svgSanitize\Sanitizer\removeRemoteReferences().

Referenced by enshrined\svgSanitize\Sanitizer\removeDoctype().

348  {
349  for ($x = $element->attributes->length - 1; $x >= 0; $x--) {
350  // get attribute name
351  $attrName = $element->attributes->item($x)->name;
352 
353  // Remove attribute if not in whitelist
354  if (!in_array(strtolower($attrName), $this->allowedAttrs) && !$this->isAriaAttribute(strtolower($attrName)) && !$this->isDataAttribute(strtolower($attrName))) {
355 
356  $element->removeAttribute($attrName);
357  $this->xmlIssues[] = array(
358  'message' => 'Suspicious attribute \'' . $attrName . '\'',
359  'line' => $element->getLineNo(),
360  );
361  }
362 
368  if (false !== strpos($attrName, 'href')) {
369  $href = $element->getAttribute($attrName);
370  if (false === $this->isHrefSafeValue($href)) {
371  $element->removeAttribute($attrName);
372  $this->xmlIssues[] = array(
373  'message' => 'Suspicious attribute \'href\'',
374  'line' => $element->getLineNo(),
375  );
376  }
377  }
378 
379  // Do we want to strip remote references?
380  if($this->removeRemoteReferences) {
381  // Remove attribute if it has a remote reference
382  if (isset($element->attributes->item($x)->value) && $this->hasRemoteReference($element->attributes->item($x)->value)) {
383  $element->removeAttribute($attrName);
384  $this->xmlIssues[] = array(
385  'message' => 'Suspicious attribute \'' . $attrName . '\'',
386  'line' => $element->getLineNo(),
387  );
388  }
389  }
390  }
391  }
hasRemoteReference($value)
Does this attribute value have a remote reference?
Definition: Sanitizer.php:500
$x
Definition: example_009.php:98
isDataAttribute($attributeName)
Check to see if an attribute is an data attribute or not.
Definition: Sanitizer.php:564
isHrefSafeValue($value)
Only allow whitelisted starts to be within the href.
Definition: Sanitizer.php:436
isAriaAttribute($attributeName)
Check to see if an attribute is an aria attribute or not.
Definition: Sanitizer.php:552
Create styles array
The data for the language used.
removeRemoteReferences($removeRemoteRefs=false)
Should we remove references to remote files?
Definition: Sanitizer.php:169
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cleanHrefs()

enshrined\svgSanitize\Sanitizer::cleanHrefs ( \DOMElement  $element)
protected

Clean the hrefs of script and data embeds.

Parameters
\DOMElement$element

Definition at line 415 of file Sanitizer.php.

References array, and enshrined\svgSanitize\Sanitizer\isHrefSafeValue().

Referenced by enshrined\svgSanitize\Sanitizer\removeDoctype().

416  {
417  $href = $element->getAttribute('href');
418  if (false === $this->isHrefSafeValue($href)) {
419  $element->removeAttribute('href');
420  $this->xmlIssues[] = array(
421  'message' => 'Suspicious attribute \'href\'',
422  'line' => $element->getLineNo(),
423  );
424  }
425  }
isHrefSafeValue($value)
Only allow whitelisted starts to be within the href.
Definition: Sanitizer.php:436
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cleanXlinkHrefs()

enshrined\svgSanitize\Sanitizer::cleanXlinkHrefs ( \DOMElement  $element)
protected

Clean the xlink:hrefs of script and data embeds.

Parameters
\DOMElement$element

Definition at line 398 of file Sanitizer.php.

References array, and enshrined\svgSanitize\Sanitizer\isHrefSafeValue().

Referenced by enshrined\svgSanitize\Sanitizer\removeDoctype().

399  {
400  $xlinks = $element->getAttributeNS('http://www.w3.org/1999/xlink', 'href');
401  if (false === $this->isHrefSafeValue($xlinks)) {
402  $element->removeAttributeNS( 'http://www.w3.org/1999/xlink', 'href' );
403  $this->xmlIssues[] = array(
404  'message' => 'Suspicious attribute \'href\'',
405  'line' => $element->getLineNo(),
406  );
407  }
408  }
isHrefSafeValue($value)
Only allow whitelisted starts to be within the href.
Definition: Sanitizer.php:436
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAllowedAttrs()

enshrined\svgSanitize\Sanitizer::getAllowedAttrs ( )

Get the array of allowed attributes.

Returns
array

Definition at line 149 of file Sanitizer.php.

References enshrined\svgSanitize\Sanitizer\$allowedAttrs.

150  {
151  return $this->allowedAttrs;
152  }

◆ getAllowedTags()

enshrined\svgSanitize\Sanitizer::getAllowedTags ( )

Get the array of allowed tags.

Returns
array

Definition at line 129 of file Sanitizer.php.

References enshrined\svgSanitize\Sanitizer\$allowedTags.

130  {
131  return $this->allowedTags;
132  }

◆ getXmlIssues()

enshrined\svgSanitize\Sanitizer::getXmlIssues ( )

Get XML issues.

Returns
array

Definition at line 179 of file Sanitizer.php.

References enshrined\svgSanitize\Sanitizer\$xmlIssues.

179  {
180  return $this->xmlIssues;
181  }

◆ getXMLOptions()

enshrined\svgSanitize\Sanitizer::getXMLOptions ( )

Get XML options to use when saving XML See: DOMDocument::saveXML.

Returns
int

Definition at line 119 of file Sanitizer.php.

References enshrined\svgSanitize\Sanitizer\$xmlOptions.

120  {
121  return $this->xmlOptions;
122  }

◆ hasRemoteReference()

enshrined\svgSanitize\Sanitizer::hasRemoteReference (   $value)
protected

Does this attribute value have a remote reference?

Parameters
$value
Returns
bool

Definition at line 500 of file Sanitizer.php.

References enshrined\svgSanitize\Sanitizer\removeNonPrintableCharacters().

Referenced by enshrined\svgSanitize\Sanitizer\cleanAttributesOnWhitelist().

501  {
502  $value = $this->removeNonPrintableCharacters($value);
503 
504  $wrapped_in_url = preg_match('~^url\(\s*[\'"]\s*(.*)\s*[\'"]\s*\)$~xi', $value, $match);
505  if (!$wrapped_in_url){
506  return false;
507  }
508 
509  $value = trim($match[1], '\'"');
510 
511  return preg_match('~^((https?|ftp|file):)?//~xi', $value);
512  }
removeNonPrintableCharacters($value)
Removes non-printable ASCII characters from string & trims it.
Definition: Sanitizer.php:489
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAriaAttribute()

enshrined\svgSanitize\Sanitizer::isAriaAttribute (   $attributeName)
protected

Check to see if an attribute is an aria attribute or not.

Parameters
$attributeName
Returns
bool

Definition at line 552 of file Sanitizer.php.

Referenced by enshrined\svgSanitize\Sanitizer\cleanAttributesOnWhitelist().

553  {
554  return strpos($attributeName, 'aria-') === 0;
555  }
+ Here is the caller graph for this function:

◆ isDataAttribute()

enshrined\svgSanitize\Sanitizer::isDataAttribute (   $attributeName)
protected

Check to see if an attribute is an data attribute or not.

Parameters
$attributeName
Returns
bool

Definition at line 564 of file Sanitizer.php.

Referenced by enshrined\svgSanitize\Sanitizer\cleanAttributesOnWhitelist().

565  {
566  return strpos($attributeName, 'data-') === 0;
567  }
+ Here is the caller graph for this function:

◆ isHrefSafeValue()

enshrined\svgSanitize\Sanitizer::isHrefSafeValue (   $value)
protected

Only allow whitelisted starts to be within the href.

This will stop scripts etc from being passed through, with or without attempting to hide bypasses. This stops the need for us to use a complicated script regex.

Parameters
$value
Returns
bool

Definition at line 436 of file Sanitizer.php.

References array.

Referenced by enshrined\svgSanitize\Sanitizer\cleanAttributesOnWhitelist(), enshrined\svgSanitize\Sanitizer\cleanHrefs(), and enshrined\svgSanitize\Sanitizer\cleanXlinkHrefs().

436  {
437 
438  // Allow fragment identifiers.
439  if ('#' === substr($value, 0, 1)) {
440  return true;
441  }
442 
443  // Allow relative URIs.
444  if ('/' === substr($value, 0, 1)) {
445  return true;
446  }
447 
448  // Allow HTTPS domains.
449  if ('https://' === substr($value, 0, 8)) {
450  return true;
451  }
452 
453  // Allow HTTP domains.
454  if ('http://' === substr($value, 0, 7)) {
455  return true;
456  }
457 
458  // Allow known data URIs.
459  if (in_array(substr($value, 0, 14), array(
460  'data:image/png', // PNG
461  'data:image/gif', // GIF
462  'data:image/jpg', // JPG
463  'data:image/jpe', // JPEG
464  'data:image/pjp', // PJPEG
465  ))) {
466  return true;
467  }
468 
469  // Allow known short data URIs.
470  if (in_array(substr($value, 0, 12), array(
471  'data:img/png', // PNG
472  'data:img/gif', // GIF
473  'data:img/jpg', // JPG
474  'data:img/jpe', // JPEG
475  'data:img/pjp', // PJPEG
476  ))) {
477  return true;
478  }
479 
480  return false;
481  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ isUseTagDirty()

enshrined\svgSanitize\Sanitizer::isUseTagDirty ( \DOMElement  $element)
protected

Make sure our use tag is only referencing internal resources.

Parameters
\DOMElement$element
Returns
bool

Definition at line 575 of file Sanitizer.php.

Referenced by enshrined\svgSanitize\Sanitizer\removeDoctype().

576  {
577  $href = Helper::getElementHref($element);
578  return $href && strpos($href, '#') !== 0;
579  }
static getElementHref(\DOMElement $element)
Definition: Helper.php:10
+ Here is the caller graph for this function:

◆ isUseTagExceedingThreshold()

enshrined\svgSanitize\Sanitizer::isUseTagExceedingThreshold ( \DOMElement  $element)
protected

Determines whether `<use ...

xlink:href="#identifier">` is expanded recursively in order to create DoS scenarios. The amount of a actually used element needs to be below $this->useThreshold.

Parameters
\DOMElement$element
Returns
bool

Definition at line 589 of file Sanitizer.php.

Referenced by enshrined\svgSanitize\Sanitizer\removeDoctype().

590  {
591  if ($this->useThreshold <= 0) {
592  return false;
593  }
595  Helper::getElementHref($element)
596  );
597  if ($useId === null) {
598  return false;
599  }
600  foreach ($this->elementReferenceResolver->findByElementId($useId) as $subject) {
601  if ($subject->countUse() >= $this->useThreshold) {
602  return true;
603  }
604  }
605  return false;
606  }
useThreshold($useThreshold=1000)
Whether `<use ...
Definition: Sanitizer.php:540
static getElementHref(\DOMElement $element)
Definition: Helper.php:10
static extractIdReferenceFromHref($href)
Definition: Helper.php:25
+ Here is the caller graph for this function:

◆ minify()

enshrined\svgSanitize\Sanitizer::minify (   $shouldMinify = false)

Should we minify the output?

Parameters
bool$shouldMinify

Definition at line 519 of file Sanitizer.php.

520  {
521  $this->minifyXML = (bool) $shouldMinify;
522  }

◆ removeDoctype()

enshrined\svgSanitize\Sanitizer::removeDoctype ( )
protected

Remove the XML Doctype It may be caught later on output but that seems to be buggy, so we need to make sure it's gone.

Definition at line 271 of file Sanitizer.php.

References $i, array, enshrined\svgSanitize\Sanitizer\cleanAttributesOnWhitelist(), enshrined\svgSanitize\Sanitizer\cleanHrefs(), enshrined\svgSanitize\Sanitizer\cleanXlinkHrefs(), enshrined\svgSanitize\Sanitizer\isUseTagDirty(), and enshrined\svgSanitize\Sanitizer\isUseTagExceedingThreshold().

Referenced by enshrined\svgSanitize\Sanitizer\sanitize().

272  {
273  foreach ($this->xmlDocument->childNodes as $child) {
274  if ($child->nodeType === XML_DOCUMENT_TYPE_NODE) {
275  $child->parentNode->removeChild($child);
276  }
277  }
278  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeNonPrintableCharacters()

enshrined\svgSanitize\Sanitizer::removeNonPrintableCharacters (   $value)
protected

Removes non-printable ASCII characters from string & trims it.

Parameters
string$value
Returns
bool

Definition at line 489 of file Sanitizer.php.

Referenced by enshrined\svgSanitize\Sanitizer\hasRemoteReference().

490  {
491  return trim(preg_replace('/[^ -~]/xu','',$value));
492  }
+ Here is the caller graph for this function:

◆ removeRemoteReferences()

enshrined\svgSanitize\Sanitizer::removeRemoteReferences (   $removeRemoteRefs = false)

Should we remove references to remote files?

Parameters
bool$removeRemoteRefs

Definition at line 169 of file Sanitizer.php.

Referenced by enshrined\svgSanitize\Sanitizer\cleanAttributesOnWhitelist().

170  {
171  $this->removeRemoteReferences = $removeRemoteRefs;
172  }
removeRemoteReferences($removeRemoteRefs=false)
Should we remove references to remote files?
Definition: Sanitizer.php:169
+ Here is the caller graph for this function:

◆ removeXMLTag()

enshrined\svgSanitize\Sanitizer::removeXMLTag (   $removeXMLTag = false)

Should we remove the XML tag in the header?

Parameters
bool$removeXMLTag

Definition at line 529 of file Sanitizer.php.

Referenced by enshrined\svgSanitize\Sanitizer\sanitize().

530  {
531  $this->removeXMLTag = (bool) $removeXMLTag;
532  }
removeXMLTag($removeXMLTag=false)
Should we remove the XML tag in the header?
Definition: Sanitizer.php:529
+ Here is the caller graph for this function:

◆ resetAfter()

enshrined\svgSanitize\Sanitizer::resetAfter ( )
protected

Reset the class after use.

Definition at line 261 of file Sanitizer.php.

Referenced by enshrined\svgSanitize\Sanitizer\sanitize().

262  {
263  // Reset the entity loader
264  libxml_disable_entity_loader($this->xmlLoaderValue);
265  }
+ Here is the caller graph for this function:

◆ resetInternal()

enshrined\svgSanitize\Sanitizer::resetInternal ( )
protected

Set up the DOMDocument.

Definition at line 94 of file Sanitizer.php.

References enshrined\svgSanitize\Sanitizer\$minifyXML.

Referenced by enshrined\svgSanitize\Sanitizer\sanitize().

95  {
96  $this->xmlDocument = new \DOMDocument();
97  $this->xmlDocument->preserveWhiteSpace = false;
98  $this->xmlDocument->strictErrorChecking = false;
99  $this->xmlDocument->formatOutput = !$this->minifyXML;
100  }
+ Here is the caller graph for this function:

◆ sanitize()

enshrined\svgSanitize\Sanitizer::sanitize (   $dirty)

Sanitize the passed string.

Parameters
string$dirty
Returns
string

Definition at line 190 of file Sanitizer.php.

References enshrined\svgSanitize\Sanitizer\removeDoctype(), enshrined\svgSanitize\Sanitizer\removeXMLTag(), enshrined\svgSanitize\Sanitizer\resetAfter(), enshrined\svgSanitize\Sanitizer\resetInternal(), and enshrined\svgSanitize\Sanitizer\setUpBefore().

191  {
192  // Don't run on an empty string
193  if (empty($dirty)) {
194  return '';
195  }
196 
197  // Strip php tags
198  $dirty = preg_replace('/<\?(=|php)(.+?)\?>/i', '', $dirty);
199 
200  $this->resetInternal();
201  $this->setUpBefore();
202 
203  $loaded = $this->xmlDocument->loadXML($dirty);
204 
205  // If we couldn't parse the XML then we go no further. Reset and return false
206  if (!$loaded) {
207  $this->resetAfter();
208  return false;
209  }
210 
211  $this->removeDoctype();
212 
213  // Pre-process all identified elements
214  $xPath = new XPath($this->xmlDocument);
215  $this->elementReferenceResolver = new Resolver($xPath, $this->useNestingLimit);
216  $this->elementReferenceResolver->collect();
217  $elementsToRemove = $this->elementReferenceResolver->getElementsToRemove();
218 
219  // Grab all the elements
220  $allElements = $this->xmlDocument->getElementsByTagName("*");
221 
222  // Start the cleaning proccess
223  $this->startClean($allElements, $elementsToRemove);
224 
225  // Save cleaned XML to a variable
226  if ($this->removeXMLTag) {
227  $clean = $this->xmlDocument->saveXML($this->xmlDocument->documentElement, $this->xmlOptions);
228  } else {
229  $clean = $this->xmlDocument->saveXML($this->xmlDocument, $this->xmlOptions);
230  }
231 
232  $this->resetAfter();
233 
234  // Remove any extra whitespaces when minifying
235  if ($this->minifyXML) {
236  $clean = preg_replace('/\s+/', ' ', $clean);
237  }
238 
239  // Return result
240  return $clean;
241  }
resetInternal()
Set up the DOMDocument.
Definition: Sanitizer.php:94
setUpBefore()
Set up libXML before we start.
Definition: Sanitizer.php:246
resetAfter()
Reset the class after use.
Definition: Sanitizer.php:261
removeDoctype()
Remove the XML Doctype It may be caught later on output but that seems to be buggy, so we need to make sure it&#39;s gone.
Definition: Sanitizer.php:271
removeXMLTag($removeXMLTag=false)
Should we remove the XML tag in the header?
Definition: Sanitizer.php:529
+ Here is the call graph for this function:

◆ setAllowedAttrs()

enshrined\svgSanitize\Sanitizer::setAllowedAttrs ( AttributeInterface  $allowedAttrs)

Set custom allowed attributes.

Parameters
AttributeInterface$allowedAttrs

Definition at line 159 of file Sanitizer.php.

160  {
161  $this->allowedAttrs = array_map('strtolower', $allowedAttrs::getAttributes());
162  }

◆ setAllowedTags()

enshrined\svgSanitize\Sanitizer::setAllowedTags ( TagInterface  $allowedTags)

Set custom allowed tags.

Parameters
TagInterface$allowedTags

Definition at line 139 of file Sanitizer.php.

140  {
141  $this->allowedTags = array_map('strtolower', $allowedTags::getTags());
142  }

◆ setUpBefore()

enshrined\svgSanitize\Sanitizer::setUpBefore ( )
protected

Set up libXML before we start.

Definition at line 246 of file Sanitizer.php.

References array.

Referenced by enshrined\svgSanitize\Sanitizer\sanitize().

247  {
248  // Turn off the entity loader
249  $this->xmlLoaderValue = libxml_disable_entity_loader(true);
250 
251  // Suppress the errors because we don't really have to worry about formation before cleansing
252  libxml_use_internal_errors(true);
253 
254  // Reset array of altered XML
255  $this->xmlIssues = array();
256  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ setUseNestingLimit()

enshrined\svgSanitize\Sanitizer::setUseNestingLimit (   $limit)

Set the nesting limit for <use> tags.

Parameters
$limit

Definition at line 613 of file Sanitizer.php.

614  {
615  $this->useNestingLimit = (int) $limit;
616  }

◆ setXMLOptions()

enshrined\svgSanitize\Sanitizer::setXMLOptions (   $xmlOptions)

Set XML options to use when saving XML See: DOMDocument::saveXML.

Parameters
int$xmlOptions

Definition at line 108 of file Sanitizer.php.

References enshrined\svgSanitize\Sanitizer\$xmlOptions.

109  {
110  $this->xmlOptions = $xmlOptions;
111  }

◆ useThreshold()

enshrined\svgSanitize\Sanitizer::useThreshold (   $useThreshold = 1000)

Whether `<use ...

xlink:href="#identifier">` elements shall be removed in case expansion would exceed this threshold.

Parameters
int$useThreshold

Definition at line 540 of file Sanitizer.php.

541  {
542  $this->useThreshold = (int)$useThreshold;
543  }
useThreshold($useThreshold=1000)
Whether `<use ...
Definition: Sanitizer.php:540

Field Documentation

◆ $allowedAttrs

enshrined\svgSanitize\Sanitizer::$allowedAttrs
protected

Definition at line 34 of file Sanitizer.php.

Referenced by enshrined\svgSanitize\Sanitizer\getAllowedAttrs().

◆ $allowedTags

enshrined\svgSanitize\Sanitizer::$allowedTags
protected

Definition at line 29 of file Sanitizer.php.

Referenced by enshrined\svgSanitize\Sanitizer\getAllowedTags().

◆ $elementReferenceResolver

enshrined\svgSanitize\Sanitizer::$elementReferenceResolver
protected

Definition at line 74 of file Sanitizer.php.

◆ $minifyXML

enshrined\svgSanitize\Sanitizer::$minifyXML = false
protected

Definition at line 44 of file Sanitizer.php.

Referenced by enshrined\svgSanitize\Sanitizer\resetInternal().

◆ $removeRemoteReferences

enshrined\svgSanitize\Sanitizer::$removeRemoteReferences = false
protected

Definition at line 49 of file Sanitizer.php.

◆ $removeXMLTag

enshrined\svgSanitize\Sanitizer::$removeXMLTag = false
protected

Definition at line 59 of file Sanitizer.php.

◆ $useNestingLimit

enshrined\svgSanitize\Sanitizer::$useNestingLimit = 15
protected

Definition at line 79 of file Sanitizer.php.

◆ $useThreshold

enshrined\svgSanitize\Sanitizer::$useThreshold = 1000
protected

Definition at line 54 of file Sanitizer.php.

◆ $xmlDocument

enshrined\svgSanitize\Sanitizer::$xmlDocument
protected

Definition at line 24 of file Sanitizer.php.

◆ $xmlIssues

enshrined\svgSanitize\Sanitizer::$xmlIssues = array()
protected

Definition at line 69 of file Sanitizer.php.

Referenced by enshrined\svgSanitize\Sanitizer\getXmlIssues().

◆ $xmlLoaderValue

enshrined\svgSanitize\Sanitizer::$xmlLoaderValue
protected

Definition at line 39 of file Sanitizer.php.

◆ $xmlOptions

enshrined\svgSanitize\Sanitizer::$xmlOptions = LIBXML_NOEMPTYTAG
protected

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