Horde_Mime_Part::getType PHP Method

getType() public method

Get the full MIME Content-Type of this part.
public getType ( boolean $charset = false ) : string
$charset boolean Append character set information to the end of the content type if this is a text/* part? `
return string The MIME type of this part.
    public function getType($charset = false)
    {
        $ct = $this->_headers['content-type'];
        return $charset ? $ct->type_charset : $ct->value;
    }

Usage Example

Example #1
0
 /**
  * Constructor.
  *
  * @param Horde_Mime_Part $mime_part  A MIME part object. Must be of
  *                                    type multipart/related.
  */
 public function __construct(Horde_Mime_Part $mime_part)
 {
     if ($mime_part->getType() != 'multipart/related') {
         throw new InvalidArgumentException('MIME part must be of type multipart/related');
     }
     $ids = array_keys($mime_part->contentTypeMap());
     $related_id = $mime_part->getMimeId();
     $id = null;
     /* Build a list of parts -> CIDs. */
     foreach ($ids as $val) {
         if (strcmp($related_id, $val) !== 0 && ($cid = $mime_part->getPart($val)->getContentId())) {
             $this->_cids[$val] = $cid;
         }
     }
     /* Look at the 'start' parameter to determine which part to start
      * with. If no 'start' parameter, use the first part (RFC 2387
      * [3.1]). */
     $start = $mime_part->getContentTypeParameter('start');
     if (!empty($start)) {
         $id = $this->cidSearch($start);
     }
     if (empty($id)) {
         reset($ids);
         $id = next($ids);
     }
     $this->_start = $id;
 }
All Usage Examples Of Horde_Mime_Part::getType