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 |
OptimizeNestedConditionals.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 * Optimize xsl:choose elements by integrating the content of another xsl:choose element located
14 * in their xsl:otherwise part
15 *
16 * Will move child nodes from //xsl:choose/xsl:otherwise/xsl:choose to their great-grandparent as
17 * long as the inner xsl:choose has no siblings. Good for XSLT stylesheets because it reduces the
18 * number of nodes, not-so-good for the PHP renderer when it prevents from optimizing branch
19 * tables by mixing the branch keys
20 */
21 class OptimizeNestedConditionals extends AbstractNormalization
22 {
23 /**
24 * {@inheritdoc}
25 */
26 protected $queries = ['//xsl:choose/xsl:otherwise[count(node()) = 1]/xsl:choose'];
27
28 /**
29 * {@inheritdoc}
30 */
31 protected function normalizeElement(DOMElement $element)
32 {
33 $otherwise = $element->parentNode;
34 $outerChoose = $otherwise->parentNode;
35
36 while ($element->firstChild)
37 {
38 $outerChoose->appendChild($element->removeChild($element->firstChild));
39 }
40
41 $outerChoose->removeChild($otherwise);
42 }
43 }