mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Prevent funny-looking text when trying to highlight a null string
This commit is contained in:
parent
6675f0141d
commit
69d51d3a81
1 changed files with 4 additions and 0 deletions
|
@ -717,6 +717,10 @@ function highlight($needle, $haystack, $case=0,
|
||||||
/// this function after performing any conversions to HTML.
|
/// this function after performing any conversions to HTML.
|
||||||
/// Function found here: http://forums.devshed.com/t67822/scdaa2d1c3d4bacb4671d075ad41f0854.html
|
/// Function found here: http://forums.devshed.com/t67822/scdaa2d1c3d4bacb4671d075ad41f0854.html
|
||||||
|
|
||||||
|
if (empty($needle)) {
|
||||||
|
return $haystack;
|
||||||
|
}
|
||||||
|
|
||||||
$list_of_words = eregi_replace("[^-a-zA-Z0-9&']", " ", $needle);
|
$list_of_words = eregi_replace("[^-a-zA-Z0-9&']", " ", $needle);
|
||||||
$list_array = explode(" ", $list_of_words);
|
$list_array = explode(" ", $list_of_words);
|
||||||
for ($i=0; $i<sizeof($list_array); $i++) {
|
for ($i=0; $i<sizeof($list_array); $i++) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue