modularize
[m6w6/replicator] / public / html.php
1 <?php
2 const INCLUDED = __FILE__;
3
4 require_once "index.php";
5
6 ob_start($res);
7
8 ?>
9 <!doctype html>
10 <html>
11 <head>
12 <meta charset="utf-8">
13 <title>Replicator</title>
14 <link rel="stylesheet" href="concise/css/concise.min.css">
15 <link href="//fonts.googleapis.com/css?family=Droid+Sans" rel="stylesheet" type="text/css">
16 <meta name="viewport" content="width=device-width, initial-scale=1">
17 <style>
18 body {
19 padding-bottom: 4em;
20 padding-top: 10em;
21 }
22 .header {
23 top: 0;
24 width: 100%;
25 }
26 .footer {
27 bottom: 0;
28 width: 100%;
29 text-align: center;
30 }
31 .header, .footer {
32 position: fixed;
33 box-shadow: 0px 0px 1em .4em #89a;
34 background: #62B3E7;
35 padding: 1em 0;
36 }
37 .header h1 {
38 font-weight: bold;
39 }
40 .header h1 a, .footer a:hover {
41 text-decoration: none;
42 }
43 .header h1 a:hover {
44 text-decoration: underline;
45 }
46 .header h1 big {
47 /* normalize browser difference */
48 font-size: 1.8em;
49 }
50 .header h1 big, .footer, .footer a {
51 color: #fdfdfd;
52 text-shadow: grey 0 0 .1em;
53 }
54 .header h1 small {
55 color: #666;
56 text-shadow: white 0 0 .2em;
57 }
58 li {
59 list-style-type: circle;
60 }
61 </style>
62 </head>
63 <body>
64 <div class="header">
65 <header>
66 <h1 class="container">
67 <a href="?"><big>Replicator</big></a><br>
68 <small>Replicating PECL releases as pharext packages since 2015</small>
69 </h1>
70 <a href="https://github.com/m6w6/replicator"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/652c5b9acfaddf3a9c326fa6bde407b87f7be0f4/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6f72616e67655f6666373630302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png"></a>
71 </header>
72 </div>
73 <div class="container">
74
75 <?php if (!empty($package)) : ?>
76
77 <h2><?= htmlspecialchars($package) ?></h2>
78 <table class="table table-full">
79 <thead>
80 <tr>
81 <th class="text-left" colspan="4">Package</th>
82 <th class="text-left">Date</th>
83 <th class="text-right">Pharext</th>
84 </tr>
85 </thead>
86 <tbody>
87
88 <?php foreach (array_reverse(package_versions($package)) as $version => $phars) : ?>
89
90 <tr>
91 <td class="text-left">
92 <?= htmlspecialchars($package) ?>
93 <?= htmlspecialchars($version) ?>
94 </td>
95
96 <?php foreach (array_map("array_values", $phars) as $ext => list($phar, $date, $size, $pharext)) : ?>
97 <td class="text-left">
98 <a href="<?= htmlspecialchars($phar) ?>"
99 >ext.phar<?= htmlspecialchars($ext) ?></a><br>
100 <small>&#10507; <?= human_size($size) ?></small>
101 </td>
102 <?php endforeach; ?>
103 <?php for($i = 0; $i < 3-count($phars); ++$i) : ?>
104
105 <td></td>
106 <?php endfor; ?>
107
108 <td class="text-left">
109 <?= human_date($date); ?>
110
111 </td>
112 <td class="text-right <?= version_compare($pharext, "3.0.1", "<") ? "color-red":"" ?>">
113 v<?= $pharext ?>
114 </td>
115 </tr>
116 <?php endforeach; ?>
117
118 </tbody>
119 </table>
120 <?php else: ?>
121
122 <h2>Available Packages</h2>
123 <ul class="list-inline">
124 <?php foreach (array_map("htmlspecialchars", $packages) as $index => $package) : ?>
125 <?php $next = strtolower($package{0}); ?>
126 <?php if (isset($prev) && $next != $prev) : ?>
127
128 </ul>
129 <ul class="list-inline">
130 <?php endif; ?>
131
132 <li><a href="?<?= $package ?>"><?= $package ?></a></li>
133 <?php $prev = $next; ?>
134 <?php endforeach; ?>
135
136 </ul>
137 <?php endif; ?>
138 </div>
139 <div class="footer">
140 <footer>
141 &copy; 2015 m6w6, Michael Wallner &mdash; Powered by <a href="//github.com/m6w6/pharext">pharext
142 <?php
143 require_once "../vendor/autoload.php";
144 printf("v%s\n", pharext\Metadata::version());
145 ?>
146 </a>
147 </footer>
148 </div>
149 </body>
150 </html>
151 <?php
152 $res->send();
153 ?>