diff options
Diffstat (limited to 'libs/Zend/Feed/Element.php')
-rw-r--r-- | libs/Zend/Feed/Element.php | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/libs/Zend/Feed/Element.php b/libs/Zend/Feed/Element.php index 2f0337d54f..b7a8e632f2 100644 --- a/libs/Zend/Feed/Element.php +++ b/libs/Zend/Feed/Element.php @@ -15,9 +15,9 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Element.php 18568 2009-10-16 11:59:55Z sgehrig $ + * @version $Id: Element.php 20104 2010-01-06 21:26:01Z matthew $ */ @@ -26,7 +26,7 @@ * * @category Zend * @package Zend_Feed - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Element implements ArrayAccess @@ -38,6 +38,11 @@ class Zend_Feed_Element implements ArrayAccess protected $_element; /** + * @var string Character encoding to utilize + */ + protected $_encoding = 'UTF-8'; + + /** * @var Zend_Feed_Element */ protected $_parentElement; @@ -148,6 +153,27 @@ class Zend_Feed_Element implements ArrayAccess return $this->_element->ownerDocument->saveXML($this->_element); } + /** + * Get encoding + * + * @return string + */ + public function getEncoding() + { + return $this->_encoding; + } + + /** + * Set encoding + * + * @param string $value Encoding to use + * @return Zend_Feed_Element + */ + public function setEncoding($value) + { + $this->_encoding = (string) $value; + return $this; + } /** * Map variable access onto the underlying entry representation. @@ -205,18 +231,18 @@ class Zend_Feed_Element implements ArrayAccess if (strpos($var, ':') !== false) { list($ns, $elt) = explode(':', $var, 2); $node = $this->_element->ownerDocument->createElementNS(Zend_Feed::lookupNamespace($ns), - $var, htmlspecialchars($val, ENT_NOQUOTES, 'UTF-8')); + $var, htmlspecialchars($val, ENT_NOQUOTES, $this->getEncoding())); $this->_element->appendChild($node); } else { $node = $this->_element->ownerDocument->createElement($var, - htmlspecialchars($val, ENT_NOQUOTES, 'UTF-8')); + htmlspecialchars($val, ENT_NOQUOTES, $this->getEncoding())); $this->_element->appendChild($node); } } elseif (count($nodes) > 1) { - /** + /** * @see Zend_Feed_Exception */ - require_once 'Zend/Feed/Exception.php'; + // require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Cannot set the value of multiple tags simultaneously.'); } else { $nodes[0]->nodeValue = $val; |