本文整理汇总了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);
}