X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=inline;f=include%2Fbb2diaspora.php;h=a07a583538e4ac5e88b1613ff765c50837c83846;hb=f639a86d02e378d591eee973dc79b32a6496d92b;hp=95e2365248e6da095e54c2ef6393c979de6fab3f;hpb=28c08467fd33d556e8e496351745773564aa2683;p=friendica.git diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index 95e2365248..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"); @@ -176,14 +201,25 @@ 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]); - return '[' . $m[1] . '](' . $y . ')'; + $y = str_replace('\\_', '_', $m[2]); + return('[' . $m[1] . '](' . $y . ')'); } function format_event_diaspora($ev) {