]> git.wh0rd.org - tt-rss.git/blame - plugins/example_routing/init.php
remove $link
[tt-rss.git] / plugins / example_routing / init.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 14
8dcb2b47
AD
15 private $host;
16
d2a421e3 17 function about() {
7a866114
AD
18 return array(1.0,
19 "Example routing plugin",
de612e7a
AD
20 "fox",
21 true);
7a866114
AD
22 }
23
d2a421e3 24 function init($host) {
8dcb2b47
AD
25 $this->host = $host;
26
27 $host->add_handler("test", "example", $this);
28 $host->add_handler("public", "getunread", $this);
29 }
30
31 function getunread() {
32 print rand(0,100); # yeah right
33 }
34
35 function example() {
36 print "example method called";
37 }
38
39 function csrf_ignore($method) {
40 return true;
41 }
42
43 function before($method) {
44 return true;
45 }
46
47 function after() {
48 return true;
49 }
50
51}
52?>