|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
You may not change or alter any portion of this comment or credits |
|
5
|
|
|
of supporting developers from this source code or any supporting source code |
|
6
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
|
7
|
|
|
|
|
8
|
|
|
This program is distributed in the hope that it will be useful, |
|
9
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* Module: randomquote |
|
15
|
|
|
* |
|
16
|
|
|
* @category Module |
|
17
|
|
|
* @package randomquote |
|
18
|
|
|
* @author XOOPS Development Team <[email protected]> - <https://xoops.org> |
|
19
|
|
|
* @copyright {@link https://xoops.org/ XOOPS Project} |
|
20
|
|
|
* @license GPL 2.0 or later |
|
21
|
|
|
* @link https://xoops.org/ |
|
22
|
|
|
* @since 1.0.0 |
|
23
|
|
|
*/ |
|
24
|
|
|
|
|
25
|
|
|
use Xoopsmodules\randomquote; |
|
|
|
|
|
|
26
|
|
|
|
|
27
|
|
|
include __DIR__ . '/../preloads/autoloader.php'; |
|
28
|
|
|
|
|
29
|
|
|
$helper = randomquote\Helper::getInstance(); |
|
30
|
|
|
|
|
31
|
|
|
// get path to icons |
|
32
|
|
|
$pathIcon32 = \Xmf\Module\Admin::menuIconPath(''); |
|
33
|
|
|
$pathModIcon32 = $helper->getModule()->getInfo('modicons32'); |
|
34
|
|
|
$adminObject = \Xmf\Module\Admin::getInstance(); |
|
35
|
|
|
|
|
36
|
|
|
$adminmenu[] = [ |
|
37
|
|
|
'title' => MI_RANDOMQUOTE_ADMENU1, |
|
38
|
|
|
'link' => 'admin/index.php', |
|
39
|
|
|
'icon' => "{$pathIcon32}/home.png" |
|
40
|
|
|
]; |
|
41
|
|
|
|
|
42
|
|
|
$adminmenu[] = [ |
|
43
|
|
|
'title' => MI_RANDOMQUOTE_ADMENU2, |
|
44
|
|
|
'link' => 'admin/quotes.php', |
|
45
|
|
|
'icon' => "{$pathIcon32}/insert_table_row.png" |
|
46
|
|
|
]; |
|
47
|
|
|
|
|
48
|
|
|
$adminmenu[] = [ |
|
49
|
|
|
'title' => MI_RANDOMQUOTE_ADMENU3, |
|
50
|
|
|
'link' => 'admin/category.php', |
|
51
|
|
|
'icon' => "{$pathIcon32}/category.png" |
|
52
|
|
|
]; |
|
53
|
|
|
|
|
54
|
|
|
$adminmenu[] = [ |
|
55
|
|
|
'title' => MI_RANDOMQUOTE_ADMENU4, |
|
56
|
|
|
'link' => 'admin/permissions.php', |
|
57
|
|
|
'icon' => "{$pathIcon32}/permissions.png" |
|
58
|
|
|
]; |
|
59
|
|
|
|
|
60
|
|
|
$adminmenu[] = [ |
|
61
|
|
|
'title' => MI_RANDOMQUOTE_ADMENU5, |
|
62
|
|
|
'link' => 'admin/about.php', |
|
63
|
|
|
'icon' => "{$pathIcon32}/about.png" |
|
64
|
|
|
]; |
|
65
|
|
|
|
Let’s assume that you have a directory layout like this:
. |-- OtherDir | |-- Bar.php | `-- Foo.php `-- SomeDir `-- Foo.phpand let’s assume the following content of
Bar.php:If both files
OtherDir/Foo.phpandSomeDir/Foo.phpare 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.phpHowever, as
OtherDir/Foo.phpdoes 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: