Exemplo n.º 1
0
 /**
  * Парсит и декодирует поля заголовка из строки
  *
  * @param string $data
  *
  * @return Mail_Message_Head
  */
 public static function from_string($data)
 {
     $head = new Mail_Message_Head();
     foreach (MIME::decode_headers($data) as $k => $f) {
         foreach ((array) $f as $v) {
             $head->field($k, $v);
         }
     }
     return $head;
 }
Exemplo n.º 2
0
 /**
  * Декодирует заголовок сообщения
  *
  * @return Mail_Message_Head
  */
 protected function decode_head()
 {
     $data = '';
     while (($line = $this->input->read_line()) && !Core_Regexps::match("{^\n\r?\$}", $line)) {
         $data .= $line;
     }
     return $this->input->eof() ? null : Mail_Message_Head::from_string($data);
 }