summaryrefslogtreecommitdiff
path: root/plugins/example_api/init.php
blob: a5f34b8652d92cb8982bb97ba89961bad9b99913 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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()));
	}
}
?>