]> git.wh0rd.org - tt-rss.git/blob - plugins/example_api/init.php
a5f34b8652d92cb8982bb97ba89961bad9b99913
[tt-rss.git] / plugins / example_api / init.php
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
9 private $link;
10 private $host;
11
12 function about() {
13 return array(1.0,
14 "Example plugin adding an API method",
15 "fox",
16 true,
17 "http://tt-rss.org/");
18 }
19
20 function init($host) {
21 $this->link = $host->get_link();
22 $this->host = $host;
23
24 $host->add_api_method("example_testmethod", $this);
25 }
26
27 function example_testmethod() {
28 return array(API::STATUS_OK, array("current_time" => time()));
29 }
30 }
31 ?>