aboutsummaryrefslogtreecommitdiffstats
path: root/include/bbcode.php
diff options
context:
space:
mode:
authorHubzilla <hubzilla@hz.macgirvin.com>2017-01-20 15:30:08 -0800
committerHubzilla <hubzilla@hz.macgirvin.com>2017-01-20 15:30:08 -0800
commit9acd3ebd42733cc089cf2192451617e0b05a0fbc (patch)
tree7ddcc0e42f5677e6b1062d69d67104cf37bc9e8e /include/bbcode.php
parent0368b6730fcb16ec66a0cb2bdc692ce85d26d633 (diff)
downloadvolse-hubzilla-9acd3ebd42733cc089cf2192451617e0b05a0fbc.tar.gz
volse-hubzilla-9acd3ebd42733cc089cf2192451617e0b05a0fbc.tar.bz2
volse-hubzilla-9acd3ebd42733cc089cf2192451617e0b05a0fbc.zip
observer.language!={something} for completeness
Diffstat (limited to 'include/bbcode.php')
-rw-r--r--include/bbcode.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index 8b78034f2..b8d732443 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -487,6 +487,20 @@ function oblanguage_callback($matches) {
return '';
}
+function oblanguage_necallback($matches) {
+ if(strlen($matches[1]) == 2) {
+ $compare = strtolower(substr(\App::$language,0,2));
+ }
+ else {
+ $compare = strtolower(\App::$language);
+ }
+
+ if($compare !== strtolower($matches[1]))
+ return $matches[2];
+
+ return '';
+}
+
function bb_observer($Text) {
$observer = App::get_observer();
@@ -579,6 +593,8 @@ function parseIdentityAwareHTML($Text) {
$Text = preg_replace_callback("/\[observer\.language\=(.*?)\](.*?)\[\/observer\]/ism",'oblanguage_callback', $Text);
+ $Text = preg_replace_callback("/\[observer\.language\!\=(.*?)\](.*?)\[\/observer\]/ism",'oblanguage_necallback', $Text);
+
if ($observer) {
$Text = preg_replace("/\[observer\=1\](.*?)\[\/observer\]/ism", '$1', $Text);
$Text = preg_replace("/\[observer\=0\].*?\[\/observer\]/ism", '', $Text);
@@ -662,6 +678,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false)
if ((strpos($Text,'[/observer]') !== false) || (strpos($Text,'[/rpost]') !== false)) {
$Text = preg_replace_callback("/\[observer\.language\=(.*?)\](.*?)\[\/observer\]/ism",'oblanguage_callback', $Text);
+ $Text = preg_replace_callback("/\[observer\.language\!\=(.*?)\](.*?)\[\/observer\]/ism",'oblanguage_necallback', $Text);
if ($observer) {
$Text = preg_replace("/\[observer\=1\](.*?)\[\/observer\]/ism", '$1', $Text);