1 | <?php |
---|
2 | |
---|
3 | /** |
---|
4 | * interface that represents a dwoo plugin proxy |
---|
5 | * |
---|
6 | * This software is provided 'as-is', without any express or implied warranty. |
---|
7 | * In no event will the authors be held liable for any damages arising from the use of this software. |
---|
8 | * |
---|
9 | * @author Denis Arh <denis@arh.cc> |
---|
10 | * @author Jordi Boggiano <j.boggiano@seld.be> |
---|
11 | * @copyright Copyright (c) 2008, Denis Arh, Jordi Boggiano |
---|
12 | * @license http://dwoo.org/LICENSE Modified BSD License |
---|
13 | * @link http://dwoo.org/ |
---|
14 | * @version 1.0.0 |
---|
15 | * @date 2008-10-23 |
---|
16 | * @package Dwoo |
---|
17 | */ |
---|
18 | interface Dwoo_IPluginProxy |
---|
19 | { |
---|
20 | /** |
---|
21 | * returns true or false to say whether the given plugin is handled by this proxy or not |
---|
22 | * |
---|
23 | * @param string $name the plugin name |
---|
24 | * @return bool true if the plugin is known and usable, otherwise false |
---|
25 | */ |
---|
26 | public function handles($name); |
---|
27 | |
---|
28 | /** |
---|
29 | * returns the code (as a string) to call the plugin |
---|
30 | * (this will be executed at runtime inside the Dwoo class) |
---|
31 | * |
---|
32 | * @param string $name the plugin name |
---|
33 | * @param array $params a parameter array, array key "*" is the rest array |
---|
34 | * @return string |
---|
35 | */ |
---|
36 | public function getCode($name, $params); |
---|
37 | |
---|
38 | /** |
---|
39 | * returns a callback to the plugin, this is used with the reflection API to |
---|
40 | * find out about the plugin's parameter names etc. |
---|
41 | * |
---|
42 | * should you need a rest array without the possibility to edit the |
---|
43 | * plugin's code, you can provide a callback to some |
---|
44 | * other function with the correct parameter signature, i.e. : |
---|
45 | * <code> |
---|
46 | * return array($this, "callbackHelper"); |
---|
47 | * // and callbackHelper would be as such: |
---|
48 | * public function callbackHelper(array $rest=array()){} |
---|
49 | * </code> |
---|
50 | * |
---|
51 | * @param string $name the plugin name |
---|
52 | * @return callback |
---|
53 | */ |
---|
54 | public function getCallback($name); |
---|
55 | |
---|
56 | /** |
---|
57 | * returns some code that will check if the plugin is loaded and if not load it |
---|
58 | * this is optional, if your plugins are autoloaded or whatever, just return an |
---|
59 | * empty string |
---|
60 | * |
---|
61 | * @param string $name the plugin name |
---|
62 | * @return string |
---|
63 | */ |
---|
64 | public function getLoader($name); |
---|
65 | } |
---|