1
0
mirror of https://tt-rss.org/git/tt-rss.git synced 2024-06-26 11:59:02 +02:00

term highlighting in content: use mb functions

This commit is contained in:
Andrew Dolgov 2013-07-31 16:42:48 +04:00
parent 34dad84414
commit a447f4e40a

View File

@ -2875,14 +2875,14 @@
$text = $child->textContent; $text = $child->textContent;
$stubs = array(); $stubs = array();
while (($pos = stripos($text, $word)) !== false) { while (($pos = mb_stripos($text, $word)) !== false) {
$fragment->appendChild(new DomText(substr($text, 0, $pos))); $fragment->appendChild(new DomText(mb_substr($text, 0, $pos)));
$word = substr($text, $pos, strlen($word)); $word = mb_substr($text, $pos, mb_strlen($word));
$highlight = $doc->createElement('span'); $highlight = $doc->createElement('span');
$highlight->appendChild(new DomText($word)); $highlight->appendChild(new DomText($word));
$highlight->setAttribute('class', 'highlight'); $highlight->setAttribute('class', 'highlight');
$fragment->appendChild($highlight); $fragment->appendChild($highlight);
$text = substr($text, $pos + strlen($word)); $text = mb_substr($text, $pos + mb_strlen($word));
} }
if (!empty($text)) $fragment->appendChild(new DomText($text)); if (!empty($text)) $fragment->appendChild(new DomText($text));