[ 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\Helpers\TemplateParser; 9 10 use DOMDocument; 11 use DOMElement; 12 use DOMNode; 13 use DOMXPath; 14 15 abstract class IRProcessor 16 { 17 /** 18 * XSL namespace 19 */ 20 const XMLNS_XSL = 'http://www.w3.org/1999/XSL/Transform'; 21 22 /** 23 * @var DOMXPath 24 */ 25 protected $xpath; 26 27 /** 28 * Create and append an element to given node in the IR 29 * 30 * @param DOMElement $parentNode Parent node of the element 31 * @param string $name Tag name of the element 32 * @param string $value Value of the element 33 * @return DOMElement The created element 34 */ 35 protected function appendElement(DOMElement $parentNode, $name, $value = '') 36 { 37 return $parentNode->appendChild($parentNode->ownerDocument->createElement($name, $value)); 38 } 39 40 /** 41 * Create and store an instance of DOMXPath for given document 42 * 43 * @param DOMDocument $dom 44 * @return void 45 */ 46 protected function createXPath(DOMDocument $dom) 47 { 48 $this->xpath = new DOMXPath($dom); 49 } 50 51 /** 52 * Evaluate an XPath expression and return its result 53 * 54 * @param string $expr XPath expression 55 * @param DOMNode $node Context node 56 * @return mixed 57 */ 58 protected function evaluate($expr, DOMNode $node = null) 59 { 60 return (isset($node)) ? $this->xpath->evaluate($expr, $node) : $this->xpath->evaluate($expr); 61 } 62 63 /** 64 * Run an XPath query and return its result 65 * 66 * @param string $query XPath query 67 * @param DOMNode $node Context node 68 * @return \DOMNodeList 69 */ 70 protected function query($query, DOMNode $node = null) 71 { 72 return (isset($node)) ? $this->xpath->query($query, $node) : $this->xpath->query($query); 73 } 74 }
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 |