aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/api.php33
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