_drupal_html_to_text_pad

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

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

Версии
6
_drupal_html_to_text_pad($text, $pad, $prefix = '')

Helper function for drupal_html_to_text().

Pad the last line with the given character.

▾ 1 функция вызывает _drupal_html_to_text_pad()

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

Код

<?php
function _drupal_html_to_text_pad($text, $pad, $prefix = '') {
  // Remove last line break.
  $text = substr($text, 0, -1);
  // Calculate needed padding space and add it.
  if (($p = strrpos($text, "\n")) === FALSE) {
    $p = -1;
  }
  $n = max(0, 79 - (strlen($text) - $p));
  // Add prefix and padding, and restore linebreak.
  return $text . $prefix . str_repeat($pad, $n - strlen($prefix)) ."\n";
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

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