1 | <?php |
||
2 | |||
3 | namespace Anax\View; |
||
4 | |||
5 | use Anax\StyleChooser\StyleChooserController; |
||
0 ignored issues
–
show
|
|||
6 | |||
7 | /** |
||
8 | * A layout rendering views in defined regions. |
||
9 | */ |
||
10 | |||
11 | $htmlClass = $htmlClass ?? []; |
||
12 | $lang = $lang ?? "sv"; |
||
13 | $charset = $charset ?? "utf-8"; |
||
14 | $title = ($title ?? "No title") . ($baseTitle ?? ""); |
||
15 | $bodyClass = $bodyClass ?? null; |
||
16 | |||
17 | // Set active stylesheet |
||
18 | $request = $di->get("request"); |
||
19 | $session = $di->get("session"); |
||
20 | if ($request->getGet("style")) { |
||
21 | $session->set("redirect", currentUrl()); |
||
22 | redirect("style/update/" . rawurlencode($_GET["style"])); |
||
23 | } |
||
24 | |||
25 | if (class_exists("StyleChooserController")) { |
||
26 | // Get the active stylesheet, if any. |
||
27 | $activeStyle = $session->get(StyleChooserController::getSessionKey(), null); |
||
28 | if ($activeStyle) { |
||
29 | $stylesheets = []; |
||
30 | $stylesheets[] = $activeStyle; |
||
31 | } |
||
32 | } |
||
33 | |||
34 | // Show hgrid & vgrid |
||
35 | if ($request->hasGet("hgrid")) { |
||
36 | $htmlClass[] = "hgrid"; |
||
37 | } |
||
38 | if ($request->hasGet("vgrid")) { |
||
39 | $htmlClass[] = "vgrid"; |
||
40 | } |
||
41 | |||
42 | // Show regions |
||
43 | if ($request->hasGet("regions")) { |
||
44 | $htmlClass[] = "regions"; |
||
45 | } |
||
46 | |||
47 | // Get current route to make as body class |
||
48 | // If route is not empty string |
||
49 | $route = str_replace("/", "-", $di->get("request")->getRoute()); |
||
50 | if ($route) { |
||
51 | $route = "route-" . $route; |
||
52 | } |
||
53 | |||
54 | ?><!doctype html> |
||
55 | <html lang="<?= $lang ?>" <?= classList($htmlClass) ?>> |
||
56 | <head> |
||
57 | <meta charset="<?= $charset ?>"> |
||
58 | <title><?= $title ?></title> |
||
59 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
||
60 | |||
61 | <?php if (isset($favicon)) : ?> |
||
62 | <link rel="icon" href="<?= asset($favicon) ?>"> |
||
63 | <?php endif; ?> |
||
64 | |||
65 | <?php if (isset($stylesheets)) : ?> |
||
66 | <?php foreach ($stylesheets as $stylesheet) : ?> |
||
67 | <link rel="stylesheet" type="text/css" href="<?= asset($stylesheet) ?>"> |
||
68 | <?php endforeach; ?> |
||
69 | <?php endif; ?> |
||
70 | |||
71 | </head> |
||
72 | |||
73 | <body <?= classList($bodyClass, $route) ?>> |
||
74 | |||
75 | <!-- siteheader --> |
||
76 | <?php if (regionHasContent("header") || regionHasContent("header-logo")) : ?> |
||
77 | <header class="region-header" role="banner"> |
||
78 | <!-- header-logo --> |
||
79 | <?php if (regionHasContent("header-logo")) : ?> |
||
80 | <div class="region-header-logo"> |
||
81 | <?php renderRegion("header-logo") ?> |
||
82 | </div> |
||
83 | <?php endif; ?> |
||
84 | |||
85 | <!-- header --> |
||
86 | <?php if (regionHasContent("header")) : ?> |
||
87 | <nav class="region-header-nav"> |
||
88 | <?php renderRegion("header") ?> |
||
89 | </nav> |
||
90 | <?php endif; ?> |
||
91 | |||
92 | <!-- header-mobile --> |
||
93 | <?php if (regionHasContent("header-mobile")) : ?> |
||
94 | <nav class="region-header-mobile"> |
||
95 | <?php renderRegion("header-mobile") ?> |
||
96 | </nav> |
||
97 | <?php endif; ?> |
||
98 | </header> |
||
99 | <?php endif; ?> |
||
100 | |||
101 | |||
102 | <!-- flash --> |
||
103 | <?php if (regionHasContent("flash")) : ?> |
||
104 | <section class="region-flash"> |
||
105 | <?php renderRegion("flash") ?> |
||
106 | </section> |
||
107 | <?php endif; ?> |
||
108 | |||
109 | |||
110 | |||
111 | <!-- breadcrumb --> |
||
112 | <?php if (regionHasContent("breadcrumb")) : ?> |
||
113 | <section class="region-breadcrumb"> |
||
114 | <?php renderRegion("breadcrumb") ?> |
||
115 | </section> |
||
116 | <?php endif; ?> |
||
117 | |||
118 | |||
119 | |||
120 | <?php |
||
121 | $sidebarLeft = regionHasContent("sidebar-left"); |
||
122 | $sidebarRight = regionHasContent("sidebar-right"); |
||
123 | $class = []; |
||
124 | |||
125 | $sidebarLeft && $class[] = "has-sidebar-left"; |
||
126 | $sidebarRight && $class[] = "has-sidebar-right"; |
||
127 | ?> |
||
128 | |||
129 | <!-- main --> |
||
130 | <main <?= classList($class) ?>> |
||
131 | <?php if ($sidebarLeft) : ?> |
||
132 | <aside class="region-sidebar region-sidebar-left" role="complementary"> |
||
133 | <div class="wrapper"> |
||
134 | <?php renderRegion("sidebar-left") ?> |
||
135 | </div> |
||
136 | </aside> |
||
137 | <?php endif; ?> |
||
138 | |||
139 | <?php if (regionHasContent("main")) : ?> |
||
140 | <section class="region-main" role="main"> |
||
141 | <?php renderRegion("main") ?> |
||
142 | </section> |
||
143 | <?php endif; ?> |
||
144 | |||
145 | <?php if ($sidebarRight) : ?> |
||
146 | <aside class="region-sidebar region-sidebar-right" role="complementary"> |
||
147 | <div class="wrapper"> |
||
148 | <?php renderRegion("sidebar-right") ?> |
||
149 | </div> |
||
150 | </aside> |
||
151 | <?php endif; ?> |
||
152 | </main> |
||
153 | |||
154 | |||
155 | |||
156 | <!-- footer --> |
||
157 | <?php if (regionHasContent("footer")) : ?> |
||
158 | <footer class="region-footer"> |
||
159 | <?php renderRegion("footer") ?> |
||
160 | </footer> |
||
161 | <?php endif; ?> |
||
162 | |||
163 | |||
164 | |||
165 | <!-- render javascripts --> |
||
166 | <?php if (isset($javascripts)) : ?> |
||
167 | <?php foreach ($javascripts as $javascript) : ?> |
||
168 | <script src="<?= asset($javascript) ?>"></script> |
||
169 | <?php endforeach; ?> |
||
170 | <?php endif; ?> |
||
171 | |||
172 | <!-- |
||
173 | Inline script with one space stops chrome from triggering transitions on page load |
||
174 | https://lab.laukstein.com/bug/input |
||
175 | https://bugs.chromium.org/p/chromium/issues/detail?id=332189#c20 |
||
176 | --> |
||
177 | <script> </script> |
||
178 | </body> |
||
179 | </html> |
||
180 |
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