Passed
Pull Request — master (#27)
by Michael
29:26 queued 12:14
created

admin/menu.php (1 issue)

Labels
Severity
1
<?php declare(strict_types=1);
2
/*
3
 * You may not change or alter any portion of this comment or credits
4
 * of supporting developers from this source code or any supporting source code
5
 * which is considered copyrighted (c) material of the original comment or credit authors.
6
 *
7
 * This program is distributed in the hope that it will be useful,
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
 */
11
12
/**
13
 * @copyright      {@link https://xoops.org/ XOOPS Project}
14
 * @license        {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later}
15
 * @author         XOOPS Development Team
16
 */
17
18
use Xmf\Module\Admin;
19
use XoopsModules\News;
20
21
/** @var News\Helper $helper */
22
$moduleDirName      = \basename(\dirname(__DIR__));
23
$moduleDirNameUpper = \mb_strtoupper($moduleDirName);
24
25
$helper = News\Helper::getInstance();
26
$helper->loadLanguage('common');
27
$helper->loadLanguage('feedback');
28
29
$pathIcon32    = Admin::menuIconPath('');
30
$pathModIcon32 = XOOPS_URL . '/modules/' . $moduleDirName . '/assets/images/icons/32/';
31
if (is_object($helper->getModule()) && false !== $helper->getModule()->getInfo('modicons32')) {
32
    $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

32
    $pathModIcon32 = $helper->url(/** @scrutinizer ignore-type */ $helper->getModule()->getInfo('modicons32'));
Loading history...
33
}
34
35
$adminObject = [];
36
$adminmenu[] = [
37
    'title' => _MI_NEWS_HOME,
38
    'link'  => 'admin/index.php',
39
    'icon'  => $pathIcon32 . '/home.png',
40
];
41
42
$adminmenu[] = [
43
    'title' => _MI_NEWS_ADMENU2,
44
    'link'  => 'admin/index.php?op=topicsmanager',
45
    'icon'  => $pathIcon32 . '/category.png',
46
];
47
48
$adminmenu[] = [
49
    'title' => _MI_NEWS_ADMENU3,
50
    'link'  => 'admin/index.php?op=newarticle',
51
    'icon'  => $pathIcon32 . '/content.png',
52
];
53
54
$adminmenu[] = [
55
    'title' => _MI_NEWS_GROUPPERMS,
56
    'link'  => 'admin/groupperms.php',
57
    'icon'  => $pathIcon32 . '/permissions.png',
58
];
59
60
// Blocks Admin
61
$adminmenu[] = [
62
    'title' => _MI_NEWS_BLOCKS,
63
    'link'  => 'admin/blocksadmin.php',
64
    'icon'  => $pathIcon32 . '/block.png',
65
];
66
67
$adminmenu[] = [
68
    'title' => _MI_NEWS_PRUNENEWS,
69
    'link'  => 'admin/index.php?op=prune',
70
    'icon'  => $pathIcon32 . '/prune.png',
71
];
72
73
$adminmenu[] = [
74
    'title' => _MI_NEWS_EXPORT,
75
    'link'  => 'admin/index.php?op=export',
76
    'icon'  => $pathIcon32 . '/export.png',
77
];
78
79
$adminmenu[] = [
80
    'title' => _MI_NEWS_NEWSLETTER,
81
    'link'  => 'admin/index.php?op=configurenewsletter',
82
    'icon'  => $pathIcon32 . '/newsletter.png',
83
];
84
85
$adminmenu[] = [
86
    'title' => _MI_NEWS_STATS,
87
    'link'  => 'admin/index.php?op=stats',
88
    'icon'  => $pathIcon32 . '/stats.png',
89
];
90
91
if (isset($xoopsModule) && 167 != $xoopsModule->getVar('version')) {
92
    $adminmenu[] = [
93
        'title' => _MI_NEWS_UPGRADE,
94
        'link'  => 'admin/upgrade.php',
95
        'icon'  => $pathIcon32 . '/update.png',
96
    ];
97
}
98
99
$adminmenu[] = [
100
    'title' => _MI_NEWS_METAGEN,
101
    'link'  => 'admin/index.php?op=metagen',
102
    'icon'  => $pathIcon32 . '/metagen.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_NEWS_ABOUT,
115
    'link'  => 'admin/about.php',
116
    'icon'  => $pathIcon32 . '/about.png',
117
];
118