From 37b37f0e04d650d33ece0dfcb0a2d541791c8ce9 Mon Sep 17 00:00:00 2001 From: PupperWoff Date: Sat, 16 Dec 2017 21:06:14 +0100 Subject: [PATCH] BugFix: Removed markup that was shown in title of thread. --- inc/functions.php | 10 ++++++++++ inc/lib/twig/extensions/Extension/Tinyboard.php | 1 + templates/thread.html | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/inc/functions.php b/inc/functions.php index c64f22a9..41c4e232 100755 --- a/inc/functions.php +++ b/inc/functions.php @@ -2398,6 +2398,16 @@ function extract_modifiers($body) { return $modifiers; } +function remove_markup($body) { + global $config; + + foreach ($config['markup'] as $markup) { + if (is_string($markup[1])) + $body = preg_replace($markup[0], "$1", $body); + } + return $body; +} + function remove_modifiers($body) { return preg_replace('@(.+?)@usm', '', $body); } diff --git a/inc/lib/twig/extensions/Extension/Tinyboard.php b/inc/lib/twig/extensions/Extension/Tinyboard.php index aa529b41..3e36db73 100644 --- a/inc/lib/twig/extensions/Extension/Tinyboard.php +++ b/inc/lib/twig/extensions/Extension/Tinyboard.php @@ -18,6 +18,7 @@ class Twig_Extensions_Extension_Tinyboard extends Twig_Extension new Twig_SimpleFilter('sprintf', 'sprintf'), new Twig_SimpleFilter('capcode', 'capcode'), new Twig_SimpleFilter('remove_modifiers', 'remove_modifiers'), + new Twig_SimpleFilter('remove_markup', 'remove_markup'), new Twig_SimpleFilter('hasPermission', 'twig_hasPermission_filter'), new Twig_SimpleFilter('date', 'twig_date_filter'), new Twig_SimpleFilter('poster_id', 'poster_id'), diff --git a/templates/thread.html b/templates/thread.html index 838430e0..042fb95b 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -11,7 +11,7 @@ {% include 'header.html' %} - {% set meta_subject %}{% if config.thread_subject_in_title and thread.subject %}{{ thread.subject|e }}{% else %}{{ thread.body_nomarkup|remove_modifiers[:256]|e }}{% endif %}{% endset %} + {% set meta_subject %}{% if config.thread_subject_in_title and thread.subject %}{{ thread.subject|e }}{% else %}{{ thread.body_nomarkup|remove_modifiers|remove_markup[:256]|e }}{% endif %}{% endset %}