You are here

function messaging_filter in Messaging 5

Same name and namespace in other branches
  1. 6 messaging.module \messaging_filter()
  2. 6.2 messaging.module \messaging_filter()
  3. 6.3 messaging.module \messaging_filter()

Implementation of hook_filter(). Contains a basic set of essential filters.

  • Plain text: Strips out all html Replaces html entities
  • HTML to text Same with some text formatting Relies on html_to_text module

File

./messaging.module, line 857

Code

function messaging_filter($op, $delta = 0, $format = -1, $text = '') {
  switch ($op) {
    case 'list':
      $info[0] = t('Plain text filter');
      if (function_exists('drupal_html_to_text')) {
        $info[1] = t('HTML to text');
      }
      return $info;
    case 'no cache':
      return TRUE;

    // No caching at all, at least for development
    case 'description':
      switch ($delta) {
        case 0:
          return t('Filters out all HTML tags and replaces HTML entities by characters.');
        case 1:
          return t('Replaces HTML tags and entities with plain text formatting, moving links at the end. This filter is just for text messages and it isn\'t safe for rendering content on a web page.');
      }
    case 'process':
      switch ($delta) {
        case 0:
          return messaging_check_plain($text);
        case 1:
          return messaging_html_to_text($text);
        default:
          return $text;
      }
    case 'settings':
      return;
    default:
      return $text;
  }
}