|
static | apply ($words, $body, $pre='< mark >', $post='</mark >') |
|
|
static | splitOnTag ($needle, $haystack, $pre, $post) |
|
◆ apply()
static apply |
( |
|
$words, |
|
|
|
$body, |
|
|
|
$pre = '<mark>' , |
|
|
|
$post = '</mark>' |
|
) |
| |
|
static |
Apply highlight to words in body text
Surround occurrences of words in body with pre in front and post behind. Considers only occurrences of words outside of HTML tags.
- Parameters
-
string | string[] | $words | words to highlight |
string | $body | body of html text to highlight |
string | $pre | string to begin a highlight |
string | $post | string to end a highlight |
- Returns
- string highlighted body
◆ splitOnTag()
static splitOnTag |
( |
|
$needle, |
|
|
|
$haystack, |
|
|
|
$pre, |
|
|
|
$post |
|
) |
| |
|
staticprotected |
find needle in between html tags and add highlighting
- Parameters
-
string | $needle | string to find |
string | $haystack | html text to find needle in |
string | $pre | insert before needle |
string | $post | insert after needle |
- Returns
- mixed return from preg_replace_callback()
◆ ENCODING
The documentation for this class was generated from the following file: