]> git.wh0rd.org - tt-rss.git/blame - plugins/example_routing/example_routing.php
add -list-plugins option; about sections to plugins
[tt-rss.git] / plugins / example_routing / example_routing.php
CommitLineData
8dcb2b47
AD
1<?php
2class Example_Routing extends Plugin implements IHandler {
3
4 // Demonstrates adding a custom handler and method:
5 // backend.php?op=test&method=example
6 // and masking a system builtin public method:
7 // public.php?op=getUnread
8
9 // Plugin class must implelement IHandler interface and has
10 // a public method of same name as being registered.
11 //
6cbe53c9
AD
12 // Any system method may be masked by plugins. You can mask
13 // entire handler by supplying "*" instead of a method name.
8dcb2b47
AD
14
15 private $link;
16 private $host;
17
7a866114
AD
18 function _about() {
19 return array(1.0,
20 "Example routing plugin",
21 "fox");
22 }
23
8dcb2b47
AD
24 function __construct($host) {
25 $this->link = $host->get_link();
26 $this->host = $host;
27
28 $host->add_handler("test", "example", $this);
29 $host->add_handler("public", "getunread", $this);
30 }
31
32 function getunread() {
33 print rand(0,100); # yeah right
34 }
35
36 function example() {
37 print "example method called";
38 }
39
40 function csrf_ignore($method) {
41 return true;
42 }
43
44 function before($method) {
45 return true;
46 }
47
48 function after() {
49 return true;
50 }
51
52}
53?>