b_adslight_add()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 17
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 17
rs 9.8666
c 0
b 0
f 0
cc 2
nc 2
nop 0
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    XOOPS Project (https://xoops.org)
14
 * @license      GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html)
15
 * @author       XOOPS Development Team
16
 * @author       Pascal Le Boustouller: original author ([email protected])
17
 * @author       Luc Bizet (www.frxoops.org)
18
 * @author       jlm69 (www.jlmzone.com)
19
 * @author       mamba (www.xoops.org)
20
 */
21
22
use XoopsModules\Adslight\Helper;
23
use XoopsModules\Adslight\Tree;
24
25
/** @var Helper $helper */
26
27
/**
28
 * @return array|false
29
 */
30
function b_adslight_add()
31
{
32
    if (!class_exists(Helper::class)) {
33
        return [];
34
    }
35
36
    $helper = Helper::getInstance();
0 ignored issues
show
Unused Code introduced by
The assignment to $helper is dead and can be removed.
Loading history...
37
    global $xoopsDB;
38
    $moduleDirName = \basename(\dirname(__DIR__));
39
    xoops_loadLanguage('main', $moduleDirName);
40
    $myTree = new Tree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
41
    $jump   = XOOPS_URL . '/modules/adslight/addlisting.php?cid=';
42
    ob_start();
43
    $myTree->makeMySelBox('title', 'title', 0, 1, 'pid', "location=\"{$jump}\"+this.options[this.selectedIndex].value");
44
    $block['selectbox'] = ob_get_clean();
0 ignored issues
show
Comprehensibility Best Practice introduced by
$block was never initialized. Although not strictly required by PHP, it is generally a good practice to add $block = array(); before regardless.
Loading history...
45
46
    return $block;
47
}
48