diff options
author | Andrew Dolgov <[email protected]> | 2013-04-12 08:18:43 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2013-04-12 08:18:43 +0400 |
commit | 79f9bef767ba0e0a35c8bf8411bb90feac35a551 (patch) | |
tree | c2a0fc927f6738ff27e26d8b08ea612ae9aad117 /plugins/example_api | |
parent | 5e725f9c8cde3d283ff15bc7e2d75d69b0cfb193 (diff) |
add support for plugins adding API methods
Diffstat (limited to 'plugins/example_api')
-rw-r--r-- | plugins/example_api/init.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/plugins/example_api/init.php b/plugins/example_api/init.php new file mode 100644 index 000000000..a5f34b865 --- /dev/null +++ b/plugins/example_api/init.php @@ -0,0 +1,31 @@ +<?php +class Example_Api extends Plugin { + + // Demonstrates adding a method to the API + // Plugin methods return an array containint + // 1. status (STATUS_OK or STATUS_ERR) + // 2. arbitrary payload + + private $link; + private $host; + + function about() { + return array(1.0, + "Example plugin adding an API method", + "fox", + true, + "http://tt-rss.org/"); + } + + function init($host) { + $this->link = $host->get_link(); + $this->host = $host; + + $host->add_api_method("example_testmethod", $this); + } + + function example_testmethod() { + return array(API::STATUS_OK, array("current_time" => time())); + } +} +?> |