drupal_wrap_mail

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

includes/mail.inc, строка 210

Версии
6
drupal_wrap_mail($text, $indent = '')

Perform format=flowed soft wrapping for mail (RFC 3676).

We use delsp=yes wrapping, but only break non-spaced languages when absolutely necessary to avoid compatibility issues.

We deliberately use LF rather than CRLF, see drupal_mail().

Параметры

$text The plain text to process.

$indent (optional) A string to indent the text with. Only '>' characters are repeated on subsequent wrapped lines. Others are replaced by spaces.

▾ 2 функции вызывают drupal_wrap_mail()

drupal_html_to_text in includes/mail.inc
Преобразует строку HTML в простой текст, сохраняя структуру разметки. Полезно при подготовке тела ноды к отправке по почте.
drupal_mail in includes/mail.inc
Отправляет сообщения по e-mail.

Код

<?php
function drupal_wrap_mail($text, $indent = '') {
  // Convert CRLF into LF.
  $text = str_replace("\r", '', $text);
  // See if soft-wrapping is allowed.
  $clean_indent = _drupal_html_to_text_clean($indent);
  $soft = strpos($clean_indent, ' ') === FALSE;
  // Check if the string has line breaks.
  if (strpos($text, "\n") !== FALSE) {
    // Remove trailing spaces to make existing breaks hard.
    $text = preg_replace('/ +\n/m', "\n", $text);
    // Wrap each line at the needed width.
    $lines = explode("\n", $text);
    array_walk($lines, '_drupal_wrap_mail_line', array('soft' => $soft, 'length' => strlen($indent)));
    $text = implode("\n", $lines);
  }
  else {
    // Wrap this line.
    _drupal_wrap_mail_line($text, 0, array('soft' => $soft, 'length' => strlen($indent)));
  }
  // Empty lines with nothing but spaces.
  $text = preg_replace('/^ +\n/m', "\n", $text);
  // Space-stuff special lines.
  $text = preg_replace('/^(>| |From)/m', ' $1', $text);
  // Apply indentation. We only include non-'>' indentation on the first line.
  $text = $indent . substr(preg_replace('/^/m', $clean_indent, $text), strlen($indent));

  return $text;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему