xref: /web-php/include/header.inc (revision a528e6e9)
1<?php
2$css_files = [
3    '/fonts/Fira/fira.css',
4    '/fonts/Font-Awesome/css/fontello.css',
5    '/styles/theme-base.css',
6    '/styles/theme-medium.css',
7];
8
9if (isset($config['css'])) {
10    $css_files = array_merge($css_files, (array) $config['css']);
11}
12if (isset($config["css_overwrite"])) {
13    $css_files = $config["css_overwrite"];
14}
15
16foreach($css_files as $filename) {
17    // files that do not start with / are assumed to be located in the /styles
18    // directory
19    if ($filename[0] !== '/') {
20        $filename = "/styles/$filename";
21    }
22    $path = dirname(__DIR__) . $filename;
23    $CSS[$filename] = @filemtime($path);
24}
25
26if (isset($shortname) && $shortname) {
27    header("Link: <$shorturl>; rel=shorturl");
28}
29
30if ($config["cache"]) {
31    if (is_numeric($config["cache"])) {
32        $timestamp = $config["cache"];
33    } else {
34        $timestamp = filemtime($_SERVER["DOCUMENT_ROOT"] . "/" . $_SERVER["BASE_PAGE"]);
35    }
36    $tsstring = gmdate("D, d M Y H:i:s ", $timestamp) . "GMT";
37
38    if (isset($_SERVER["HTTP_IF_MODIFIED_SINCE"]) && $_SERVER["HTTP_IF_MODIFIED_SINCE"] == $tsstring) {
39        header("HTTP/1.1 304 Not Modified");
40        exit;
41    }
42    header("Last-Modified: " . $tsstring);
43}
44if (!isset($config["languages"])) {
45    $config["languages"] = [];
46}
47
48?>
49<!DOCTYPE html>
50<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php echo $lang?>">
51<head>
52
53  <meta charset="utf-8">
54  <meta name="viewport" content="width=device-width, initial-scale=1.0">
55
56  <title>PHP: <?php echo $title ?></title>
57
58 <link rel="icon" type="image/svg+xml" sizes="any" href="<?php echo $MYSITE ?>favicon.svg?v=2">
59 <link rel="icon" type="image/png" sizes="196x196" href="<?php echo $MYSITE ?>favicon-196x196.png?v=2">
60 <link rel="icon" type="image/png" sizes="32x32" href="<?php echo $MYSITE ?>favicon-32x32.png?v=2">
61 <link rel="icon" type="image/png" sizes="16x16" href="<?php echo $MYSITE ?>favicon-16x16.png?v=2">
62 <link rel="shortcut icon" href="<?php echo $MYSITE ?>favicon.ico?v=2">
63
64 <link rel="search" type="application/opensearchdescription+xml" href="http://php.net/phpnetimprovedsearch.src" title="Add PHP.net search">
65 <link rel="alternate" type="application/atom+xml" href="<?php echo $MYSITE ?>releases/feed.php" title="PHP Release feed">
66 <link rel="alternate" type="application/atom+xml" href="<?php echo $MYSITE ?>feed.atom" title="PHP: Hypertext Preprocessor">
67
68<?php if (isset($_SERVER['BASE_PAGE'])): ?>
69 <link rel="canonical" href="https://www.php.net/<?php echo $_SERVER['BASE_PAGE']?>">
70<?php if ($shortname): ?>
71 <link rel="shorturl" href="<?php echo $shorturl ?>">
72 <link rel="alternate" href="<?php echo $shorturl ?>" hreflang="x-default">
73<?php endif ?>
74<?php endif ?>
75
76<?php foreach($config["meta-navigation"] as $rel => $page): ?>
77 <link rel="<?php echo $rel ?>" href="<?php echo $MYSITE ?><?php echo $page ?>">
78<?php endforeach ?>
79
80<?php foreach($config["languages"] as $code): ?>
81 <link rel="alternate" href="<?php echo $MYSITE ?>manual/<?php echo $code?>/<?php echo $config["thispage"] ?>" hreflang="<?php echo $code?>">
82<?php endforeach ?>
83
84<?php foreach($CSS as $filename => $modified): ?>
85<link rel="stylesheet" type="text/css" href="/cached.php?t=<?php echo $modified?>&amp;f=<?php echo $filename?>" media="screen">
86<?php endforeach ?>
87
88<?php if (!empty($_SERVER["BASE_HREF"])): ?>
89 <base href="<?php echo $_SERVER["BASE_HREF"] ?>">
90<?php endif ?>
91
92<?php if (isset($config['meta_tags'])) { echo $config['meta_tags']; } ?>
93
94</head>
95<body class="<?php echo $curr; ?> <?php echo $classes; ?>">
96
97<nav id="head-nav" class="navbar navbar-fixed-top">
98  <div class="navbar-inner clearfix">
99    <a href="/" class="brand"><img src="/images/logos/php-logo.svg" width="48" height="24" alt="php"></a>
100    <div id="mainmenu-toggle-overlay"></div>
101    <input type="checkbox" id="mainmenu-toggle">
102    <ul class="nav">
103      <li class="<?php echo $curr == "downloads" ? "active" : ""?>"><a href="/downloads">Downloads</a></li>
104      <li class="<?php echo $curr == "docs" ? "active" : ""?>"><a href="/docs.php">Documentation</a></li>
105      <li class="<?php echo $curr == "community" ? "active" : ""?>"><a href="/get-involved" >Get Involved</a></li>
106      <li class="<?php echo $curr == "help" ? "active" : ""?>"><a href="/support">Help</a></li>
107      <li class="<?php echo $curr === "php8" ? "active" : "" ?>">
108        <a href="/releases/8.3/index.php">
109          <img src="/images/php8/logo_php8_3.svg" alt="php8.3" height="22" width="60">
110        </a>
111      </li>
112    </ul>
113    <form class="navbar-search" id="topsearch" action="/search.php">
114      <input type="hidden" name="show" value="quickref">
115      <input type="search" name="pattern" class="search-query" placeholder="Search" accesskey="s">
116    </form>
117  </div>
118  <div id="flash-message"></div>
119</nav>
120<?php if (!empty($config["headsup"])): ?>
121<div class="headsup"><?php echo $config["headsup"]?></div>
122<?php endif ?>
123<nav id="trick"><div><?php doc_toc("en") ?></div></nav>
124<div id="goto">
125    <div class="search">
126         <div class="text"></div>
127         <div class="results"><ul></ul></div>
128   </div>
129</div>
130
131<?php if (!empty($config['breadcrumbs'])): ?>
132  <div id="breadcrumbs" class="clearfix">
133    <div id="breadcrumbs-inner">
134    <?php if (isset($config['next'])): ?>
135      <div class="next">
136        <a href="<?php echo $config['next'][0]; ?>">
137          <?php echo $config['next'][1]; ?> &raquo;
138        </a>
139      </div>
140    <?php endif; ?>
141    <?php if (isset($config['prev'])): ?>
142      <div class="prev">
143        <a href="<?php echo $config['prev'][0]; ?>">
144          &laquo; <?php echo $config['prev'][1]; ?>
145        </a>
146      </div>
147    <?php endif; ?>
148      <ul>
149      <?php
150          $breadcrumbs = $config['breadcrumbs'];
151          $last = array_pop($breadcrumbs);
152          foreach ($breadcrumbs as $crumb) {
153              echo "      <li><a href='{$crumb['link']}'>{$crumb['title']}</a></li>";
154          }
155          echo "      <li><a href='{$last['link']}'>{$last['title']}</a></li>";
156
157      ?>
158      </ul>
159    </div>
160  </div>
161<?php endif; ?>
162
163
164<?php if (!empty($config['intro'])):?>
165<div id="intro" class="clearfix">
166  <div class="container">
167    <?php echo $config['intro'];?>
168  </div>
169</div>
170<?php endif;?>
171
172
173<div id="layout" class="clearfix">
174  <section id="layout-content">
175