|
1
|
|
|
<?php |
|
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
You may not change or alter any portion of this comment or credits |
|
5
|
|
|
of supporting developers from this source code or any supporting source code |
|
6
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
|
7
|
|
|
|
|
8
|
|
|
This program is distributed in the hope that it will be useful, |
|
9
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
11
|
|
|
*/ |
|
12
|
|
|
/** |
|
13
|
|
|
* tdmcreate module. |
|
14
|
|
|
* |
|
15
|
|
|
* @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ |
|
16
|
|
|
* @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) |
|
17
|
|
|
* |
|
18
|
|
|
* @since 2.5.0 |
|
19
|
|
|
* |
|
20
|
|
|
* @author Txmod Xoops http://www.txmodxoops.org |
|
21
|
|
|
* |
|
22
|
|
|
* @version $Id: templates_footer.php 12258 2014-01-02 09:33:29Z timgno $ |
|
23
|
|
|
*/ |
|
24
|
|
|
defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* Class TemplatesUserFooter. |
|
28
|
|
|
*/ |
|
29
|
|
|
class TemplatesUserFooter extends TDMCreateFile |
|
|
|
|
|
|
30
|
|
|
{ |
|
31
|
|
|
/* |
|
32
|
|
|
* @public function constructor |
|
33
|
|
|
* @param null |
|
34
|
|
|
*/ |
|
35
|
|
|
/** |
|
36
|
|
|
* |
|
37
|
|
|
*/ |
|
38
|
|
|
public function __construct() |
|
39
|
|
|
{ |
|
40
|
|
|
parent::__construct(); |
|
41
|
|
|
$this->htmlcode = TDMCreateHtmlSmartyCodes::getInstance(); |
|
|
|
|
|
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
/* |
|
45
|
|
|
* @static function &getInstance |
|
46
|
|
|
* @param null |
|
47
|
|
|
*/ |
|
48
|
|
|
/** |
|
49
|
|
|
* @return TemplatesUserFooter |
|
50
|
|
|
*/ |
|
51
|
|
|
public static function &getInstance() |
|
52
|
|
|
{ |
|
53
|
|
|
static $instance = false; |
|
54
|
|
|
if (!$instance) { |
|
55
|
|
|
$instance = new self(); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
return $instance; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
/* |
|
62
|
|
|
* @public function write |
|
63
|
|
|
* @param string $module |
|
64
|
|
|
* @param mixed $table |
|
65
|
|
|
* @param string $filename |
|
66
|
|
|
*/ |
|
67
|
|
|
/** |
|
68
|
|
|
* @param $module |
|
69
|
|
|
* @param $table |
|
70
|
|
|
* @param $filename |
|
71
|
|
|
*/ |
|
72
|
|
|
public function write($module, $table, $filename) |
|
73
|
|
|
{ |
|
74
|
|
|
$this->setModule($module); |
|
75
|
|
|
$this->setTable($table); |
|
76
|
|
|
$this->setFileName($filename); |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
/* |
|
80
|
|
|
* @public function getTemplateUserFooterFacebookLikeButton |
|
81
|
|
|
* @param null |
|
82
|
|
|
* |
|
83
|
|
|
* @return bool|string |
|
84
|
|
|
*/ |
|
85
|
|
|
public function getTemplateUserFooterFacebookLikeButton() |
|
86
|
|
|
{ |
|
87
|
|
|
return "<li class='fb-like' data-href='<{\$xoops_mpageurl}>' data-layout='standard' data-action='like' data-show-faces='true'></li>"; |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
/* |
|
91
|
|
|
* @public function getTemplateUserFooterFacebookShareButton |
|
92
|
|
|
* @param null |
|
93
|
|
|
* |
|
94
|
|
|
* @return bool|string |
|
95
|
|
|
*/ |
|
96
|
|
|
public function getTemplateUserFooterFacebookShareButton() |
|
97
|
|
|
{ |
|
98
|
|
|
return "<li class='fb-share-button' data-href='<{\$xoops_mpageurl}>' data-layout='button_count'></li>"; |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
/* |
|
102
|
|
|
* @public function render |
|
103
|
|
|
* @param null |
|
104
|
|
|
*/ |
|
105
|
|
|
/** |
|
106
|
|
|
* @return bool|string |
|
107
|
|
|
*/ |
|
108
|
|
|
public function render() |
|
109
|
|
|
{ |
|
110
|
|
|
$module = $this->getModule(); |
|
111
|
|
|
$table = $this->getTable(); |
|
112
|
|
|
$filename = $this->getFileName(); |
|
113
|
|
|
$moduleDirname = $module->getVar('mod_dirname'); |
|
114
|
|
|
$language = $this->getLanguage($moduleDirname, 'MA'); |
|
115
|
|
|
$content = <<<EOT |
|
116
|
|
|
<{if \$bookmarks != 0}> |
|
117
|
|
|
<{include file="db:system_bookmarks.html"}> |
|
118
|
|
|
<{/if}> |
|
119
|
|
|
\n<{if \$fbcomments != 0}> |
|
120
|
|
|
<{include file="db:system_fbcomments.html"}> |
|
121
|
|
|
<{/if}> |
|
122
|
|
|
<div class="pull-left"><{\$copyright}></div>\n |
|
123
|
|
|
EOT; |
|
124
|
|
|
if (is_object($table) && $table->getVar('table_name') != null) { |
|
125
|
|
|
$content .= <<<EOT |
|
126
|
|
|
<{if \$pagenav != ''}> |
|
127
|
|
|
<div class="pull-right"><{\$pagenav}></div> |
|
128
|
|
|
<{/if}> |
|
129
|
|
|
<br />\n |
|
130
|
|
|
EOT; |
|
131
|
|
|
} |
|
132
|
|
|
$content .= <<<EOT |
|
133
|
|
|
<{if \$xoops_isadmin}> |
|
134
|
|
|
<div class="text-center bold"><a href="<{\$admin}>"><{\$smarty.const.{$language}ADMIN}></a></div><br /> |
|
135
|
|
|
<{/if}>\n |
|
136
|
|
|
EOT; |
|
137
|
|
|
if (is_object($table)) { |
|
138
|
|
|
if (1 == $table->getVar('table_comments')) { |
|
139
|
|
|
$content .= <<<EOT |
|
140
|
|
|
<div class="pad2 marg2"> |
|
141
|
|
|
<{if \$comment_mode == "flat"}> |
|
142
|
|
|
<{include file="db:system_comments_flat.html"}> |
|
143
|
|
|
<{elseif \$comment_mode == "thread"}> |
|
144
|
|
|
<{include file="db:system_comments_thread.html"}> |
|
145
|
|
|
<{elseif \$comment_mode == "nest"}> |
|
146
|
|
|
<{include file="db:system_comments_nest.html"}> |
|
147
|
|
|
<{/if}> |
|
148
|
|
|
</div>\n |
|
149
|
|
|
<br />\n |
|
150
|
|
|
EOT; |
|
151
|
|
|
} |
|
152
|
|
|
if (1 == $table->getVar('table_notifications')) { |
|
153
|
|
|
$content .= <<<EOT |
|
154
|
|
|
<{include file='db:system_notification_select.html'}> |
|
155
|
|
|
EOT; |
|
156
|
|
|
} |
|
157
|
|
|
} |
|
158
|
|
|
$this->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); |
|
159
|
|
|
|
|
160
|
|
|
return $this->renderFile(); |
|
161
|
|
|
} |
|
162
|
|
|
} |
|
163
|
|
|
|
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.