]>
Commit | Line | Data |
---|---|---|
79f9bef7 AD |
1 | <?php |
2 | class Example_Api extends Plugin { | |
3 | ||
4 | // Demonstrates adding a method to the API | |
5 | // Plugin methods return an array containint | |
6 | // 1. status (STATUS_OK or STATUS_ERR) | |
7 | // 2. arbitrary payload | |
8 | ||
79f9bef7 AD |
9 | private $host; |
10 | ||
11 | function about() { | |
12 | return array(1.0, | |
13 | "Example plugin adding an API method", | |
14 | "fox", | |
15 | true, | |
16 | "http://tt-rss.org/"); | |
17 | } | |
18 | ||
19 | function init($host) { | |
79f9bef7 AD |
20 | $this->host = $host; |
21 | ||
22 | $host->add_api_method("example_testmethod", $this); | |
23 | } | |
24 | ||
25 | function example_testmethod() { | |
26 | return array(API::STATUS_OK, array("current_time" => time())); | |
27 | } | |
28 | } | |
29 | ?> |