aboutsummaryrefslogtreecommitdiffstats
path: root/include/bbcode.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2016-05-31 11:01:24 +0200
committerMario Vavti <mario@mariovavti.com>2016-05-31 11:01:24 +0200
commit380f65d309a6ab01d8e804f704962d5baef9820a (patch)
tree896fd1d53ccb3863380653d1b065c7fc4ef7a641 /include/bbcode.php
parent90f29590765f79fe4bd1e3d59e47ce932ec04d0d (diff)
parent670e83b30050201e3ac069c9dfa86a92aff2431d (diff)
downloadvolse-hubzilla-380f65d309a6ab01d8e804f704962d5baef9820a.tar.gz
volse-hubzilla-380f65d309a6ab01d8e804f704962d5baef9820a.tar.bz2
volse-hubzilla-380f65d309a6ab01d8e804f704962d5baef9820a.zip
Merge branch 'dev' into sabre32
Diffstat (limited to 'include/bbcode.php')
-rw-r--r--include/bbcode.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index f47dc6f2e..42741b392 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -477,9 +477,12 @@ function bb_observer($Text) {
return $Text;
}
-
-
-
+function bb_code($match) {
+ if(strpos($match[0], "<br />"))
+ return '<code>' . trim($match[1]) . '</code>';
+ else
+ return '<code class="inline-code">' . trim($match[1]) . '</code>';
+}
@@ -785,12 +788,9 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false)
$Text = preg_replace("/\[font=(.*?)\](.*?)\[\/font\]/sm", "<span style=\"font-family: $1;\">$2</span>", $Text);
}
- // Declare the format for [code] layout
- $CodeLayout = '<code>$1</code>';
-
// Check for [code] text
if (strpos($Text,'[code]') !== false) {
- $Text = preg_replace("/\[code\](.*?)\[\/code\]/ism", "$CodeLayout", $Text);
+ $Text = preg_replace_callback("/\[code\](.*?)\[\/code\]/ism", 'bb_code', $Text);
}
// Check for [spoiler] text