Return the descriptive part label, making sure it is not empty.
public getPartName ( Horde_Mime_Part $part, boolean $use_descrip = false ) : string | ||
$part | Horde_Mime_Part | The MIME Part object. |
$use_descrip | boolean | Use description? If false, uses name. |
Результат | string | The part label (non-empty). |
/** */ public function downloadAttach($id) { global $session; $session->close(); if (!($mime = $this->_getRawDownloadPart($id))) { return array(); } return array('data' => $mime->getContents(array('stream' => true)), 'name' => $this->_contents->getPartName($mime), 'type' => $mime->getType(true)); }
/** */ public function downloadAttach($id, $zip = false) { global $page_output, $session; $session->close(); $mime = $this->_getRawDownloadPart($id); $name = $this->_contents->getPartName($mime); /* Compress output? */ if ($zip) { $data = Horde_Compress::factory('Zip')->compress(array(array('data' => $mime->getContents(), 'name' => $name)), array('stream' => true)); $name .= '.zip'; $type = 'application/zip'; $page_output->disableCompression(); } else { $data = $mime->getContents(array('stream' => true)); $type = $mime->getType(true); } return array('data' => $data, 'name' => $name, 'type' => $type); }