Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
OptimizeConditionalValueOf.php
01 <?php
02
03 /**
04 * @package s9e\TextFormatter
05 * @copyright Copyright (c) 2010-2022 The s9e authors
06 * @license http://www.opensource.org/licenses/mit-license.php The MIT License
07 */
08 namespace s9e\TextFormatter\Configurator\TemplateNormalizations;
09
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 }