[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch

title

Body

[close]

/vendor/s9e/text-formatter/src/Configurator/TemplateChecks/ -> DisallowElement.php (source)

   1  <?php
   2  
   3  /*
   4  * @package   s9e\TextFormatter
   5  * @copyright Copyright (c) 2010-2019 The s9e Authors
   6  * @license   http://www.opensource.org/licenses/mit-license.php The MIT License
   7  */
   8  namespace s9e\TextFormatter\Configurator\TemplateChecks;
   9  use DOMElement;
  10  use DOMXPath;
  11  use s9e\TextFormatter\Configurator\Exceptions\UnsafeTemplateException;
  12  use s9e\TextFormatter\Configurator\Items\Tag;
  13  use s9e\TextFormatter\Configurator\TemplateCheck;
  14  class DisallowElement extends TemplateCheck
  15  {
  16      public $elName;
  17  	public function __construct($elName)
  18      {
  19          $this->elName = \strtolower($elName);
  20      }
  21  	public function check(DOMElement $template, Tag $tag)
  22      {
  23          $xpath = new DOMXPath($template->ownerDocument);
  24          $query
  25              = '//*[translate(local-name(), "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz") = "' . $this->elName . '"]|//xsl:element[translate(@name,"ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz") = "' . $this->elName . '"]';
  26          $node = $xpath->query($query)->item(0);
  27          if ($node)
  28              throw new UnsafeTemplateException("Element '" . $this->elName . "' is disallowed", $node);
  29      }
  30  }


Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1