diff options
author | zotlabs <mike@macgirvin.com> | 2018-01-15 20:47:32 -0800 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2018-01-15 20:47:32 -0800 |
commit | 014a1f01589c0389c60630148a4972840c63faad (patch) | |
tree | 4064e3952039608e5402d4b95c7f773f7a2d7db0 /include/bbcode.php | |
parent | 91db66b32d2c469a6d0292712666614b48b4c62e (diff) | |
download | volse-hubzilla-014a1f01589c0389c60630148a4972840c63faad.tar.gz volse-hubzilla-014a1f01589c0389c60630148a4972840c63faad.tar.bz2 volse-hubzilla-014a1f01589c0389c60630148a4972840c63faad.zip |
add summary bbcode tag
Diffstat (limited to 'include/bbcode.php')
-rw-r--r-- | include/bbcode.php | 15 |
1 files changed, 15 insertions, 0 deletions
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 '<div onclick="openClose(\'opendiv-' . $rnd . '\'); return false;" class="fakelink">' . $openclose . '</div><blockquote id="opendiv-' . $rnd . '" style="display: none;">' . $text . '</blockquote>'; } +function bb_summary($match) { + $rnd1 = mt_rand(); + $rnd2 = mt_rand(); + $rnd3 = mt_rand(); + $rnd4 = mt_rand(); + + return $match[1] . '<div style="display: block;" id="opendiv-' . $rnd2 . '">' . $match[2] . '</div><div style="display: block;" id="opendiv-' . $rnd3 . '" onclick="openClose(\'opendiv-' . $rnd1 . '\'); openClose(\'opendiv-' . $rnd2 . '\'); openClose(\'opendiv-' . $rnd3 . '\'); openClose(\'opendiv-' . $rnd4 . '\'); return false;" class="fakelink">' . t('View article') . '</div><div style="display: none;" id="opendiv-' . $rnd4 . '" onclick="openClose(\'opendiv-' . $rnd1 . '\'); openClose(\'opendiv-' . $rnd2 . '\'); openClose(\'opendiv-' . $rnd3 . '\'); openClose(\'opendiv-' . $rnd4 . '\'); return false;" class="fakelink">' . t('View summary') . '</div><div id="opendiv-' . $rnd1 . '" style="display: none;">' . $match[3] . '</div>'; +} + + 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)) { |