Verzeichnisstruktur phpBB-3.2.0
- Veröffentlicht
- 06.01.2017
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 |
Parser.php
01 <?php
02
03 /*
04 * @package s9e\TextFormatter
05 * @copyright Copyright (c) 2010-2016 The s9e Authors
06 * @license http://www.opensource.org/licenses/mit-license.php The MIT License
07 */
08 namespace s9e\TextFormatter\Plugins\HTMLElements;
09 use s9e\TextFormatter\Parser\Tag;
10 use s9e\TextFormatter\Plugins\ParserBase;
11 class Parser extends ParserBase
12 {
13 public function parse($text, array $matches)
14 {
15 foreach ($matches as $m)
16 {
17 $isEnd = (bool) ($text[$m[0][1] + 1] === '/');
18 $pos = $m[0][1];
19 $len = \strlen($m[0][0]);
20 $elName = \strtolower($m[2 - $isEnd][0]);
21 $tagName = (isset($this->config['aliases'][$elName]['']))
22 ? $this->config['aliases'][$elName]['']
23 : $this->config['prefix'] . ':' . $elName;
24 if ($isEnd)
25 {
26 $this->parser->addEndTag($tagName, $pos, $len);
27 continue;
28 }
29 $tag = (\preg_match('/(<\\S+|[\'"\\s])\\/>$/', $m[0][0]))
30 ? $this->parser->addTagPair($tagName, $pos, $len, $pos + $len, 0)
31 : $this->parser->addStartTag($tagName, $pos, $len);
32 $this->captureAttributes($tag, $elName, $m[3][0]);
33 }
34 }
35 protected function captureAttributes(Tag $tag, $elName, $str)
36 {
37 \preg_match_all(
38 '/[a-z][-a-z0-9]*(?>\\s*=\\s*(?>"[^"]*"|\'[^\']*\'|[^\\s"\'=<>`]+))?/i',
39 $str,
40 $attrMatches
41 );
42 foreach ($attrMatches[0] as $attrMatch)
43 {
44 $pos = \strpos($attrMatch, '=');
45 if ($pos === \false)
46 {
47 $pos = \strlen($attrMatch);
48 $attrMatch .= '=' . \strtolower($attrMatch);
49 }
50 $attrName = \strtolower(\trim(\substr($attrMatch, 0, $pos)));
51 $attrValue = \trim(\substr($attrMatch, 1 + $pos));
52 if (isset($this->config['aliases'][$elName][$attrName]))
53 $attrName = $this->config['aliases'][$elName][$attrName];
54 if ($attrValue[0] === '"' || $attrValue[0] === "'")
55 $attrValue = \substr($attrValue, 1, -1);
56 $tag->setAttribute($attrName, \html_entity_decode($attrValue, \ENT_QUOTES, 'UTF-8'));
57 }
58 }
59 }