Skip to content

Commit 59f32e7

Browse files
committed
Update eol.php to use VersionData
1 parent 597d47b commit 59f32e7

1 file changed

Lines changed: 28 additions & 24 deletions

File tree

eol.php

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
<?php
2+
3+
use phpweb\Releases\SupportState;
4+
use phpweb\Releases\VersionData;
5+
26
$_SERVER['BASE_PAGE'] = 'eol.php';
37

48
include_once __DIR__ . '/include/prepend.inc';
5-
include_once __DIR__ . '/include/branches.inc';
69

710
// Notes for specific branches can be added here, and will appear in the table.
811
$BRANCH_NOTES = [
@@ -23,6 +26,9 @@
2326
'4.4' => '<a href="https://php-legacy-docs.zend.com/manual/php5/en/migration5">A guide is available for migrating from PHP 4 to 5.0.</a>',
2427
];
2528

29+
$releases = array_filter(VersionData::all(), fn(VersionData $version) => $version->supportState === SupportState::Eol);
30+
$releases = VersionData::sort($releases, 'desc');
31+
2632
site_header('Unsupported Branches');
2733
?>
2834

@@ -36,7 +42,7 @@
3642
more recent versions of PHP.
3743
</p>
3844

39-
<table class="standard">
45+
<table class="standard" style="width: 100%">
4046
<thead>
4147
<tr>
4248
<th>Branch</th>
@@ -46,28 +52,26 @@
4652
</tr>
4753
</thead>
4854
<tbody>
49-
<?php foreach (get_eol_branches() as $major => $branches): ?>
50-
<?php foreach ($branches as $branch => $detail): ?>
51-
<?php $eolDate = get_branch_security_eol_date($branch) ?>
52-
<?php $eolPeriod = format_interval($eolDate, new DateTime('now')) ?>
53-
<tr>
54-
<td><?php echo htmlspecialchars($branch); ?></td>
55-
<td>
56-
<?php echo $eolDate->format('j M Y') ?>
57-
<br/>
58-
<em>(<?php echo $eolPeriod ?>)</em>
59-
</td>
60-
<td>
61-
<a href="<?php echo htmlspecialchars($detail['link']); ?>">
62-
<?php echo htmlspecialchars($detail['version']); ?>
63-
</a>
64-
</td>
65-
<td>
66-
<?php echo $BRANCH_NOTES[$branch] ?? ''; ?>
67-
</td>
68-
</tr>
69-
<?php endforeach ?>
70-
<?php endforeach ?>
55+
<?php foreach ($releases as $release) { ?>
56+
<?php $eolDate = $release->securityEOL ?>
57+
<?php $eolPeriod = format_interval($eolDate, new DateTime('now')) ?>
58+
<tr>
59+
<td><?= safe($release->label) ?></td>
60+
<td>
61+
<?= safe($eolDate->format('j M Y')) ?>
62+
<br/>
63+
<em>(<?= safe($eolPeriod) ?>)</em>
64+
</td>
65+
<td>
66+
<?php if ($release->latestRelease) { ?>
67+
<a href="<?= safe($release->latestRelease->announcementUrl); ?>">
68+
<?= safe($release->latestRelease->label) ?>
69+
</a>
70+
<?php } ?>
71+
</td>
72+
<td><?= $BRANCH_NOTES[$release->label] ?? '' ?></td>
73+
</tr>
74+
<?php } ?>
7175
</tbody>
7276
</table>
7377

0 commit comments

Comments
 (0)