From: Hypolite Petovan Date: Sun, 22 Apr 2018 22:02:00 +0000 (-0400) Subject: Move content filter HTML in a template X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=48122733b828f0bc2369da40e3860ec545822344;p=friendica.git Move content filter HTML in a template --- diff --git a/include/text.php b/include/text.php index 6c09167494..5e189d58f1 100644 --- a/include/text.php +++ b/include/text.php @@ -1411,27 +1411,13 @@ function prepare_body(array &$item, $attach = false, $is_preview = false) function apply_content_filter($html, array $reasons) { if (count($reasons)) { - $rnd = random_string(8); - - if (count($reasons) > 1) { - $content_filter_html = ' -

'; - } elseif (count($reasons) == 1) { - $reason = array_pop($reasons); - $content_filter_html .= '

' . htmlspecialchars($reason) . '

'; - } - - $content_filter_html .= ''; + $tpl = get_markup_template('wall/content_filter.tpl'); + $html = replace_macros($tpl, [ + '$reasons' => $reasons, + '$rnd' => random_string(8), + '$openclose' => L10n::t('Click to open/close'), + '$html' => $html + ]); } return $html; diff --git a/view/templates/wall/content_filter.tpl b/view/templates/wall/content_filter.tpl new file mode 100644 index 0000000000..2dafdca095 --- /dev/null +++ b/view/templates/wall/content_filter.tpl @@ -0,0 +1,22 @@ +{{if count($reasons) > 1}} + +

+ +

+{{else}} +

+ {{$reasons.0|escape:html}} + +

+{{/if}} + \ No newline at end of file