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

Parser.php

Zuletzt modifiziert: 02.04.2025, 15:04 - Dateigröße: 1.67 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\Plugins\Preg;
09   
10  use s9e\TextFormatter\Plugins\ParserBase;
11   
12  class Parser extends ParserBase
13  {
14      /**
15      * {@inheritdoc}
16      */
17      public function parse($text, array $matches)
18      {
19          foreach ($this->config['generics'] as list($tagName, $regexp, $passthroughIdx, $map))
20          {
21              preg_match_all($regexp, $text, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE);
22   
23              foreach ($matches as $m)
24              {
25                  $startTagPos = $m[0][1];
26                  $matchLen    = strlen($m[0][0]);
27   
28                  if ($passthroughIdx && isset($m[$passthroughIdx]) && $m[$passthroughIdx][0] !== '')
29                  {
30                      // Compute the position and length of the start tag, end tag, and the content in
31                      // between. PREG_OFFSET_CAPTURE gives us the position of the content, and we
32                      // know its length. Everything before is considered part of the start tag, and
33                      // everything after is considered part of the end tag
34                      $contentPos  = $m[$passthroughIdx][1];
35                      $contentLen  = strlen($m[$passthroughIdx][0]);
36                      $startTagLen = $contentPos - $startTagPos;
37                      $endTagPos   = $contentPos + $contentLen;
38                      $endTagLen   = $matchLen - ($startTagLen + $contentLen);
39   
40                      $tag = $this->parser->addTagPair($tagName, $startTagPos, $startTagLen, $endTagPos, $endTagLen, -100);
41                  }
42                  else
43                  {
44                      $tag = $this->parser->addSelfClosingTag($tagName, $startTagPos, $matchLen, -100);
45                  }
46   
47                  foreach ($map as $i => $attrName)
48                  {
49                      if ($attrName && isset($m[$i]) && $m[$i][0] !== '')
50                      {
51                          $tag->setAttribute($attrName, $m[$i][0]);
52                      }
53                  }
54              }
55          }
56      }
57  }