-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththeme.php
275 lines (221 loc) · 6.01 KB
/
theme.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
<?php
/**
* Bootstrap 3 Theme for e107 v2.x
* Landing Zero Theme by www.bootstrapzero.com adapted for e107 CMS.
* Released under the terms and conditions of the
* GNU General Public License (http://gnu.org).
*/
if (!defined('e107_INIT'))
{
exit;
}
////// Multilanguages/ /////////////////////////////////////////////////////////
e107::lan('theme');
class theme implements e_theme_render
{
public $membersonly_enabled = false;
function init()
{
////// Your own css fixes ////////////////////////////////////////////////////
define("CORE_CSS", false);
e107::css('theme', 'e107.css');
////// Theme meta tags /////////////////////////////////////////////////////////
$this->set_metas();
/////// Theme css /////////////////////////////////////////////////////////////
$this->register_css();
/////// Theme js /////////////////////////////////////////////////////////////
$this->register_js();
/////// Theme fonts ///////////////////////////////////////////////////////////
$this->register_fonts();
/////// Theme icons ///////////////////////////////////////////////////////////
$this->register_icons();
$this->getInlineCodes();
}
public function set_metas()
{
e107::meta("viewport", "width=device-width, initial-scale=1.0");
}
public function register_css()
{
e107::css('theme', 'css/animate.min.css');
e107::css('theme', 'css/styles.css');
e107::css('theme', 'style.css');
}
public function register_js()
{
e107::js("theme", "js/wow.js", 'jquery');
e107::js("theme", "js/scripts.js", 'jquery');
e107::js("footer-inline", "$('.e-tip').tooltip({container: 'body'})"); // activate bootstrap tooltips.
}
public function register_fonts()
{
$fonts_local = e107::pref('theme', 'fonts_local', FALSE);
$fonts_subset = e107::pref('theme', 'fonts_subset', FALSE);
if ($fonts_local)
{
e107::css('theme', 'fonts/fonts.css');
if ($fonts_subset)
{
e107::css('theme', 'fonts/fonts_ext.css');
}
}
else
{
e107::css('url', 'https://fonts.googleapis.com/css?family=Questrial');
e107::css('url', 'https://fonts.googleapis.com/css?family=Dancing+Script:700');
}
}
public function register_icons()
{
e107::css('theme', 'css/ionicons.min.css');
}
public function getInlineCodes()
{
$inlinecss = e107::pref('theme', 'custom_css', FALSE);
if ($inlinecss)
{
e107::css("inline", $inlinecss);
}
$inlinejs = e107::pref('theme', 'inlinejs');
if ($inlinejs)
{
e107::js("footer-inline", $inlinejs);
}
}
/**
* @param string $text
* @return string without p tags added always with bbcodes
* note: this solves W3C validation issue and CSS style problems
* use this carefully, mainly for custom menus, let decision on theme developers
*/
function remove_ptags($text = '') // FIXME this is a bug in e107 if this is required.
{
$text = str_replace(array("<!-- bbcode-html-start --><p>", "</p><!-- bbcode-html-end -->"), "", $text);
return $text;
}
/**
* @param string $caption
* @param string $text
* @param string $id : id of the current render
* @param array $info : current style and other menu data.
*/
function tablestyle($caption, $text, $id = '', $info = array())
{
// global $style; // no longer needed.
$style = $info['setStyle'];
if (e_DEBUG || e_DEVELOPER || true)
{
echo "<!-- tablestyle: style=" . $style . " id=" . $id . " -->\n\n";
}
$type = $style;
if (empty($caption))
{
$type = 'box';
}
//use only $style for tablerender
switch ($id)
{
case "wm": // Example - If rendered from 'welcome message'
$style = "wm";
$class = " class=tablestyle-" . $id;
break;
case "login_page":
case "coppa":
case "signup":
case "fpw":
$style = "singleform";
$class = " class=tablestyle-" . $id;
break;
}
if (e_DEBUG || e_DEVELOPER || true)
{
echo "<!-- tablestyle: style=" . $style . " id=" . $id . " -->\n\n";
}
if ($style == 'wm') // Example - If rendered from 'welcome message'
{
echo '<h1 class="cursive">' . $caption . '</h1><h4>' . $this->remove_ptags($text) . '</h4>';
return;
}
switch ($style)
{
case "singleform":
echo "<div style='display:table; height:100%; margin: 0 auto;'" . $class . ">
<div style='display:table-cell; vertical-align:middle;'>";
if (!empty($caption))
{
echo '<h1 class="display-5 singleform-heading">' . $caption . '</h1>';
}
echo '<div class="singleform-body"><div class="wrapper">' . $text . '</div></div>';
echo '</div></div>';
return;
}
if ($style == 'col-md-4' || $style == 'col-md-6' || $style == 'col-md-8')
{
echo ' <div class="col-xs-12 ' . $style . '">';
if (!empty($caption))
{
echo '<h2>' . $caption . '</h2>';
}
echo '
' . $text . '
</div>';
return;
}
if ($style === 'menu' && !empty($info['footer']) && !empty($info['text']))
{
$style = 'menu-footer';
}
if ($style == 'menu')
{
echo '<div class="panel panel-default">
<div class="panel-heading">' . $caption . '</div>
<div class="panel-body">
' . $this->remove_ptags($text) . '
</div>
</div>';
return;
}
if ($style == 'menu-footer')
{
echo '<div class="panel panel-default">
<div class="panel-heading">' . $caption . '</div>
<div class="panel-body">
' . $this->remove_ptags($text) . '
</div>
<div class="panel-footer text-align:right">' . $info['footer'] . '</div>
</div>';
return;
}
if ($style == 'portfolio')
{
echo '
<div class="col-lg-4 col-md-4 col-sm-6">
' . $text . '
</div>';
return;
}
if ($style == 'nocaption')
{
echo $this->remove_ptags($text);
return;
}
if ($style == 'footercolumn')
{
echo '<h4 class="caption">' . $caption . '</h4>' . $this->remove_ptags($text);
return;
}
if ($style == 'footercolumn-12')
{
echo '<div class="col-xs-12 col-sm-3 footercolumn">
<h4 class="caption">' . $caption . '</h4>' . $text . '</div>';
return;
}
// default.
if (!empty($caption))
{
echo '<h2 class="caption">' . $caption . '</h2>';
}
echo $text;
return;
}
}