Esempio n. 1
0
 /**
  * Determines the type of any XML-RPC value
  * @param mixed The XML-RPC value
  * @return string The type of the XML-RPC value
  */
 function getTypeFromValue(&$value)
 {
     require_once DOM_XMLRPC_INCLUDE_PATH . 'dom_xmlrpc_constants.php';
     $scalarType = dom_xmlrpc_utilities::getScalarTypeFromValue($value);
     if ($scalarType == '') {
         require_once DOM_XMLRPC_INCLUDE_PATH . 'dom_xmlrpc_struct.php';
         if (is_array($value)) {
             if (dom_xmlrpc_utilities::isAssociativeArray($value)) {
                 return DOM_XMLRPC_TYPE_STRUCT;
             } else {
                 return DOM_XMLRPC_TYPE_ARRAY;
             }
         } else {
             if (get_class($value) == 'dom_xmlrpc_struct') {
                 return DOM_XMLRPC_TYPE_STRUCT;
             } else {
                 if (is_object($value)) {
                     return DOM_XMLRPC_TYPE_STRUCT;
                 }
             }
         }
     } else {
         return $scalarType;
     }
 }
 /**
  * Converts PHP arrays to stdclass objects
  * @param array The PHP array
  * @return object A stdclass object
  */
 function &arraysToObjects(&$myArray)
 {
     foreach ($myArray as $key => $value) {
         $currItem =& $myArray[$key];
         if (is_array($currItem)) {
             $currItem =& $this->arraysToObjects($currItem);
         }
     }
     if (dom_xmlrpc_utilities::isAssociativeArray($myArray)) {
         $obj = new stdclass();
         foreach ($myArray as $key => $value) {
             $obj->{$key} =& $myArray[$value];
         }
         return $obj;
     } else {
         return $myArray;
     }
 }