[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch

title

Body

[close]

/vendor/s9e/text-formatter/src/Configurator/TemplateChecks/ -> DisallowNodeByXPath.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 DisallowNodeByXPath extends TemplateCheck
  15  {
  16      public $query;
  17  	public function __construct($query)
  18      {
  19          $this->query = $query;
  20      }
  21  	public function check(DOMElement $template, Tag $tag)
  22      {
  23          $xpath = new DOMXPath($template->ownerDocument);
  24          foreach ($xpath->query($this->query) as $node)
  25              throw new UnsafeTemplateException("Node '" . $node->nodeName . "' is disallowed because it matches '" . $this->query . "'", $node);
  26      }
  27  }


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