You are here

function messaging_filter in Messaging 6.3

Same name and namespace in other branches
  1. 5 messaging.module \messaging_filter()
  2. 6 messaging.module \messaging_filter()
  3. 6.2 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 519

Code

function messaging_filter($op, $delta = 0, $format = -1, $text = '') {
  switch ($op) {
    case 'list':
      $info[0] = t('Plain text');
      $info[1] = t('HTML to text');
      return $info;
    case 'description':
      switch ($delta) {
        case 0:
          return t('Filters out all HTML tags and replaces HTML entities by characters, respects HTML line breaks.');
        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, "\n");
        case 1:
          return drupal_html_to_text($text);
        default:
          return $text;
      }
    case 'settings':
      return;
    default:
      return $text;
  }
}