com web/php: use updated "Strip http://php.net" method for more news links: conferences/index.php include/layout.inc
| From: | Peter Cowburn | Date: | Tue, 23 Jul 2019 19:07:25 +0000 |
| Subject: | com web/php: use updated "Strip http://php.net" method for more news links: conferences/index.php include/layout.inc | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-28245@lists.php.net to get a copy of this message | ||
Commit: 39daeda954b803b5bdcbca133e91b538672a027e
Author: Peter Cowburn <salathe@php.net> Tue, 23 Jul 2019 20:07:25 +0100
Parents: c41f8bffe7caef1a455327d971a56d8788885e6a
Branches: master
Link: http://git.php.net/?p=web/php.git;a=commitdiff;h=39daeda954b803b5bdcbca133e91b538672a027e
Log:
use updated "Strip http://php.net" method for more news
links
Following on from a similar change in 47f8ecc688, update more places
where we manipulate the URL.
Changed paths:
M conferences/index.php
M include/layout.inc
Diff:
diff --git a/conferences/index.php b/conferences/index.php
index 14daf18..1bb5cdc 100644
--- a/conferences/index.php
+++ b/conferences/index.php
@@ -29,7 +29,7 @@ $panels = '<p class="prepend"><a href="https://wiki.php.net/conferences">Want to
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_format(date_create($entry["updated"]), 'Y-m-d');
$content .= '<div class="newsentry">';
diff --git a/include/layout.inc b/include/layout.inc
index 4ef1de6..82c3d11 100644
--- a/include/layout.inc
+++ b/include/layout.inc
@@ -536,7 +536,7 @@ function get_news_changes()
$date->modify("+1 week");
if ($date->getTimestamp() > $_SERVER["REQUEST_TIME"]) {
- $link = substr($NEWS_ENTRIES[0]["link"][0]["href"], 14); // Strip http://php.net
+ $link = preg_replace('~^(http://php.net/|https://www.php.net/)~', '',
$NEWS_ENTRIES[0]["link"][0]["href"]);
$title = $NEWS_ENTRIES[0]["title"];
return "<a href='{$link}'>{$title}</a>";
}