[ Index ] |
PHP Cross Reference of phpBB-3.3.14-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package s9e\TextFormatter 5 * @copyright Copyright (c) 2010-2022 The s9e authors 6 * @license http://www.opensource.org/licenses/mit-license.php The MIT License 7 */ 8 namespace s9e\TextFormatter\Configurator\TemplateChecks; 9 10 use DOMElement; 11 use s9e\TextFormatter\Configurator\Exceptions\UnsafeTemplateException; 12 use s9e\TextFormatter\Configurator\Items\Tag; 13 use s9e\TextFormatter\Configurator\TemplateCheck; 14 15 class DisallowElementNS extends TemplateCheck 16 { 17 /** 18 * @var string Local name of the disallowed element 19 */ 20 public $elName; 21 22 /** 23 * @var string Namespace URI of the disallowed element 24 */ 25 public $namespaceURI; 26 27 /** 28 * Constructor 29 * 30 * @param string $namespaceURI Namespace URI of the disallowed element 31 * @param string $elName Local name of the disallowed element 32 */ 33 public function __construct($namespaceURI, $elName) 34 { 35 $this->namespaceURI = $namespaceURI; 36 $this->elName = $elName; 37 } 38 39 /** 40 * Test for the presence of an element of given name in given namespace 41 * 42 * @param DOMElement $template <xsl:template/> node 43 * @param Tag $tag Tag this template belongs to 44 * @return void 45 */ 46 public function check(DOMElement $template, Tag $tag) 47 { 48 $node = $template->getElementsByTagNameNS($this->namespaceURI, $this->elName)->item(0); 49 50 if ($node) 51 { 52 throw new UnsafeTemplateException("Element '" . $node->nodeName . "' is disallowed", $node); 53 } 54 } 55 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Mon Nov 25 19:05:08 2024 | Cross-referenced by PHPXref 0.7.1 |