From 014a1f01589c0389c60630148a4972840c63faad Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 15 Jan 2018 20:47:32 -0800 Subject: add summary bbcode tag --- include/bbcode.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'include/bbcode.php') 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 ''; } +function bb_summary($match) { + $rnd1 = mt_rand(); + $rnd2 = mt_rand(); + $rnd3 = mt_rand(); + $rnd4 = mt_rand(); + + return $match[1] . '
' . $match[2] . '
'; +} + + 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)) { -- cgit v1.2.3