|
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 Header. |
|
31
|
|
|
*/ |
|
32
|
|
|
class Header extends Files\CreateFile |
|
33
|
|
|
{ |
|
34
|
|
|
/** |
|
35
|
|
|
* @var string |
|
36
|
|
|
*/ |
|
37
|
|
|
private $tdmcfile = null; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @public function constructor |
|
41
|
|
|
* @param null |
|
42
|
|
|
*/ |
|
43
|
|
|
public function __construct() |
|
44
|
|
|
{ |
|
45
|
|
|
parent::__construct(); |
|
46
|
|
|
$this->tdmcfile = Tdmcreate\Files\CreateFile::getInstance(); |
|
|
|
|
|
|
47
|
|
|
$this->htmlcode = Tdmcreate\Files\CreateHtmlCode::getInstance(); |
|
|
|
|
|
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* @static function getInstance |
|
52
|
|
|
* @param null |
|
53
|
|
|
* @return Header |
|
54
|
|
|
*/ |
|
55
|
|
|
public static function getInstance() |
|
56
|
|
|
{ |
|
57
|
|
|
static $instance = false; |
|
58
|
|
|
if (!$instance) { |
|
59
|
|
|
$instance = new self(); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
return $instance; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* @public function write |
|
67
|
|
|
* @param string $module |
|
68
|
|
|
* @param string $filename |
|
69
|
|
|
*/ |
|
70
|
|
|
public function write($module, $filename) |
|
71
|
|
|
{ |
|
72
|
|
|
$this->setModule($module); |
|
73
|
|
|
$this->setFileName($filename); |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* @public function getTemplatesUserHeader |
|
78
|
|
|
* @param $moduleDirname |
|
79
|
|
|
* @return bool|string |
|
80
|
|
|
*/ |
|
81
|
|
|
public function getTemplatesUserHeader($moduleDirname) |
|
82
|
|
|
{ |
|
83
|
|
|
$hc = Tdmcreate\Files\CreateHtmlCode::getInstance(); |
|
84
|
|
|
$sc = Tdmcreate\Files\CreateSmartyCode::getInstance(); |
|
85
|
|
|
$ret = $sc->getSmartyIncludeFile($moduleDirname, 'breadcrumbs', false, true, '', "\n\n"); |
|
86
|
|
|
$var = $sc->getSmartySingleVar('ads', '', ''); |
|
87
|
|
|
$div = $hc->getHtmlDiv($var, 'center', "\t","\n", false) ; |
|
88
|
|
|
$ret .= $sc->getSmartyConditions('ads', ' != ', '\'\'', $div); |
|
89
|
|
|
|
|
90
|
|
|
return $ret; |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
/** |
|
94
|
|
|
* @public function getTemplateFooterFacebbokSDK |
|
95
|
|
|
* @param null |
|
96
|
|
|
* |
|
97
|
|
|
* @return bool|string |
|
98
|
|
|
*/ |
|
99
|
|
|
public function getTemplateUserHeaderFacebbokSDK() |
|
100
|
|
|
{ |
|
101
|
|
|
$ret = <<<'EOT' |
|
102
|
|
|
<!-- Load Facebook SDK for JavaScript --> |
|
103
|
|
|
<div id="fb-root"></div> |
|
104
|
|
|
<script>(function(d, s, id) { |
|
105
|
|
|
var js, fjs = d.getElementsByTagName(s)[0]; |
|
106
|
|
|
if (d.getElementById(id)) return; |
|
107
|
|
|
js = d.createElement(s); js.id = id; |
|
108
|
|
|
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1"; |
|
109
|
|
|
fjs.parentNode.insertBefore(js, fjs); |
|
110
|
|
|
}(document, 'script', 'facebook-jssdk'));</script> |
|
111
|
|
|
EOT; |
|
112
|
|
|
|
|
113
|
|
|
return $ret; |
|
114
|
|
|
} |
|
115
|
|
|
|
|
116
|
|
|
/** |
|
117
|
|
|
* @public function render |
|
118
|
|
|
* @param null |
|
119
|
|
|
* @return bool|string |
|
120
|
|
|
*/ |
|
121
|
|
|
public function render() |
|
122
|
|
|
{ |
|
123
|
|
|
$module = $this->getModule(); |
|
124
|
|
|
$filename = $this->getFileName(); |
|
125
|
|
|
$moduleDirname = $module->getVar('mod_dirname'); |
|
126
|
|
|
//$language = $this->getLanguage($moduleDirname, 'MA'); |
|
127
|
|
|
$content = $this->getTemplatesUserHeader($moduleDirname); |
|
128
|
|
|
|
|
129
|
|
|
$this->tdmcfile->create($moduleDirname, 'templates', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); |
|
130
|
|
|
|
|
131
|
|
|
return $this->tdmcfile->renderFile(); |
|
132
|
|
|
} |
|
133
|
|
|
} |
|
134
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..