Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/view/DiffusionPatternSearchView.php
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | foreach ($this->matches as $result) { | ||||
} else { | } else { | ||||
$output = array(); | $output = array(); | ||||
$cursor = 0; | $cursor = 0; | ||||
$length = strlen($string); | $length = strlen($string); | ||||
foreach ($matches[0] as $match) { | foreach ($matches[0] as $match) { | ||||
$offset = $match[1]; | $offset = $match[1]; | ||||
if ($cursor != $offset) { | if ($cursor != $offset) { | ||||
$output[] = array( | $output[] = array( | ||||
'text' => substr($string, $cursor, $offset), | 'text' => substr($string, $cursor, ($offset - $cursor)), | ||||
'highlight' => false, | 'highlight' => false, | ||||
); | ); | ||||
} | } | ||||
$output[] = array( | $output[] = array( | ||||
'text' => $match[0], | 'text' => $match[0], | ||||
'highlight' => true, | 'highlight' => true, | ||||
); | ); | ||||
$cursor = $offset + strlen($match[0]); | $cursor = $offset + strlen($match[0]); | ||||
▲ Show 20 Lines • Show All 67 Lines • Show Last 20 Lines |