From 7c0101899da879dc52008bd9c0445d4a24ab9fcb Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 12 Feb 2014 13:45:11 -0800 Subject: another bbcode addition for the demo, however this one is potentially useful for other purposes --- include/bbcode.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'include/bbcode.php') diff --git a/include/bbcode.php b/include/bbcode.php index c6ec060af..630be0b89 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -373,6 +373,20 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) { } } + $channel = $a->get_channel(); + if (strpos($Text,'[/channel]') !== false) { + if ($channel) { + $Text = preg_replace("/\[channel\=1\](.*?)\[\/channel\]/ism", '$1', $Text); + $Text = preg_replace("/\[channel\=0\].*?\[\/channel\]/ism", '', $Text); + } else { + $Text = preg_replace("/\[channel\=1\].*?\[\/channel\]/ism", '', $Text); + $Text = preg_replace("/\[channel\=0\](.*?)\[\/channel\]/ism", '$1', $Text); + } + } + + + + $Text = str_replace(array('[baseurl]','[sitename]','[sitepath]'),array(z_root(),get_config('system','sitename'),$_SESSION['return_url']),$Text); -- cgit v1.2.3