Skip to content

Commit a13154a

Browse files
committed
restructured
1 parent 84c2e43 commit a13154a

File tree

2 files changed

+50
-53
lines changed

2 files changed

+50
-53
lines changed

src/Modules/DB/DBBaseModule.php

Lines changed: 49 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,13 @@
1313
namespace chillerlan\bbcode\Modules\DB;
1414

1515
use chillerlan\bbcode\BBTemp;
16-
use chillerlan\bbcode\Modules\Html5\{Html5BaseModule, Code, Containers, Expanders, Images, Links, Lists,
17-
Noparse, Simpletext, Singletags, StyledText, Tables, Video};
18-
use chillerlan\Database\DBOptions;
16+
use chillerlan\bbcode\Modules\Markup\MarkupBaseModule;
1917
use chillerlan\Database\Traits\DatabaseTrait;
2018

2119
/**
2220
*
2321
*/
24-
class DBBaseModule extends Html5BaseModule{
22+
class DBBaseModule extends MarkupBaseModule{
2523
use DatabaseTrait;
2624

2725
/**
@@ -32,20 +30,32 @@ class DBBaseModule extends Html5BaseModule{
3230
*/
3331
protected $modules = [
3432
DBTags::class,
35-
Code::class,
36-
Containers::class,
37-
Expanders::class,
38-
# Images::class,
39-
# Links::class,
40-
Lists::class,
41-
Noparse::class,
42-
# Simpletext::class,
43-
# Singletags::class,
44-
# StyledText::class,
45-
Tables::class,
46-
Video::class,
4733
];
4834

35+
/**
36+
* An array of tags the module is able to process
37+
*
38+
* @var array
39+
* @see \chillerlan\bbcode\Modules\Tagmap::$tags
40+
*/
41+
protected $tags = [];
42+
43+
/**
44+
* An optional array of tags contained in self::$tags which are marked as "noparse"
45+
*
46+
* @var array
47+
* @see \chillerlan\bbcode\Modules\Tagmap::$noparse_tags
48+
*/
49+
protected $noparse_tags = [];
50+
51+
/**
52+
* An optional array of tags contained in self::$tags which are marked as "single tag"
53+
*
54+
* @var array
55+
* @see \chillerlan\bbcode\Modules\Tagmap::$singletags
56+
*/
57+
protected $singletags = [];
58+
4959
/**
5060
* @var \chillerlan\Database\Drivers\DBDriverInterface
5161
*/
@@ -59,10 +69,33 @@ class DBBaseModule extends Html5BaseModule{
5969
public function __construct(BBTemp $bbtemp = null){
6070
parent::__construct($bbtemp);
6171

72+
$this->tags = [];
73+
$this->noparse_tags = [];
74+
$this->singletags = [];
75+
6276
if($this->parserOptions && $this->parserOptions->DBDriver){
6377
$this->DBDriverInterface = $this->dbconnect($this->parserOptions->DBDriver, $this->parserOptions->DBOptions);
6478
}
6579

6680
}
6781

82+
/**
83+
* Holds the current base module's EOL token which will replace any newlines
84+
*
85+
* @var string
86+
* @see \chillerlan\bbcode\Modules\ModuleInfo::$eol_token
87+
*/
88+
protected $eol_token = '<br />';
89+
90+
/**
91+
* Sanitizes the content to prevent vulnerabilities or compatibility problems
92+
*
93+
* @param $content string to sanitize
94+
*
95+
* @return string
96+
*/
97+
public function sanitize(string $content):string{
98+
return htmlspecialchars($content, ENT_NOQUOTES | ENT_SUBSTITUTE | ENT_DISALLOWED | ENT_HTML5, 'UTF-8', false);
99+
}
100+
68101
}

src/Modules/DB/DBTags.php

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -19,43 +19,6 @@
1919
*/
2020
class DBTags extends DBBaseModule implements ModuleInterface{
2121

22-
/**
23-
* An array of tags the module is able to process
24-
*
25-
* @var array
26-
* @see \chillerlan\bbcode\Modules\Tagmap::$tags
27-
*/
28-
protected $tags = [];
29-
30-
/**
31-
* An optional array of tags contained in self::$tags which are marked as "noparse"
32-
*
33-
* @var array
34-
* @see \chillerlan\bbcode\Modules\Tagmap::$noparse_tags
35-
*/
36-
protected $noparse_tags = [];
37-
38-
/**
39-
* An optional array of tags contained in self::$tags which are marked as "single tag"
40-
*
41-
* @var array
42-
* @see \chillerlan\bbcode\Modules\Tagmap::$singletags
43-
*/
44-
protected $singletags = [];
45-
46-
/**
47-
* DBTags constructor.
48-
*
49-
* @param \chillerlan\bbcode\BBTemp $bbtemp
50-
*/
51-
public function __construct(BBTemp $bbtemp = null){
52-
parent::__construct($bbtemp);
53-
54-
$this->tags = [];
55-
$this->noparse_tags = [];
56-
$this->singletags = [];
57-
}
58-
5922
/**
6023
* Transforms the bbcode, called from BaseModuleInterface
6124
*
@@ -65,4 +28,5 @@ public function __construct(BBTemp $bbtemp = null){
6528
public function __transform():string{
6629
// TODO: Implement __transform() method.
6730
}
31+
6832
}

0 commit comments

Comments
 (0)