Code Duplication    Length = 43-43 lines in 2 locations

class/Breadcrumb.php 1 location

@@ 31-73 (lines=43) @@
28
 * $breadcrumb->addLink( 'bread 3', 'index3.php' );
29
 * echo $breadcrumb->render();
30
 */
31
class Breadcrumb
32
{
33
    public  $dirname;
34
    private $bread = [];
35
36
    public function __construct()
37
    {
38
        $this->dirname = basename(dirname(__DIR__));
39
    }
40
41
    /**
42
     * Add link to breadcrumb
43
     *
44
     * @param string $title
45
     * @param string $link
46
     */
47
    public function addLink($title = '', $link = '')
48
    {
49
        $this->bread[] = [
50
            'link'  => $link,
51
            'title' => $title,
52
        ];
53
    }
54
55
    /**
56
     * Render xnewsletter BreadCrumb
57
     */
58
    public function render()
59
    {
60
        if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) {
61
            require_once $GLOBALS['xoops']->path('/class/theme.php');
62
            $GLOBALS['xoTheme'] = new \xos_opal_Theme();
63
        }
64
65
        require_once $GLOBALS['xoops']->path('class/template.php');
66
        $breadcrumbTpl = new \XoopsTpl();
67
        $breadcrumbTpl->assign('breadcrumb', $this->bread);
68
        $html = $breadcrumbTpl->fetch("db:{$this->dirname}_common_breadcrumb.tpl");
69
        unset($breadcrumbTpl);
70
71
        return $html;
72
    }
73
}
74

class/Common/Breadcrumb.php 1 location

@@ 37-79 (lines=43) @@
34
/**
35
 * Class Breadcrumb
36
 */
37
class Breadcrumb
38
{
39
    public  $dirname;
40
    private $bread = [];
41
42
    public function __construct()
43
    {
44
        $this->dirname = basename(dirname(dirname(__DIR__)));
45
    }
46
47
    /**
48
     * Add link to breadcrumb
49
     *
50
     * @param string $title
51
     * @param string $link
52
     */
53
    public function addLink($title = '', $link = '')
54
    {
55
        $this->bread[] = [
56
            'link'  => $link,
57
            'title' => $title,
58
        ];
59
    }
60
61
    /**
62
     * Render BreadCrumb
63
     */
64
    public function render()
65
    {
66
        if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) {
67
            require $GLOBALS['xoops']->path('class/theme.php');
68
            $GLOBALS['xoTheme'] = new \xos_opal_Theme();
69
        }
70
71
        require $GLOBALS['xoops']->path('class/template.php');
72
        $breadcrumbTpl = new \XoopsTpl();
73
        $breadcrumbTpl->assign('breadcrumb', $this->bread);
74
        $html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl');
75
        unset($breadcrumbTpl);
76
77
        return $html;
78
    }
79
}
80