Re: [SMARTY-DEV] Suggestion for the outputfilter.trimwhitespace.php plugin

From: Date: Fri, 02 Jan 2004 17:46:03 +0000
Subject: Re: [SMARTY-DEV] Suggestion for the outputfilter.trimwhitespace.php plugin
References: 1 2  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-2015@lists.php.net to get a copy of this message
On Friday 02 January 2004 05:08 am, messju mohr wrote: > the count()-call is in the initialization of the for-loop: > for ($_i=0, $_count=count($replace); $_i<$_count; $_i++) > (note: it's a comma after "$_i=0" - not a semicolon) > > so count() is only called once right now. Right you are. So I've modified my code to reflect this. Now it only tests for content in the $replace array, and it just returns when its empty. bash-2.05b$ cvs diff -u -r 1.2 outputfilter.trimwhitespace.php Index: outputfilter.trimwhitespace.php =================================================================== RCS file: /cvs/mpn2/includes/class/smarty/plugins/ outputfilter.trimwhitespace.php,v retrieving revision 1.2 diff -u -r1.2 outputfilter.trimwhitespace.php --- outputfilter.trimwhitespace.php 11 Dec 2003 23:00:08 -0000 1.2 +++ outputfilter.trimwhitespace.php 2 Jan 2004 17:38:38 -0000 @@ -62,6 +62,7 @@ } function smarty_outputfilter_trimwhitespace_replace($search_str, $replace, & $subject) { + if (empty($replace)) return; $_len = strlen($search_str); $_pos = 0; for ($_i=0, $_count=count($replace); $_i<$_count; $_i++)

« previous php.smarty.dev (#2015) next »