From 7426217e760601f684c402bf363a51bb8c79947c Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Tue, 31 Jul 2012 23:26:15 +0200 Subject: Fix /privatedata/getattribute route --- lib/api.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lib/api.php') diff --git a/lib/api.php b/lib/api.php index 203b07880fd..cf699f547f3 100644 --- a/lib/api.php +++ b/lib/api.php @@ -38,14 +38,16 @@ class OC_API { * @param callable $action the function to run * @param string $app the id of the app registering the call */ - public static function register($method, $url, $action, $app){ + public static function register($method, $url, $action, $app, + $defaults = array(), + $requirements = array()){ $name = strtolower($method).$url; $name = str_replace(array('/', '{', '}'), '_', $name); if(!isset(self::$actions[$name])){ OC::$router->create($name, $url.'.{_format}') ->method($method) - ->defaults(array('_format' => 'xml')) - ->requirements(array('_format' => 'xml|json')) + ->defaults(array('_format' => 'xml') + $defaults) + ->requirements(array('_format' => 'xml|json') + $requirements) ->action('OC_API', 'call'); self::$actions[$name] = array(); } @@ -112,7 +114,7 @@ class OC_API { private static function respond($response, $format='json'){ if ($format == 'json') { echo json_encode($response); - } else if ($format == 'xml') { + //} else if ($format == 'xml') { // TODO array to xml } else { var_dump($format, $response); -- cgit v1.2.3