本文整理汇总了PHP中Horde_Mime_Part::getDisposition方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Mime_Part::getDisposition方法的具体用法?PHP Horde_Mime_Part::getDisposition怎么用?PHP Horde_Mime_Part::getDisposition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Horde_Mime_Part
的用法示例。
在下文中一共展示了Horde_Mime_Part::getDisposition方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: canRender
/**
* Can this driver render the the data?
*
* @param string $mode The mode. Either 'full', 'inline', 'info', or
* 'raw'.
*
* @return boolean True if the driver can render the data for the given
* view.
*/
public function canRender($mode)
{
$viewer = $this->_getViewer();
if ($viewer) {
return $viewer->canRender($mode);
}
switch ($mode) {
case 'full':
case 'info':
case 'raw':
return $this->_capability[$mode];
case 'inline':
return $this->getConfigParam('inline') && ($this->_metadata['forceinline'] || $this->_capability['inline'] && $this->_mimepart->getDisposition() != 'attachment');
default:
return false;
}
}
示例2: isAttachment
/**
* Determines if a MIME type is an attachment.
*
* @param Horde_Mime_Part $part The MIME part.
*/
public static function isAttachment(Horde_Mime_Part $part)
{
$type = $part->getType();
switch ($type) {
case 'application/ms-tnef':
case 'application/pgp-keys':
case 'application/vnd.ms-tnef':
return false;
}
if ($part->parent) {
switch ($part->parent->getType()) {
case 'multipart/encrypted':
switch ($type) {
case 'application/octet-stream':
return false;
}
break;
case 'multipart/signed':
switch ($type) {
case 'application/pgp-signature':
case 'application/pkcs7-signature':
case 'application/x-pkcs7-signature':
return false;
}
break;
}
}
switch ($part->getDisposition()) {
case 'attachment':
return true;
}
switch ($part->getPrimaryType()) {
case 'application':
if (strlen($part->getName())) {
return true;
}
break;
case 'audio':
case 'video':
return true;
case 'multipart':
return false;
}
return false;
}
示例3: _buildEasAttachmentFromMime
/**
* Build an appropriate attachment object from the given mime part.
*
* @param integer $id The mime id for the part
* @param Horde_Mime_Part $mime_part The mime part.
* @param float $version The EAS version.
*
* @return Horde_ActiveSync_Message_AirSyncBaseAttachment |
* Horde_ActiveSync_Message_Attachment
*/
protected function _buildEasAttachmentFromMime($id, Horde_Mime_Part $mime_part, $version)
{
if ($version > Horde_ActiveSync::VERSION_TWOFIVE) {
$atc = Horde_ActiveSync::messageFactory('AirSyncBaseAttachment');
$atc->contentid = $mime_part->getContentId();
$atc->isinline = $mime_part->getDisposition() == 'inline';
} else {
$atc = Horde_ActiveSync::messageFactory('Attachment');
$atc->attoid = $mime_part->getContentId();
}
$atc->attsize = intval($mime_part->getBytes(true));
$atc->attname = $this->_mbox . ':' . $this->uid . ':' . $id;
$atc->displayname = Horde_String::convertCharset($this->getPartName($mime_part, true), $this->basePart->getHeaderCharset(), 'UTF-8', true);
$atc->attmethod = in_array($mime_part->getType(), array('message/rfc822', 'message/disposition-notification')) ? Horde_ActiveSync_Message_AirSyncBaseAttachment::ATT_TYPE_EMBEDDED : Horde_ActiveSync_Message_AirSyncBaseAttachment::ATT_TYPE_NORMAL;
return $atc;
}
示例4: testNullCharactersNotAllowedInMimeHeaderData
public function testNullCharactersNotAllowedInMimeHeaderData()
{
$part = new Horde_Mime_Part();
$part->setType("text/plain");
$this->assertEquals('text/plain', $part->getType());
$part->setDisposition("inline");
$this->assertEquals('inline', $part->getDisposition());
$part->setDispositionParameter('size', '123' . "" . '456');
$this->assertEquals(123456, $part->getDispositionParameter('size'));
$part->setDispositionParameter('foo', "foobar");
$this->assertEquals('foobar', $part->getDispositionParameter('foo'));
$part->setCharset("utf-8");
$this->assertEquals('utf-8', $part->getCharset());
$part->setName("foobar");
$this->assertEquals('foobar', $part->getName());
$this->assertEquals('foobar', $part->getDispositionParameter('filename'));
$this->assertEquals('foobar', $part->getContentTypeParameter('name'));
$part->setLanguage("en");
$this->assertEquals(array('en'), $part->getLanguage());
$part->setLanguage(array("en", "de"));
$this->assertEquals(array('en', 'de'), $part->getLanguage());
$part->setDuration('123' . "" . '456');
$this->assertEquals(123456, $part->getDuration());
$part->setBytes('123' . "" . '456');
$this->assertEquals(123456, $part->getBytes());
$part->setDescription("foobar");
$this->assertEquals('foobar', $part->getDescription());
$part->setContentTypeParameter('foo', "foobar");
$this->assertEquals('foobar', $part->getContentTypeParameter('foo'));
$part->setContentId("foobar");
$this->assertEquals('foobar', $part->getContentId());
}