|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* |
|
4
|
|
|
* Advanced BBCode Box |
|
5
|
|
|
* |
|
6
|
|
|
* @copyright (c) 2018 Matt Friedman |
|
7
|
|
|
* @license GNU General Public License, version 2 (GPL-2.0) |
|
8
|
|
|
* |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace vse\abbc3\core; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* ABBC3 custom BBCodes configurator |
|
15
|
|
|
*/ |
|
16
|
|
|
class bbcodes_config |
|
17
|
|
|
{ |
|
18
|
|
|
/** |
|
19
|
|
|
* Configure s9e Pipes table plugin |
|
20
|
|
|
* |
|
21
|
|
|
* @param \s9e\TextFormatter\Configurator $configurator |
|
22
|
|
|
* @access public |
|
23
|
|
|
*/ |
|
24
|
|
|
public function pipes($configurator) |
|
25
|
|
|
{ |
|
26
|
|
|
$configurator->plugins->load('PipeTables'); |
|
27
|
|
|
|
|
28
|
|
|
// Add class "pipe-table" to allow us to style the table with our CSS |
|
29
|
|
|
$dom = $configurator->tags['TABLE']->template->asDOM(); |
|
30
|
|
|
foreach ($dom->getElementsByTagName('table') as $table) |
|
31
|
|
|
{ |
|
32
|
|
|
$table->setAttribute('class', 'pipe-table'); |
|
33
|
|
|
} |
|
34
|
|
|
$dom->saveChanges(); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* Configure BBVideo to use the MEDIA tag with the Media Embed plugin |
|
39
|
|
|
* |
|
40
|
|
|
* @param \s9e\TextFormatter\Configurator $configurator |
|
41
|
|
|
* @access public |
|
42
|
|
|
*/ |
|
43
|
|
|
public function bbvideo($configurator) |
|
44
|
|
|
{ |
|
45
|
|
|
foreach ($configurator->MediaEmbed->defaultSites as $tagName => $tag) |
|
46
|
|
|
{ |
|
47
|
|
|
if (!isset($configurator->BBCodes[$tagName])) |
|
48
|
|
|
{ |
|
49
|
|
|
$configurator->MediaEmbed->add($tagName); |
|
50
|
|
|
} |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
unset($configurator->BBCodes['bbvideo'], $configurator->tags['bbvideo']); |
|
54
|
|
|
$configurator->BBCodes->add( |
|
55
|
|
|
'bbvideo', |
|
56
|
|
|
[ |
|
57
|
|
|
'contentAttributes' => ['url'], |
|
58
|
|
|
'tagName' => 'MEDIA' |
|
59
|
|
|
] |
|
60
|
|
|
); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* Configure Hidden BBCode |
|
65
|
|
|
* |
|
66
|
|
|
* @param \s9e\TextFormatter\Configurator $configurator |
|
67
|
|
|
* @access public |
|
68
|
|
|
*/ |
|
69
|
|
|
public function hidden($configurator) |
|
70
|
|
|
{ |
|
71
|
|
|
unset($configurator->BBCodes['hidden'], $configurator->tags['hidden']); |
|
72
|
|
|
$configurator->BBCodes->addCustom( |
|
73
|
|
|
'[hidden]{TEXT}[/hidden]', |
|
74
|
|
|
'<xsl:choose> |
|
75
|
|
|
<xsl:when test="$S_USER_LOGGED_IN and not($S_IS_BOT)"> |
|
76
|
|
|
<div class="hidebox hidebox_visible"> |
|
77
|
|
|
<div class="hidebox_title hidebox_visible">{L_ABBC3_HIDDEN_OFF}</div> |
|
78
|
|
|
<div class="hidebox_visible">{TEXT}</div> |
|
79
|
|
|
</div> |
|
80
|
|
|
</xsl:when> |
|
81
|
|
|
<xsl:otherwise> |
|
82
|
|
|
<div class="hidebox hidebox_hidden"> |
|
83
|
|
|
<div class="hidebox_title hidebox_hidden">{L_ABBC3_HIDDEN_ON}</div> |
|
84
|
|
|
<div class="hidebox_hidden">{L_ABBC3_HIDDEN_EXPLAIN}</div> |
|
85
|
|
|
</div> |
|
86
|
|
|
</xsl:otherwise> |
|
87
|
|
|
</xsl:choose>' |
|
88
|
|
|
); |
|
89
|
|
|
} |
|
90
|
|
|
} |
|
91
|
|
|
|