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 |
acp_utils.php
01 <?php
02 /**
03 *
04 * This file is part of the phpBB Forum Software package.
05 *
06 * @copyright (c) phpBB Limited <https://www.phpbb.com>
07 * @license GNU General Public License, version 2 (GPL-2.0)
08 *
09 * For full copyright and license information, please see
10 * the docs/CREDITS.txt file.
11 *
12 */
13
14 namespace phpbb\textformatter\s9e;
15
16 use phpbb\textformatter\acp_utils_interface;
17 use s9e\TextFormatter\Configurator\Exceptions\UnsafeTemplateException;
18
19 class acp_utils implements acp_utils_interface
20 {
21 /**
22 * @var factory $factory
23 */
24 protected $factory;
25
26 /**
27 * @param factory $factory
28 */
29 public function __construct(factory $factory)
30 {
31 $this->factory = $factory;
32 }
33
34 /**
35 * {@inheritdoc}
36 */
37 public function analyse_bbcode(string $definition, string $template): array
38 {
39 $configurator = $this->factory->get_configurator();
40 $return = ['status' => self::BBCODE_STATUS_SAFE];
41
42 // Capture and normalize the BBCode name manually because there's no easy way to retrieve
43 // it in TextFormatter <= 2.x
44 if (preg_match('(\\[([-\\w]++))', $definition, $m))
45 {
46 $return['name'] = strtoupper($m[1]);
47 }
48
49 try
50 {
51 $configurator->BBCodes->addCustom($definition, $template);
52 }
53 catch (UnsafeTemplateException $e)
54 {
55 $return['status'] = self::BBCODE_STATUS_UNSAFE;
56 $return['error_text'] = $e->getMessage();
57 $return['error_html'] = $e->highlightNode('<span class="highlight">');
58 }
59 catch (\Exception $e)
60 {
61 $return['status'] = (preg_match('(xml|xpath|xsl)i', $e->getMessage())) ? self::BBCODE_STATUS_INVALID_TEMPLATE : self::BBCODE_STATUS_INVALID_DEFINITION;
62 $return['error_text'] = $e->getMessage();
63 }
64
65 return $return;
66 }
67 }
68