From: Michael M Slusarz Date: Tue, 18 Nov 2008 20:14:55 +0000 (-0700) Subject: Add option to return Mime_Part object instead. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=45a8f5a57480cbb9153e3962555b68ff911bf03e;p=horde.git Add option to return Mime_Part object instead. --- diff --git a/framework/Mime/lib/Horde/Mime/Message.php b/framework/Mime/lib/Horde/Mime/Message.php index 7f1de72b2..d952d37f7 100644 --- a/framework/Mime/lib/Horde/Mime/Message.php +++ b/framework/Mime/lib/Horde/Mime/Message.php @@ -172,12 +172,17 @@ class Horde_Mime_Message extends Horde_Mime_Part * the body in text lines. * 'md5' - [OPTIONAL] (string) The part's MD5 value. * + * @param array $options Additional options: + *
+     * 'mimepart' - (boolean) Return a Horde_Mime_Part object instead of a
+     *              Horde_Mime_Message object?
+     * 
* * @return object A Horde_Mime_Message object. */ - static public function parseStructure($structure) + static public function parseStructure($structure, $options = array()) { - $ob = self::_parseStructure($structure, true); + $ob = self::_parseStructure($structure, empty($options['mimepart'])); $ob->buildMimeIds(); return $ob; } @@ -282,12 +287,17 @@ class Horde_Mime_Message extends Horde_Mime_Part * This function can be called statically via: * $mime_message = Horde_Mime_Message::parseMessage(); * - * @param string $text The text of the MIME message. + * @param string $text The text of the MIME message. + * @param array $options Additional options: + *
+     * 'mimepart' - (boolean) Return a Horde_Mime_Part object instead of a
+     *              Horde_Mime_Message object?
+     * 
* * @return Horde_Mime_Message A Horde_Mime_Message object, or false on * error. */ - static public function parseMessage($text) + static public function parseMessage($text, $options = array()) { /* Set up the options for the mimeDecode class. */ $decode_args = array( @@ -302,7 +312,7 @@ class Horde_Mime_Message extends Horde_Mime_Part return false; } - return self::parseStructure(self::_convertMimeDecodeData($ob)); + return self::parseStructure(self::_convertMimeDecodeData($ob), $options); } /**