[geeklog-cvs] geeklog: Excess whitespace can lead to unexpectedly short search...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Thu Jun 11 10:32:10 EDT 2009


details:   http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/da0af061667f
changeset: 7101:da0af061667f
user:      Dirk Haun <dirk at haun-online.de>
date:      Thu Jun 11 16:30:20 2009 +0200
description:
Excess whitespace can lead to unexpectedly short search results

diffstat:

 system/classes/search.class.php |  2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diffs (12 lines):

diff -r f869991bf353 -r da0af061667f system/classes/search.class.php
--- a/system/classes/search.class.php	Thu Jun 11 15:37:17 2009 +0200
+++ b/system/classes/search.class.php	Thu Jun 11 16:30:20 2009 +0200
@@ -789,6 +789,8 @@
     function _shortenText( $keyword, $text, $num_words = 7 )
     {
         $text = strip_tags($text);
+        $text = str_replace(array("\011", "\012", "\015"), ' ', trim($text));
+        $text = preg_replace('/\s\s+/', ' ', $text);
         $words = explode(' ', $text);
         $word_count = count($words);
         if ($word_count <= $num_words) {



More information about the geeklog-cvs mailing list