diff options
author | zotlabs <mike@macgirvin.com> | 2016-12-27 07:29:57 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-27 07:29:57 +1100 |
commit | fdbb5b67a87cb2077ec5a4e00b3e882892187235 (patch) | |
tree | 81692f98c08d349a7700c48c87552034dff7975d /include | |
parent | 56219f9f61a32e5733a8c6315637bfae13e38fc0 (diff) | |
parent | 67f09fb1d6caf7c527aa7d66f29f6ec4a4b5dab3 (diff) | |
download | volse-hubzilla-fdbb5b67a87cb2077ec5a4e00b3e882892187235.tar.gz volse-hubzilla-fdbb5b67a87cb2077ec5a4e00b3e882892187235.tar.bz2 volse-hubzilla-fdbb5b67a87cb2077ec5a4e00b3e882892187235.zip |
Merge pull request #628 from anaqreon/dev
Doco revisions
Diffstat (limited to 'include')
-rw-r--r-- | include/bbcode.php | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/include/bbcode.php b/include/bbcode.php index c7bee6f97..f0cf861f3 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -530,7 +530,17 @@ function bb_fixtable_lf($match) { } function parseIdentityAwareHTML($Text) { - + + // Hide all [noparse] contained bbtags by spacefying them + if (strpos($Text,'[noparse]') !== false) { + $Text = preg_replace_callback("/\[noparse\](.*?)\[\/noparse\]/ism", 'bb_spacefy',$Text); + } + if (strpos($Text,'[nobb]') !== false) { + $Text = preg_replace_callback("/\[nobb\](.*?)\[\/nobb\]/ism", 'bb_spacefy',$Text); + } + if (strpos($Text,'[pre]') !== false) { + $Text = preg_replace_callback("/\[pre\](.*?)\[\/pre\]/ism", 'bb_spacefy',$Text); + } // process [observer] tags before we do anything else because we might // be stripping away stuff that then doesn't need to be worked on anymore @@ -568,9 +578,21 @@ function parseIdentityAwareHTML($Text) { $Text = str_replace('[observer.photo]','', $Text); } - $Text = str_replace(array('[baseurl]','[sitename]'),array(z_root(),get_config('system','sitename')),$Text); + $Text = str_replace(array('[baseurl]','[sitename]'),array(z_root(),get_config('system','sitename')),$Text); - return $Text; + + // Unhide all [noparse] contained bbtags unspacefying them + // and triming the [noparse] tag. + if (strpos($Text,'[noparse]') !== false) { + $Text = preg_replace_callback("/\[noparse\](.*?)\[\/noparse\]/ism", 'bb_unspacefy_and_trim', $Text); + } + if (strpos($Text,'[nobb]') !== false) { + $Text = preg_replace_callback("/\[nobb\](.*?)\[\/nobb\]/ism", 'bb_unspacefy_and_trim', $Text); + } + if (strpos($Text,'[pre]') !== false) { + $Text = preg_replace_callback("/\[pre\](.*?)\[\/pre\]/ism", 'bb_unspacefy_and_trim', $Text); + } + return $Text; } // BBcode 2 HTML was written by WAY2WEB.net @@ -891,8 +913,8 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false) } if (strpos($Text,'[/table]') !== false) { $Text = preg_replace("/\[table\](.*?)\[\/table\]/sm", '<table>$1</table>', $Text); - $Text = preg_replace("/\[table border=1\](.*?)\[\/table\]/sm", '<table border="1" >$1</table>', $Text); - $Text = preg_replace("/\[table border=0\](.*?)\[\/table\]/sm", '<table border="0" >$1</table>', $Text); + $Text = preg_replace("/\[table border=1\](.*?)\[\/table\]/sm", '<table class="table table-responsive table-bordered" >$1</table>', $Text); + $Text = preg_replace("/\[table border=0\](.*?)\[\/table\]/sm", '<table class="table table-responsive" >$1</table>', $Text); } $Text = str_replace('</tr><br /><tr>', "</tr>\n<tr>", $Text); $Text = str_replace('[hr]', '<hr />', $Text); |