From 48122733b828f0bc2369da40e3860ec545822344 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 22 Apr 2018 18:02:00 -0400 Subject: [PATCH 1/2] Move content filter HTML in a template --- include/text.php | 28 +++++++------------------- view/templates/wall/content_filter.tpl | 22 ++++++++++++++++++++ 2 files changed, 29 insertions(+), 21 deletions(-) create mode 100644 view/templates/wall/content_filter.tpl 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 From 087bfbc6a79f34d837734fec5bbe04934711b70b Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 22 Apr 2018 18:13:13 -0400 Subject: [PATCH 2/2] Forgot new line at end of file in templates/wall/content_filter.tpl --- view/templates/wall/content_filter.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/templates/wall/content_filter.tpl b/view/templates/wall/content_filter.tpl index 2dafdca095..1e2b99c226 100644 --- a/view/templates/wall/content_filter.tpl +++ b/view/templates/wall/content_filter.tpl @@ -19,4 +19,4 @@ {{/if}} \ No newline at end of file +