PluginItem::loadLanguage()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 1
dl 0
loc 15
rs 10
c 0
b 0
f 0
1
<?php namespace XoopsModules\Mymenus;
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
 * @copyright       XOOPS Project (https://xoops.org)
15
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU Public License
16
 * @package         Mymenus
17
 * @since           1.0
18
 * @author          trabis <[email protected]>
19
 */
20
21
use XoopsModules\Mymenus;
22
23
defined('XOOPS_ROOT_PATH') || die('Restricted access');
24
25
//require  dirname(__DIR__) . '/include/common.php';
26
xoops_load('XoopsLists');
0 ignored issues
show
Bug introduced by
The function xoops_load was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

26
/** @scrutinizer ignore-call */ 
27
xoops_load('XoopsLists');
Loading history...
27
28
29
/**
30
 * Class PluginItem
31
 */
32
class PluginItem
33
{
34
35
    /**
36
     * @param string $name
37
     *
38
     * @return mixed
39
     */
40
    public static function loadLanguage($name)
41
    {
42
        /** @var \XoopsModules\Mymenus\Helper $helper */
43
        $helper  = \XoopsModules\Mymenus\Helper::getInstance();
44
        $language = $GLOBALS['xoopsConfig']['language'];
45
        //        $path     = $GLOBALS['xoops']->path("modules/{$mymenus->dirname}/plugins/{$name}/language");
46
        //        if (!($ret = @require "{$path}/{$language}/{$name}.php")) {
47
        //            $ret = @require "{$path}/english/{$name}.php";
48
        //        }
49
        //        return $ret;
50
51
        $path2 = "{$helper->getDirname()}/plugins/{$name}/{$language}/";
52
        xoops_loadLanguage($name, $path2);
0 ignored issues
show
Bug introduced by
The function xoops_loadLanguage was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

52
        /** @scrutinizer ignore-call */ 
53
        xoops_loadLanguage($name, $path2);
Loading history...
53
54
        return true;
55
    }
56
}
57