diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php
index 69a87b381..fc05e720f 100644
--- a/include/bb2diaspora.php
+++ b/include/bb2diaspora.php
@@ -152,22 +152,22 @@ function format_event_diaspora($ev) {
$o .= '**' . (($ev['summary']) ? bb2diaspora($ev['summary']) : bb2diaspora($ev['desc'])) . '**' . "\n";
$o .= t('Starts:') . ' ' . '['
- . (($ev['adjust']) ? day_translate(datetime_convert('UTC', 'UTC',
+ . (($ev['adjust']) ? day_translate(datetime_convert('UTC', 'UTC',
$ev['start'] , $bd_format ))
- : day_translate(datetime_convert('UTC', 'UTC',
+ : day_translate(datetime_convert('UTC', 'UTC',
$ev['start'] , $bd_format)))
. '](' . $a->get_baseurl() . '/localtime/?f=&time=' . urlencode(datetime_convert('UTC','UTC',$ev['start'])) . ")\n";
if(! $ev['nofinish'])
- $o .= t('Finishes:') . ' ' . '['
- . (($ev['adjust']) ? day_translate(datetime_convert('UTC', 'UTC',
+ $o .= t('Finishes:') . ' ' . '['
+ . (($ev['adjust']) ? day_translate(datetime_convert('UTC', 'UTC',
$ev['finish'] , $bd_format ))
- : day_translate(datetime_convert('UTC', 'UTC',
+ : day_translate(datetime_convert('UTC', 'UTC',
$ev['finish'] , $bd_format )))
. '](' . $a->get_baseurl() . '/localtime/?f=&time=' . urlencode(datetime_convert('UTC','UTC',$ev['finish'])) . ")\n";
if(strlen($ev['location']))
- $o .= t('Location:') . bb2diaspora($ev['location'])
+ $o .= t('Location:') . bb2diaspora($ev['location'])
. "\n";
$o .= "\n";
diff --git a/include/bbcode.php b/include/bbcode.php
index 8102fc3f7..13061958c 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]."
";
+}
+
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
]*>)([^<]*)
(?!
]*>)|ism", 'bb_onelinecode_cb', $Text);
+
// Unhide all [noparse] contained bbtags unspacefying them
// and triming the [noparse] tag.
diff --git a/include/html2bbcode.php b/include/html2bbcode.php
index d2699460e..10a2fd13e 100644
--- a/include/html2bbcode.php
+++ b/include/html2bbcode.php
@@ -90,12 +90,18 @@ function html2bbcode($message)
$message = str_replace("\r", "", $message);
+ $message = preg_replace_callback("|
|ism", function($m) {
+ return "([^<]*)
".str_replace("\n","
";
+ }, $message);
+
$message = str_replace(array(
"
\n",$m[1]). "