コード例 #1
0
 /**
  * Returns the appropriate message body for a given MIME-based decoded
  * structure.
  *
  * @access  public
  * @param   object $output The parsed message structure
  * @return  string The message body
  * @see     Mime_Helper::decode()
  */
 function getMessageBody(&$output)
 {
     $parts = array();
     Mime_Helper::parse_output($output, $parts);
     $str = '';
     $is_html = false;
     if (isset($parts["text"])) {
         $str = join("\n\n", $parts["text"]);
     } elseif (isset($parts["html"])) {
         $is_html = true;
         $str = join("\n\n", $parts["html"]);
         // hack for inotes to prevent content from being displayed all on one line.
         $str = str_replace("</DIV><DIV>", "\n", $str);
         $str = str_replace(array("<br>", "<br />", "<BR>", "<BR />"), "\n", $str);
     }
     if (@$output->headers['content-transfer-encoding'] == 'quoted-printable') {
         $str = Mime_Helper::decodeBody($str, 'quoted-printable');
     }
     // XXX: do we also need to do something here about base64 encoding?
     if ($is_html) {
         $str = strip_tags($str);
     }
     return $str;
 }