mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-11-09 11:26:17 +00:00
97a60576a6
Upgrade Bootstrap from V3 to V5. The current version is very much out of date. Migration wasn't particularly straightforward - I have rejected doing it in the past for that reason. I let AI help me this time around, and, although we went down many blind alleys, we eventually met with success. The upgrade leads to a couple of improvements: - There is now a toggle for light/dark mode. - The dropdown lists now have scrollbars when needed. This means that we can re-consolidate some categories which were previously split up because the dropdown was unusable. This PR leaves the categories unchanged, but it is something I can consider in future. Bootstrap V5 no longer requires jQuery, so it is dropped. FontAwesome is still on an old version. Newer versions use much larger files, mainly because of many new icons, none of which we use. So there is a cost to upgrading, and I don't see a compensating advantage. In fact, I have reduced its css file to one which includes only the icons we are using. And, since more modern versions distribute only the woff2 version of the font, I am removing the alternatives; I'm willing to add them back on request. This change does not affect the PhpSpreadsheet code in any way, nor does it affect running samples from the command line - just running samples in a browser.
85 lines
3.6 KiB
PHP
85 lines
3.6 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Header file.
|
|
*/
|
|
|
|
use PhpOffice\PhpSpreadsheet\Helper\Sample;
|
|
|
|
error_reporting(E_ALL);
|
|
|
|
require_once __DIR__ . '/Bootstrap.php';
|
|
|
|
$helper = new Sample();
|
|
|
|
// Return to the caller script when runs by CLI
|
|
if ($helper->isCli()) {
|
|
return;
|
|
}
|
|
?>
|
|
<html data-bs-theme="light">
|
|
<head>
|
|
<title><?php echo $helper->getPageTitle(); ?></title>
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
<link rel="stylesheet" href="/bootstrap/css/bootstrap.min.css?v5"/>
|
|
<link rel="stylesheet" href="/bootstrap/css/font-awesome.v4.used.css"/>
|
|
<link rel="stylesheet" href="/bootstrap/css/phpspreadsheet.css?v5"/>
|
|
<script src="/bootstrap/js/bootstrap.bundle.min.js" defer></script>
|
|
<script src="/bootstrap/js/darklighttoggle.js"></script>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<div class="navbar navbar-expand-lg bg-body-tertiary" role="navigation">
|
|
<div class="container-fluid">
|
|
<div class="navbar-header">
|
|
<button type="button" class="navbar-toggler" data-bs-toggle="collapse" data-bs-target=".navbar-collapse">
|
|
<span class="visually-hidden">Toggle navigation</span>
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
|
|
<a class="navbar-brand" href="/">PHPSpreadsheet</a>
|
|
<a href="https://github.com/PHPOffice/PHPSpreadsheet">
|
|
<i class="fa fa-github fa-lg" title="GitHub"></i>
|
|
|
|
</a>
|
|
<a href="https://phpspreadsheet.readthedocs.io">
|
|
<i class="fa fa-book fa-lg" title="Docs"></i>
|
|
|
|
</a>
|
|
<br><br><button class="btn btn-outline-secondary btn-sm" id="themeToggler" type="button" title="Toggle dark/light mode">
|
|
<i class="fa fa-moon-o fa-lg" id="themeIcon"></i>
|
|
</button>
|
|
</div>
|
|
<div class="collapse navbar-collapse">
|
|
<ul class="navbar-nav"><?php
|
|
foreach ($helper->getSamples() as $category => $files) {
|
|
?><li class="nav-item dropdown">
|
|
<a href="#" class="nav-link dropdown-toggle" data-bs-toggle="dropdown" role="button" aria-expanded="false"><?php echo $category ?>
|
|
</a>
|
|
<ul class="dropdown-menu dropdown-menu-end text-wrap" style="max-width: 300px;"><?php
|
|
foreach ($files as $name => $file) {
|
|
if (
|
|
!in_array(
|
|
$file,
|
|
[
|
|
'Chart/35_Chart_render.php',
|
|
'Chart/35_Chart_render33.php',
|
|
],
|
|
true
|
|
)
|
|
) {
|
|
echo '<li><a class="dropdown-item" href="/' . $file . '">' . $name . '</a></li>';
|
|
}
|
|
} ?></ul>
|
|
</li>
|
|
<?php
|
|
} ?>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
echo $helper->getPageHeading();
|