]> git.wh0rd.org Git - tt-rss.git/commitdiff
term highlighting in content: use mb functions
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Wed, 31 Jul 2013 12:42:48 +0000 (16:42 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Wed, 31 Jul 2013 12:42:48 +0000 (16:42 +0400)
include/functions.php

index 5b752124929e996ae463393aa60a066404591f1c..3aaccbb1936ecfa96bb0590f7c57a3378da1eea3 100644 (file)
                                      $text = $child->textContent;
                                                $stubs = array();
 
-                                               while (($pos = stripos($text, $word)) !== false) {
-                                                       $fragment->appendChild(new DomText(substr($text, 0, $pos)));
-                                                       $word = substr($text, $pos, strlen($word));
+                                               while (($pos = mb_stripos($text, $word)) !== false) {
+                                                       $fragment->appendChild(new DomText(mb_substr($text, 0, $pos)));
+                                                       $word = mb_substr($text, $pos, mb_strlen($word));
                                                        $highlight = $doc->createElement('span');
                                                        $highlight->appendChild(new DomText($word));
                                                        $highlight->setAttribute('class', '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));