]> git.wh0rd.org - tt-rss.git/blob - plugins/example_routing/init.php
31c5b6f284f67a1a7e29681bd400b4054df1d9f9
[tt-rss.git] / plugins / example_routing / init.php
1 <?php
2 class 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 //
12 // Any system method may be masked by plugins. You can mask
13 // entire handler by supplying "*" instead of a method name.
14
15 private $link;
16 private $host;
17
18 function about() {
19 return array(1.0,
20 "Example routing plugin",
21 "fox",
22 true);
23 }
24
25 function init($host) {
26 $this->link = $host->get_link();
27 $this->host = $host;
28
29 $host->add_handler("test", "example", $this);
30 $host->add_handler("public", "getunread", $this);
31 }
32
33 function getunread() {
34 print rand(0,100); # yeah right
35 }
36
37 function example() {
38 print "example method called";
39 }
40
41 function csrf_ignore($method) {
42 return true;
43 }
44
45 function before($method) {
46 return true;
47 }
48
49 function after() {
50 return true;
51 }
52
53 }
54 ?>