summaryrefslogtreecommitdiffstats
path: root/lib/api.php
diff options
context:
space:
mode:
authorTom Needham <needham.thomas@gmail.com>2013-01-24 10:39:33 +0000
committerTom Needham <needham.thomas@gmail.com>2013-01-24 10:39:33 +0000
commit02f8c941f4cea9d4a116d5cc7e9239eabf4e6272 (patch)
tree62d9ce049708d55c7501addf52cc9e16035d2e06 /lib/api.php
parent8f9d3cd01d9cf253b88ac360c291bf361514742a (diff)
downloadnextcloud-server-02f8c941f4cea9d4a116d5cc7e9239eabf4e6272.tar.gz
nextcloud-server-02f8c941f4cea9d4a116d5cc7e9239eabf4e6272.zip
API: If key begins with '@' treat it as an xml attribute
Diffstat (limited to 'lib/api.php')
-rw-r--r--lib/api.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/api.php b/lib/api.php
index 64b2f0fe9c1..47318d4ae1c 100644
--- a/lib/api.php
+++ b/lib/api.php
@@ -188,18 +188,25 @@ class OC_API {
}
private static function toXML($array, $writer) {
+
foreach($array as $k => $v) {
- if (is_numeric($k)) {
+ if (substr($k, 0, 1) === '@') {
+ $writer->writeAttribute(substr($k, 1), $v);
+ continue;
+ } else if (is_numeric($k)) {
$k = 'element';
}
- if (is_array($v)) {
+
+ if(is_array($v)) {
$writer->startElement($k);
self::toXML($v, $writer);
$writer->endElement();
} else {
$writer->writeElement($k, $v);
}
+
}
+
}
}