summaryrefslogtreecommitdiff
path: root/classes/api.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2013-04-12 08:18:43 +0400
committerAndrew Dolgov <[email protected]>2013-04-12 08:18:43 +0400
commit79f9bef767ba0e0a35c8bf8411bb90feac35a551 (patch)
treec2a0fc927f6738ff27e26d8b08ea612ae9aad117 /classes/api.php
parent5e725f9c8cde3d283ff15bc7e2d75d69b0cfb193 (diff)
add support for plugins adding API methods
Diffstat (limited to 'classes/api.php')
-rw-r--r--classes/api.php15
1 files changed, 13 insertions, 2 deletions
diff --git a/classes/api.php b/classes/api.php
index aaeb86dcf..0fcd65eb3 100644
--- a/classes/api.php
+++ b/classes/api.php
@@ -464,8 +464,19 @@ class API extends Handler {
}
- function index() {
- print $this->wrap(self::STATUS_ERR, array("error" => 'UNKNOWN_METHOD'));
+ function index($method) {
+ global $pluginhost;
+
+ $plugin = $pluginhost->get_api_method(strtolower($method));
+
+ if ($plugin && method_exists($plugin, $method)) {
+ $reply = $plugin->$method();
+
+ print $this->wrap($reply[0], $reply[1]);
+
+ } else {
+ print $this->wrap(self::STATUS_ERR, array("error" => 'UNKNOWN_METHOD', "method" => $method));
+ }
}
function shareToPublished() {