本文整理匯總了PHP中Horde_Mime_Part::findBody方法的典型用法代碼示例。如果您正苦於以下問題:PHP Horde_Mime_Part::findBody方法的具體用法?PHP Horde_Mime_Part::findBody怎麽用?PHP Horde_Mime_Part::findBody使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Horde_Mime_Part
的用法示例。
在下文中一共展示了Horde_Mime_Part::findBody方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _isAttachment
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: isAttachment
/**
* 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: findBody
/**
* 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: _getHtmlPart
/**
* 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);
}