diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-09-24 15:27:02 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-09-24 15:27:02 +0000 |
commit | 4d979970cb5edeeec54f8bf593765679ff79e37a (patch) | |
tree | ad63012beb80415106cd3a20f744cd8d874c19f0 /engine | |
parent | 0bf17c03c2de8423045bf59b83d1e6d12ed7ca42 (diff) | |
download | elgg-4d979970cb5edeeec54f8bf593765679ff79e37a.tar.gz elgg-4d979970cb5edeeec54f8bf593765679ff79e37a.tar.bz2 |
Added endpoint page handler.
git-svn-id: https://code.elgg.org/elgg/trunk@2115 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r-- | engine/lib/api.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/engine/lib/api.php b/engine/lib/api.php index d9ef87f78..04a033825 100644 --- a/engine/lib/api.php +++ b/engine/lib/api.php @@ -1085,4 +1085,37 @@ ); } + // Initialisation & pagehandler /////////////////////////////////////////////////////////// + + function api_init() + { + // Register a page handler, so we can have nice URLs + register_page_handler('api','api_endpoint_handler'); + } + + function api_endpoint_handler($page) + { + global $CONFIG; + + // Which view + if ($page[1]) + { + elgg_set_viewtype($page[1]); + + } + + // Which endpoint + if ($page[0]) + { + switch ($page[0]) + { + case 'rest' : + default : include($CONFIG->path . "services/api/rest.php"); + } + } + } + + + register_elgg_event_handler('init','system','api_init'); + ?>
\ No newline at end of file |