Quick fix to PR #2682

This commit is contained in:
fabrixxm 2016-08-02 12:24:07 +02:00
parent 0f4e57fb95
commit 87fb0b7b26
2 changed files with 18 additions and 12 deletions

View file

@ -768,6 +768,7 @@
} }
$data3 = array($root_element => $data2); $data3 = array($root_element => $data2);
$ret = xml::from_array($data3, $xml, false, $namespaces); $ret = xml::from_array($data3, $xml, false, $namespaces);
return $ret; return $ret;
} }
@ -2377,9 +2378,9 @@
$res = array(); $res = array();
$uri = $item['uri']."-l"; $uri = $item['uri']."-l";
foreach($activities as $k => $v) { foreach($activities as $k => $v) {
$res[$k] = ( x($v,$uri) ? array_map("api_contactlink_to_array", $v[$uri]) : array() ); $res[$k] = (x($v,$uri)?count($v[$uri]):0);
#$res[$k] = ( x($v,$uri) ? array_map("api_contactlink_to_array", $v[$uri]) : array() );
} }
return $res; return $res;
} }

View file

@ -51,8 +51,13 @@ class xml {
$element = $xml; $element = $xml;
if (is_integer($key)) { if (is_integer($key)) {
if (isset($element)) if (isset($element)) {
$element[0] = $value; if (is_scalar($value)) {
$element[0] = $value;
} else {
/// @todo: handle nested array values
}
}
continue; continue;
} }