function elf_filter in External Links Filter 5.2
Same name and namespace in other branches
- 5.3 elf.module \elf_filter()
- 5 elf.module \elf_filter()
- 6.3 elf.module \elf_filter()
- 6.2 elf.module \elf_filter()
Implementation of hook_filter().
File
- ./
elf.module, line 65
Code
function elf_filter($op, $delta = 0, $format = -1, $text = '') {
switch ($op) {
case 'list':
return array(
0 => t('External links filter'),
);
case 'description':
return t('Adds a CSS class to all external and mailto links.');
case 'process':
// find all <a> tags and match their href so we can test if the link is external or not
$text = preg_replace_callback('!<a.*?href="([^"]+)".*?>!', elf_replace, $text);
return $text;
default:
return $text;
}
}