From ad1c1980b58aa490790935af8c45a527c45dad42 Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Sat, 16 Oct 2004 23:02:44 +0000 Subject: [PATCH] add indent for the append part --- include/newsletter.inc.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/include/newsletter.inc.php b/include/newsletter.inc.php index 8c8822b..8a1d115 100644 --- a/include/newsletter.inc.php +++ b/include/newsletter.inc.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: newsletter.inc.php,v 1.11 2004-10-16 22:34:09 x2000habouzit Exp $ + $Id: newsletter.inc.php,v 1.12 2004-10-16 23:02:44 x2000habouzit Exp $ ***************************************************************************/ @@ -189,7 +189,7 @@ class NLArticle { function toText() { $title = '*'.$this->title().'*'; $body = enriched_to_text($this->_body,false,true); - $app = enriched_to_text($this->_append); + $app = enriched_to_text($this->_append,false,false,4); return trim("$title\n\n$body\n\n$app")."\n"; } @@ -200,7 +200,7 @@ class NLArticle { $app = enriched_to_text($this->_append,true); $art = "$title\n$body
"; - if ($app) $art .= "
$app
"; + if ($app) $art .= "
$app
"; return $art; } @@ -299,7 +299,7 @@ function justify($text,$n) { } -function enriched_to_text($input,$html=false,$just=false) { +function enriched_to_text($input,$html=false,$just=false,$indent=0) { $text = stripslashes(trim($input)); if($html) { $text = htmlspecialchars($text); @@ -318,7 +318,12 @@ function enriched_to_text($input,$html=false,$just=false) { $text = preg_replace('!\[\/?i\]!','/',$text); $text = preg_replace('!((https?|ftp)://[^\r\n\t ]*)!','[\1]', $text); $text = preg_replace('!([a-zA-Z0-9\-_+.]*@[a-zA-Z0-9\-_+.]*)!','[mailto:\1]', $text); - return $just ? justify($text,68) : wordwrap($text,68); + $text = $just ? justify($text,68-$indent) : wordwrap($text,68-$indent); + if($indent) { + $ind = str_pad('',$indent); + $text = $ind.str_replace("\n","\n$ind",$text); + } + return $text; } } -- 2.1.4