function _filter_html
Same name and namespace in other branches
- 6.x drupal-6.x/modules/filter/filter.module \_filter_html()
Implements callback_filter_process().
Provides filtering of input into accepted HTML.
Related topics
2 calls to _filter_html()
- FilterUnitTestCase::testHtmlFilter in drupal-7.x/
modules/ filter/ filter.test - Tests filter settings, defaults, access restrictions and similar.
- FilterUnitTestCase::testNoFollowFilter in drupal-7.x/
modules/ filter/ filter.test - Tests the spam deterrent.
2 string references to '_filter_html'
- filter_filter_info in drupal-7.x/
modules/ filter/ filter.module - Implements hook_filter_info().
- hook_filter_info in drupal-7.x/
modules/ filter/ filter.api.php - Define content filters.
Archivo
- drupal-7.x/
modules/ filter/ filter.module, line 1291 - Framework for handling the filtering of content.
Código
function _filter_html($text, $filter) {
$allowed_tags = preg_split('/\s+|<|>/', $filter->settings['allowed_html'], -1, PREG_SPLIT_NO_EMPTY);
$text = filter_xss($text, $allowed_tags);
if ($filter->settings['filter_html_nofollow']) {
$html_dom = filter_dom_load($text);
$links = $html_dom->getElementsByTagName('a');
foreach ($links as $link) {
$link->setAttribute('rel', 'nofollow');
}
$text = filter_dom_serialize($html_dom);
}
return trim($text);
}