import v1.1.0_RC2 | 2009-09-20
This commit is contained in:
@ -15,8 +15,9 @@
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Client
|
||||
* @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: Client.php 17759 2009-08-22 21:26:21Z lars $
|
||||
*/
|
||||
|
||||
|
||||
@ -70,7 +71,7 @@ require_once 'Zend/XmlRpc/Fault.php';
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Client
|
||||
* @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_Client
|
||||
@ -267,10 +268,13 @@ class Zend_XmlRpc_Client
|
||||
|
||||
$http->setHeaders(array(
|
||||
'Content-Type: text/xml; charset=utf-8',
|
||||
'User-Agent: Zend_XmlRpc_Client',
|
||||
'Accept: text/xml',
|
||||
));
|
||||
|
||||
if ($http->getHeader('user-agent') === null) {
|
||||
$http->setHeaders(array('User-Agent: Zend_XmlRpc_Client'));
|
||||
}
|
||||
|
||||
$xml = $this->_lastRequest->__toString();
|
||||
$http->setRawData($xml);
|
||||
$httpResponse = $http->request(Zend_Http_Client::POST);
|
||||
@ -313,29 +317,36 @@ class Zend_XmlRpc_Client
|
||||
$success = false;
|
||||
}
|
||||
if ($success) {
|
||||
$validTypes = array(
|
||||
Zend_XmlRpc_Value::XMLRPC_TYPE_ARRAY,
|
||||
Zend_XmlRpc_Value::XMLRPC_TYPE_BASE64,
|
||||
Zend_XmlRpc_Value::XMLRPC_TYPE_BOOLEAN,
|
||||
Zend_XmlRpc_Value::XMLRPC_TYPE_DATETIME,
|
||||
Zend_XmlRpc_Value::XMLRPC_TYPE_DOUBLE,
|
||||
Zend_XmlRpc_Value::XMLRPC_TYPE_I4,
|
||||
Zend_XmlRpc_Value::XMLRPC_TYPE_INTEGER,
|
||||
Zend_XmlRpc_Value::XMLRPC_TYPE_NIL,
|
||||
Zend_XmlRpc_Value::XMLRPC_TYPE_STRING,
|
||||
Zend_XmlRpc_Value::XMLRPC_TYPE_STRUCT,
|
||||
);
|
||||
$params = (array)$params;
|
||||
foreach ($params as $key => $param) {
|
||||
if (is_array($param) && empty($param)) {
|
||||
$type = 'array';
|
||||
foreach ($signatures as $signature) {
|
||||
if (!is_array($signature)) {
|
||||
continue;
|
||||
}
|
||||
if (array_key_exists($key + 1, $signature)) {
|
||||
$type = $signature[$key + 1];
|
||||
$type = (in_array($type, array('array', 'struct'))) ? $type : 'array';
|
||||
break;
|
||||
}
|
||||
$type = Zend_XmlRpc_Value::AUTO_DETECT_TYPE;
|
||||
foreach ($signatures as $signature) {
|
||||
if (!is_array($signature)) {
|
||||
continue;
|
||||
}
|
||||
if (isset($signature['parameters'][$key])) {
|
||||
$type = $signature['parameters'][$key];
|
||||
$type = in_array($type, $validTypes) ? $type : Zend_XmlRpc_Value::AUTO_DETECT_TYPE;
|
||||
}
|
||||
$params[$key] = array(
|
||||
'type' => $type,
|
||||
'value' => $param
|
||||
);
|
||||
}
|
||||
$params[$key] = Zend_XmlRpc_Value::getXmlRpcValue($param, $type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$request = new Zend_XmlRpc_Request($method, $params);
|
||||
$request = $this->_createRequest($method, $params);
|
||||
|
||||
$this->doRequest($request);
|
||||
|
||||
@ -352,4 +363,14 @@ class Zend_XmlRpc_Client
|
||||
|
||||
return $this->_lastResponse->getReturnValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create request object
|
||||
*
|
||||
* @return Zend_XmlRpc_Request
|
||||
*/
|
||||
protected function _createRequest($method, $params)
|
||||
{
|
||||
return new Zend_XmlRpc_Request($method, $params);
|
||||
}
|
||||
}
|
||||
|
@ -15,8 +15,9 @@
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Client
|
||||
* @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 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
*/
|
||||
|
||||
|
||||
@ -32,7 +33,7 @@ require_once 'Zend/XmlRpc/Exception.php';
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Client
|
||||
* @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_Client_Exception extends Zend_XmlRpc_Exception
|
||||
|
@ -15,8 +15,9 @@
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Client
|
||||
* @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: FaultException.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
*/
|
||||
|
||||
|
||||
@ -30,7 +31,7 @@ require_once 'Zend/XmlRpc/Client/Exception.php';
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Client
|
||||
* @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_Client_FaultException extends Zend_XmlRpc_Client_Exception
|
||||
|
@ -15,8 +15,9 @@
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Client
|
||||
* @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: HttpException.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
*/
|
||||
|
||||
|
||||
@ -33,7 +34,7 @@ require_once 'Zend/XmlRpc/Client/Exception.php';
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Client
|
||||
* @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_Client_HttpException extends Zend_XmlRpc_Client_Exception
|
||||
|
@ -15,8 +15,9 @@
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Client
|
||||
* @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: IntrospectException.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
*/
|
||||
|
||||
|
||||
@ -32,7 +33,7 @@ require_once 'Zend/XmlRpc/Client/Exception.php';
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Client
|
||||
* @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_Client_IntrospectException extends Zend_XmlRpc_Client_Exception
|
||||
|
@ -15,8 +15,9 @@
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Client
|
||||
* @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: ServerIntrospection.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -25,7 +26,7 @@
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Client
|
||||
* @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_Client_ServerIntrospection
|
||||
|
@ -15,8 +15,9 @@
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Client
|
||||
* @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: ServerProxy.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
*/
|
||||
|
||||
|
||||
@ -28,7 +29,7 @@
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Client
|
||||
* @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_Client_ServerProxy
|
||||
|
@ -14,8 +14,9 @@
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @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 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
*/
|
||||
|
||||
|
||||
@ -28,7 +29,7 @@ require_once 'Zend/Exception.php';
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @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_Exception extends Zend_Exception
|
||||
|
@ -14,8 +14,9 @@
|
||||
*
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Server
|
||||
* @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: Fault.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -35,7 +36,7 @@ require_once 'Zend/XmlRpc/Value.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @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_Fault
|
||||
|
@ -14,7 +14,7 @@
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Controller
|
||||
* @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
|
||||
*/
|
||||
|
||||
@ -41,9 +41,9 @@ require_once 'Zend/XmlRpc/Fault.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @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: Request.php 13223 2008-12-14 11:21:31Z thomas $
|
||||
* @version $Id: Request.php 17786 2009-08-23 22:26:33Z lars $
|
||||
*/
|
||||
class Zend_XmlRpc_Request
|
||||
{
|
||||
@ -326,7 +326,7 @@ class Zend_XmlRpc_Request
|
||||
$types = array();
|
||||
$argv = array();
|
||||
foreach ($xml->params->children() as $param) {
|
||||
if (! $param->value instanceof SimpleXMLElement) {
|
||||
if (!isset($param->value)) {
|
||||
$this->_fault = new Zend_XmlRpc_Fault(633);
|
||||
$this->_fault->setEncoding($this->getEncoding());
|
||||
return false;
|
||||
|
@ -14,7 +14,7 @@
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Controller
|
||||
* @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
|
||||
*/
|
||||
|
||||
@ -32,9 +32,9 @@ require_once 'Zend/XmlRpc/Request.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @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: Http.php 8064 2008-02-16 10:58:39Z thomas $
|
||||
* @version $Id: Http.php 16208 2009-06-21 19:19:26Z thomas $
|
||||
*/
|
||||
class Zend_XmlRpc_Request_Http extends Zend_XmlRpc_Request
|
||||
{
|
||||
|
@ -14,7 +14,7 @@
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Controller
|
||||
* @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
|
||||
*/
|
||||
|
||||
@ -32,9 +32,9 @@ require_once 'Zend/XmlRpc/Request.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @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: Stdin.php 8064 2008-02-16 10:58:39Z thomas $
|
||||
* @version $Id: Stdin.php 16208 2009-06-21 19:19:26Z thomas $
|
||||
*/
|
||||
class Zend_XmlRpc_Request_Stdin extends Zend_XmlRpc_Request
|
||||
{
|
||||
|
@ -14,7 +14,7 @@
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Controller
|
||||
* @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
|
||||
*/
|
||||
|
||||
@ -35,9 +35,9 @@ require_once 'Zend/XmlRpc/Fault.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @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: Response.php 8064 2008-02-16 10:58:39Z thomas $
|
||||
* @version $Id: Response.php 16208 2009-06-21 19:19:26Z thomas $
|
||||
*/
|
||||
class Zend_XmlRpc_Response
|
||||
{
|
||||
|
@ -14,7 +14,7 @@
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Controller
|
||||
* @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
|
||||
*/
|
||||
|
||||
@ -29,9 +29,9 @@ require_once 'Zend/XmlRpc/Response.php';
|
||||
* @uses Zend_XmlRpc_Response
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @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: Http.php 9343 2008-04-28 19:51:02Z matthew $
|
||||
* @version $Id: Http.php 16208 2009-06-21 19:19:26Z thomas $
|
||||
*/
|
||||
class Zend_XmlRpc_Response_Http extends Zend_XmlRpc_Response
|
||||
{
|
||||
|
@ -15,9 +15,9 @@
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Server
|
||||
* @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: Server.php 13223 2008-12-14 11:21:31Z thomas $
|
||||
* @version $Id: Server.php 17786 2009-08-23 22:26:33Z lars $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -111,7 +111,7 @@ require_once 'Zend/Server/Reflection/Method.php';
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Server
|
||||
* @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_Server extends Zend_Server_Abstract
|
||||
@ -136,7 +136,7 @@ class Zend_XmlRpc_Server extends Zend_Server_Abstract
|
||||
|
||||
/**
|
||||
* Dispatch table of name => method pairs
|
||||
* @var Zend_XmlRpc_Server_ServerDefinition
|
||||
* @var Zend_Server_Definition
|
||||
*/
|
||||
protected $_table;
|
||||
|
||||
@ -170,6 +170,13 @@ class Zend_XmlRpc_Server extends Zend_Server_Abstract
|
||||
'mixed' => 'struct'
|
||||
);
|
||||
|
||||
/**
|
||||
* Send arguments to all methods or just constructor?
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $_sendArgumentsToAllMethods = true;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -261,16 +268,14 @@ class Zend_XmlRpc_Server extends Zend_Server_Abstract
|
||||
public function setClass($class, $namespace = '', $argv = null)
|
||||
{
|
||||
if (is_string($class) && !class_exists($class)) {
|
||||
if (!class_exists($class)) {
|
||||
require_once 'Zend/XmlRpc/Server/Exception.php';
|
||||
throw new Zend_XmlRpc_Server_Exception('Invalid method class', 610);
|
||||
}
|
||||
require_once 'Zend/XmlRpc/Server/Exception.php';
|
||||
throw new Zend_XmlRpc_Server_Exception('Invalid method class', 610);
|
||||
}
|
||||
|
||||
$argv = null;
|
||||
if (3 < func_num_args()) {
|
||||
if (2 < func_num_args()) {
|
||||
$argv = func_get_args();
|
||||
$argv = array_slice($argv, 3);
|
||||
$argv = array_slice($argv, 2);
|
||||
}
|
||||
|
||||
$dispatchable = Zend_Server_Reflection::reflectClass($class, $argv, $namespace);
|
||||
@ -291,7 +296,7 @@ class Zend_XmlRpc_Server extends Zend_Server_Abstract
|
||||
if (!$fault instanceof Exception) {
|
||||
$fault = (string) $fault;
|
||||
if (empty($fault)) {
|
||||
$fault = 'Unknown error';
|
||||
$fault = 'Unknown Error';
|
||||
}
|
||||
require_once 'Zend/XmlRpc/Server/Exception.php';
|
||||
$fault = new Zend_XmlRpc_Server_Exception($fault, $code);
|
||||
@ -447,15 +452,14 @@ class Zend_XmlRpc_Server extends Zend_Server_Abstract
|
||||
*/
|
||||
public function setResponseClass($class)
|
||||
{
|
||||
if (class_exists($class)) {
|
||||
$reflection = new ReflectionClass($class);
|
||||
if ($reflection->isSubclassOf(new ReflectionClass('Zend_XmlRpc_Response'))) {
|
||||
$this->_responseClass = $class;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (!class_exists($class) or
|
||||
($c = new ReflectionClass($class) and !$c->isSubclassOf('Zend_XmlRpc_Response'))) {
|
||||
|
||||
return false;
|
||||
require_once 'Zend/XmlRpc/Server/Exception.php';
|
||||
throw new Zend_XmlRpc_Server_Exception('Invalid response class');
|
||||
}
|
||||
$this->_responseClass = $class;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -501,6 +505,24 @@ class Zend_XmlRpc_Server extends Zend_Server_Abstract
|
||||
return $this->_system;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send arguments to all methods?
|
||||
*
|
||||
* If setClass() is used to add classes to the server, this flag defined
|
||||
* how to handle arguments. If set to true, all methods including constructor
|
||||
* will receive the arguments. If set to false, only constructor will receive the
|
||||
* arguments
|
||||
*/
|
||||
public function sendArgumentsToAllMethods($flag = null)
|
||||
{
|
||||
if ($flag === null) {
|
||||
return $this->_sendArgumentsToAllMethods;
|
||||
}
|
||||
|
||||
$this->_sendArgumentsToAllMethods = (bool)$flag;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Map PHP type to XML-RPC type
|
||||
*
|
||||
@ -537,7 +559,7 @@ class Zend_XmlRpc_Server extends Zend_Server_Abstract
|
||||
$info = $this->_table->getMethod($method);
|
||||
$params = $request->getParams();
|
||||
$argv = $info->getInvokeArguments();
|
||||
if (0 < count($argv)) {
|
||||
if (0 < count($argv) and $this->sendArgumentsToAllMethods()) {
|
||||
$params = array_merge($params, $argv);
|
||||
}
|
||||
|
||||
|
@ -15,9 +15,9 @@
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Server
|
||||
* @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: Cache.php 12195 2008-10-30 13:34:35Z matthew $
|
||||
* @version $Id: Cache.php 16208 2009-06-21 19:19:26Z thomas $
|
||||
*/
|
||||
|
||||
/** Zend_Server_Cache */
|
||||
@ -29,7 +29,7 @@ require_once 'Zend/Server/Cache.php';
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Server
|
||||
* @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_Server_Cache extends Zend_Server_Cache
|
||||
|
@ -15,9 +15,9 @@
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Server
|
||||
* @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 9102 2008-03-30 20:27:03Z thomas $
|
||||
* @version $Id: Exception.php 16208 2009-06-21 19:19:26Z thomas $
|
||||
*/
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ require_once 'Zend/XmlRpc/Exception.php';
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Server
|
||||
* @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_Server_Exception extends Zend_XmlRpc_Exception
|
||||
|
@ -15,9 +15,9 @@
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Server
|
||||
* @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: Fault.php 9102 2008-03-30 20:27:03Z thomas $
|
||||
* @version $Id: Fault.php 16208 2009-06-21 19:19:26Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -44,7 +44,7 @@ require_once 'Zend/XmlRpc/Fault.php';
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Server
|
||||
* @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_Server_Fault extends Zend_XmlRpc_Fault
|
||||
|
@ -15,9 +15,9 @@
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Server
|
||||
* @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$
|
||||
* @version $Id: System.php 17803 2009-08-24 21:22:58Z matthew $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -26,7 +26,7 @@
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Server
|
||||
* @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_Server_System
|
||||
@ -70,7 +70,8 @@ class Zend_XmlRpc_Server_System
|
||||
{
|
||||
$table = $this->_server->getDispatchTable();
|
||||
if (!$table->hasMethod($method)) {
|
||||
throw new Zend_Server_Exception('Method "' . $method . '"does not exist', 640);
|
||||
require_once 'Zend/XmlRpc/Server/Exception.php';
|
||||
throw new Zend_XmlRpc_Server_Exception('Method "' . $method . '" does not exist', 640);
|
||||
}
|
||||
|
||||
return $table->getMethod($method)->getMethodHelp();
|
||||
@ -86,7 +87,8 @@ class Zend_XmlRpc_Server_System
|
||||
{
|
||||
$table = $this->_server->getDispatchTable();
|
||||
if (!$table->hasMethod($method)) {
|
||||
throw new Zend_Server_Exception('Method "' . $method . '"does not exist', 640);
|
||||
require_once 'Zend/XmlRpc/Server/Exception.php';
|
||||
throw new Zend_XmlRpc_Server_Exception('Method "' . $method . '" does not exist', 640);
|
||||
}
|
||||
$method = $table->getMethod($method)->toArray();
|
||||
return $method['prototypes'];
|
||||
@ -135,7 +137,13 @@ class Zend_XmlRpc_Server_System
|
||||
$request->setMethod($method['methodName']);
|
||||
$request->setParams($method['params']);
|
||||
$response = $this->_server->handle($request);
|
||||
$responses[] = $response->getReturnValue();
|
||||
if ($response instanceof Zend_XmlRpc_Fault
|
||||
|| $response->isFault()
|
||||
) {
|
||||
$fault = $response;
|
||||
} else {
|
||||
$responses[] = $response->getReturnValue();
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$fault = $this->_server->fault($e);
|
||||
}
|
||||
|
@ -15,44 +15,11 @@
|
||||
* @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: Value.php 13223 2008-12-14 11:21:31Z thomas $
|
||||
* @version $Id: Value.php 17786 2009-08-23 22:26:33Z lars $
|
||||
*/
|
||||
|
||||
/** Zend_XmlRpc_Value_Scalar */
|
||||
require_once 'Zend/XmlRpc/Value/Scalar.php';
|
||||
|
||||
/** Zend_XmlRpc_Value_Base64 */
|
||||
require_once 'Zend/XmlRpc/Value/Base64.php';
|
||||
|
||||
/** Zend_XmlRpc_Value_Boolean */
|
||||
require_once 'Zend/XmlRpc/Value/Boolean.php';
|
||||
|
||||
/** Zend_XmlRpc_Value_DateTime */
|
||||
require_once 'Zend/XmlRpc/Value/DateTime.php';
|
||||
|
||||
/** Zend_XmlRpc_Value_Double */
|
||||
require_once 'Zend/XmlRpc/Value/Double.php';
|
||||
|
||||
/** Zend_XmlRpc_Value_Integer */
|
||||
require_once 'Zend/XmlRpc/Value/Integer.php';
|
||||
|
||||
/** Zend_XmlRpc_Value_String */
|
||||
require_once 'Zend/XmlRpc/Value/String.php';
|
||||
|
||||
/** Zend_XmlRpc_Value_Nil */
|
||||
require_once 'Zend/XmlRpc/Value/Nil.php';
|
||||
|
||||
/** Zend_XmlRpc_Value_Collection */
|
||||
require_once 'Zend/XmlRpc/Value/Collection.php';
|
||||
|
||||
/** Zend_XmlRpc_Value_Array */
|
||||
require_once 'Zend/XmlRpc/Value/Array.php';
|
||||
|
||||
/** Zend_XmlRpc_Value_Struct */
|
||||
require_once 'Zend/XmlRpc/Value/Struct.php';
|
||||
|
||||
/**
|
||||
* Represent a native XML-RPC value entity, used as parameters for the methods
|
||||
* called by the Zend_XmlRpc_Client object and as the return value for those calls.
|
||||
@ -64,7 +31,7 @@ require_once 'Zend/XmlRpc/Value/Struct.php';
|
||||
* from PHP variables, XML string or by specifing the exact XML-RPC natvie type
|
||||
*
|
||||
* @package Zend_XmlRpc
|
||||
* @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
|
||||
@ -250,31 +217,38 @@ abstract class Zend_XmlRpc_Value
|
||||
// Break intentionally omitted
|
||||
case 'array':
|
||||
// Default native type for a PHP array (a simple numeric array) is 'array'
|
||||
require_once 'Zend/XmlRpc/Value/Array.php';
|
||||
$obj = 'Zend_XmlRpc_Value_Array';
|
||||
|
||||
// Determine if this is an associative array
|
||||
if (!empty($value) && is_array($value) && (array_keys($value) !== range(0, count($value) - 1))) {
|
||||
require_once 'Zend/XmlRpc/Value/Struct.php';
|
||||
$obj = 'Zend_XmlRpc_Value_Struct';
|
||||
}
|
||||
return new $obj($value);
|
||||
|
||||
case 'integer':
|
||||
require_once 'Zend/XmlRpc/Value/Integer.php';
|
||||
return new Zend_XmlRpc_Value_Integer($value);
|
||||
|
||||
case 'double':
|
||||
require_once 'Zend/XmlRpc/Value/Double.php';
|
||||
return new Zend_XmlRpc_Value_Double($value);
|
||||
|
||||
case 'boolean':
|
||||
require_once 'Zend/XmlRpc/Value/Boolean.php';
|
||||
return new Zend_XmlRpc_Value_Boolean($value);
|
||||
|
||||
case 'NULL':
|
||||
case 'null':
|
||||
require_once 'Zend/XmlRpc/Value/Nil.php';
|
||||
return new Zend_XmlRpc_Value_Nil();
|
||||
|
||||
case 'string':
|
||||
// Fall through to the next case
|
||||
default:
|
||||
// If type isn't identified (or identified as string), it treated as string
|
||||
require_once 'Zend/XmlRpc/Value/String.php';
|
||||
return new Zend_XmlRpc_Value_String($value);
|
||||
}
|
||||
}
|
||||
@ -283,17 +257,17 @@ abstract class Zend_XmlRpc_Value
|
||||
/**
|
||||
* Transform an XML string into a XML-RPC native value
|
||||
*
|
||||
* @param string|SimpleXMLElement $simple_xml A SimpleXMLElement object represent the XML string
|
||||
* @param string|SimpleXMLElement $xml A SimpleXMLElement object represent the XML string
|
||||
* It can be also a valid XML string for convertion
|
||||
*
|
||||
* @return Zend_XmlRpc_Value
|
||||
* @static
|
||||
*/
|
||||
private static function _xmlStringToNativeXmlRpc($simple_xml)
|
||||
private static function _xmlStringToNativeXmlRpc($xml)
|
||||
{
|
||||
if (!$simple_xml instanceof SimpleXMLElement) {
|
||||
if (!$xml instanceof SimpleXMLElement) {
|
||||
try {
|
||||
$simple_xml = @new SimpleXMLElement($simple_xml);
|
||||
$xml = @new SimpleXMLElement($xml);
|
||||
} catch (Exception $e) {
|
||||
// The given string is not a valid XML
|
||||
require_once 'Zend/XmlRpc/Value/Exception.php';
|
||||
@ -302,7 +276,7 @@ abstract class Zend_XmlRpc_Value
|
||||
}
|
||||
|
||||
// Get the key (tag name) and value from the simple xml object and convert the value to an XML-RPC native value
|
||||
list($type, $value) = each($simple_xml);
|
||||
list($type, $value) = each($xml);
|
||||
if (!$type) { // If no type was specified, the default is string
|
||||
$type = self::XMLRPC_TYPE_STRING;
|
||||
}
|
||||
@ -312,33 +286,33 @@ abstract class Zend_XmlRpc_Value
|
||||
case self::XMLRPC_TYPE_I4:
|
||||
// Fall through to the next case
|
||||
case self::XMLRPC_TYPE_INTEGER:
|
||||
require_once 'Zend/XmlRpc/Value/Integer.php';
|
||||
$xmlrpc_val = new Zend_XmlRpc_Value_Integer($value);
|
||||
break;
|
||||
case self::XMLRPC_TYPE_DOUBLE:
|
||||
require_once 'Zend/XmlRpc/Value/Double.php';
|
||||
$xmlrpc_val = new Zend_XmlRpc_Value_Double($value);
|
||||
break;
|
||||
case self::XMLRPC_TYPE_BOOLEAN:
|
||||
require_once 'Zend/XmlRpc/Value/Boolean.php';
|
||||
$xmlrpc_val = new Zend_XmlRpc_Value_Boolean($value);
|
||||
break;
|
||||
case self::XMLRPC_TYPE_STRING:
|
||||
require_once 'Zend/XmlRpc/Value/String.php';
|
||||
$xmlrpc_val = new Zend_XmlRpc_Value_String($value);
|
||||
break;
|
||||
case self::XMLRPC_TYPE_DATETIME: // The value should already be in a iso8601 format
|
||||
require_once 'Zend/XmlRpc/Value/DateTime.php';
|
||||
$xmlrpc_val = new Zend_XmlRpc_Value_DateTime($value);
|
||||
break;
|
||||
case self::XMLRPC_TYPE_BASE64: // The value should already be base64 encoded
|
||||
require_once 'Zend/XmlRpc/Value/Base64.php';
|
||||
$xmlrpc_val = new Zend_XmlRpc_Value_Base64($value ,true);
|
||||
break;
|
||||
case self::XMLRPC_TYPE_NIL: // The value should always be NULL
|
||||
$xmlrpc_val = new Zend_XmlRpc_Value_Nil();
|
||||
break;
|
||||
case self::XMLRPC_TYPE_ARRAY:
|
||||
// If the XML is valid, $value must be an SimpleXML element and contain the <data> tag
|
||||
if (!$value instanceof SimpleXMLElement) {
|
||||
require_once 'Zend/XmlRpc/Value/Exception.php';
|
||||
throw new Zend_XmlRpc_Value_Exception('XML string is invalid for XML-RPC native '. self::XMLRPC_TYPE_ARRAY .' type');
|
||||
}
|
||||
|
||||
// PHP 5.2.4 introduced a regression in how empty($xml->value)
|
||||
// returns; need to look for the item specifically
|
||||
$data = null;
|
||||
@ -359,26 +333,23 @@ abstract class Zend_XmlRpc_Value
|
||||
foreach ($data->value as $element) {
|
||||
$values[] = self::_xmlStringToNativeXmlRpc($element);
|
||||
}
|
||||
require_once 'Zend/XmlRpc/Value/Array.php';
|
||||
$xmlrpc_val = new Zend_XmlRpc_Value_Array($values);
|
||||
break;
|
||||
case self::XMLRPC_TYPE_STRUCT:
|
||||
// If the XML is valid, $value must be an SimpleXML
|
||||
if ((!$value instanceof SimpleXMLElement)) {
|
||||
require_once 'Zend/XmlRpc/Value/Exception.php';
|
||||
throw new Zend_XmlRpc_Value_Exception('XML string is invalid for XML-RPC native '. self::XMLRPC_TYPE_STRUCT .' type');
|
||||
}
|
||||
$values = array();
|
||||
// Parse all the memebers of the struct from the XML string
|
||||
// (simple xml element) to Zend_XmlRpc_Value objects
|
||||
foreach ($value->member as $member) {
|
||||
// @todo? If a member doesn't have a <value> tag, we don't add it to the struct
|
||||
// Maybe we want to throw an exception here ?
|
||||
if ((!$member->value instanceof SimpleXMLElement)) {
|
||||
if (!isset($member->value) or !isset($member->name)) {
|
||||
continue;
|
||||
//throw new Zend_XmlRpc_Value_Exception('Member of the '. self::XMLRPC_TYPE_STRUCT .' XML-RPC native type must contain a VALUE tag');
|
||||
}
|
||||
$values[(string)$member->name] = self::_xmlStringToNativeXmlRpc($member->value);
|
||||
}
|
||||
require_once 'Zend/XmlRpc/Value/Struct.php';
|
||||
$xmlrpc_val = new Zend_XmlRpc_Value_Struct($values);
|
||||
break;
|
||||
default:
|
||||
@ -386,7 +357,7 @@ abstract class Zend_XmlRpc_Value
|
||||
throw new Zend_XmlRpc_Value_Exception('Value type \''. $type .'\' parsed from the XML string is not a known XML-RPC native type');
|
||||
break;
|
||||
}
|
||||
$xmlrpc_val->_setXML($simple_xml->asXML());
|
||||
$xmlrpc_val->_setXML($xml->asXML());
|
||||
|
||||
return $xmlrpc_val;
|
||||
}
|
||||
@ -397,6 +368,26 @@ abstract class Zend_XmlRpc_Value
|
||||
$this->_as_xml = $xml;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Make sure a string will be safe for XML, convert risky characters to entities
|
||||
*
|
||||
* @param string $str
|
||||
* @return string
|
||||
*/
|
||||
protected function _escapeXmlEntities($str)
|
||||
{
|
||||
return htmlspecialchars($str, ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert XML entities into string values
|
||||
*
|
||||
* @param string $str
|
||||
* @return string
|
||||
*/
|
||||
protected function _decodeXmlEntities($str)
|
||||
{
|
||||
return html_entity_decode($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: 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