<style>
body {
padding-bottom: 4em;
+ padding-top: 10em;
+ }
+ .header {
+ top: 0;
+ width: 100%;
}
.footer {
bottom: 0;
- position: fixed;
width: 100%;
text-align: center;
}
.header, .footer {
+ position: fixed;
+ box-shadow: 0px 0px 1em .4em #89a;
background: #62B3E7;
padding: 1em 0;
}
.header h1 a:hover {
text-decoration: underline;
}
- .header h1 big , .footer, .footer a {
+ .header h1 big {
+ /* normalize browser difference */
+ font-size: 1.8em;
+ }
+ .header h1 big, .footer, .footer a {
color: #fdfdfd;
text-shadow: grey 0 0 .1em;
}
</header>
</div>
<div class="container">
- <?php $packages = array_map("basename", glob("phars/*")); ?>
+ <?php
+
+ $packages = array_map("basename", glob("phars/*", GLOB_NOSORT|GLOB_ONLYDIR));
+ sort($packages, SORT_NATURAL|SORT_FLAG_CASE);
+
+ ?>
<?php if ($_SERVER["QUERY_STRING"] && in_array($_SERVER["QUERY_STRING"], $packages, true)) : ?>
<table class="table table-full">
<thead>
<tr>
- <th class="text-left">Package</th>
+ <th class="text-left" colspan="4">Package</th>
<th class="text-left">Date</th>
<th class="text-right">Size</th>
+ <th class="text-right">Pharext</th>
</tr>
</thead>
<tbody>
- <?php foreach (array_reverse(glob("phars/$package/*.ext.phar*")) as $phar) : ?>
+
+ <?php
+
+ $versions = [];
+ foreach (glob("phars/$package/*.ext.phar*") as $phar) {
+ list($name, $enc) = explode(".ext.phar", basename($phar));
+ $data = new Phar($phar);
+ $meta = $data->getMetadata();
+ if ($meta) {
+ $release = $meta["release"];
+ } else {
+ $release = substr($name, strlen($package)+1);
+ }
+ $versions[$release][$enc] = [$phar, $meta];
+ uksort($versions[$release], function($a, $b) {
+ $al = strlen($a);
+ $bl = strlen($b);
+ if ($al < $bl) return -1;
+ if ($al > $bl) return 1;
+ return 0;
+ });
+ }
+ uksort($versions, "version_compare");
+
+ ?>
+ <?php foreach (array_reverse($versions) as $version => $phars) : ?>
<tr>
+ <td class="text-left">
+ <?= htmlspecialchars($package) ?>
+ <?= htmlspecialchars($version) ?>
+ </td>
+
+ <?php foreach ($phars as $ext => list($phar, $meta)) : ?>
<td class="text-left">
<a href="<?= htmlspecialchars($phar) ?>"
- ><?= htmlspecialchars(basename($phar)) ?></a>
+ >ext.phar<?= htmlspecialchars($ext) ?></a>
</td>
+ <?php endforeach; ?>
+ <?php for($i = 0; $i < 3-count($phars); ++$i) : ?>
+
+ <td></td>
+ <?php endfor; ?>
+
<td class="text-left">
<?php
?>
</td>
+ <td class="text-right">
+ <?php
+ if ($meta) {
+ printf("v%s\n", $meta["version"]);
+ } else {
+ print "v2.0.1\n";
+ }
+ ?>
+ </td>
</tr>
<?php endforeach; ?>
</ul>
<?php endif; ?>
-
+ <pre><?php var_dump($versions)?></pre>
</div>
<div class="footer">
<footer>
- © 2015 m6w6, Michael Wallner
+ © 2015 m6w6, Michael Wallner — Powered by <a href="//github.com/m6w6/pharext">pharext
+ <?php
+ require_once "../vendor/autoload.php";
+ printf("v%s\n", pharext\Metadata::version());
+ ?>
+ </a>
</footer>
</div>
</body>