|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Copyright (c) 2018 Justin Kuenzel (jukusoft.com) |
|
5
|
|
|
* |
|
6
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
7
|
|
|
* you may not use this file except in compliance with the License. |
|
8
|
|
|
* You may obtain a copy of the License at |
|
9
|
|
|
* |
|
10
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
|
11
|
|
|
* |
|
12
|
|
|
* Unless required by applicable law or agreed to in writing, software |
|
13
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
|
14
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
15
|
|
|
* See the License for the specific language governing permissions and |
|
16
|
|
|
* limitations under the License. |
|
17
|
|
|
*/ |
|
18
|
|
|
|
|
19
|
|
|
class StyleController { |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* get name of current style |
|
23
|
|
|
* |
|
24
|
|
|
* @param $registry Registry instance |
|
25
|
|
|
* |
|
26
|
|
|
* @return current style as string name |
|
|
|
|
|
|
27
|
|
|
*/ |
|
28
|
|
|
public static function getCurrentStyle (Registry &$registry, Page &$page, PageType &$page_type) : string { |
|
|
|
|
|
|
29
|
|
|
//get default styles |
|
30
|
|
|
$default_style_name = Settings::get("default_style_name"); |
|
31
|
|
|
$default_mobile_style_name = Settings::get("default_mobile_style_name"); |
|
32
|
|
|
|
|
33
|
|
|
$style_name = !Browser::isMobile() ? $default_style_name : $default_mobile_style_name; |
|
34
|
|
|
|
|
35
|
|
|
//apply style rules |
|
36
|
|
|
$style_name = StyleRules::getStyle($registry, $style_name); |
|
37
|
|
|
|
|
38
|
|
|
//throw event, so plugins can change style |
|
39
|
|
|
Events::throwEvent("get_style", array( |
|
40
|
|
|
'default_style_name' => $default_style_name, |
|
41
|
|
|
'default_mobile_style_name' => $default_mobile_style_name, |
|
42
|
|
|
'style_name' => &$style_name, |
|
43
|
|
|
'registry' => $registry |
|
44
|
|
|
)); |
|
45
|
|
|
|
|
46
|
|
|
return $style_name; |
|
|
|
|
|
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
public static function showPage (Registry &$registry, Page &$page, PageType &$page_type) { |
|
50
|
|
|
//create new template |
|
51
|
|
|
$template = new DwooTemplate("index"); |
|
52
|
|
|
|
|
53
|
|
|
$title_preafix = Settings::get("title_praefix", ""); |
|
54
|
|
|
$title_suffix = Settings::get("title_suffix", ""); |
|
55
|
|
|
|
|
56
|
|
|
//translate title |
|
57
|
|
|
$title = Translator::translateTitle($page->getTitle()); |
|
58
|
|
|
|
|
59
|
|
|
//assign variables |
|
60
|
|
|
$template->assign("TITLE", $title_preafix . $title . $title_suffix); |
|
61
|
|
|
$template->assign("SHORT_TITLE", $title); |
|
62
|
|
|
$template->assign("RAW_TITLE", $page->getTitle()); |
|
63
|
|
|
$template->assign("REGISTRY", $registry->listSettings()); |
|
64
|
|
|
|
|
65
|
|
|
$head_content = ""; |
|
66
|
|
|
|
|
67
|
|
|
Events::throwEvent("get_head", array( |
|
68
|
|
|
'registry' => &$registry, |
|
69
|
|
|
'page' => &$page, |
|
70
|
|
|
'page_type' => &$page_type, |
|
71
|
|
|
'head_content' => $head_content |
|
72
|
|
|
)); |
|
73
|
|
|
|
|
74
|
|
|
$template->assign("HEAD", $head_content . $page_type->getAdditionalHeaderCode()); |
|
75
|
|
|
|
|
76
|
|
|
$template->assign("CONTENT", $page_type->getContent()); |
|
77
|
|
|
$template->assign("HEADER", $registry->getSetting("header", "")); |
|
|
|
|
|
|
78
|
|
|
$template->assign("FOOTER", $registry->getSetting("footer", "")); |
|
79
|
|
|
$template->assign("COPYRIGHT", Settings::get("copyright", "<strong>Copyright © 2018 <a href=\"http://jukusoft.com\">JuKuSoft.com</a></strong>, All Rights Reserved.")); |
|
80
|
|
|
|
|
81
|
|
|
$template->assign("FOOTER_SCRIPTS", $page_type->getFooterScripts()); |
|
82
|
|
|
|
|
83
|
|
|
$template->assign("MY_GROUP_IDS", implode(",", $registry->getObject("groups")->listGroupIDs())); |
|
84
|
|
|
$template->assign("CHARSET", $page_type->getCharset()); |
|
85
|
|
|
|
|
86
|
|
|
//create new css builder |
|
87
|
|
|
/*$css_builder = new CSSBuilder(); |
|
88
|
|
|
|
|
89
|
|
|
//create new js builder |
|
90
|
|
|
$js_builder = new JSBuilder(); |
|
91
|
|
|
|
|
92
|
|
|
$current_style = $registry->getSetting("current_style_name"); |
|
93
|
|
|
$template->assign("CSS_HASH_ALL", $css_builder->getHash($current_style, "ALL", "header")); |
|
94
|
|
|
$template->assign("JS_HASH_ALL_HEADER", $js_builder->getHash($current_style, "ALL", "header")); |
|
95
|
|
|
$template->assign("JS_HASH_ALL_FOOTER", $js_builder->getHash($current_style, "ALL", "footer")); |
|
96
|
|
|
|
|
97
|
|
|
//set empty flags |
|
98
|
|
|
$template->assign("CSS_ALL_EMPTY", $css_builder->isEmpty($current_style, "ALL", "header")); |
|
99
|
|
|
$template->assign("JS_ALL_HEADER_EMPTY", $js_builder->isEmpty($current_style, "ALL", "header")); |
|
100
|
|
|
$template->assign("JS_ALL_FOOTER_EMPTY", $js_builder->isEmpty($current_style, "ALL", "footer"));*/ |
|
101
|
|
|
|
|
102
|
|
|
//set sidebar arrays |
|
103
|
|
|
$left_sidebar = Registry::singleton()->getObject("left_sidebar"); |
|
104
|
|
|
$right_sidebar = Registry::singleton()->getObject("right_sidebar"); |
|
105
|
|
|
$sidebars_var = array( |
|
106
|
|
|
'left_sidebar' => $left_sidebar->listWidgetTplArray(), |
|
107
|
|
|
'right_sidebar' => $right_sidebar->listWidgetTplArray() |
|
108
|
|
|
); |
|
109
|
|
|
$template->assign("sidebars", $sidebars_var); |
|
110
|
|
|
|
|
111
|
|
|
//set version and build number |
|
112
|
|
|
if (PermissionChecker::current()->hasRight("can_see_cms_version")) { |
|
113
|
|
|
$template->assign("VERSION", Version::current()->getVersion()); |
|
114
|
|
|
$template->assign("BUILD", Version::current()->getBuildNumber()); |
|
115
|
|
|
} else { |
|
116
|
|
|
$template->assign("VERSION", "Unknown"); |
|
117
|
|
|
$template->assign("BUILD", "Unknown"); |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
//userid and username |
|
121
|
|
|
$user = User::current(); |
|
122
|
|
|
/*$template->assign("USERID", $user->getID()); |
|
123
|
|
|
$template->assign("USERNAME", $user->getUsername());*/ |
|
124
|
|
|
$template->assign("IS_LOGGED_IN", $user->isLoggedIn()); |
|
125
|
|
|
|
|
126
|
|
|
//assign menu code |
|
127
|
|
|
$globalMenu = $registry->getObject("main_menu"); |
|
128
|
|
|
$localMenu = $registry->getObject("local_menu"); |
|
129
|
|
|
$template->assign("MENU", $globalMenu->getCode()); |
|
130
|
|
|
$template->assign("LOCALMENU", $localMenu->getCode()); |
|
131
|
|
|
|
|
132
|
|
|
if (User::current()->isLoggedIn()) { |
|
133
|
|
|
$template->assign("is_logged_in", true); |
|
134
|
|
|
//$template->parse("main.logged_in"); |
|
135
|
|
|
} else { |
|
136
|
|
|
$template->assign("is_logged_in", false); |
|
137
|
|
|
//$template->parse("main.not_logged_in"); |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
|
|
//throw event |
|
141
|
|
|
Events::throwEvent("show_page", array( |
|
142
|
|
|
'registry' => &$registry, |
|
143
|
|
|
'page' => &$page, |
|
144
|
|
|
'page_type' => &$page_type, |
|
145
|
|
|
'template' => &$template |
|
146
|
|
|
)); |
|
147
|
|
|
|
|
148
|
|
|
if ($page_type->showFooter()) { |
|
149
|
|
|
$template->assign("show_footer", true); |
|
150
|
|
|
//$template->parse("main.footer"); |
|
151
|
|
|
} else { |
|
152
|
|
|
$template->assign("show_footer", false); |
|
153
|
|
|
} |
|
154
|
|
|
|
|
155
|
|
|
//$template->parse(); |
|
156
|
|
|
|
|
157
|
|
|
echo $template->getCode(); |
|
158
|
|
|
} |
|
159
|
|
|
|
|
160
|
|
|
} |
|
161
|
|
|
|
|
162
|
|
|
?> |
|
|
|
|
|
|
163
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths