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 |
EnforceHTMLOmittedEndTags.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 use s9e\TextFormatter\Configurator\Helpers\ElementInspector;
12
13 /**
14 * Enforce omitted/optional HTML 5 end tags and fix the DOM
15 *
16 * Will replace
17 * <p>.<p>.</p></p>
18 * with
19 * <p>.</p><p>.</p>
20 */
21 class EnforceHTMLOmittedEndTags extends AbstractNormalization
22 {
23 /**
24 * {@inheritdoc}
25 */
26 protected $queries = ['//*[namespace-uri() = ""]/*[namespace-uri() = ""]'];
27
28 /**
29 * {@inheritdoc}
30 */
31 protected function normalizeElement(DOMElement $element)
32 {
33 $parentNode = $element->parentNode;
34 if (ElementInspector::isVoid($parentNode) || ElementInspector::closesParent($element, $parentNode))
35 {
36 $this->reparentElement($element);
37 }
38 }
39
40 /**
41 * Move given element and its following siblings after its parent element
42 *
43 * @param DOMElement $element First element to move
44 * @return void
45 */
46 protected function reparentElement(DOMElement $element)
47 {
48 $parentNode = $element->parentNode;
49 do
50 {
51 $lastChild = $parentNode->lastChild;
52 $parentNode->parentNode->insertBefore($lastChild, $parentNode->nextSibling);
53 }
54 while (!$lastChild->isSameNode($element));
55 }
56 }