X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fbb2diaspora.php;h=80ee1b50dcc0b505f338ee79f1257287ba023f5a;hb=4a473611163a12b48d3bbad71dc54765be8789f9;hp=03eff5a6b73a5bd2c398d11fe8c4d448110a1497;hpb=ee293f2ce28270e1f8e05ce38991977d41e40c27;p=friendica.git diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index 03eff5a6b7..80ee1b50dc 100644 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -1,11 +1,15 @@ 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 +204,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 +243,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;