import v1.1.0_RC2 | 2009-09-20
This commit is contained in:
@ -15,9 +15,9 @@
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Value
|
||||
* @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: Array.php 9096 2008-03-30 19:04:05Z thomas $
|
||||
* @version $Id: Array.php 16208 2009-06-21 19:19:26Z thomas $
|
||||
*/
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ require_once 'Zend/XmlRpc/Value/Collection.php';
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Value
|
||||
* @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_XmlRpc_Value_Array extends Zend_XmlRpc_Value_Collection
|
||||
|
@ -15,9 +15,9 @@
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Value
|
||||
* @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: Base64.php 9096 2008-03-30 19:04:05Z thomas $
|
||||
* @version $Id: Base64.php 16208 2009-06-21 19:19:26Z thomas $
|
||||
*/
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ require_once 'Zend/XmlRpc/Value/Scalar.php';
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Value
|
||||
* @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_XmlRpc_Value_Base64 extends Zend_XmlRpc_Value_Scalar
|
||||
|
@ -15,9 +15,9 @@
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Value
|
||||
* @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: Boolean.php 9096 2008-03-30 19:04:05Z thomas $
|
||||
* @version $Id: Boolean.php 16208 2009-06-21 19:19:26Z thomas $
|
||||
*/
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ require_once 'Zend/XmlRpc/Value/Scalar.php';
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Value
|
||||
* @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_XmlRpc_Value_Boolean extends Zend_XmlRpc_Value_Scalar
|
||||
|
@ -15,9 +15,9 @@
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Value
|
||||
* @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: Collection.php 9096 2008-03-30 19:04:05Z thomas $
|
||||
* @version $Id: Collection.php 17786 2009-08-23 22:26:33Z lars $
|
||||
*/
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ require_once 'Zend/XmlRpc/Value.php';
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Value
|
||||
* @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
|
||||
*/
|
||||
abstract class Zend_XmlRpc_Value_Collection extends Zend_XmlRpc_Value
|
||||
@ -66,14 +66,8 @@ abstract class Zend_XmlRpc_Value_Collection extends Zend_XmlRpc_Value
|
||||
$values = (array)$this->_value;
|
||||
foreach ($values as $key => $value) {
|
||||
/* @var $value Zend_XmlRpc_Value */
|
||||
|
||||
if (!$value instanceof parent) {
|
||||
throw new Zend_XmlRpc_Value_Exception('Values of '. get_class($this) .' type must be Zend_XmlRpc_Value objects');
|
||||
}
|
||||
$values[$key] = $value->getValue();
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -15,9 +15,9 @@
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Value
|
||||
* @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: DateTime.php 9096 2008-03-30 19:04:05Z thomas $
|
||||
* @version $Id: DateTime.php 17786 2009-08-23 22:26:33Z lars $
|
||||
*/
|
||||
|
||||
|
||||
@ -31,12 +31,11 @@ require_once 'Zend/XmlRpc/Value/Scalar.php';
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Value
|
||||
* @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_XmlRpc_Value_DateTime extends Zend_XmlRpc_Value_Scalar
|
||||
{
|
||||
|
||||
/**
|
||||
* Set the value of a dateTime.iso8601 native type
|
||||
*
|
||||
@ -51,20 +50,21 @@ class Zend_XmlRpc_Value_DateTime extends Zend_XmlRpc_Value_Scalar
|
||||
|
||||
// If the value is not numeric, we try to convert it to a timestamp (using the strtotime function)
|
||||
if (is_numeric($value)) { // The value is numeric, we make sure it is an integer
|
||||
$value = (int)$value;
|
||||
$timestamp = (int)$value;
|
||||
} else {
|
||||
$value = strtotime($value);
|
||||
if ($value === false || $value == -1) { // cannot convert the value to a timestamp
|
||||
$timestamp = strtotime($value);
|
||||
if ($timestamp === false || $timestamp == -1) { // cannot convert the value to a timestamp
|
||||
throw new Zend_XmlRpc_Value_Exception('Cannot convert given value \''. $value .'\' to a timestamp');
|
||||
}
|
||||
}
|
||||
$value = date('c', $value); // Convert the timestamp to iso8601 format
|
||||
|
||||
$date = date('c', $timestamp); // Convert the timestamp to iso8601 format
|
||||
|
||||
// Strip out TZ information and dashes
|
||||
$value = preg_replace('/(\+|-)\d{2}:\d{2}$/', '', $value);
|
||||
$value = str_replace('-', '', $value);
|
||||
$date = preg_replace('/(\+|-)\d{2}:\d{2}$/', '', $date);
|
||||
$date = str_replace('-', '', $date);
|
||||
|
||||
$this->_value = $value;
|
||||
$this->_value = $date;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -76,6 +76,4 @@ class Zend_XmlRpc_Value_DateTime extends Zend_XmlRpc_Value_Scalar
|
||||
{
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -15,9 +15,9 @@
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Value
|
||||
* @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: Double.php 9096 2008-03-30 19:04:05Z thomas $
|
||||
* @version $Id: Double.php 16208 2009-06-21 19:19:26Z thomas $
|
||||
*/
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ require_once 'Zend/XmlRpc/Value/Scalar.php';
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Value
|
||||
* @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_XmlRpc_Value_Double extends Zend_XmlRpc_Value_Scalar
|
||||
|
@ -15,9 +15,9 @@
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Value
|
||||
* @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: Exception.php 9096 2008-03-30 19:04:05Z thomas $
|
||||
* @version $Id: Exception.php 16208 2009-06-21 19:19:26Z thomas $
|
||||
*/
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ require_once 'Zend/XmlRpc/Exception.php';
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Value
|
||||
* @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_XmlRpc_Value_Exception extends Zend_XmlRpc_Exception
|
||||
|
@ -15,9 +15,9 @@
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Value
|
||||
* @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: Integer.php 9095 2008-03-30 18:52:31Z thomas $
|
||||
* @version $Id: Integer.php 17759 2009-08-22 21:26:21Z lars $
|
||||
*/
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ require_once 'Zend/XmlRpc/Value/Scalar.php';
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Value
|
||||
* @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_XmlRpc_Value_Integer extends Zend_XmlRpc_Value_Scalar
|
||||
@ -44,6 +44,11 @@ class Zend_XmlRpc_Value_Integer extends Zend_XmlRpc_Value_Scalar
|
||||
*/
|
||||
public function __construct($value)
|
||||
{
|
||||
if ($value > PHP_INT_MAX) {
|
||||
require_once 'Zend/XmlRpc/Value/Exception.php';
|
||||
throw new Zend_XmlRpc_Value_Exception('Overlong integer given');
|
||||
}
|
||||
|
||||
$this->_type = self::XMLRPC_TYPE_INTEGER;
|
||||
$this->_value = (int)$value; // Make sure this value is integer
|
||||
}
|
||||
|
@ -15,9 +15,9 @@
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Value
|
||||
* @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: Nil.php 9095 2008-03-30 18:52:31Z thomas $
|
||||
* @version $Id: Nil.php 17786 2009-08-23 22:26:33Z lars $
|
||||
*/
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ require_once 'Zend/XmlRpc/Value/Scalar.php';
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Value
|
||||
* @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_XmlRpc_Value_Nil extends Zend_XmlRpc_Value_Scalar
|
||||
@ -56,24 +56,5 @@ class Zend_XmlRpc_Value_Nil extends Zend_XmlRpc_Value_Scalar
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the XML code representing the nil
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function saveXML()
|
||||
{
|
||||
if (! $this->_as_xml) { // The XML was not generated yet
|
||||
$dom = new DOMDocument('1.0', 'UTF-8');
|
||||
$value = $dom->appendChild($dom->createElement('value'));
|
||||
$type = $value->appendChild($dom->createElement($this->_type));
|
||||
|
||||
$this->_as_dom = $value;
|
||||
$this->_as_xml = $this->_stripXmlDeclaration($dom);
|
||||
}
|
||||
|
||||
return $this->_as_xml;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,9 +15,9 @@
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Value
|
||||
* @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: Scalar.php 9095 2008-03-30 18:52:31Z thomas $
|
||||
* @version $Id: Scalar.php 16208 2009-06-21 19:19:26Z thomas $
|
||||
*/
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ require_once 'Zend/XmlRpc/Value.php';
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Value
|
||||
* @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
|
||||
*/
|
||||
abstract class Zend_XmlRpc_Value_Scalar extends Zend_XmlRpc_Value
|
||||
|
@ -15,9 +15,9 @@
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Value
|
||||
* @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: String.php 9095 2008-03-30 18:52:31Z thomas $
|
||||
* @version $Id: String.php 17759 2009-08-22 21:26:21Z lars $
|
||||
*/
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ require_once 'Zend/XmlRpc/Value/Scalar.php';
|
||||
/**
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Value
|
||||
* @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_XmlRpc_Value_String extends Zend_XmlRpc_Value_Scalar
|
||||
@ -45,7 +45,7 @@ class Zend_XmlRpc_Value_String extends Zend_XmlRpc_Value_Scalar
|
||||
$this->_type = self::XMLRPC_TYPE_STRING;
|
||||
|
||||
// Make sure this value is string and all XML characters are encoded
|
||||
$this->_value = $this->_xml_entities($value);
|
||||
$this->_value = $this->_escapeXmlEntities($value);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -56,19 +56,7 @@ class Zend_XmlRpc_Value_String extends Zend_XmlRpc_Value_Scalar
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return html_entity_decode($this->_value, ENT_QUOTES, 'UTF-8');
|
||||
return $this->_decodeXmlEntities($this->_value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure a string will be safe for XML, convert risky characters to HTML entities
|
||||
*
|
||||
* @param string $str
|
||||
* @return string
|
||||
*/
|
||||
private function _xml_entities($str)
|
||||
{
|
||||
return htmlentities($str, ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -15,9 +15,9 @@
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Value
|
||||
* @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: Struct.php 9095 2008-03-30 18:52:31Z thomas $
|
||||
* @version $Id: Struct.php 17759 2009-08-22 21:26:21Z lars $
|
||||
*/
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ require_once 'Zend/XmlRpc/Value/Collection.php';
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Value
|
||||
* @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_XmlRpc_Value_Struct extends Zend_XmlRpc_Value_Collection
|
||||
@ -64,7 +64,7 @@ class Zend_XmlRpc_Value_Struct extends Zend_XmlRpc_Value_Collection
|
||||
foreach ($this->_value as $name => $val) {
|
||||
/* @var $val Zend_XmlRpc_Value */
|
||||
$member = $struct->appendChild($dom->createElement('member'));
|
||||
$member->appendChild($dom->createElement('name', $name));
|
||||
$member->appendChild($dom->createElement('name', $this->_escapeXmlEntities($name)));
|
||||
$member->appendChild($dom->importNode($val->getAsDOM(), 1));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user