web/lib/Zend/XmlRpc/Value.php
changeset 1230 68c69c656a2c
parent 807 877f952ae2bd
equal deleted inserted replaced
1229:5a6b6e770365 1230:68c69c656a2c
    13  * to license@zend.com so we can send you a copy immediately.
    13  * to license@zend.com so we can send you a copy immediately.
    14  *
    14  *
    15  * @category   Zend
    15  * @category   Zend
    16  * @package    Zend_XmlRpc
    16  * @package    Zend_XmlRpc
    17  * @subpackage Value
    17  * @subpackage Value
    18  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    18  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    20  * @version    $Id: Value.php 24593 2012-01-05 20:35:02Z matthew $
    20  * @version    $Id$
    21  */
    21  */
    22 
    22 
    23 /**
    23 /**
    24  * Represent a native XML-RPC value entity, used as parameters for the methods
    24  * Represent a native XML-RPC value entity, used as parameters for the methods
    25  * called by the Zend_XmlRpc_Client object and as the return value for those calls.
    25  * called by the Zend_XmlRpc_Client object and as the return value for those calls.
    29  *
    29  *
    30  * Using this function, users/Zend_XmlRpc_Client object can create the Zend_XmlRpc_Value objects
    30  * Using this function, users/Zend_XmlRpc_Client object can create the Zend_XmlRpc_Value objects
    31  * from PHP variables, XML string or by specifing the exact XML-RPC natvie type
    31  * from PHP variables, XML string or by specifing the exact XML-RPC natvie type
    32  *
    32  *
    33  * @package    Zend_XmlRpc
    33  * @package    Zend_XmlRpc
    34  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    34  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
    35  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    35  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    36  */
    36  */
    37 abstract class Zend_XmlRpc_Value
    37 abstract class Zend_XmlRpc_Value
    38 {
    38 {
    39     /**
    39     /**
   498                     break;
   498                     break;
   499                 }
   499                 }
   500             }
   500             }
   501         }
   501         }
   502 
   502 
       
   503         //if there is a child element, try to parse type for it
       
   504         if (!$type && $value instanceof SimpleXMLElement) {
       
   505             self::_extractTypeAndValue($value->children(), $type, $value);
       
   506         }
       
   507 
   503         // If no type was specified, the default is string
   508         // If no type was specified, the default is string
   504         if (!$type) {
   509         if (!$type) {
   505             $type = self::XMLRPC_TYPE_STRING;
   510             $type = self::XMLRPC_TYPE_STRING;
       
   511             if (preg_match('#^<value>.*</value>$#', $xml->asXML())) {
       
   512                 $value = str_replace(array('<value>', '</value>'), '', $xml->asXML());
       
   513             }
   506         }
   514         }
   507     }
   515     }
   508 
   516 
   509     /**
   517     /**
   510      * @param string $xml
   518      * @param string $xml