X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fbbcode.php;h=13061958c5f12682deb5bc52f87ea5868f9f5a93;hb=92a15d91784830c34aea3a29f1e4aafe4ac16bf8;hp=8102fc3f71e5de0ef5251b034305cddb04ee4f04;hpb=c8e0685788a26811af63f3127ecff0c9f1712ca4;p=friendica.git
diff --git a/include/bbcode.php b/include/bbcode.php
index 8102fc3f71..13061958c5 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -268,6 +268,13 @@ function stripcode_br_cb($s) {
return '[code]' . str_replace('
', '', $s[1]) . '[/code]';
}
+function bb_onelinecode_cb($match) {
+ if (strpos($match[1],"
")===false){
+ return "".$match[1]."";
+ }
+ return "".$match[1]."
";
+}
+
function tryoembed($match){
//$url = ((count($match)==2)?$match[1]:$match[2]);
$url = $match[1];
@@ -1179,7 +1186,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
// If we found an event earlier, strip out all the event code and replace with a reformatted version.
// Replace the event-start section with the entire formatted event. The other bbcode is stripped.
- // Summary (e.g. title) is required, earlier revisions only required description (in addition to
+ // Summary (e.g. title) is required, earlier revisions only required description (in addition to
// start which is always required). Allow desc with a missing summary for compatibility.
if((x($ev,'desc') || x($ev,'summary')) && x($ev,'start')) {
@@ -1193,6 +1200,10 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
$Text = preg_replace("/\[event\-adjust\](.*?)\[\/event\-adjust\]/ism",'',$Text);
}
+
+ //replace oneliner with
+ $Text = preg_replace_callback("|(?!
]*>)([^<]*)
(?!
]*>)|ism", 'bb_onelinecode_cb', $Text);
+
// Unhide all [noparse] contained bbtags unspacefying them
// and triming the [noparse] tag.