You are here

function elf_filter in External Links Filter 5.3

Same name and namespace in other branches
  1. 5 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 27

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':
      return elf_replace($text, $format);
    case 'settings':
      $form['elf'] = array(
        '#type' => 'fieldset',
        '#title' => t('External links filter'),
        '#collapsible' => TRUE,
      );
      $form['elf']["elf_nofollow_{$format}"] = array(
        '#type' => 'checkbox',
        '#title' => t('Spam link deterrent'),
        '#description' => t('Add !code to external links, as a measure to reduce the effectiveness of spam links. Note: this will also prevent valid links from being followed by search engines, therefore it is likely most effective when enabled for anonymous users.', array(
          '!code' => '<code>rel="nofollow"</code>',
        )),
        '#default_value' => variable_get("elf_nofollow{$format}", FALSE),
      );
      return $form;
    default:
      return $text;
  }
}