Issues (584)

class/Common/Breadcrumb.php (2 issues)

Labels
Severity
1
<?php
2
3
namespace XoopsModules\Wggithub\Common;
4
5
/*
6
 You may not change or alter any portion of this comment or credits
7
 of supporting developers from this source code or any supporting source code
8
 which is considered copyrighted (c) material of the original comment or credit authors.
9
10
 This program is distributed in the hope that it will be useful,
11
 but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
 */
14
15
/**
16
 * Breadcrumb Class
17
 *
18
 * @copyright   The XOOPS Project http://sourceforge.net/projects/xoops/
19
 * @license     http://www.fsf.org/copyleft/gpl.html GNU public license
20
 * @author      lucio <[email protected]>
21
 * @package     Wggithub
22
 *
23
 * Example:
24
 * $breadcrumb = new Common\Breadcrumb();
25
 * $breadcrumb->addLink( 'bread 1', 'index1.php' );
26
 * $breadcrumb->addLink( 'bread 2', '' );
27
 * $breadcrumb->addLink( 'bread 3', 'index3.php' );
28
 * echo $breadcrumb->render();
29
 */
30
31
use XoopsModules\Wggithub;
32
use XoopsModules\Wggithub\Common;
33
34
\defined('XOOPS_ROOT_PATH') || exit('XOOPS Root Path not defined');
35
36
/**
37
 * Class Breadcrumb
38
 */
39
class Breadcrumb
40
{
41
    public  $dirname;
42
    private $bread = [];
43
44
    public function __construct()
45
    {
46
        $this->dirname = \basename(\dirname(__DIR__, 2));
47
    }
48
49
    /**
50
     * Add link to breadcrumb
51
     *
52
     * @param string $title
53
     * @param string $link
54
     */
55
    public function addLink($title = '', $link = '')
56
    {
57
        $this->bread[] = [
58
            'link'  => $link,
59
            'title' => $title,
60
        ];
61
    }
62
63
    /**
64
     * Render BreadCrumb
65
     */
66
    public function render()
67
    {
68
        if (!isset($GLOBALS['xoTheme']) || !\is_object($GLOBALS['xoTheme'])) {
69
            require $GLOBALS['xoops']->path('class/theme.php');
70
            $GLOBALS['xoTheme'] = new \xos_opal_Theme();
0 ignored issues
show
The type xos_opal_Theme was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
71
        }
72
73
        require $GLOBALS['xoops']->path('class/template.php');
74
        $breadcrumbTpl = new \XoopsTpl();
0 ignored issues
show
The type XoopsTpl was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
75
        $breadcrumbTpl->assign('breadcrumb', $this->bread);
76
        $html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl');
77
        unset($breadcrumbTpl);
78
79
        return $html;
80
    }
81
}
82