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 |
Configurator.php
01 <?php declare(strict_types=1);
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\TaskLists;
09
10 use s9e\TextFormatter\Configurator\Items\Tag;
11 use s9e\TextFormatter\Plugins\ConfiguratorBase;
12
13 class Configurator extends ConfiguratorBase
14 {
15 /**
16 * {@inheritdoc}
17 */
18 public function asConfig()
19 {
20 return;
21 }
22
23 /**
24 * {@inheritdoc}
25 */
26 public function finalize()
27 {
28 $this->configureListItemTag();
29 }
30
31 protected function setUp(): void
32 {
33 if (!isset($this->configurator->tags['LI']))
34 {
35 $this->configurator->Litedown;
36 }
37
38 $this->createTaskTag();
39 $this->configureListItemTag();
40 }
41
42 protected function configureListItemTag(): void
43 {
44 if (!isset($this->configurator->tags['LI']))
45 {
46 return;
47 }
48
49 $tag = $this->configurator->tags['LI'];
50 $callback = Helper::class . '::filterListItem';
51 if (!$tag->filterChain->containsCallback($callback))
52 {
53 $tag->filterChain->append($callback)
54 ->resetParameters()
55 ->addParameterByName('parser')
56 ->addParameterByName('tag')
57 ->addParameterByName('text')
58 ->setJS(file_get_contents(__DIR__ . '/filterListItem.js'));
59 }
60
61 $dom = $tag->template->asDOM();
62 foreach ($dom->query('//li[not(xsl:if[@test="TASK"])]') as $li)
63 {
64 $if = $li->prependXslIf('TASK');
65 $if->appendXslAttribute('data-s9e-livepreview-ignore-attrs', 'data-task-id');
66 $if->appendXslAttribute('data-task-id')->appendXslValueOf('TASK/@id');
67 $if->appendXslAttribute('data-task-state')->appendXslValueOf('TASK/@state');
68 }
69 $dom->saveChanges();
70 }
71
72 protected function createTaskTag(): void
73 {
74 $tag = $this->configurator->tags->add('TASK');
75 $tag->attributes->add('id')->filterChain->append('#identifier');
76 $tag->attributes->add('state')->filterChain->append('#identifier');
77 $tag->template = '<input data-task-id="{@id}" data-s9e-livepreview-ignore-attrs="data-task-id" type="checkbox">
78 <xsl:if test="@state = \'checked\'"><xsl:attribute name="checked"/></xsl:if>
79 <xsl:if test="not($TASKLISTS_EDITABLE)"><xsl:attribute name="disabled"/></xsl:if>
80 </input>';
81 }
82 }