[ 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\TemplateNormalizations; 9 10 use DOMAttr; 11 use s9e\TextFormatter\Configurator\Helpers\AVTHelper; 12 use s9e\TextFormatter\Configurator\Helpers\XPathHelper; 13 14 class MinifyXPathExpressions extends AbstractNormalization 15 { 16 /** 17 * {@inheritdoc} 18 */ 19 protected $queries = ['//@*[contains(., " ") or contains(., ")")]']; 20 21 /** 22 * {@inheritdoc} 23 */ 24 protected function normalizeAttribute(DOMAttr $attribute) 25 { 26 $element = $attribute->parentNode; 27 if (!$this->isXsl($element)) 28 { 29 // Replace XPath expressions in non-XSL elements 30 $this->replaceAVT($attribute); 31 } 32 elseif (in_array($attribute->nodeName, ['match', 'select', 'test'], true)) 33 { 34 // Replace the content of match, select and test attributes of an XSL element 35 $expr = XPathHelper::minify($attribute->nodeValue); 36 $element->setAttribute($attribute->nodeName, $expr); 37 } 38 } 39 40 /** 41 * Minify XPath expressions in given attribute 42 * 43 * @param DOMAttr $attribute 44 * @return void 45 */ 46 protected function replaceAVT(DOMAttr $attribute) 47 { 48 AVTHelper::replace( 49 $attribute, 50 function ($token) 51 { 52 if ($token[0] === 'expression') 53 { 54 $token[1] = XPathHelper::minify($token[1]); 55 } 56 57 return $token; 58 } 59 ); 60 } 61 }
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 |