You are here

function elf_filter in External Links Filter 5

Same name and namespace in other branches
  1. 5.3 elf.module \elf_filter()
  2. 5.2 elf.module \elf_filter()
  3. 6.3 elf.module \elf_filter()
  4. 6.2 elf.module \elf_filter()

Implementation of hook_filter().

File

./elf.module, line 58

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 test their href values.
      $text = preg_replace_callback('!<a.*?href="([^"]+)".*?>!', 'elf_replace', $text);
      return $text;
    default:
      return $text;
  }
}