]>
Commit | Line | Data |
---|---|---|
8dcb2b47 AD |
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. | |
13 | ||
14 | private $link; | |
15 | private $host; | |
16 | ||
17 | function __construct($host) { | |
18 | $this->link = $host->get_link(); | |
19 | $this->host = $host; | |
20 | ||
21 | $host->add_handler("test", "example", $this); | |
22 | $host->add_handler("public", "getunread", $this); | |
23 | } | |
24 | ||
25 | function getunread() { | |
26 | print rand(0,100); # yeah right | |
27 | } | |
28 | ||
29 | function example() { | |
30 | print "example method called"; | |
31 | } | |
32 | ||
33 | function csrf_ignore($method) { | |
34 | return true; | |
35 | } | |
36 | ||
37 | function before($method) { | |
38 | return true; | |
39 | } | |
40 | ||
41 | function after() { | |
42 | return true; | |
43 | } | |
44 | ||
45 | } | |
46 | ?> |