-
Notifications
You must be signed in to change notification settings - Fork 1
/
theme.php
182 lines (137 loc) · 4.7 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
<?php
if(!defined('e107_INIT'))
{
exit();
}
// [multilanguage]
e107::lan('theme'); // loads e107_themes/CURRENT_THEME/languages/English.php (when English is selected)
class theme implements e_theme_render {
public function init() {
e107::meta('viewport', 'width=device-width, initial-scale=1.0'); // added to <head>
// e107::link('rel="preload" href="{THEME}fonts/myfont.woff2?v=2.2.0" as="font" type="font/woff2" crossorigin'); // added to <head>
//e107::meta('apple-mobile-web-app-capable','yes');
$bootswatch = e107::pref('theme', 'bootswatch', false);
if($bootswatch) {
e107::css('url', 'https://bootswatch.com/4/' . $bootswatch . '/bootstrap.min.css');
e107::css('url', 'https://bootswatch.com/4/' . $bootswatch . '/bootstrap.min.css');
}
e107::library("load", "animate.css");
// e107::css('url', 'https://fonts.googleapis.com/css?family=Oswald:300,400,500,600,700&display=swap');
// e107::css('url', 'https://fonts.googleapis.com/css?family=Exo+2:100,200,300,400,500,600,700,800,900&display=swap');
// e107::css("theme", "css/aos.css");
// e107::css("theme", "css/languages.css");
e107::js("footer-inline", "$('.e-tip').tooltip({container: 'body'})"); // activate bootstrap tooltips.
// e107::js("theme", "js/masonry.pkgd.js");
// e107::js("theme", "js/imagesloaded.pkgd.min.js");
// e107::js("theme", "js/jquery.lettering.js");
// e107::js("theme", "js/jquery.matchHeight.js");
// e107::js("theme", "js/aos.js");
e107::js("theme", "js/custom.js", "jquery");
/* @example prefetch */
//e107::link(array('rel'=>'prefetch', 'href'=>THEME.'images/browsers.png'));
}
/**
* @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;
}
function tablestyle($caption, $text, $mode='', $options = array()) {
$style = varset($options['setStyle'], 'default');
// Override style based on mode.
switch($mode){
case 'contact-info':
$style = 'contact-info';
break;
case 'testimonials-testimonials-menu':
$style = 'testimonials';
break;
}
//this should be displayed only in e_debug mode
echo "\n<!-- tablestyle initial: style=". $style." mode=".$mode." UniqueId=".varset($options['uniqueId'])." -->\n\n";
switch($style){
/* case 'home':
echo $caption;
echo $text;
break;
case 'menu':
echo $caption;
echo $text;
break;
case 'full':
echo $caption;
echo $text;
break;
*/
case 'nocaption':
case 'main':
echo $text;
break;
case 'hero':
echo $text;
break;
case "contact":
echo "<div class='text-center mb-5'>";
if(!empty($caption)) {
echo "<h1 class='fw-bolder'>{$caption}</h1>";
}
echo $text;
echo "</div>";
break;
case 'contact-info':
echo $text;
break;
case "testimonials":
echo "<div class='mb-4'>";
if(!empty($caption)) {
echo "<h2 class='fw-bolder mb-5'>{$caption}</h2>";
}
echo $text;
echo "</div>";
break;
case "full":
echo "<div class='text-center mb-5'>";
if(!empty($caption)) {
echo "<h1 class='fw-bolder'>{$caption}</h1>";
}
echo $text;
echo "</div>";
break;
case 'subscribe':
echo $text;
break;
case "portfolio":
echo "<div class='col-md-4 col-lg-3 col-xl-2'>{$text}</div>";
break;
case "main":
echo "<div class='leftcol-content'>";
if(!empty($caption)) {
echo "<div class='leftcol-content-title'><h2>{$caption}</h2></div>";
}
echo "<div class='leftcol-content-body'>{$text}</div>";
echo "</div>";
break;
case "rightcol":
echo "<div class='rightcol-content'>";
if(!empty($caption)) {
echo "<div class='rightcol-content-title'><h2>{$caption}</h2></div>";
}
echo "<div class='rightcol-content-body'>{$text}</div>";
echo "</div>";
break;
default:
// default style
// only if this always work, play with different styles
if(!empty($caption)) {
echo "<h2 class='fw-bolder fs-5 mb-4'>{$caption}</h2>";
}
echo $text;
return;
}
}
}