function services_admin_browse_test_unserialize_args in Services 6.2
Same name and namespace in other branches
- 5 services_admin_browse.inc \services_admin_browse_test_unserialize_args()
- 6 services_admin_browse.inc \services_admin_browse_test_unserialize_args()
- 7 services_admin_browse.inc \services_admin_browse_test_unserialize_args()
1 call to services_admin_browse_test_unserialize_args()
- services_admin_browse_test_submit in ./
services_admin_browse.inc - Submit callback for services_admin_browse_test().
File
- ./
services_admin_browse.inc, line 193 - Browser thru all services and servers.
Code
function services_admin_browse_test_unserialize_args($values, $formats) {
$return = array();
$method = services_method_get(arg(4));
$noskip = FALSE;
// Convert args
for ($c = count($method['args']) - 1; $c >= 0; $c--) {
$arg = $method['args'][$c];
$value = $values[$c];
// Remove empty values from end of array
// Once we find a value, we can no longer skip
if (!is_numeric($value) && empty($value) && !$noskip) {
continue;
}
$noskip = TRUE;
switch ($formats[$c]) {
case 'cdel':
if (empty($value)) {
$return[$c] = NULL;
}
else {
$return[$c] = split(',', $value);
}
break;
case 'json':
if (empty($value)) {
$return[$c] = NULL;
}
else {
$return[$c] = json_decode($value, $arg['type'] === 'array');
}
break;
case 'sphp':
if (empty($value)) {
$return[$c] = NULL;
}
else {
$return[$c] = unserialize($value);
}
break;
default:
$return[$c] = $value;
}
}
if ($return) {
ksort($return);
}
return $return;
}