Exemplo n.º 1
0
 /**
  * Prepares results from search for display
  *
  * @param string The source string
  * @param int Number of chars to trim
  * @param string The searchword to select around
  * @return string
  */
 function prepareSearchContent($text, $length = 200, $searchword)
 {
     // strips tags won't remove the actual jscript
     $text = preg_replace("'<script[^>]*>.*?</script>'si", "", $text);
     $text = preg_replace('/{.+?}/', '', $text);
     //$text = preg_replace( '/<a\s+.*?href="([^"]+)"[^>]*>([^<]+)<\/a>/is','\2', $text );
     // replace line breaking tags with whitespace
     $text = preg_replace("'<(br[^/>]*?/|hr[^/>]*?/|/(div|h[1-6]|li|p|td))>'si", ' ', $text);
     return SearchHelper::_smartSubstr(strip_tags($text), $length, $searchword);
 }