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

class/Files/Templates/User/Defstyle/Footer.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace XoopsModules\Modulebuilder\Files\Templates\User\Defstyle;
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 Footer.
32
 */
33
class Footer extends Files\CreateFile
34
{
35
36
    /**
37
     * @var mixed
38
     */
39
    private $hc = null;
40
41
    /**
42
     * @var mixed
43
     */
44
    private $sc = null;
45
46
    /**
47
     * @public function constructor
48
     * @param null
49
     */
50
    public function __construct()
51
    {
52
        parent::__construct();
53
        $this->hc = Modulebuilder\Files\CreateHtmlCode::getInstance();
54
        $this->sc = Modulebuilder\Files\CreateSmartyCode::getInstance();
55
    }
56
57
    /**
58
     * @static function getInstance
59
     * @param null
60
     * @return Footer
61
     */
62
    public static function getInstance()
63
    {
64
        static $instance = false;
65
        if (!$instance) {
66
            $instance = new self();
67
        }
68
69
        return $instance;
70
    }
71
72
    /**
73
     * @public function write
74
     * @param        $module
75
     * @param mixed  $table
76
     * @param string $filename
77
     */
78
    public function write($module, $table, $filename)
79
    {
80
        $this->setModule($module);
81
        $this->setTable($table);
82
        $this->setFileName($filename);
83
    }
84
85
    /**
86
     * @public function getTemplateUserFooterFacebookLikeButton
87
     * @param null
88
     *
89
     * @return bool|string
90
     */
91
    public function getTemplateUserFooterFacebookLikeButton()
92
    {
93
        return "<li class='fb-like' data-href='<{\$xoops_mpageurl}>' data-layout='standard' data-action='like' data-show-faces='true'></li>";
94
    }
95
96
    /**
97
     * @public function getTemplateUserFooterFacebookShareButton
98
     * @param null
99
     *
100
     * @return bool|string
101
     */
102
    public function getTemplateUserFooterFacebookShareButton()
103
    {
104
        return "<li class='fb-share-button' data-href='<{\$xoops_mpageurl}>' data-layout='button_count'></li>";
105
    }
106
107
    /**
108
     * @public function render
109
     * @param $language
110
     * @return bool|string
111
     */
112
    private function getTemplateUserFooterContent($language)
113
    {
114
        $ret     = $this->hc->getHtmlDiv('<{$copyright}>', 'pull-left', '', "\n", false);
115
        $ret     .= $this->hc->getHtmlEmpty("\n");
116
        $contIf  = $this->hc->getHtmlDiv('<{$pagenav}>', 'pull-right', "\t", "\n", false);
117
        $ret     .= $this->sc->getSmartyConditions('pagenav', '', '', $contIf);
118
        $ret     .= $this->hc->getHtmlEmpty("<br>\n");
119
        $contIf  = $this->hc->getHtmlDiv("<a href='<{\$admin}>'><{\$smarty.const.{$language}ADMIN}></a>", 'text-center bold', "\t", "\n", false);
120
        $ret     .= $this->sc->getSmartyConditions('xoops_isadmin', '', '', $contIf);
121
        $ret     .= $this->hc->getHtmlEmpty("\n");
122
        $contIf  = $this->sc->getSmartyIncludeFile('system_comments','flat',false, false,"\t\t\t");
123
        $contIf  .= $this->getSimpleString('<{elseif $comment_mode == "thread"}>',"\t\t");
124
        $contIf  .= $this->sc->getSmartyIncludeFile('system_comments','thread',false, false,"\t\t\t");
125
        $contIf  .= $this->getSimpleString('<{elseif $comment_mode == "nest"}>',"\t\t");
126
        $contIf  .= $this->sc->getSmartyIncludeFile('system_comments','nest',false, false,"\t\t\t");
127
        $contDiv = $this->sc->getSmartyConditions('comment_mode', ' == ', '"flat"', $contIf, false, '','',"\t\t", "\n", true, false);
128
        $contIf  = $this->hc->getHtmlDiv($contDiv, 'pad2 marg2', "\t", "\n", true);
129
        $ret     .= $this->sc->getSmartyConditions('comment_mode', '', '', $contIf);
130
        $ret     .= $this->sc->getSmartyIncludeFile('system_notification','select');
131
132
        return $ret;
133
    }
134
135
136
    /**
137
     * @public function render
138
     * @param null
139
     * @return bool|string
140
     */
141
    public function render()
142
    {
143
        $module        = $this->getModule();
144
        $filename      = $this->getFileName();
145
        $moduleDirname = $module->getVar('mod_dirname');
146
        $language      = $this->getLanguage($moduleDirname, 'MA', '', 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

146
        $language      = $this->getLanguage($moduleDirname, 'MA', '', /** @scrutinizer ignore-type */ false);
Loading history...
147
        $content       = $this->getTemplateUserFooterContent($language);
148
149
        $this->create($moduleDirname, 'templates', $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED);
150
151
        return $this->renderFile();
152
    }
153
}
154