if (!empty($_REQUEST['text'])) {
switch (($_REQUEST['type'] ?? '') ?: 'bbcode') {
case 'bbcode':
- $bbcode = trim($_REQUEST['text']);
+ $bbcode = $_REQUEST['text'];
$results[] = [
'title' => DI::l10n()->t('Source input'),
'content' => visible_whitespace($bbcode)
'content' => visible_whitespace($html)
];
+ $results[] = [
+ 'title' => DI::l10n()->t('BBCode::convert (hex)'),
+ 'content' => visible_whitespace(bin2hex($html)),
+ ];
+
$results[] = [
'title' => DI::l10n()->t('BBCode::convert'),
'content' => $html
'content' => $html
];
+ $config = \HTMLPurifier_Config::createDefault();
+ $HTMLPurifier = new \HTMLPurifier($config);
+ $purified = $HTMLPurifier->purify($html);
+
+ $results[] = [
+ 'title' => DI::l10n()->t('HTML Purified (raw)'),
+ 'content' => visible_whitespace($purified),
+ ];
+
+ $results[] = [
+ 'title' => DI::l10n()->t('HTML Purified (hex)'),
+ 'content' => visible_whitespace(bin2hex($purified)),
+ ];
+
+ $results[] = [
+ 'title' => DI::l10n()->t('HTML Purified'),
+ 'content' => $purified,
+ ];
+
$bbcode = Text\HTML::toBBCode($html);
$results[] = [
'title' => DI::l10n()->t('HTML::toBBCode'),
<div class="panel-heading">
<h3 class="panel-title">{{$result.title}}</h3>
</div>
- <div class="panel-body">
- {{$result.content nofilter}}
- </div>
+ <div class="panel-body">{{$result.content nofilter}}</div>
</div>
{{/foreach}}
</div>