You are here

function _mailhandler_filter_process in Mailhandler 6.2

Same name and namespace in other branches
  1. 7.2 mailhandler.module \_mailhandler_filter_process()
1 call to _mailhandler_filter_process()
mailhandler_filter in ./mailhandler.module
Implementation of hook_filter().

File

./mailhandler.module, line 241
Retrieves email for posting as nodes and comments.

Code

function _mailhandler_filter_process($delta = 0, $format = -1, $text = '', $cache_id = 0) {
  switch ($delta) {
    case '0':
      $strip_body_regex = variable_get("mailhandler_filter_{$format}", '-- ') . "\n";
      $sig_index = strpos($text, $strip_body_regex);
      if ($sig_index !== FALSE) {
        $text = drupal_substr($text, 0, $sig_index);
      }
      return $text;
    case '1':
      $lines = explode("\n", $text);
      foreach ($lines as $i => $line) {
        $lines[$i] = ltrim($line, '> ');
      }
      $text = implode("\n", $lines);
      return $text;
  }
}