xref: /web-php/include/changelogs.inc (revision acd86a16)
1<?php
2
3function bugfix($number): void {
4    echo "Fixed bug "; bugl($number);
5}
6
7function bugl($number): void {
8    echo "<a href=\"http://bugs.php.net/$number\">#$number</a>";
9}
10
11function implemented($number): void {
12    echo "Implemented FR "; bugl($number);
13}
14
15function peclbugfix($number): void {
16    echo "Fixed PECL bug "; bugl($number);
17}
18
19function peclbugl($number): void {
20    echo "<a href=\"http://pecl.php.net/bugs/bug.php?id=$number\">#$number</a>";
21}
22
23function githubissue($repo, $number): void {
24    echo "Fixed issue "; githubissuel($repo, $number);
25}
26
27function githubissuel($repo, $number): void {
28    echo "<a href=\"https://github.com/$repo/issues/$number\">GH-$number</a>";
29}
30
31function githubsecurityl($repo, $id): void {
32    echo "<a href=\"https://github.com/$repo/security/advisories/GHSA-$id\">GHSA-$id</a>";
33}
34
35function release_date($in): void {
36    $time = strtotime($in);
37    $human_readable = date('d M Y', $time);
38    $for_tools = date('Y-m-d', $time);
39    echo "<time class='releasedate' datetime='{$for_tools}'>{$human_readable}</time>";
40}
41
42function changelog_makelink(string $branch): string {
43    return '<a href="#PHP_' . urlencode(strtr($branch, '.', '_')) . '">' . htmlentities($branch) . '</a>';
44}
45
46function changelog_header(int $major_version, array $minor_versions): void {
47    site_header("PHP {$major_version} ChangeLog", [
48        'current' => 'docs',
49        'css' => ['changelog.css'],
50        'layout_span' => 12,
51    ]);
52    echo "<h1>PHP {$major_version} ChangeLog</h1>\n";
53    $glue = '';
54    foreach ($minor_versions as $branch) {
55        echo $glue, changelog_makelink($branch);
56        $glue = ' | ';
57    }
58    echo "\n";
59}
60
61function changelog_footer(int $current_major, array $minor_versions): void {
62    $sidebar = "<div class=\"panel\">ChangeLogs<div class=\"body\"><ul>\n";
63    foreach ([8, 7, 5, 4] as $major) {
64        if ($major === $current_major) {
65            $sidebar .= "  <li><b>PHP {$major}.x</b>\n    <ul>";
66            foreach ($minor_versions as $branch) {
67                $sidebar .= "      <li>" . changelog_makelink($branch) . "</li>\n";
68            }
69            $sidebar .= "    </ul></li>\n";
70        } else {
71            $sidebar .= "  <li><a href=\"/ChangeLog-{$major}.php\">PHP {$major}.x</a></li>\n";
72        }
73    }
74    site_footer(['sidebar' => "$sidebar</ul></div></div>"]);
75}
76