Passed
Pull Request — master (#88)
by Michael
02:56
created

admin/menu.php (1 issue)

Labels
Severity
1
<?php declare(strict_types=1);
2
3
/**
4
 * TDMDownload
5
 *
6
 * You may not change or alter any portion of this comment or credits
7
 * of supporting developers from this source code or any supporting source code
8
 * which is considered copyrighted (c) material of the original comment or credit authors.
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
 *
13
 * @copyright   Gregory Mage (Aka Mage)
14
 * @license     GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
15
 * @author      Gregory Mage (Aka Mage)
16
 */
17
18
use Xmf\Module\Admin;
19
use XoopsModules\Tdmdownloads\Helper;
20
21
require dirname(__DIR__) . '/preloads/autoloader.php';
22
23
$moduleDirName      = basename(dirname(__DIR__));
24
$moduleDirNameUpper = mb_strtoupper($moduleDirName);
25
26
/** @var \XoopsModules\Tdmdownloads\Helper $helper */
27
$helper = Helper::getInstance();
28
$helper->loadLanguage('common');
29
$helper->loadLanguage('feedback');
30
31
$pathIcon32 = Admin::menuIconPath('');
32
if (is_object($helper->getModule())) {
33
//    $pathModIcon32 = $helper->getModule()->getInfo('modicons32');
34
    $pathModIcon32 = $helper->url($helper->getModule()->getInfo('modicons32'));
0 ignored issues
show
It seems like $helper->getModule()->getInfo('modicons32') can also be of type array; however, parameter $url of Xmf\Module\Helper\GenericHelper::url() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

34
    $pathModIcon32 = $helper->url(/** @scrutinizer ignore-type */ $helper->getModule()->getInfo('modicons32'));
Loading history...
35
}
36
37
$adminmenu[] = [
38
    'title' => _MI_TDMDOWNLOADS_ADMENU1,
39
    'link'  => 'admin/index.php',
40
//    'icon'  => "{$pathModIcon32}/home.png",
41
    'icon'  => 'assets/images/admin/home.png',
42
];
43
44
$adminmenu[] = [
45
    'title' => _MI_TDMDOWNLOADS_ADMENU2,
46
    'link'  => 'admin/category.php',
47
//    'icon'  => "{$pathModIcon32}/category.png",
48
    'icon'  => 'assets/images/admin/category.png',
49
];
50
51
$adminmenu[] = [
52
    'title' => _MI_TDMDOWNLOADS_ADMENU3,
53
    'link'  => 'admin/downloads.php',
54
//    'icon'  => "{$pathModIcon32}/downloads.png",
55
    'icon'  => 'assets/images/admin/downloads.png',
56
    //'menu' =>  "{$pathIcon32}/menu_downloads.png",
57
];
58
59
$adminmenu[] = [
60
    'title' => _MI_TDMDOWNLOADS_ADMENU4,
61
    'link'  => 'admin/broken.php',
62
//    'icon'  => "{$pathModIcon32}/broken.png",
63
    'icon'  => 'assets/images/admin/broken.png',
64
    //'menu' =>  "{$pathIcon32}/menu_broken.png",
65
];
66
67
$adminmenu[] = [
68
    'title' => _MI_TDMDOWNLOADS_ADMENU5,
69
    'link'  => 'admin/modified.php',
70
//    'icon'  => "{$pathModIcon32}/modified.png",
71
    'icon'  => 'assets/images/admin/modified.png',
72
    //'menu' =>  "{$pathIcon32}/menu_modified.png",
73
];
74
75
$adminmenu[] = [
76
    'title' => _MI_TDMDOWNLOADS_ADMENU6,
77
    'link'  => 'admin/field.php',
78
//    'icon'  => "{$pathModIcon32}/field.png",
79
    'icon'  => 'assets/images/admin/field.png',
80
    //'menu' =>  "{$pathIcon32}/menu_field.png",
81
];
82
83
$adminmenu[] = [
84
    'title' => _MI_TDMDOWNLOADS_ADMENU7,
85
    'link'  => 'admin/import.php',
86
//    'icon'  => "{$pathModIcon32}/import.png",
87
    'icon'  => 'assets/images/admin/import.png',
88
    //'menu' =>  "{$pathIcon32}/menu_import.png",
89
];
90
91
$adminmenu[] = [
92
    'title' => _MI_TDMDOWNLOADS_ADMENU8,
93
    'link'  => 'admin/permissions.php',
94
    'icon'  => "{$pathIcon32}/permissions.png",
95
    //'menu' =>  "{$pathIcon32}/menu_permissions.png",
96
];
97
98
// Blocks Admin
99
$adminmenu[] = [
100
    'title' => constant('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS'),
101
    'link'  => 'admin/blocksadmin.php',
102
    'icon'  => $pathIcon32 . '/block.png',
103
];
104
105
if (is_object($helper->getModule()) && $helper->getConfig('displayDeveloperTools')) {
106
    $adminmenu[] = [
107
        'title' => constant('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_MIGRATE'),
108
        'link'  => 'admin/migrate.php',
109
        'icon'  => $pathIcon32 . '/database_go.png',
110
    ];
111
}
112
113
$adminmenu[] = [
114
    'title' => _MI_TDMDOWNLOADS_ADMENU9,
115
    'link'  => 'admin/about.php',
116
    'icon'  => "{$pathIcon32}/about.png",
117
    //'menu' =>  "{$pathIcon32}/menu_about.png",
118
];
119