From ae2b68d34ea32b4682f9f01b1f99aa17caff573d Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Tue, 12 Apr 2022 15:33:53 +0800 Subject: [PATCH] fix spolier multiple --- include/functions.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/functions.php b/include/functions.php index b2846fdd..96b14d4f 100644 --- a/include/functions.php +++ b/include/functions.php @@ -382,7 +382,7 @@ function format_comment($text, $strip_html = true, $xssclean = false, $newtab = } //[spoiler=What happens to the hero?]The hero dies at the end![/spoiler] if (str_contains($s, '[spoiler')) { - $s = preg_replace_callback("/\[spoiler(=(.*))?\](.+?)\[\/spoiler\]/is", function ($matches) { + $s = preg_replace_callback("/\[spoiler(=(.*))?\](.*)\[\/spoiler\]/isU", function ($matches) { return formatSpoiler($matches[3], $matches[2], nexus()->getScript() != 'preview'); }, $s); } @@ -5141,11 +5141,11 @@ function strip_all_tags($text) //替换掉无参数标签 $bbTags = [ '[*]', '[b]', '[/b]', '[i]', '[/i]', '[u]', '[/u]', '[pre]', '[/pre]', '[quote]', '[/quote]', - '[/color]', '[/font]', '[/size]', '[/url]', '[/youtube]', + '[/color]', '[/font]', '[/size]', '[/url]', '[/youtube]', '[/spoiler]', ]; $text = str_replace($bbTags, '', $text); //替换掉有参数标签 - $pattern = '/\[url=.*\]|\[color=.*\]|\[font=.*\]|\[size=.*\]|\[youtube.*\]/isU'; + $pattern = '/\[url=.*\]|\[color=.*\]|\[font=.*\]|\[size=.*\]|\[youtube.*\]|\[spoiler.*\]/isU'; $text = preg_replace($pattern, "", $text); //去掉表情 static $emoji = null;