You are here

function messaging_filter in Messaging 6

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

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 '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.');
      }
    case 'process':
      switch ($delta) {
        case 0:
          return messaging_check_plain($text);
        case 1:
          return drupal_html_to_text($text);
        default:
          return $text;
      }
    case 'settings':
      return;
    default:
      return $text;
  }
}