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 |
AbstractInlineMarkup.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\Plugins\Litedown\Parser\Passes;
09
10 abstract class AbstractInlineMarkup extends AbstractPass
11 {
12 /**
13 * Parse given inline markup in text
14 *
15 * The markup must start and end with exactly 2 characters
16 *
17 * @param string $str First markup string
18 * @param string $regexp Regexp used to match the markup's span
19 * @param string $tagName Name of the tag produced by this markup
20 * @return void
21 */
22 protected function parseInlineMarkup(string $str, string $regexp, string $tagName): void
23 {
24 $pos = $this->text->indexOf($str);
25 if ($pos === false)
26 {
27 return;
28 }
29
30 preg_match_all($regexp, $this->text, $matches, PREG_OFFSET_CAPTURE, $pos);
31 foreach ($matches[0] as [$match, $matchPos])
32 {
33 $matchLen = strlen($match);
34 $endPos = $matchPos + $matchLen - 2;
35
36 $this->parser->addTagPair($tagName, $matchPos, 2, $endPos, 2);
37 $this->text->overwrite($matchPos, 2);
38 $this->text->overwrite($endPos, 2);
39 }
40 }
41 }