[ 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 DOMElement; 11 12 /** 13 * Remove unnecessary <xsl:if> tests around <xsl:value-of> 14 * 15 * NOTE: should be performed before attributes are inlined for maximum effect 16 */ 17 class OptimizeConditionalValueOf extends AbstractNormalization 18 { 19 /** 20 * {@inheritdoc} 21 */ 22 protected $queries = ['//xsl:if[count(descendant::node()) = 1]/xsl:value-of']; 23 24 /** 25 * {@inheritdoc} 26 */ 27 protected function normalizeElement(DOMElement $element) 28 { 29 $if = $element->parentNode; 30 $test = $if->getAttribute('test'); 31 $select = $element->getAttribute('select'); 32 33 // Ensure that the expressions match, and that they select one single attribute 34 if ($select !== $test || !preg_match('#^@[-\\w]+$#D', $select)) 35 { 36 return; 37 } 38 39 // Replace the xsl:if element with the xsl:value-of element 40 $if->parentNode->replaceChild($if->removeChild($element), $if); 41 } 42 }
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 |