Passed
Push — master ( 834a16...1c3825 )
by Goffy
09:06 queued 04:27
created

Footer::getInstance()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 0
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace XoopsModules\Tdmcreate\Files\Templates\User;
4
5
use XoopsModules\Tdmcreate;
6
use XoopsModules\Tdmcreate\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
 * tdmcreate module.
19
 *
20
 * @copyright       XOOPS Project (https://xoops.org)
21
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
22
 *
23
 * @since           2.5.0
24
 *
25
 * @author          Txmod Xoops http://www.txmodxoops.org
26
 *
27
 */
28
29
/**
30
 * class Footer.
31
 */
32
class Footer extends Files\CreateFile
33
{
34
    /**
35
     * @var string
36
     */
37
    private $tdmcfile = null;
0 ignored issues
show
introduced by
The private property $tdmcfile is not used, and could be removed.
Loading history...
38
39
    /**
40
     * @public function constructor
41
     * @param null
42
     */
43
    public function __construct()
44
    {
45
        parent::__construct();
46
    }
47
48
    /**
49
     * @static function getInstance
50
     * @param null
51
     * @return Footer
52
     */
53
    public static function getInstance()
54
    {
55
        static $instance = false;
56
        if (!$instance) {
57
            $instance = new self();
58
        }
59
60
        return $instance;
61
    }
62
63
    /**
64
     * @public function write
65
     * @param string $module
66
     * @param mixed  $table
67
     * @param string $filename
68
     */
69
    public function write($module, $table, $filename)
70
    {
71
        $this->setModule($module);
72
        $this->setTable($table);
73
        $this->setFileName($filename);
74
    }
75
76
    /**
77
     * @public function getTemplateUserFooterFacebookLikeButton
78
     * @param null
79
     *
80
     * @return bool|string
81
     */
82
    public function getTemplateUserFooterFacebookLikeButton()
83
    {
84
        return "<li class='fb-like' data-href='<{\$xoops_mpageurl}>' data-layout='standard' data-action='like' data-show-faces='true'></li>";
85
    }
86
87
    /**
88
     * @public function getTemplateUserFooterFacebookShareButton
89
     * @param null
90
     *
91
     * @return bool|string
92
     */
93
    public function getTemplateUserFooterFacebookShareButton()
94
    {
95
        return "<li class='fb-share-button' data-href='<{\$xoops_mpageurl}>' data-layout='button_count'></li>";
96
    }
97
98
    /**
99
     * @public function render
100
     * @param null
101
     * @return bool|string
102
     */
103
    private function getTemplateUserFooterContent($moduleDirname, $language)
0 ignored issues
show
Unused Code introduced by
The parameter $moduleDirname is not used and could be removed. ( Ignorable by Annotation )

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

103
    private function getTemplateUserFooterContent(/** @scrutinizer ignore-unused */ $moduleDirname, $language)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
104
    {
105
        $hc = Tdmcreate\Files\CreateHtmlCode::getInstance();
106
        $sc = Tdmcreate\Files\CreateSmartyCode::getInstance();
107
        $ret     = $hc->getHtmlDiv('<{$copyright}>', 'pull-left', '', "\n", false);
108
        $ret     .= $hc->getHtmlEmpty("\n");
109
        $contIf  = $hc->getHtmlDiv('<{$pagenav}>', 'pull-right', "\t", "\n", false);
110
        $ret     .= $sc->getSmartyConditions('pagenav', ' != ', "''", $contIf);
111
        $ret     .= $hc->getHtmlEmpty("<br>\n");
112
        $contIf  = $hc->getHtmlDiv("<a href='<{\$admin}>'><{\$smarty.const.{$language}ADMIN}></a>", 'text-center bold', "\t", "\n", false);
113
        $ret     .= $sc->getSmartyConditions('xoops_isadmin', ' != ', "''", $contIf);
114
        $ret     .= $hc->getHtmlEmpty("\n");
115
        $contIf  = $sc->getSmartyIncludeFile('system_comments','flat',false, false,"\t\t\t");
116
        $contIf  .= $this->getSimpleString('<{elseif $comment_mode == "thread"}>',"\t\t");
117
        $contIf  .= $sc->getSmartyIncludeFile('system_comments','thread',false, false,"\t\t\t");
118
        $contIf  .= $this->getSimpleString('<{elseif $comment_mode == "nest"}>',"\t\t");
119
        $contIf  .= $sc->getSmartyIncludeFile('system_comments','nest',false, false,"\t\t\t");
120
        $contDiv = $sc->getSmartyConditions('comment_mode', ' == ', '"flat"', $contIf, false, '','',"\t\t");
0 ignored issues
show
Bug introduced by
'' of type string is incompatible with the type boolean expected by parameter $count of XoopsModules\Tdmcreate\F...::getSmartyConditions(). ( Ignorable by Annotation )

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

120
        $contDiv = $sc->getSmartyConditions('comment_mode', ' == ', '"flat"', $contIf, false, /** @scrutinizer ignore-type */ '','',"\t\t");
Loading history...
Bug introduced by
'' of type string is incompatible with the type boolean expected by parameter $noSimbol of XoopsModules\Tdmcreate\F...::getSmartyConditions(). ( Ignorable by Annotation )

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

120
        $contDiv = $sc->getSmartyConditions('comment_mode', ' == ', '"flat"', $contIf, false, '',/** @scrutinizer ignore-type */ '',"\t\t");
Loading history...
121
        $contIf  = $hc->getHtmlDiv($contDiv, 'pad2 marg2', "\t", "\n", true);
122
        $ret     .= $sc->getSmartyConditions('comment_mode', '', '', $contIf);
123
124
        return $ret;
125
    }
126
127
128
    /**
129
     * @public function render
130
     * @param null
131
     * @return bool|string
132
     */
133
    public function render()
134
    {
135
        $module        = $this->getModule();
136
        $filename      = $this->getFileName();
137
        $moduleDirname = $module->getVar('mod_dirname');
138
        $language      = $this->getLanguage($moduleDirname, 'MA');
139
        $content       = $this->getTemplateUserFooterContent($moduleDirname, $language);
140
141
        $this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
142
143
        return $this->renderFile();
144
    }
145
}
146