|
1
|
|
|
<?php |
|
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 The XOOPS Project http://sourceforge.net/projects/xoops/ |
|
14
|
|
|
* @license http://www.fsf.org/copyleft/gpl.html GNU public license |
|
15
|
|
|
* @author trabis <[email protected]> |
|
16
|
|
|
*/ |
|
17
|
|
|
class SystemUsermenuPlugin implements UsermenuPluginInterface |
|
18
|
|
|
{ |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* @return array |
|
22
|
|
|
*/ |
|
23
|
|
|
public function usermenu() |
|
24
|
|
|
{ |
|
25
|
|
|
$xoops = \Xoops::getInstance(); |
|
26
|
|
|
$ret = array(); |
|
27
|
|
|
// View Account |
|
28
|
|
|
$ret[] = [ |
|
29
|
|
|
'name' => XoopsLocale::VIEW_ACCOUNT, |
|
30
|
|
|
'link' => $xoops->url('userinfo.php?uid=' . $xoops->user->getVar('uid')), |
|
31
|
|
|
'icon' => 'glyphicon-user', |
|
32
|
|
|
]; |
|
33
|
|
|
|
|
34
|
|
|
// Edit Account |
|
35
|
|
|
$ret[] = [ |
|
36
|
|
|
'name' => XoopsLocale::EDIT_ACCOUNT, |
|
37
|
|
|
'link' => $xoops->url('edituser.php'), |
|
38
|
|
|
'icon' => 'glyphicon-pencil', |
|
39
|
|
|
]; |
|
40
|
|
|
|
|
41
|
|
|
// Administration Menu |
|
42
|
|
|
if ($xoops->isAdmin()) { |
|
43
|
|
|
$ret[] = [ |
|
44
|
|
|
'name' => SystemLocale::ADMINISTRATION_MENU, |
|
45
|
|
|
'link' => $xoops->url('admin.php'), |
|
46
|
|
|
'icon' => 'glyphicon-wrench', |
|
47
|
|
|
]; |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
// Inbox |
|
51
|
|
|
if (!$xoops->isActiveModule('pm')) { |
|
52
|
|
|
$criteria = new CriteriaCompo(new Criteria('read_msg', 0)); |
|
53
|
|
|
$criteria->add(new Criteria('to_userid', $xoops->user->getVar('uid'))); |
|
54
|
|
|
$pm_handler = $xoops->getHandlerPrivateMessage(); |
|
55
|
|
|
$xoops->events()->triggerEvent('system.blocks.system_blocks.usershow', array(&$pm_handler)); |
|
56
|
|
|
|
|
57
|
|
|
$name = XoopsLocale::INBOX; |
|
58
|
|
View Code Duplication |
if ($pm_count = $pm_handler->getCount($criteria)) { |
|
|
|
|
|
|
59
|
|
|
$name = XoopsLocale::INBOX . ' <span class="badge">' . $pm_count . '</span>'; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
$ret[] = [ |
|
63
|
|
|
'name' => $name, |
|
64
|
|
|
'link' => $xoops->url('viewpmsg.php'), |
|
65
|
|
|
'icon' => 'glyphicon-envelope', |
|
66
|
|
|
]; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
// Logout |
|
70
|
|
|
$ret[] = [ |
|
71
|
|
|
'name' => XoopsLocale::A_LOGOUT, |
|
72
|
|
|
'link' => $xoops->url('user.php?op=logout'), |
|
73
|
|
|
'icon' => 'glyphicon-log-out', |
|
74
|
|
|
]; |
|
75
|
|
|
|
|
76
|
|
|
return $ret; |
|
77
|
|
|
} |
|
78
|
|
|
} |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: