public function MailhandlerPhpImapRetrieve::get_mime_type in Mailhandler 7.2
Same name and namespace in other branches
- 6.2 modules/mailhandler_php_imap/plugins/mailhandler/retrieve/MailhandlerPhpImapRetrieve.class.php \MailhandlerPhpImapRetrieve::get_mime_type()
Retrieve MIME type of the message structure.
1 call to MailhandlerPhpImapRetrieve::get_mime_type()
- MailhandlerPhpImapRetrieve::get_part in modules/
mailhandler_php_imap/ plugins/ mailhandler/ retrieve/ MailhandlerPhpImapRetrieve.class.php - Gets a message part and adds it to $parts.
File
- modules/
mailhandler_php_imap/ plugins/ mailhandler/ retrieve/ MailhandlerPhpImapRetrieve.class.php, line 319 - Definition of MailhandlerPhpImapRetrieve class.
Class
- MailhandlerPhpImapRetrieve
- Retrieve messages using PHP IMAP library.
Code
public function get_mime_type(&$structure) {
static $primary_mime_type = array(
'text',
'multipart',
'message',
'application',
'audio',
'image',
'video',
'other',
);
$type_id = (int) $structure->type;
if (isset($primary_mime_type[$type_id]) && !empty($structure->subtype)) {
return $primary_mime_type[$type_id] . '/' . drupal_strtolower($structure->subtype);
}
return 'text/plain';
}