Horde_Kolab_Storage_Object_MimeType::getMimeTypeFromObjectType PHP Method

getMimeTypeFromObjectType() public static method

Determine the mime type given the object type.
public static getMimeTypeFromObjectType ( string $type ) : string
$type string The object type.
return string The mime type associated to the object type.
    public static function getMimeTypeFromObjectType($type)
    {
        if (isset(self::$_object_types[$type])) {
            return self::$_object_types[$type];
        } else {
            throw new Horde_Kolab_Storage_Data_Exception(sprintf('Unsupported object type %s!', $type));
        }
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Embed the Kolab content into a new MIME Part.
  *
  * @param resource $content The Kolab content.
  *
  * @return Horde_Mime_Part The MIME part that encapsules the Kolab content.
  */
 protected function createFreshKolabPart($content)
 {
     $part = new Horde_Mime_Part();
     $part->setCharset('utf-8');
     $part->setDisposition('inline');
     $part->setDispositionParameter('x-kolab-type', 'xml');
     $part->setName('kolab.xml');
     $part->setType(Horde_Kolab_Storage_Object_MimeType::getMimeTypeFromObjectType($this->getType()));
     $part->setContents($content, array('encoding' => 'quoted-printable'));
     return $part;
 }
All Usage Examples Of Horde_Kolab_Storage_Object_MimeType::getMimeTypeFromObjectType