You are here

function example_filter in Coder 7

Same name and namespace in other branches
  1. 7.2 coder_upgrade/tests/old/samples/example.module \example_filter()

Implement hook_filter().

File

coder_upgrade/tests/old/samples/example.module, line 981

Code

function example_filter($op, $delta = 0, $format = -1, $text = '', $cache_id = 0) {
  switch ($op) {
    case 'list':
      return array(
        0 => t('Limit allowed HTML tags'),
        1 => t('Convert line breaks'),
        2 => t('Convert URLs into links'),
        3 => t('Correct broken HTML'),
        4 => t('Escape all HTML'),
      );
    case 'description':
      switch ($delta) {
        case 0:
          return t('Allows you to restrict the HTML tags the user can use. It will also remove harmful content such as JavaScript events, JavaScript URLs and CSS styles from those tags that are not removed.');
        case 1:
          return t('Converts line breaks into HTML (i.e. <br> and <p>) tags.');
        case 2:
          return t('Turns web and e-mail addresses into clickable links.');
        case 3:
          return t('Corrects faulty and chopped off HTML in postings.');
        case 4:
          return t('Escapes all HTML tags, so they will be visible instead of being effective.');
        default:
          return;
      }
    case 'process':
      switch ($delta) {
        case 0:
          return _filter_html($text, $format);
        case 1:
          return _filter_autop($text);
        case 2:
          return _filter_url($text, $format);
        case 3:
          return _filter_htmlcorrector($text);
        case 4:
          return trim(check_plain($text));
        default:
          return $text;
      }
    case 'settings':
      switch ($delta) {
        case 0:
          return _filter_html_settings($format);
        case 2:
          return _filter_url_settings($format);
        default:
          return;
      }
    default:
      return $text;
  }
}