-
Notifications
You must be signed in to change notification settings - Fork 624
Expand file tree
/
Copy pathheader.inc
More file actions
350 lines (311 loc) · 10.8 KB
/
header.inc
File metadata and controls
350 lines (311 loc) · 10.8 KB
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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
<?php
$css_files = [
'/fonts/Fira/fira.css',
'/fonts/Font-Awesome/css/fontello.css',
'/styles/theme-base.css',
'/styles/theme-medium.css',
];
if (isset($config['css'])) {
$css_files = array_merge($css_files, (array) $config['css']);
}
if (isset($config["css_overwrite"])) {
$css_files = $config["css_overwrite"];
}
foreach($css_files as $filename) {
// files that do not start with / are assumed to be located in the /styles
// directory
if ($filename[0] !== '/') {
$filename = "/styles/$filename";
}
$path = dirname(__DIR__) . $filename;
$CSS[$filename] = @filemtime($path);
}
$JS = [];
if (isset($config["js_files"])) {
foreach($config['js_files'] as $filename) {
$path = dirname(__DIR__) . '/' . $filename;
$JS[$filename] = @filemtime($path);
}
}
if (isset($shortname) && $shortname) {
header("Link: <$shorturl>; rel=shorturl");
}
if ($config["cache"]) {
if (is_numeric($config["cache"])) {
$timestamp = $config["cache"];
} else {
$timestamp = filemtime($_SERVER["DOCUMENT_ROOT"] . "/" . $_SERVER["BASE_PAGE"]);
}
$tsstring = gmdate("D, d M Y H:i:s ", $timestamp) . "GMT";
if (isset($_SERVER["HTTP_IF_MODIFIED_SINCE"]) && $_SERVER["HTTP_IF_MODIFIED_SINCE"] == $tsstring) {
header("HTTP/1.1 304 Not Modified");
exit;
}
header("Last-Modified: " . $tsstring);
}
if (!isset($config["languages"])) {
$config["languages"] = [];
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php echo $lang?>">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php if (!empty($_SERVER["BASE_HREF"])): ?>
<base href="<?php echo $_SERVER["BASE_HREF"]; ?>">
<?php endif ?>
<title><?php echo $title ?></title>
<?php foreach($CSS as $filename => $modified): ?>
<link rel="stylesheet" type="text/css" href="/cached.php?t=<?php echo $modified?>&f=<?php echo $filename?>" media="screen">
<?php endforeach ?>
<link rel="icon" type="image/svg+xml" sizes="any" href="<?php echo $MYSITE ?>favicon.svg?v=2">
<link rel="icon" type="image/png" sizes="196x196" href="<?php echo $MYSITE ?>favicon-196x196.png?v=2">
<link rel="icon" type="image/png" sizes="32x32" href="<?php echo $MYSITE ?>favicon-32x32.png?v=2">
<link rel="icon" type="image/png" sizes="16x16" href="<?php echo $MYSITE ?>favicon-16x16.png?v=2">
<link rel="shortcut icon" href="<?php echo $MYSITE ?>favicon.ico?v=2">
<link rel="search" type="application/opensearchdescription+xml" href="https://www.php.net/phpnetimprovedsearch.src" title="Add PHP.net search">
<link rel="alternate" type="application/atom+xml" href="<?php echo $MYSITE ?>releases/feed.php" title="PHP Release feed">
<link rel="alternate" type="application/atom+xml" href="<?php echo $MYSITE ?>feed.atom" title="PHP: Hypertext Preprocessor">
<?php if (isset($_SERVER['BASE_PAGE'])): ?>
<link rel="canonical" href="https://www.php.net/<?php echo $_SERVER['BASE_PAGE']?>">
<?php if ($shortname): ?>
<link rel="shorturl" href="<?php echo $shorturl ?>">
<link rel="alternate" href="<?php echo $shorturl ?>" hreflang="x-default">
<?php endif ?>
<?php endif ?>
<?php foreach($config["meta-navigation"] as $rel => $page): ?>
<link rel="<?php echo $rel ?>" href="<?php echo $MYSITE ?><?php echo $page ?>">
<?php endforeach ?>
<?php foreach($config["languages"] as $code): ?>
<link rel="alternate" href="<?php echo $MYSITE ?>manual/<?php echo $code?>/<?php echo $config["thispage"] ?>" hreflang="<?php echo $code?>">
<?php endforeach ?>
<?php foreach($CSS as $filename => $modified): ?>
<link rel="stylesheet" type="text/css" href="/cached.php?t=<?php echo $modified?>&f=<?php echo $filename?>" media="screen">
<?php endforeach ?>
<?php foreach($JS as $filename => $modified): ?>
<script type="text/javascript" src="/cached.php?t=<?php echo $modified?>&f=<?php echo $filename?>"></script>
<?php endforeach ?>
<?php if (!empty($_SERVER["BASE_HREF"])): ?>
<base href="<?php echo $_SERVER["BASE_HREF"] ?>">
<?php endif ?>
<?php if (isset($config['meta_tags'])) { echo $config['meta_tags']; } ?>
<?php if (is_primary_site()) { ?>
<!-- Matomo -->
<script>
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(["setDoNotTrack", true]);
_paq.push(["disableCookies"]);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="https://analytics.php.net/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '1']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->
<?php } ?>
</head>
<body class="<?php echo $curr; ?> <?php echo $classes; ?>">
<nav class="navbar navbar-fixed-top">
<div class="navbar__inner">
<a href="/" aria-label="PHP Home" class="navbar__brand">
<img
src="/images/logos/php-logo-white.svg"
aria-hidden="true"
width="80"
height="40"
>
</a>
<div
id="navbar__offcanvas"
tabindex="-1"
class="navbar__offcanvas"
aria-label="Menu"
>
<button
id="navbar__close-button"
class="navbar__icon-item navbar_icon-item--visually-aligned navbar__close-button"
>
<svg xmlns="http://www.w3.org/2000/svg" width="24" viewBox="0 0 24 24" fill="currentColor"><path d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z" /></svg>
</button>
<ul class="navbar__nav">
<?php foreach (get_nav_items() as $entry): ?>
<?php
$isActive = $curr == $entry->id;
$activeClass = $isActive ? 'navbar__link--active' : '';
$releaseClass = $entry->image ? 'navbar__release' : '';
?>
<li class="navbar__item">
<a
href="<?= $entry->href ?>"
<?= $isActive ? 'aria-current="page"' : '' ?>
class="navbar__link <?= "$activeClass $releaseClass" ?>"
>
<?php if ($entry->image): ?>
<img src="<?= $entry->image ?>" alt="<?= $entry->name ?>">
<?php else: ?>
<?= $entry->name ?>
<?php endif; ?>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
<div class="navbar__right">
<?php
// https://feathericons.com search
$searchIcon = <<<SVG
<svg
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
width="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<circle cx="11" cy="11" r="8"></circle>
<line x1="21" y1="21" x2="16.65" y2="16.65"></line>
</svg>
SVG;
// https://pictogrammers.com/library/mdi/icon/menu/
$menuIcon = <<<SVG
<svg xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
width="24"
viewBox="0 0 24 24"
fill="currentColor"
>
<path d="M3,6H21V8H3V6M3,11H21V13H3V11M3,16H21V18H3V16Z" />
</svg>
SVG;
?>
<!-- Desktop default search -->
<form
action="/manual-lookup.php"
class="navbar__search-form"
>
<label for="navbar__search-input" aria-label="Search docs">
<?= $searchIcon ?>
</label>
<input
type="search"
name="pattern"
id="navbar__search-input"
class="navbar__search-input"
placeholder="Search docs"
accesskey="s"
>
<input type="hidden" name="scope" value="quickref">
</form>
<!-- Desktop encanced search -->
<button
id="navbar__search-button"
class="navbar__search-button"
hidden
>
<?= $searchIcon ?>
Search docs
</button>
<!-- Mobile default items -->
<a
id="navbar__search-link"
href="/lookup-form.php"
aria-label="Search docs"
class="navbar__icon-item navbar__search-link"
>
<?= $searchIcon ?>
</a>
<a
id="navbar__menu-link"
href="/menu.php"
aria-label="Menu"
class="navbar__icon-item navbar_icon-item--visually-aligned navbar_menu-link"
>
<?= $menuIcon ?>
</a>
<!-- Mobile enhanced items -->
<button
id="navbar__search-button-mobile"
aria-label="Search docs"
class="navbar__icon-item navbar__search-button-mobile"
hidden
>
<?= $searchIcon ?>
</button>
<button
id="navbar__menu-button"
aria-label="Menu"
class="navbar__icon-item navbar_icon-item--visually-aligned"
hidden
>
<?= $menuIcon ?>
</button>
</div>
<div
id="navbar__backdrop"
class="navbar__backdrop"
></div>
</div>
<div id="flash-message"></div>
</nav>
<?php if (!empty($config["headsup"])): ?>
<div class="headsup"><?php echo $config["headsup"]?></div>
<?php endif ?>
<nav id="trick"><div><?php doc_toc("en") ?></div></nav>
<div id="goto">
<div class="search">
<div class="text"></div>
<div class="results"><ul></ul></div>
</div>
</div>
<?php if (!empty($config['breadcrumbs'])): ?>
<div id="breadcrumbs" class="clearfix">
<div id="breadcrumbs-inner">
<?php if (isset($config['next'])): ?>
<div class="next">
<a href="<?php echo $config['next'][0]; ?>">
<?php echo $config['next'][1]; ?> »
</a>
</div>
<?php endif; ?>
<?php if (isset($config['prev'])): ?>
<div class="prev">
<a href="<?php echo $config['prev'][0]; ?>">
« <?php echo $config['prev'][1]; ?>
</a>
</div>
<?php endif; ?>
<ul>
<?php
$breadcrumbs = $config['breadcrumbs'];
$last = array_pop($breadcrumbs);
foreach ($breadcrumbs as $crumb) {
echo " <li><a href='{$crumb['link']}'>{$crumb['title']}</a></li>";
}
echo " <li><a href='{$last['link']}'>{$last['title']}</a></li>";
?>
</ul>
</div>
</div>
<?php endif; ?>
<?php if (!empty($config['intro'])):?>
<div id="intro" class="clearfix">
<div class="hero-background">
<div class="hero-grid-overlay"></div>
<div class="hero-glow"></div>
</div>
<div class="container">
<?php echo $config['intro'];?>
</div>
</div>
<?php endif;?>
<div id="layout" class="clearfix">
<section id="layout-content">