Passed
Push — master ( 7331d1...59e477 )
by Goffy
05:28
created

Files/Templates/Admin/TemplatesAdminFooter.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace XoopsModules\Modulebuilder\Files\Templates\Admin;
4
5
use XoopsModules\Modulebuilder;
6
use XoopsModules\Modulebuilder\Files;
7
8
/*
9
 You may not change or alter any portion of this comment or credits
10
 of supporting developers from this source code or any supporting source code
11
 which is considered copyrighted (c) material of the original comment or credit authors.
12
13
 This program is distributed in the hope that it will be useful,
14
 but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
 */
17
/**
18
 * modulebuilder module.
19
 *
20
 * @copyright       XOOPS Project (https://xoops.org)
21
 * @license         GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
22
 *
23
 * @since           2.5.0
24
 *
25
 * @author          Txmod Xoops https://xoops.org 
26
 *                  Goffy https://myxoops.org
27
 *
28
 */
29
30
/**
31
 * Class TemplatesAdminFooter.
32
 */
33
class TemplatesAdminFooter extends Files\CreateFile
34
{
35
    /**
36
     * @var mixed
37
     */
38
    private $hc = null;
39
40
    /**
41
     * @var mixed
42
     */
43
    private $sc = null;
44
45
    /**
46
     * @public function constructor
47
     * @param null
48
     */
49
    public function __construct()
50
    {
51
        parent::__construct();
52
        $this->hc = Modulebuilder\Files\CreateHtmlCode::getInstance();
53
        $this->sc = Modulebuilder\Files\CreateSmartyCode::getInstance();
54
    }
55
56
    /**
57
     * @static   function getInstance
58
     * @return TemplatesAdminFooter
59
     */
60
    public static function getInstance()
61
    {
62
        static $instance = false;
63
        if (!$instance) {
64
            $instance = new self();
65
        }
66
67
        return $instance;
68
    }
69
70
    /**
71
     * @public function write
72
     * @param string $module
73
     * @param string $filename
74
     */
75
    public function write($module, $filename)
76
    {
77
        $this->setModule($module);
78
        $this->setFileName($filename);
79
    }
80
81
    /**
82
     * @public function render
83
     * @param null
84
     * @return bool|string
85
     */
86
    public function render()
87
    {
88
        $module        = $this->getModule();
89
        $filename      = $this->getFileName();
90
        $moduleName    = $module->getVar('mod_name');
91
        $moduleDirname = $module->getVar('mod_dirname');
92
        $supportName   = $module->getVar('mod_support_name');
93
        $language      = $this->getLanguage($moduleDirname, 'AM', '', false);
0 ignored issues
show
false of type false is incompatible with the type string expected by parameter $addFq of XoopsModules\Modulebuild...eateFile::getLanguage(). ( Ignorable by Annotation )

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

93
        $language      = $this->getLanguage($moduleDirname, 'AM', '', /** @scrutinizer ignore-type */ false);
Loading history...
94
        $singleNoVar = $this->sc->getSmartyNoSimbol('xoModuleIcons32 xoopsmicrobutton.gif');
95
        $img         = $this->hc->getHtmlTag('img', ['src' => $singleNoVar, 'alt' => 'XOOPS'], '', true, '','');
96
        $anchor      = $this->hc->getHtmlTag('a', ['href' => 'https://xoops.org/', 'title' => 'Visit XOOPS', 'target' => '_blank'], $img) ;
97
        $content     = $this->hc->getHtmlTag('div', ['class' => 'center'], "\n\t" . $anchor);
98
        $tree        = $this->hc->getHtmlTag('strong', [], $moduleName, false, '', '');
99
        $tree        .= $this->sc->getSmartyConst($language, 'MAINTAINEDBY');
100
        $tree        .= $this->hc->getHtmlTag('a', ['href' => '<{$maintainedby}>', 'title' => 'Visit ' . $supportName, 'class' => 'tooltip', 'rel' => 'external'], $supportName);
101
        $content     .= $this->hc->getHtmlTag('div', ['class' => 'center smallsmall italic pad5'], "\n\t" . $tree);
102
103
        $this->create($moduleDirname, 'templates/admin', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED);
104
105
        return $this->renderFile();
106
    }
107
}
108