1 | <?php |
||
24 | class XoopsXmlRpcApi |
||
25 | { |
||
26 | |||
27 | // reference to method parameters |
||
28 | protected $params; |
||
29 | |||
30 | // reference to xmlrpc document class object |
||
31 | /** |
||
32 | * @var XoopsXmlRpcResponse |
||
33 | */ |
||
34 | protected $response; |
||
35 | |||
36 | // reference to module class object |
||
37 | /** |
||
38 | * @var XoopsModule |
||
39 | */ |
||
40 | protected $module; |
||
41 | |||
42 | // map between xoops tags and blogger specific tags |
||
43 | protected $xoopsTagMap = array(); |
||
44 | |||
45 | // user class object |
||
46 | protected $user; |
||
47 | |||
48 | protected $isadmin = false; |
||
49 | |||
50 | /** |
||
51 | * @param $params |
||
52 | * @param $response |
||
53 | * @param $module |
||
54 | */ |
||
55 | 17 | public function __construct(&$params, &$response, &$module) |
|
61 | |||
62 | /** |
||
63 | * @param $user |
||
64 | * @param bool $isadmin |
||
65 | */ |
||
66 | 2 | public function _setUser(&$user, $isadmin = false) |
|
73 | |||
74 | /** |
||
75 | * @param $username |
||
76 | * @param $password |
||
77 | * |
||
78 | * @return bool |
||
79 | */ |
||
80 | 1 | public function _checkUser($username, $password) |
|
97 | |||
98 | /** |
||
99 | * @return bool |
||
100 | */ |
||
101 | 1 | public function _checkAdmin() |
|
115 | |||
116 | /** |
||
117 | * @param null $post_id |
||
118 | * @param null $blog_id |
||
119 | * |
||
120 | * @return array |
||
121 | */ |
||
122 | 1 | public function &_getPostFields($post_id = null, $blog_id = null) |
|
146 | |||
147 | /** |
||
148 | * @param string $xoopstag |
||
149 | * @param string $blogtag |
||
150 | */ |
||
151 | 8 | public function _setXoopsTagMap($xoopstag, $blogtag) |
|
157 | |||
158 | /** |
||
159 | * @param $xoopstag |
||
160 | * |
||
161 | * @return mixed |
||
162 | */ |
||
163 | 1 | public function _getXoopsTagMap($xoopstag) |
|
171 | |||
172 | /** |
||
173 | * @param $text |
||
174 | * @param $tag |
||
175 | * @param bool $remove |
||
176 | * |
||
177 | * @return string |
||
178 | */ |
||
179 | 1 | public function _getTagCdata(&$text, $tag, $remove = true) |
|
192 | |||
193 | // kind of dirty method to load XOOPS API and create a new object thereof |
||
194 | // returns itself if the calling object is XOOPS API |
||
195 | /** |
||
196 | * @param $params |
||
197 | * |
||
198 | * @return XoopsApi |
||
199 | */ |
||
200 | 1 | public function _getXoopsApi(&$params) |
|
210 | } |
||
211 |
Let’s assume that you have a directory layout like this:
and let’s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: