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 |
BBCodeCollection.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\BBCodes\Configurator;
09 use RuntimeException;
10 use s9e\TextFormatter\Configurator\Collections\NormalizedCollection;
11 use s9e\TextFormatter\Configurator\JavaScript\Dictionary;
12 use s9e\TextFormatter\Configurator\Validators\AttributeName;
13 use s9e\TextFormatter\Configurator\Validators\TagName;
14 class BBCodeCollection extends NormalizedCollection
15 {
16 protected $onDuplicateAction = 'replace';
17 protected function getAlreadyExistsException($key)
18 {
19 return new RuntimeException("BBCode '" . $key . "' already exists");
20 }
21 protected function getNotExistException($key)
22 {
23 return new RuntimeException("BBCode '" . $key . "' does not exist");
24 }
25 public function normalizeKey($key)
26 {
27 return BBCode::normalizeName($key);
28 }
29 public function normalizeValue($value)
30 {
31 return ($value instanceof BBCode)
32 ? $value
33 : new BBCode($value);
34 }
35 public function asConfig()
36 {
37 $bbcodes = parent::asConfig();
38 foreach ($bbcodes as $bbcodeName => &$bbcode)
39 {
40 if (isset($bbcode['tagName'])
41 && TagName::isValid($bbcodeName)
42 && TagName::normalize($bbcodeName) === $bbcode['tagName'])
43 unset($bbcode['tagName']);
44 if (isset($bbcode['defaultAttribute'])
45 && AttributeName::isValid($bbcodeName)
46 && AttributeName::normalize($bbcodeName) === $bbcode['defaultAttribute'])
47 unset($bbcode['defaultAttribute']);
48 }
49 unset($bbcode);
50 return new Dictionary($bbcodes);
51 }
52 }