function _glossify_replace in Glossify 6
Same name and namespace in other branches
- 6.3 glossify.module \_glossify_replace()
Helper function that fetches and returns the styled term depending on the style and term.
1 call to _glossify_replace()
- glossify_filter in ./
glossify.module - Implementation of hook_filter().
File
- ./
glossify.module, line 367
Code
function _glossify_replace($configuration, &$html, $term_title, $replacement, &$replaced) {
if (count($html
->childNodes()) > 0) {
foreach ($html
->childNodes() as $child_node) {
_glossify_replace($configuration, $child_node, $term_title, $replacement, $replaced);
}
}
else {
if (isset($html->tag) && $html->tag !== 'root') {
if ($configuration['only_first'] && $replaced == 0) {
if ($configuration['break']) {
$html->innertext = preg_replace('/\\b' . $term_title . '\\b/', $replacement, $html->innertext, $configuration['only_first'] ? 1 : -1, $temp_replaced);
}
else {
$html->innertext = preg_replace('/' . $term_title . '/', $replacement, $html->innertext, $configuration['only_first'] ? 1 : -1, $temp_replaced);
}
$replaced = $temp_replaced;
}
}
}
}