function htmlpurifier_filter in HTML Purifier 6.2
Same name and namespace in other branches
- 5 htmlpurifier.module \htmlpurifier_filter()
- 6 htmlpurifier.module \htmlpurifier_filter()
Implementation of hook_filter().
File
- ./
htmlpurifier.module, line 66 - Implements HTML Purifier as a Drupal filter.
Code
function htmlpurifier_filter($op, $delta = 0, $format = -1, $text = '') {
switch ($op) {
case 'list':
return array(
0 => t('HTML Purifier'),
1 => t('HTML Purifier (advanced)'),
);
case 'no cache':
// Since HTML Purifier implements its own caching layer, having filter
// cache it again is wasteful. Returns FALSE if double caching is permitted.
return !variable_get("htmlpurifier_doublecache", FALSE);
case 'description':
$common = t('Removes malicious HTML code and ensures that the output ' . 'is standards compliant. <strong>Warning:</strong> For performance ' . 'reasons, please ensure that there are no highly dynamic filters before HTML Purifier. ');
switch ($delta) {
case 0:
return $common;
case 1:
return $common . t('<em>This version has advanced configuration options, do not enable both at the same time.</em>');
}
case 'prepare':
return $text;
case 'process':
return _htmlpurifier_process($text, $format);
case 'settings':
return _htmlpurifier_settings($delta, $format);
default:
return NULL;
}
}