X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fbb2diaspora.php;h=a07a583538e4ac5e88b1613ff765c50837c83846;hb=f639a86d02e378d591eee973dc79b32a6496d92b;hp=8d871a07b18e2e054efdc7a930ba4fa4860ee977;hpb=03571f6e7499631018620ab8272430a974909f55;p=friendica.git diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index 8d871a07b1..a07a583538 100644 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -1,11 +1,12 @@ convert($Text); // unmask the special chars back to HTML - $Text = str_replace(array('&_lt_;','&_gt_;','&_amp_;'),array('<','>','&'),$Text); + $Text = str_replace(array('&_lt_;', '&_gt_;', '&_amp_;'), array('<', '>', '&'), $Text); $a->save_timestamp($stamp1, "parser"); @@ -172,20 +201,31 @@ function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) { $Text = preg_replace_callback("/([@]\[(.*?)\])\(([$URLSearchString]*?)\)/ism", 'diaspora_mentions', $Text); } + // Restore code blocks + $Text = preg_replace_callback('/#codeblock-([0-9]+)#/iU', + function ($matches) use ($codeblocks) { + $return = ''; + if (isset($codeblocks[intval($matches[1])])) { + $return = $codeblocks[$matches[1]]; + } + return $return; + } + , $Text); + call_hooks('bb2diaspora',$Text); return $Text; } function unescape_underscores_in_links($m) { - $y = str_replace('\\_','_', $m[2]); + $y = str_replace('\\_', '_', $m[2]); return('[' . $m[1] . '](' . $y . ')'); } function format_event_diaspora($ev) { - - if (! ((is_array($ev)) && count($ev))) + if (! ((is_array($ev)) && count($ev))) { return ''; + } $bd_format = t('l F d, Y \@ g:i A') ; // Friday January 18, 2011 @ 8 AM @@ -200,17 +240,19 @@ function format_event_diaspora($ev) { $ev['start'] , $bd_format))) . '](' . App::get_baseurl() . '/localtime/?f=&time=' . urlencode(datetime_convert('UTC','UTC',$ev['start'])) . ")\n"; - if (! $ev['nofinish']) + if (! $ev['nofinish']) { $o .= t('Finishes:') . ' ' . '[' . (($ev['adjust']) ? day_translate(datetime_convert('UTC', 'UTC', $ev['finish'] , $bd_format )) : day_translate(datetime_convert('UTC', 'UTC', $ev['finish'] , $bd_format ))) . '](' . App::get_baseurl() . '/localtime/?f=&time=' . urlencode(datetime_convert('UTC','UTC',$ev['finish'])) . ")\n"; + } - if (strlen($ev['location'])) + if (strlen($ev['location'])) { $o .= t('Location:') . bb2diaspora($ev['location']) . "\n"; + } $o .= "\n"; return $o;