<?php $dir = __DIR__; $files = scandir($dir); $pieces = array(); foreach ($files as $file) { if (!preg_match("/\.(php|html)$/i", $file)) continue; if ($file === "plan-board.php") continue; $base = pathinfo($file, PATHINFO_FILENAME); $img = ""; $exts = array("png","jpg","jpeg","webp"); foreach ($exts as $e) { if (file_exists($dir . "/" . $base . "." . $e)) { $img = $base . "." . $e; break; } } $title = $base; $data = @file_get_contents($dir . "/" . $file); if ($data && preg_match("/<title>(.*?)<\/title>/is", $data, $m)) { $title = trim($m[1]); } $pieces[] = array( "file" => $file, "title" => $title, "size" => round(filesize($dir . "/" . $file) / 1024, 1) . " KB", "date" => date("Y-m-d", filemtime($dir . "/" . $file)), "image" => $img ); } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>The Plan</title> plan-assets/board.css </head> <body> <div id="board"> <svg id="strings"></svg> <?php foreach ($pieces as $i => $p) { ?> <div class="piece" style="--i:<?php echo $i; ?>"> <?php if ($p["image"]) { ?> <?php echo htmlspecialchars($p[ ?>"> <?php } ?> <div class="label"> <strong><?php echo htmlspecialchars($p["title"]); ?></strong><br> <?php echo htmlspecialchars($p["file"]); ?><br> <?php echo $p["size"]; ?><br> <?php echo $p["date"]; ?> </div> </div> <?php } ?> </div> plan-assets/board.jsscript> </body> </html>