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.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

InlineElements.php

Zuletzt modifiziert: 02.04.2025, 15:04 - Dateigröße: 1.42 KiB


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  use DOMException;
12   
13  /**
14  * Inline the elements declarations of a template
15  *
16  * Will replace
17  *     <xsl:element name="div"><xsl:apply-templates/></xsl:element>
18  * with
19  *     <div><xsl:apply-templates/></div>
20  */
21  class InlineElements extends AbstractNormalization
22  {
23      /**
24      * {@inheritdoc}
25      */
26      protected $queries = ['//xsl:element'];
27   
28      /**
29      * {@inheritdoc}
30      */
31      protected function normalizeElement(DOMElement $element)
32      {
33          $elName = $element->getAttribute('name');
34          $dom    = $this->ownerDocument;
35   
36          try
37          {
38              // Create the new static element
39              $newElement = ($element->hasAttribute('namespace'))
40                          ? $dom->createElementNS($element->getAttribute('namespace'), $elName)
41                          : $dom->createElement($elName);
42          }
43          catch (DOMException $e)
44          {
45              // Ignore this element if an exception got thrown
46              return;
47          }
48   
49          // Replace the old <xsl:element/> with it. We do it now so that libxml doesn't have to
50          // redeclare the XSL namespace
51          $element->parentNode->replaceChild($newElement, $element);
52   
53          // One by one and in order, we move the nodes from the old element to the new one
54          while ($element->firstChild)
55          {
56              $newElement->appendChild($element->removeChild($element->firstChild));
57          }
58      }
59  }