Passed
Pull Request — master (#18)
by Michael
04:31
created

User_language   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 80
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 80
rs 10
c 0
b 0
f 0
wmc 12
lcom 0
cbo 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A User_language() 0 3 1
A __construct() 0 3 1
B getUserbar() 0 56 10
1
<?php
2
/**
3
 * User Language Class (moved from 'main' language file)
4
 * @package   ::    newbb
5
 * @subpackage:: class
6
 */
7
8
require_once $GLOBALS['xoops']->path('modules/newbb/class/user.php');
9
10
/**
11
 *
12
 * Allows setting for user information
13
 * If you have a customized userbar, define it here.
14
 *
15
 */
16
class User_language extends User
17
{
18
19
    /**
20
     * User_language constructor.
21
     * @param $user
22
     */
23
    public function __construct($user)
24
    {
25
        parent::__construct($user);
26
    }
27
    /**
28
     * @param $user
29
     */
30
    public function User_language(&$user)
31
    {
32
        $this->__construct($user);
33
    }
34
35
    /**
36
     * @return array|null
37
     */
38
    public function &getUserbar()
39
    {
40
        global $xoopsModuleConfig, $xoopsUser, $isadmin;
41
        if (empty($GLOBALS['xoopsModuleConfig']['userbar_enabled'])) {
42
            return null;
43
        }
44
        $user      = $this->user;
45
        $userbar   = array();
46
        $userbar[] = array(
47
            'link' => $GLOBALS['xoops']->url('userinfo.php?uid=' . $user->getVar('uid')),
48
            'name' => PROFILE
0 ignored issues
show
Bug introduced by
The constant PROFILE was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
49
        );
50
        if (is_object($xoopsUser)) {
51
            $userbar[] = array(
52
                'link' => "javascript:void openWithSelfMain('" . XOOPS_URL . '/pmlite.php?send2=1&amp;to_userid=' . $user->getVar('uid') . "','pmlite', 450, 380);",
53
                'name' => _MD_PM
54
            );
55
        }
56
        if ($user->getVar('user_viewemail') || $isadmin) {
57
            $userbar[] = array(
58
                'link' => "javascript:void window.open('mailto:" . $user->getVar('email') . "','new');",
59
                'name' => _MD_EMAIL
60
            );
61
        }
62
        if ($user->getVar('url')) {
63
            $userbar[] = array(
64
                'link' => "javascript:void window.open('" . $user->getVar('url') . "','new');",
65
                'name' => _MD_WWW
66
            );
67
        }
68
        if ($user->getVar('user_icq')) {
69
            $userbar[] = array(
70
                'link' => "javascript:void window.open('http://wwp.icq.com/scripts/search.dll?to=" . $user->getVar('user_icq') . "','new');",
71
                'name' => _MD_ICQ
72
            );
73
        }
74
        if ($user->getVar('user_aim')) {
75
            $userbar[] = array(
76
                'link' => "javascript:void window.open('aim:goim?screenname=" . $user->getVar('user_aim') . '&amp;message=Hi+' . $user->getVar('user_aim') . '+Are+you+there?' . "','new');",
77
                'name' => _MD_AIM
78
            );
79
        }
80
        if ($user->getVar('user_yim')) {
81
            $userbar[] = array(
82
                'link' => "javascript:void window.open('http://edit.yahoo.com/config/send_webmesg?.target=" . $user->getVar('user_yim') . '&.src=pg' . "','new');",
83
                'name' => _MD_YIM
84
            );
85
        }
86
        if ($user->getVar('user_msnm')) {
87
            $userbar[] = array(
88
                'link' => "javascript:void window.open('http://members.msn.com?mem=" . $user->getVar('user_msnm') . "','new');",
89
                'name' => _MD_MSNM
90
            );
91
        }
92
93
        return $userbar;
94
    }
95
}
96