-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
54 lines (43 loc) · 1.39 KB
/
index.php
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
<?php
require __DIR__ . '/_assets/inc.php';
$boards = [];
foreach (new DirectoryIterator(__DIR__) as $entry) {
if ($entry->isDot()) {
// No '.' or '..' entries
continue;
}
if (!$entry->isDir()) {
// Only directories wanted, please
continue;
}
if (!is_link("./{$entry->getFilename()}/index.php") || count(glob("./{$entry->getFilename()}/*.svg")) === 0) {
// Require existence of index.php symlink, plus at least one svg file in each directory to view
continue;
}
$boards[$entry->getFilename()] = $entry->getFileInfo();
}
ksort($boards, SORT_NATURAL);
?><!DOCTYPE html>
<html>
<head>
<title>My PCB Designs</title>
<link rel="stylesheet" type="text/css" href="/_assets/style.css">
</head>
<body class="page-index">
<h1>My PCB Designs</h1>
<p>Click a link to board design to see full, zoomable SVG renders of both layers of the board.</p>
<article>
<ul>
<?php foreach ($boards as /** @var SplFileInfo */ $board): ?>
<li>
<a href="./<?= html($board->getFilename()) ?>/">
<?= html($board->getFilename()) ?>
</a>
</li>
<?php endforeach; ?>
</ul>
</article>
<?php require __DIR__ . '/_assets/footer.php'; ?>
<script src="/_assets/script-index.js"></script>
</body>
</html>