当前位置: 首页>>代码示例>>PHP>>正文


PHP Horde_Mime_Part::getName方法代码示例

本文整理汇总了PHP中Horde_Mime_Part::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Mime_Part::getName方法的具体用法?PHP Horde_Mime_Part::getName怎么用?PHP Horde_Mime_Part::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Horde_Mime_Part的用法示例。


在下文中一共展示了Horde_Mime_Part::getName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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;
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:50,代码来源:Attachment.php

示例2: _write

 /**
  */
 protected function _write($filename, Horde_Mime_Part $part)
 {
     global $browser;
     try {
         $this->_vfs->write($this->_vfspath, $this->_id, $filename, true);
     } catch (Horde_Vfs_Exception $e) {
         throw new IMP_Compose_Exception($e);
     }
     // Prevent 'jar:' attacks on Firefox.  See Ticket #5892.
     $type = $part->getType();
     if ($browser->isBrowser('mozilla') && in_array(Horde_String::lower($type), array('application/java-archive', 'application/x-jar'))) {
         $type = 'application/octet-stream';
     }
     $md = $this->getMetadata();
     $md->filename = $part->getName(true);
     $md->time = time();
     $md->type = $type;
     $this->saveMetadata($md);
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:21,代码来源:VfsLinked.php

示例3: getPartName

 /**
  * Return the descriptive part label, making sure it is not empty.
  *
  * @param Horde_Mime_Part $part  The MIME Part object.
  * @param boolean $use_descrip   Use description? If false, uses name.
  *
  * @return string  The part label (non-empty).
  */
 public function getPartName(Horde_Mime_Part $part, $use_descrip = false)
 {
     $name = $use_descrip ? $part->getDescription(true) : $part->getName(true);
     if ($name) {
         return $name;
     }
     switch ($ptype = $part->getPrimaryType()) {
         case 'multipart':
             if ($part->getSubType() == 'related' && ($view_id = $part->getMetaData('viewable_part')) && ($viewable = $this->getMimePart($view_id, array('nocontents' => true)))) {
                 return $this->getPartName($viewable, $use_descrip);
             }
             /* Fall-through. */
         /* Fall-through. */
         case 'application':
         case 'model':
             $ptype = $part->getSubType();
             break;
     }
     switch ($ptype) {
         case 'audio':
             return _("Audio");
         case 'image':
             return _("Image");
         case 'message':
         case '':
         case Horde_Mime_Part::UNKNOWN:
             return _("Message");
         case 'multipart':
             return _("Multipart");
         case 'text':
             return _("Text");
         case 'video':
             return _("Video");
         default:
             // Attempt to translate this type, if possible. Odds are that
             // it won't appear in the dictionary though.
             return _(Horde_String::ucfirst($ptype));
     }
 }
开发者ID:horde,项目名称:horde,代码行数:47,代码来源:Contents.php

示例4: getName

 /**
  * @return string
  */
 public function getName()
 {
     return $this->mimePart->getName();
 }
开发者ID:matiasdelellis,项目名称:mail,代码行数:7,代码来源:attachment.php

示例5: 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());
 }
开发者ID:x59,项目名称:horde-mime,代码行数:32,代码来源:PartTest.php

示例6: subMimeStructToFlatStruct

 /**
  *
  * @param unknown $struct
  * @param unknown $partno
  * @param unknown $outStruct
  */
 public function subMimeStructToFlatStruct(Horde_Mime_Part $struct, &$outStruct)
 {
     $partno = $struct->getMimeId();
     $outStruct[$partno] = array();
     $outStruct[$partno]['type'] = $struct->getType(false);
     $outStruct[$partno]['subtype'] = $struct->getSubType();
     $outStruct[$partno]['content'] = $struct->getContents(array('stream' => false));
     if ($v = $struct->getCharset()) {
         $outStruct[$partno]['charset'] = $v;
     }
     if ($v = $struct->getName(false)) {
         $outStruct[$partno]['name'] = $v;
     }
     if ($v = $struct->getSize(false)) {
         $outStruct[$partno]['bytes'] = $v;
     }
     if ($v = $struct->getContentId()) {
         $outStruct[$partno]['id'] = $v;
     }
     foreach ($struct->getParts() as $sStruct) {
         $this->subMimeStructToFlatStruct($sStruct, $outStruct);
     }
 }
开发者ID:micoli,项目名称:qd_mail,代码行数:29,代码来源:QDImapHORDE.php

示例7: addAttachmentFromPart

 /**
  * Adds an attachment from Horde_Mime_Part data.
  *
  * @param Horde_Mime_Part $part  The object that contains the attachment
  *                               data.
  *
  * @return IMP_Compose_Attachment  Attachment object.
  * @throws IMP_Compose_Exception
  */
 public function addAttachmentFromPart($part)
 {
     /* Extract the data from the Horde_Mime_Part. */
     $atc_file = Horde::getTempFile('impatt');
     $stream = $part->getContents(array('stream' => true));
     rewind($stream);
     if (file_put_contents($atc_file, $stream) === false) {
         throw new IMP_Compose_Exception(sprintf(_("Could not attach %s to the message."), $part->getName()));
     }
     return $this->_addAttachment($atc_file, ftell($stream), $part->getName(true), $part->getType());
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:20,代码来源:Compose.php


注:本文中的Horde_Mime_Part::getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。