1
0
mirror of https://github.com/php/web-php.git synced 2026-03-24 07:12:16 +01:00

Fix news links

As of commit 464ff73, news entry URLs target https://www.php.net
instead of http://php.net.  Therefore the magic number 15 is no longer
appropriate.  To also cater to existing news entries, we use a
preg_replace() now.

[1] <http://git.php.net/?p=web/php.git;a=commit;h=464ff738bafbd7882c3e9b399531702e95f08023>
This commit is contained in:
Christoph M. Becker
2019-07-11 14:31:56 +02:00
parent 4ba0feb8d5
commit 47f8ecc688

View File

@@ -64,7 +64,7 @@ foreach($NEWS_ENTRIES as $entry) {
}
}
foreach($frontpage as $entry) {
$link = substr($entry["id"], 15); // Strip http://php.net/
$link = preg_replace('~^(http://php.net/|https://www.php.net/)~', '', $entry["id"]);
$id = parse_url($entry["id"], PHP_URL_FRAGMENT);
$date = date_create($entry['updated']);
$date_human = date_format($date, 'd M Y');