diff options
author | Tom Needham <needham.thomas@gmail.com> | 2013-01-24 10:39:33 +0000 |
---|---|---|
committer | Tom Needham <needham.thomas@gmail.com> | 2013-01-24 10:39:33 +0000 |
commit | 02f8c941f4cea9d4a116d5cc7e9239eabf4e6272 (patch) | |
tree | 62d9ce049708d55c7501addf52cc9e16035d2e06 /lib/api.php | |
parent | 8f9d3cd01d9cf253b88ac360c291bf361514742a (diff) | |
download | nextcloud-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.php | 11 |
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); } + } + } } |