X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=mod%2Fbabel.php;h=6e47b81084b0f158be746c56af021f026cd0c7ff;hb=4af0119b7310e9731e60b11a14fd917580b95715;hp=e5ae96be70489556dd683a3ce3340b469d7a6b6b;hpb=c083ae047c4259dcfa1c61a3795679bbf1b08d8c;p=friendica.git diff --git a/mod/babel.php b/mod/babel.php index e5ae96be70..6e47b81084 100644 --- a/mod/babel.php +++ b/mod/babel.php @@ -5,6 +5,7 @@ use Friendica\Content\Text; use Friendica\Core\L10n; +use Friendica\Core\Renderer; function visible_whitespace($s) { @@ -71,6 +72,21 @@ function babel_content() 'title' => L10n::t('BBCode::toMarkdown => Markdown::convert => HTML::toBBCode'), 'content' => visible_whitespace($bbcode4) ]; + + $item = [ + 'body' => $bbcode, + 'tag' => '', + ]; + + \Friendica\Model\Item::setHashtags($item); + $results[] = [ + 'title' => L10n::t('Item Body'), + 'content' => visible_whitespace($item['body']) + ]; + $results[] = [ + 'title' => L10n::t('Item Tags'), + 'content' => $item['tag'] + ]; break; case 'markdown': $markdown = trim($_REQUEST['text']); @@ -114,6 +130,17 @@ function babel_content() 'content' => visible_whitespace($bbcode) ]; + $html2 = Text\BBCode::convert($bbcode); + $results[] = [ + 'title' => L10n::t('HTML::toBBCode => BBCode::convert'), + 'content' => $html2 + ]; + + $results[] = [ + 'title' => L10n::t('HTML::toBBCode => BBCode::convert (raw HTML)'), + 'content' => htmlspecialchars($html2) + ]; + $markdown = Text\HTML::toMarkdown($html); $results[] = [ 'title' => L10n::t('HTML::toMarkdown'), @@ -128,9 +155,9 @@ function babel_content() } } - $tpl = get_markup_template('babel.tpl'); - $o = replace_macros($tpl, [ - '$text' => ['text', L10n::t('Source text'), htmlentities(defaults($_REQUEST, 'text', '')), ''], + $tpl = Renderer::getMarkupTemplate('babel.tpl'); + $o = Renderer::replaceMacros($tpl, [ + '$text' => ['text', L10n::t('Source text'), defaults($_REQUEST, 'text', ''), ''], '$type_bbcode' => ['type', L10n::t('BBCode'), 'bbcode', '', defaults($_REQUEST, 'type', 'bbcode') == 'bbcode'], '$type_markdown' => ['type', L10n::t('Markdown'), 'markdown', '', defaults($_REQUEST, 'type', 'bbcode') == 'markdown'], '$type_html' => ['type', L10n::t('HTML'), 'html', '', defaults($_REQUEST, 'type', 'bbcode') == 'html'],