Skip to content

Commit

Permalink
[fix] Finder: Indexer Parsers break search result descriptions. Fixes #…
Browse files Browse the repository at this point in the history
…4327. Fixes #4345

Fix - Finder: Indexer Parsers break search result descriptions #4327
  • Loading branch information
Kubik-Rubik authored and phproberto committed Oct 8, 2014
1 parent 733641f commit 88effc7
Showing 1 changed file with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,25 @@ protected function process($input)
// Strip all script tags.
$input = preg_replace('#<script[^>]*>.*?</script>#si', ' ', $input);

// Deal with spacing issues in the input.
$input = str_replace('>', '> ', $input);
// Strip the tags from the input
$input = strip_tags($input);

// Deal with spacing issues in the input
$input = str_replace(array('&nbsp;', '&#160;'), ' ', $input);
$input = trim(preg_replace('#\s+#u', ' ', $input));

// Strip the tags from the input and decode entities.
$input = strip_tags($input);
// Remove last parts of HTML code which may be caused by a cut of the string
if (strpos($input, '>') !== false)
{
$input = substr($input, strpos($input, '>') + 1);
}

if (strpos($input, '<') !== false)
{
$input = substr($input, 0, strpos($input, '<'));
}

// Decode entities and remove unneeded white spaces
$input = html_entity_decode($input, ENT_QUOTES, 'UTF-8');
$input = trim(preg_replace('#\s+#u', ' ', $input));

Expand Down

0 comments on commit 88effc7

Please sign in to comment.