diff options
author | Bharat Mediratta <bharat@menalto.com> | 2010-01-19 01:33:57 -0800 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-01-19 01:33:57 -0800 |
commit | c590fed132b07647c38b1d5b4a93ffe30b6ac4bf (patch) | |
tree | 5033885b2775694a0971592549eb385225e49b4a /modules/rest/helpers/rest.php | |
parent | f95442c314f84004c48758579f076ae209aace43 (diff) |
Change rest::url() to take a module name and a resource. The module
does the rest. This function is symmetrical to rest::resolve.
Diffstat (limited to 'modules/rest/helpers/rest.php')
-rw-r--r-- | modules/rest/helpers/rest.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/modules/rest/helpers/rest.php b/modules/rest/helpers/rest.php index 423765bb..93ad2bd3 100644 --- a/modules/rest/helpers/rest.php +++ b/modules/rest/helpers/rest.php @@ -75,10 +75,14 @@ class rest_Core { /** * Return an absolute url used for REST resource location. * @param string module name (eg, "gallery", "tags") - * @param string relative path (eg "Family/Weddings.jpg") - * @return string complete url + * @param object resource */ - static function url($module, $path) { - return url::abs_site("rest/$module/$path"); + static function url($module, $resource) { + $class = "{$module}_rest"; + if (!method_exists($class, "url")) { + throw new Exception("@todo MISSING REST CLASS: $class"); + } + + return call_user_func(array($class, "url"), $resource); } } |