當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Horde_Mime_Part::getDescription方法代碼示例

本文整理匯總了PHP中Horde_Mime_Part::getDescription方法的典型用法代碼示例。如果您正苦於以下問題:PHP Horde_Mime_Part::getDescription方法的具體用法?PHP Horde_Mime_Part::getDescription怎麽用?PHP Horde_Mime_Part::getDescription使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Horde_Mime_Part的用法示例。


在下文中一共展示了Horde_Mime_Part::getDescription方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: process_message_part_attachment

 /**
  * Process a message again to add body and attachment data.
  *
  * @param \Horde_Imap_Client_Data_Fetch $messagedata The structure and part of the message body
  * @param \Horde_Mime_Part $partdata The part data
  * @param string $part The part ID.
  * @param string $filename The filename of the attachment
  * @return \stdClass
  * @throws \core\message\inbound\processing_failed_exception If the attachment can't be saved to disk.
  */
 private function process_message_part_attachment($messagedata, $partdata, $part, $filename)
 {
     global $CFG;
     // If a filename is present, assume that this part is an attachment.
     $attachment = new \stdClass();
     $attachment->filename = $filename;
     $attachment->type = $partdata->getType();
     $attachment->content = $partdata->getContents();
     $attachment->charset = $partdata->getCharset();
     $attachment->description = $partdata->getDescription();
     $attachment->contentid = $partdata->getContentId();
     $attachment->filesize = $messagedata->getBodyPartSize($part);
     if (!empty($CFG->antiviruses)) {
         mtrace("--> Attempting virus scan of '{$attachment->filename}'");
         // Store the file on disk - it will need to be virus scanned first.
         $itemid = rand(1, 999999999);
         $directory = make_temp_directory("/messageinbound/{$itemid}", false);
         $filepath = $directory . "/" . $attachment->filename;
         if (!($fp = fopen($filepath, "w"))) {
             // Unable to open the temporary file to write this to disk.
             mtrace("--> Unable to save the file to disk for virus scanning. Check file permissions.");
             throw new \core\message\inbound\processing_failed_exception('attachmentfilepermissionsfailed', 'tool_messageinbound');
         }
         fwrite($fp, $attachment->content);
         fclose($fp);
         // Perform a virus scan now.
         try {
             \core\antivirus\manager::scan_file($filepath, $attachment->filename, true);
         } catch (\core\antivirus\scanner_exception $e) {
             mtrace("--> A virus was found in the attachment '{$attachment->filename}'.");
             $this->inform_attachment_virus();
             return;
         }
     }
     return $attachment;
 }
開發者ID:Chocolate-lightning,項目名稱:moodle,代碼行數:46,代碼來源:manager.php

示例2: 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

示例3: 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


注:本文中的Horde_Mime_Part::getDescription方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。