From 985e826f56af19d0245be9743486529fe3479d66 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 10 Jun 2005 12:00:27 +0000 Subject: [PATCH] shows headline now git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@669 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/functions_helpviewer.inc | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/include/functions_helpviewer.inc b/include/functions_helpviewer.inc index ee03d28c9..9d699c589 100644 --- a/include/functions_helpviewer.inc +++ b/include/functions_helpviewer.inc @@ -64,6 +64,7 @@ function readfiles($basedir,$prefix,$suffix,$onlyIndex,$singlepage=false) /* Readfile conent too ? */ if(!$onlyIndex){ $str[$file]['content']= remove_unwanted_tags(linkwrapper(getcontents($basedir.$file),""),$replacements); + $str[$file]['headline'] = getheader_from_content($str[$file]['content']); } /* Include file status, for debugging, not used in script yet */ @@ -86,6 +87,7 @@ function readfiles($basedir,$prefix,$suffix,$onlyIndex,$singlepage=false) /* If onlyIndex == true skip reading content */ if(!$onlyIndex){ $str[$file]['content']= remove_unwanted_tags(linkwrapper(getcontents($basedir.$file),""),$replacements); + $str[$file]['headline'] = getheader_from_content($str[$file]['content']); } /* Include file status, for debugging, not used in script yet */ @@ -304,8 +306,8 @@ function markword($string,$position,$word,$prefix,$suffix) function createResultEntry($entry,$res,$name,$max) { $percentage = (int)(($res['hits']['overall'] / $max) * 100) ; - - $str = "".sprintf(_("%s%% hit rate in file %s"),$percentage,$name)."
" ; + $str = "".$entry['headline']."
"; + $str.= "".sprintf(_("%s%% hit rate in file %s"),$percentage,$name)."
" ; $str.= substr(strip_tags($entry['content']),0,200); $str.= "
"; @@ -326,5 +328,18 @@ function is_in_tag($string,$pos) } } +/*Returns frist line of readable text, it should be the headline */ +function getheader_from_content($str) +{ + $str = strip_tags($str); + $pos = 0; + $arr = split("\n",$str); + foreach($arr as $possibleheadline){ + if(strlen($possibleheadline)>=3){ + return $possibleheadline; + } + } +} + // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> -- 2.30.2