function _glossify_replace_terms_simplehtmldom in Glossify 6.3
1 call to _glossify_replace_terms_simplehtmldom()
- glossify_filter in ./
glossify.module - Implementation of hook_filter().
File
- ./
glossify.module, line 426
Code
function _glossify_replace_terms_simplehtmldom($text, $configurations, $node) {
$html_body = str_get_html($text);
foreach ($configurations as $config_name => $configuration) {
if (isset($configuration['from'][$node->type])) {
$enabled_styles = array_filter($configuration['style']);
$compare_function = $configuration['case_insensitivity'] ? 'stripos' : 'strpos';
foreach (_fetch_possible_keywords($config_name, $configuration, $node->nid) as $kwd) {
list($term_title, $target_url) = $kwd;
$replaced = 0;
foreach ($enabled_styles as $style => $enabled) {
if ($enabled && !empty($term_title) && false !== $compare_function($html_body->innertext, $term_title)) {
$replacement = _fetch_replacement($style, $term_title, $target_url);
_glossify_replace($configuration, $html_body, $term_title, $replacement, $replaced);
// Update the state of the DOM to reflect new tags added.
if (0 < $replaced) {
$html_body = str_get_html($html_body->innertext);
}
}
}
}
}
}
return $html_body->innertext;
}