From c6cdad946eac99ced15cd8fa294ab0fdaa05f3a5 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 7 Feb 2012 00:13:16 -0800 Subject: more fixes for textmode --- mod/parse_url.php | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) (limited to 'mod/parse_url.php') diff --git a/mod/parse_url.php b/mod/parse_url.php index 2df9de476..e0b378f68 100755 --- a/mod/parse_url.php +++ b/mod/parse_url.php @@ -12,6 +12,13 @@ function parse_url_content(&$a) { $text = null; $str_tags = ''; + $textmode = false; + if(local_user() && intval(get_pconfig(local_user(),'system','plaintext'))) + $textmode = true; + + if($textmode) + $br = (($textmode) ? "\n" : '
'; + $str_tags = $br . implode(' ',$arr_tags) . $br; } } logger('parse_url: ' . $url); - $template = "
%s%s
"; + if($textmode) + $template = $br . '[bookmark=%s]%s[/bookmark]%s' . $br; + else + $template = "
%s%s
"; $arr = array('url' => $url, 'text' => ''); @@ -49,7 +59,11 @@ function parse_url_content(&$a) { if($url && $title && $text) { - $text = '

' . $text . '

'; + if($textmode) + $text = $br . $br . '[quote]' . $text . '[/quote]' . $br; + else + $text = '

' . $text . '

'; + $title = str_replace(array("\r","\n"),array('',''),$title); $result = sprintf($template,$url,($title) ? $title : $url,$text) . $str_tags; @@ -208,10 +222,17 @@ function parse_url_content(&$a) { $ph->scaleImage(300); $new_width = $ph->getWidth(); $new_height = $ph->getHeight(); - $image = '

photo'; + if($textmode) + $image = $br . $br . '[img=' . $new_width . 'x' . $new_height . ']' . $image . '[/img]'; + else + $image = '

photo'; + } + else { + if($textmode) + $image = $br . $br . '[img]' . $image . '[/img]'; + else + $image = '

photo'; } - else - $image = '

photo'; } else $image = ''; @@ -223,11 +244,14 @@ function parse_url_content(&$a) { } if(strlen($text)) { - $text = '

' . $text . '

'; + if($textmode) + $text = $br .$br . '[quote]' . $text . '[/quote]' . $br ; + else + $text = '

' . $text . '

'; } if($image) { - $text = $image . '
' . $text; + $text = $image . $br . $text; } $title = str_replace(array("\r","\n"),array('',''),$title); -- cgit v1.2.3