[ Index ] |
PHP Cross Reference of phpBB-3.3.12-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 * Optimize conditional attributes 14 * 15 * Will replace conditional attributes with a <xsl:copy-of/>, e.g. 16 * <xsl:if test="@foo"> 17 * <xsl:attribute name="foo"> 18 * <xsl:value-of select="@foo" /> 19 * </xsl:attribute> 20 * </xsl:if> 21 * into 22 * <xsl:copy-of select="@foo"/> 23 */ 24 class OptimizeConditionalAttributes extends AbstractNormalization 25 { 26 /** 27 * {@inheritdoc} 28 */ 29 protected $queries = ['//xsl:if[starts-with(@test, "@")][count(descendant::node()) = 2][xsl:attribute[@name = substring(../@test, 2)][xsl:value-of[@select = ../../@test]]]']; 30 31 /** 32 * {@inheritdoc} 33 */ 34 protected function normalizeElement(DOMElement $element) 35 { 36 $copyOf = $this->createElement('xsl:copy-of'); 37 $copyOf->setAttribute('select', $element->getAttribute('test')); 38 39 $element->parentNode->replaceChild($copyOf, $element); 40 } 41 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Jun 23 12:25:44 2024 | Cross-referenced by PHPXref 0.7.1 |