mirror of https://github.com/tildeclub/site.git
Update index.php
change 10 most recent gold star supporters .
This commit is contained in:
parent
bbfc51b8cb
commit
436a87e234
25
index.php
25
index.php
|
@ -30,15 +30,28 @@
|
||||||
they give, only by the fact that they gave.
|
they give, only by the fact that they gave.
|
||||||
Here's who has donated! When you're on the
|
Here's who has donated! When you're on the
|
||||||
server, THANK THEM.</p>
|
server, THANK THEM.</p>
|
||||||
|
<?php
|
||||||
|
$supporters = json_decode(file_get_contents('supporters.json'), true);
|
||||||
|
usort($supporters, function($a, $b) {
|
||||||
|
return strtotime($b['date']) - strtotime($a['date']);
|
||||||
|
});
|
||||||
|
|
||||||
|
$showAll = isset($_GET['show_all']) && $_GET['show_all'] == 'true';
|
||||||
|
$supportersToShow = $showAll ? $supporters : array_slice($supporters, 0, 10);
|
||||||
|
?>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<?php
|
<?php foreach ($supportersToShow as $supporter): ?>
|
||||||
$supporters = json_decode(file_get_contents('supporters.json'), true);
|
<li><?= htmlspecialchars($supporter['date']) ?> | <a href="<?= htmlspecialchars($supporter['url']) ?>"><?= htmlspecialchars($supporter['name']) ?></a></li>
|
||||||
foreach ($supporters as $supporter) {
|
<?php endforeach; ?>
|
||||||
echo '<li>' . htmlspecialchars($supporter['date']) . ' | <a href="' . htmlspecialchars($supporter['url']) . '">' . htmlspecialchars($supporter['name']) . '</a></li>';
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<?php if (!$showAll): ?>
|
||||||
|
<p><a href="?show_all=true">Show all supporters</a></p>
|
||||||
|
<?php else: ?>
|
||||||
|
<p><a href="?show_all=false">Show only the 10 most recent supporters</a></p>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col">
|
<div class="col">
|
||||||
|
|
Loading…
Reference in New Issue