init.php 601 B

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