Update string.utils.php
This commit is contained in:
parent
1b1bdbb150
commit
81e66754f4
|
@ -171,13 +171,22 @@ if(!check_function_exists("parse_pipelined_data")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("get_highlighted_html_by_word")) {
|
if(!check_function_exists("get_tokenized_text")) {
|
||||||
function get_highlighted_html_by_word($word, $text) {
|
function get_tokenized_text($text, $delimiters=array(",", " ", "|", "-", "+")) {
|
||||||
$html = $text;
|
return multi_explode($delimiters, $text);
|
||||||
if(strlen($word) > 0) {
|
}
|
||||||
$html = preg_replace("/\w*?$word\w*/i", "<strong class=\"highlight\">$0</strong>", $text);
|
}
|
||||||
}
|
|
||||||
return $html;
|
if(!check_function_exists("get_highlighted_html_by_words")) {
|
||||||
|
function get_highlighted_html_by_word($word, $text, $delimiters=array(",", " ", "|", "-", "+")) {
|
||||||
|
$html = $text;
|
||||||
|
|
||||||
|
$words = get_tokenized_text($word, $delimiters);
|
||||||
|
if(check_array_length($words, 0) > 0) {
|
||||||
|
$html = preg_replace(sprintf("/%s/i", implode("|", $words)), "<strong class=\"highlight\">$0</strong>", $text);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $html;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user