Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvipsoft <vipsoft@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2009-09-07 22:40:52 +0400
committervipsoft <vipsoft@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2009-09-07 22:40:52 +0400
commit9ce132f774176704fe8a23ce1dc169a9e94ac465 (patch)
treeb205427c2cbb4c03d741b62ed6cd64f763a99bef /libs/Zend/Mail/Part.php
parentab982e606b2dc25ef7ea9ba9496416972e82df6b (diff)
Fixes #497 - update to Zend Framework 1.9.2 (subset); remove svn:keywords to preserve the original $Id; misc changes to handle fetchRow() sometimes returning null (instead of false)
Diffstat (limited to 'libs/Zend/Mail/Part.php')
-rw-r--r--libs/Zend/Mail/Part.php81
1 files changed, 66 insertions, 15 deletions
diff --git a/libs/Zend/Mail/Part.php b/libs/Zend/Mail/Part.php
index 53a9a0a47e..4541a5acc1 100644
--- a/libs/Zend/Mail/Part.php
+++ b/libs/Zend/Mail/Part.php
@@ -4,19 +4,19 @@
*
* LICENSE
*
- * This source file is subject to version 1.0 of the Zend Framework
- * license, that is bundled with this package in the file LICENSE.txt, and
- * is available through the world-wide-web at the following URL:
- * http://framework.zend.com/license/new-bsd. If you did not receive
- * a copy of the Zend Framework license and are unable to obtain it
- * through the world-wide-web, please send a note to license@zend.com
- * so we can mail you a copy immediately.
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Mail
- * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Part.php 8064 2008-02-16 10:58:39Z thomas $
+ * @version $Id: Part.php 16219 2009-06-21 19:45:39Z thomas $
*/
@@ -25,14 +25,19 @@
*/
require_once 'Zend/Mime/Decode.php';
+/**
+ * @see Zend_Mail_Part_Interface
+ */
+require_once 'Zend/Mail/Part/Interface.php';
+
/**
* @category Zend
* @package Zend_Mail
- * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
-class Zend_Mail_Part implements RecursiveIterator
+class Zend_Mail_Part implements RecursiveIterator, Zend_Mail_Part_Interface
{
/**
* headers of part as array
@@ -177,6 +182,18 @@ class Zend_Mail_Part implements RecursiveIterator
}
/**
+ * Return size of part
+ *
+ * Quite simple implemented currently (not decoding). Handle with care.
+ *
+ * @return int size
+ */
+ public function getSize() {
+ return strlen($this->getContent());
+ }
+
+
+ /**
* Cache content and split in parts if multipart
*
* @return null
@@ -203,6 +220,9 @@ class Zend_Mail_Part implements RecursiveIterator
throw new Zend_Mail_Exception('no boundary found in content type to split message');
}
$parts = Zend_Mime_Decode::splitMessageStruct($this->_content, $boundary);
+ if ($parts === null) {
+ return;
+ }
$counter = 1;
foreach ($parts as $part) {
$this->_parts[$counter++] = new self(array('headers' => $part['header'], 'content' => $part['body']));
@@ -317,14 +337,14 @@ class Zend_Mail_Part implements RecursiveIterator
$lowerName = strtolower($name);
- if (!isset($this->_headers[$lowerName])) {
+ if ($this->headerExists($name) == false) {
$lowerName = strtolower(preg_replace('%([a-z])([A-Z])%', '\1-\2', $name));
- if (!isset($this->_headers[$lowerName])) {
+ if($this->headerExists($lowerName) == false) {
/**
* @see Zend_Mail_Exception
*/
require_once 'Zend/Mail/Exception.php';
- throw new Zend_Mail_Exception("no Header with Name $name found");
+ throw new Zend_Mail_Exception("no Header with Name $name or $lowerName found");
}
}
$name = $lowerName;
@@ -345,6 +365,22 @@ class Zend_Mail_Part implements RecursiveIterator
return $header;
}
+
+ /**
+ * Check wheater the Mail part has a specific header.
+ *
+ * @param string $name
+ * @return boolean
+ */
+ public function headerExists($name)
+ {
+ $name = strtolower($name);
+ if(isset($this->_headers[$name])) {
+ return true;
+ } else {
+ return false;
+ }
+ }
/**
* Get a specific field from a header like content type or all fields as array
@@ -362,7 +398,7 @@ class Zend_Mail_Part implements RecursiveIterator
* @throws Zend_Exception, Zend_Mail_Exception
*/
public function getHeaderField($name, $wantedPart = 0, $firstName = 0) {
- return Zend_Mime_Decode::splitHeaderField(current($this->getHeader($name, 'array')), $wantedPart, $firstName);
+ return Zend_Mime_Decode::splitHeaderField(current($this->getHeader($name, 'array')), $wantedPart, $firstName);
}
@@ -383,6 +419,21 @@ class Zend_Mail_Part implements RecursiveIterator
}
/**
+ * Isset magic method proxy to hasHeader
+ *
+ * This method is short syntax for Zend_Mail_Part::hasHeader($name);
+ *
+ * @see Zend_Mail_Part::hasHeader
+ *
+ * @param string
+ * @return boolean
+ */
+ public function __isset($name)
+ {
+ return $this->headerExists($name);
+ }
+
+ /**
* magic method to get content of part
*
* @return string content