2013-04-12 04:18:43 +00:00
|
|
|
<?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 $host;
|
|
|
|
|
|
|
|
function about() {
|
|
|
|
return array(1.0,
|
|
|
|
"Example plugin adding an API method",
|
|
|
|
"fox",
|
|
|
|
true,
|
|
|
|
"http://tt-rss.org/");
|
|
|
|
}
|
|
|
|
|
|
|
|
function init($host) {
|
|
|
|
$this->host = $host;
|
|
|
|
|
|
|
|
$host->add_api_method("example_testmethod", $this);
|
|
|
|
}
|
|
|
|
|
|
|
|
function example_testmethod() {
|
|
|
|
return array(API::STATUS_OK, array("current_time" => time()));
|
|
|
|
}
|
2013-04-19 13:31:56 +00:00
|
|
|
|
|
|
|
function api_version() {
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
2013-04-12 04:18:43 +00:00
|
|
|
}
|
|
|
|
?>
|