Line | |
---|
1 | <?php |
---|
2 | # -- BEGIN LICENSE BLOCK --------------------------------------- |
---|
3 | # |
---|
4 | # This file is part of Dotclear 2. |
---|
5 | # |
---|
6 | # Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear |
---|
7 | # Licensed under the GPL version 2.0 license. |
---|
8 | # See LICENSE file or |
---|
9 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
10 | # |
---|
11 | # -- END LICENSE BLOCK ----------------------------------------- |
---|
12 | if (!defined('DC_RC_PATH')) { return; } |
---|
13 | |
---|
14 | /** |
---|
15 | @ingroup DC_CORE |
---|
16 | @brief Dotclear REST server extension |
---|
17 | |
---|
18 | This class extends restServer to handle dcCore instance in each rest method call. |
---|
19 | Instance of this class is provided by dcCore $rest. |
---|
20 | */ |
---|
21 | class dcRestServer extends restServer |
---|
22 | { |
---|
23 | public $core; ///< dcCore instance |
---|
24 | |
---|
25 | /** |
---|
26 | Object constructor. |
---|
27 | |
---|
28 | @param core <b>dcCore</b> dcCore instance |
---|
29 | */ |
---|
30 | public function __construct($core) |
---|
31 | { |
---|
32 | parent::__construct(); |
---|
33 | |
---|
34 | $this->core =& $core; |
---|
35 | } |
---|
36 | |
---|
37 | /** |
---|
38 | Rest method call. |
---|
39 | |
---|
40 | @param name <b>string</b> Method name |
---|
41 | @param get <b>array</b> GET parameters copy |
---|
42 | @param post <b>array</b> POST parameters copy |
---|
43 | @return <b>mixed</b> Rest method result |
---|
44 | */ |
---|
45 | protected function callFunction($name,$get,$post) |
---|
46 | { |
---|
47 | if (isset($this->functions[$name])) { |
---|
48 | return call_user_func($this->functions[$name],$this->core,$get,$post); |
---|
49 | } |
---|
50 | } |
---|
51 | } |
---|
52 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.