diff --git a/include/bbcode.php b/include/bbcode.php
index 775a91f9a..de32bd57a 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -428,6 +428,16 @@ function bb_spoilertag($match) {
return '
' . $openclose . '
' . $text . '
';
}
+function bb_summary($match) {
+ $rnd1 = mt_rand();
+ $rnd2 = mt_rand();
+ $rnd3 = mt_rand();
+ $rnd4 = mt_rand();
+
+ return $match[1] . '' . $match[2] . '
' . t('View article') . '
' . t('View summary') . '
' . $match[3] . '
';
+}
+
+
function bb_definitionList($match) {
// $match[1] is the markup styles for the "terms" in the definition list.
// $match[2] is the content between the [dl]...[/dl] tags
@@ -1062,6 +1072,11 @@ function bbcode($Text, $options = []) {
$Text = preg_replace_callback("/\[code(.*?)\](.*?)\[\/code\]/ism", 'bb_code_options', $Text);
}
+
+ if(strpos($Text,'[/summary]') !== false) {
+ $Text = preg_replace_callback("/^(.*?)\[summary\](.*?)\[\/summary\](.*?)$/ism", 'bb_summary', $Text);
+ }
+
// Check for [spoiler] text
$endlessloop = 0;
while ((strpos($Text, "[/spoiler]")!== false) and (strpos($Text, "[spoiler]") !== false) and (++$endlessloop < 20)) {