You are here

function xmlrpc_value in Drupal 6

Same name and namespace in other branches
  1. 4 includes/xmlrpc.inc \xmlrpc_value()
  2. 5 includes/xmlrpc.inc \xmlrpc_value()
  3. 7 includes/xmlrpc.inc \xmlrpc_value()

Recursively turn a data structure into objects with 'data' and 'type' attributes.

Parameters

$data: The data structure.

$type: Optional type assign to $data.

Return value

Object.

2 calls to xmlrpc_value()
xmlrpc_request in includes/xmlrpc.inc
Construct an object representing an XML-RPC request
xmlrpc_server in includes/xmlrpcs.inc
The main entry point for XML-RPC requests.

File

includes/xmlrpc.inc, line 22
Drupal XML-RPC library. Based on the IXR - The Incutio XML-RPC Library - (c) Incutio Ltd 2002-2005 Version 1.7 (beta) - Simon Willison, 23rd May 2005 Site: http://scripts.incutio.com/xmlrpc/ Manual: http://scripts.incutio.com/xmlrpc/manual.php This…

Code

function xmlrpc_value($data, $type = FALSE) {
  $xmlrpc_value = new stdClass();
  $xmlrpc_value->data = $data;
  if (!$type) {
    $type = xmlrpc_value_calculate_type($xmlrpc_value);
  }
  $xmlrpc_value->type = $type;
  if ($type == 'struct') {

    // Turn all the values in the array into new xmlrpc_values
    foreach ($xmlrpc_value->data as $key => $value) {
      $xmlrpc_value->data[$key] = xmlrpc_value($value);
    }
  }
  if ($type == 'array') {
    for ($i = 0, $j = count($xmlrpc_value->data); $i < $j; $i++) {
      $xmlrpc_value->data[$i] = xmlrpc_value($xmlrpc_value->data[$i]);
    }
  }
  return $xmlrpc_value;
}