diaspora formatting improvements (getting too many xx-large posts)

This commit is contained in:
friendica 2014-12-22 20:54:22 -08:00
parent ee89ff5124
commit 8db34ac826

View File

@ -116,6 +116,7 @@ function diaspora_mention_callback($matches) {
function diaspora2bb($s,$use_zrl = false) { function diaspora2bb($s,$use_zrl = false) {
$s = str_replace("
","\r",$s);
$s = str_replace("
\n>","",$s); $s = str_replace("
\n>","",$s);
$s = html_entity_decode($s,ENT_COMPAT,'UTF-8'); $s = html_entity_decode($s,ENT_COMPAT,'UTF-8');
@ -123,11 +124,11 @@ function diaspora2bb($s,$use_zrl = false) {
// Too many new lines. So deactivated the following line // Too many new lines. So deactivated the following line
// $s = str_replace("\r","\n",$s); // $s = str_replace("\r","\n",$s);
// Simply remove cr. // Simply remove cr.
$s = str_replace("\r","",$s); // $s = str_replace("\r","",$s);
// <br/> is invalid. Replace it with the valid expression // <br/> is invalid. Replace it with the valid expression
$s = str_replace("<br/>","<br />",$s); // $s = str_replace("<br/>","<br />",$s);
$s = str_replace("\n","<br />",$s); // $s = str_replace("\n","<br />",$s);
// $s = preg_replace('/\@\{(.+?)\; (.+?)\@(.+?)\}/','@[url=https://$3/u/$2]$1[/url]',$s); // $s = preg_replace('/\@\{(.+?)\; (.+?)\@(.+?)\}/','@[url=https://$3/u/$2]$1[/url]',$s);
@ -147,6 +148,8 @@ function diaspora2bb($s,$use_zrl = false) {
$s = Markdown($s); $s = Markdown($s);
$s = str_replace("\r","",$s);
$s = str_replace('&#35;','#',$s); $s = str_replace('&#35;','#',$s);
// we seem to have double linebreaks // we seem to have double linebreaks
// $s = str_replace("\n",'<br />',$s); // $s = str_replace("\n",'<br />',$s);
@ -175,7 +178,6 @@ function diaspora2bb($s,$use_zrl = false) {
// remove duplicate adjacent code tags // remove duplicate adjacent code tags
$s = preg_replace("/(\[code\])+(.*?)(\[\/code\])+/ism","[code]$2[/code]", $s); $s = preg_replace("/(\[code\])+(.*?)(\[\/code\])+/ism","[code]$2[/code]", $s);
$s = preg_replace_callback('/\[share(.*?)\]/ism','share_unshield',$s); $s = preg_replace_callback('/\[share(.*?)\]/ism','share_unshield',$s);