findBody() 공개 메소드

"Body" data is the first text part under this part.
public findBody ( string $subtype = null ) : mixed
$subtype string Specifically search for this subtype.
리턴 mixed The MIME ID of the main body part, or null if a body part is not found.
예제 #1
0
 protected function _isAttachment($part)
 {
     if ($part->getDisposition() == 'attachment') {
         return true;
     }
     $id = $part->getMimeId();
     $mime_type = $part->getType();
     switch ($mime_type) {
         case 'text/plain':
             if (!($this->_part->findBody('plain') == $id)) {
                 return true;
             }
             return false;
         case 'text/html':
             if (!($this->_part->findBody('html') == $id)) {
                 return true;
             }
             return false;
         case 'application/pkcs7-signature':
         case 'application/x-pkcs7-signature':
             return false;
     }
     list($ptype, ) = explode('/', $mime_type, 2);
     switch ($ptype) {
         case 'message':
             return in_array($mime_type, array('message/rfc822', 'message/disposition-notification'));
         case 'multipart':
             return false;
         default:
             return true;
     }
 }
예제 #2
0
파일: Mime.php 프로젝트: horde/horde
 /**
  * Determines if a MIME type is an attachment.
  * For our purposes, an attachment is any MIME part that can be
  * downloaded by itself (i.e. all the data needed to view the part is
  * contained within the download data).
  *
  * @param string $id         The MIME Id for the part we are checking.
  * @param string $mime_type  The MIME type.
  *
  * @return boolean  True if an attachment.
  * @todo Pass a single mime part as parameter.
  */
 public function isAttachment($id, $mime_type)
 {
     switch ($mime_type) {
         case 'text/plain':
             if (!($this->_base->findBody('plain') == $id)) {
                 return true;
             }
             return false;
         case 'text/html':
             if (!($this->_base->findBody('html') == $id)) {
                 return true;
             }
             return false;
         case 'application/pkcs7-signature':
         case 'application/x-pkcs7-signature':
             return false;
     }
     if ($this->_base->getPart($id)->getDisposition() == 'attachment') {
         return true;
     }
     list($ptype, ) = explode('/', $mime_type, 2);
     switch ($ptype) {
         case 'message':
             return in_array($mime_type, array('message/rfc822', 'message/disposition-notification'));
         case 'multipart':
             return false;
         default:
             return true;
     }
 }
예제 #3
0
파일: Contents.php 프로젝트: horde/horde
 /**
  * Finds the main "body" text part (if any) in a message.
  * "Body" data is the first text part in the base MIME part.
  *
  * @param string $subtype  Specifically search for this subtype.
  *
  * @return string  The MIME ID of the main body part.
  */
 public function findBody($subtype = null)
 {
     $this->_buildMessage();
     return $this->_message->findBody($subtype);
 }
예제 #4
0
파일: Mail.php 프로젝트: raz0rsdge/horde
 /**
  * Build the HTML part of a SMARTREPLY or SMARTFORWARD
  *
  * @param string $html_id                The MIME part id of the html part of
  *                                       $base_part.
  * @param Horde_Mime_Part $mime_message  The MIME part of the email to be
  *                                       sent.
  * @param array $body_data @see Horde_ActiveSync_Imap_Message::getMessageBodyData()
  * @param Horde_Mime_Part $base_part     The base MIME part of the source
  *                                       message for a SMART request.
  *
  * @return string  The plaintext part of the email message that is being sent.
  */
 protected function _getHtmlPart($html_id, $mime_message, $body_data, $base_part)
 {
     if (!($id = $mime_message->findBody('html'))) {
         $smart_text = self::text2html(Horde_ActiveSync_Utils::ensureUtf8($mime_message->getPart($mime_message->findBody('plain'))->getContents(), $mime_message->getCharset()));
     } else {
         $smart_text = Horde_ActiveSync_Utils::ensureUtf8($mime_message->getPart($id)->getContents(), $mime_message->getCharset());
     }
     if ($this->_forward) {
         return $smart_text . $this->_forwardText($body_data, $base_part->getPart($html_id), true);
     }
     return $smart_text . $this->_replyText($body_data, $base_part->getPart($html_id), true);
 }