diff options
author | redmatrix <redmatrix@redmatrix.me> | 2015-05-14 18:02:29 -0700 |
---|---|---|
committer | redmatrix <redmatrix@redmatrix.me> | 2015-05-14 18:02:29 -0700 |
commit | a6cb90c81c29663e96d4fd96acd43fde1c28ac15 (patch) | |
tree | 24d116fb5fe6b1e2687f833cee9685d6480a95eb /include/bbcode.php | |
parent | b467dc4f0055452b65fac842d1294ec9cc978445 (diff) | |
parent | 51b89f0ed8833004cf695de90791d8d0eec550b5 (diff) | |
download | volse-hubzilla-a6cb90c81c29663e96d4fd96acd43fde1c28ac15.tar.gz volse-hubzilla-a6cb90c81c29663e96d4fd96acd43fde1c28ac15.tar.bz2 volse-hubzilla-a6cb90c81c29663e96d4fd96acd43fde1c28ac15.zip |
Merge branch 'master' into tres
Conflicts:
include/Import/refimport.php
include/activities.php
include/attach.php
include/event.php
include/externals.php
include/identity.php
include/items.php
include/notifier.php
include/photos.php
include/taxonomy.php
include/zot.php
mod/channel.php
mod/connedit.php
mod/events.php
mod/item.php
mod/like.php
mod/manage.php
mod/mood.php
mod/ping.php
mod/poke.php
mod/subthread.php
mod/tagger.php
mod/thing.php
Diffstat (limited to 'include/bbcode.php')
-rw-r--r-- | include/bbcode.php | 48 |
1 files changed, 44 insertions, 4 deletions
diff --git a/include/bbcode.php b/include/bbcode.php index fe5f37260..49dd4752d 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -292,7 +292,7 @@ function bb_ShareAttributesSimple($match) { if ($matches[1] != "") $profile = $matches[1]; - $text = '<br />' . html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8') . ' <a href="' . $profile . '">' . $author . '</a>: div class="reshared-content">' . $match[2] . '</div>'; + $text = html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8') . ' <a href="' . $profile . '">' . $author . '</a>: div class="reshared-content">' . $match[2] . '</div>'; return($text); } @@ -381,10 +381,49 @@ function bb_sanitize_style($input) { return '<span style="' . $css_string_san . '">' . $input[2] . '</span>'; } +function bb_observer($Text) { + + $a = get_app(); + + $observer = $a->get_observer(); + + if ((strpos($Text,'[/observer]') !== false) || (strpos($Text,'[/rpost]') !== false)) { + if ($observer) { + $Text = preg_replace("/\[observer\=1\](.*?)\[\/observer\]/ism", '$1', $Text); + $Text = preg_replace("/\[observer\=0\].*?\[\/observer\]/ism", '', $Text); + $Text = preg_replace_callback("/\[rpost(=(.*?))?\](.*?)\[\/rpost\]/ism", 'rpost_callback', $Text); + } else { + $Text = preg_replace("/\[observer\=1\].*?\[\/observer\]/ism", '', $Text); + $Text = preg_replace("/\[observer\=0\](.*?)\[\/observer\]/ism", '$1', $Text); + $Text = preg_replace("/\[rpost(=.*?)?\](.*?)\[\/rpost\]/ism", '', $Text); + } + } + + $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); + } + } + + return $Text; +} + + + + + + + // BBcode 2 HTML was written by WAY2WEB.net // extended to work with Mistpark/Friendica/Red - Mike Macgirvin -function bbcode($Text, $preserve_nl = false, $tryoembed = true) { +function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false) { $a = get_app(); @@ -420,7 +459,8 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true) { // 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 - if(get_config('system','item_cache')) + + if($cache) $observer = false; else $observer = $a->get_observer(); @@ -437,7 +477,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true) { } } - if(get_config('system','item_cache')) + if($cache) $channel = false; else $channel = $a->get_channel(); |