elName = strtolower($elName); } /** * Test for the presence of an element of given name * * @param DOMElement $template node * @param Tag $tag Tag this template belongs to * @return void */ public function check(DOMElement $template, Tag $tag) { $xpath = new DOMXPath($template->ownerDocument); $query = '//*[translate(local-name(), "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz") = "' . $this->elName . '"]' . '|' . '//xsl:element[translate(@name,"ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz") = "' . $this->elName . '"]'; $node = $xpath->query($query)->item(0); if ($node) { throw new UnsafeTemplateException("Element '" . $this->elName . "' is disallowed", $node); } } }