com web/php: Fix news links: index.php
| From: | Christoph Michael Becker | Date: | Thu, 11 Jul 2019 12:31:56 +0000 |
| Subject: | com web/php: Fix news links: index.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-28228@lists.php.net to get a copy of this message | ||
Commit: 47f8ecc68811b3f1b3833dcac845b7b8130e8e4a
Author: Christoph M. Becker <cmbecker69@gmx.de> Thu, 11 Jul 2019 14:31:56 +0200
Parents: 4ba0feb8d589038a53a1b1c9bb0aeb0c4bb3d8fd
Branches: master
Link: http://git.php.net/?p=web/php.git;a=commitdiff;h=47f8ecc68811b3f1b3833dcac845b7b8130e8e4a
Log:
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>
Changed paths:
M index.php
Diff:
diff --git a/index.php b/index.php
index 0358d9b..9f25d87 100644
--- a/index..php
+++ b/index.php
@@ -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');