aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-09-23 16:50:06 -0700
committerfriendica <info@friendica.com>2013-09-23 16:50:06 -0700
commitc1234d6f5f926fe6c8b37230d8ddb87aee101985 (patch)
treeb4f0e3e81d2e33ca79a9c7e4a9d25c491820fab5
parenta2b20bd58f0b1c466235a96c41846aba613ea31b (diff)
parente79bc2924422578a9eb8fc44be59e619a1c158b5 (diff)
downloadvolse-hubzilla-c1234d6f5f926fe6c8b37230d8ddb87aee101985.tar.gz
volse-hubzilla-c1234d6f5f926fe6c8b37230d8ddb87aee101985.tar.bz2
volse-hubzilla-c1234d6f5f926fe6c8b37230d8ddb87aee101985.zip
Merge pull request #151 from zzottel/master
add [observer] tags and [observer.baseurl]
-rw-r--r--include/bbcode.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index 997cbac2e..30bfdad56 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -217,6 +217,18 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
$ev = bbtoevent($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
+ $observer = $a->get_observer();
+ if (strpos($Text,'[/observer]') !== false) {
+ if ($observer) {
+ $Text = preg_replace("/\[observer(\=1)?\](.*?)\[\/observer\]/ism", '$2', $Text);
+ $Text = preg_replace("/\[observer\=0\].*?\[\/observer\]/ism", '', $Text);
+ } else {
+ $Text = preg_replace("/\[observer(\=1)?\].*?\[\/observer\]/ism", '', $Text);
+ $Text = preg_replace("/\[observer\=0\](.*?)\[\/observer\]/ism", '$1', $Text);
+ }
+ }
// Replace any html brackets with HTML Entities to prevent executing HTML or script
// Don't use strip_tags here because it breaks [url] search by replacing & with amp
@@ -246,6 +258,14 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
// Set up the parameters for a MAIL search string
$MAILSearchString = $URLSearchString;
+ // replace [observer.baseurl]
+ if ($observer) {
+ $obsBaseURL = $observer['xchan_url'];
+ $obsBaseURL = preg_replace("/\/channel\/.*$/", '', $obsBaseURL);
+ $Text = str_replace('[observer.baseurl]', $obsBaseURL, $Text);
+ } else {
+ $Text = str_replace('[observer.baseurl]', '', $Text);
+ }
// Perform URL Search