function htmltidy_filter in HTML Tidy 5
Same name and namespace in other branches
- 6 htmltidy.module \htmltidy_filter()
Implimentation of hook_filter()
File
- ./
htmltidy.module, line 212
Code
function htmltidy_filter($op, $delta = 0, $format = NULL, $text = '') {
switch ($op) {
case 'list':
return array(
0 => t('HTML Tidy'),
);
case 'description':
return t('Corrects faulty and invalid HTML according to <a href="%admin-settings-htmltidy">htmltidy configuration rules</a>.', array(
'%admin-settings-htmltidy' => url('admin/settings/htmltidy'),
));
// case 'no cache': // TODO: remove this once the module is tested.
// return TRUE; // No caching for tidy, this way we can test it
case 'process':
global $htmltidy_filter;
$errors = array();
$cleaned = htmltidy_fragment($text, $errors, $warnings);
$htmltidy_filter['filtered'] = TRUE;
$htmltidy_filter['errors'] = $errors;
$htmltidy_filter['warnings'] = $warnings;
return $cleaned;
default:
return $text;
}
}