Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-11-14 12:13:59 +0100
committerErich Eckner <git@eckner.net>2019-11-14 12:13:59 +0100
commit8ea14b8c6bd740bfc69bd4a65eadd7eb3916b48a (patch)
treeb3397d031d5c831f113d0173182f82a3b87343b6 /index.php
parent26182b2b47754c5cbc480526e23884feb8c3788b (diff)
index.php: extract date from recovered news
Diffstat (limited to 'index.php')
-rw-r--r--index.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/index.php b/index.php
index f0405a4..370fe5a 100644
--- a/index.php
+++ b/index.php
@@ -107,9 +107,16 @@ if ($news32 === false) {
print " </h4>\n";
} else {
foreach($news32 -> {'entry'} as $entry) {
+ $content = $entry -> {'summary'} -> __toString();
+ if (preg_match('#^<p>By [^<]*<br />On ([0-9]+)/([0-9]+)/([0-9]+), [^<]+</p>.*$#', $content) == false)
+ $date = explode('T', $entry -> {'updated'} -> __toString())[0];
+ else {
+ $date = preg_replace('#^<p>By [^<]*<br />On ([0-9]+)/([0-9]+)/([0-9]+), [^<]+</p>.*$#', '\3-\1-\2', $content);
+ $content = preg_replace('#^<p>By [^<]*<br />On [^<]*</p>#', '', $content);
+ }
$news[] = array (
- 'content' => preg_replace('#^<p>By [^<]*<br />On [^<]*</p>#', '', $entry -> {'summary'} -> __toString()),
- 'date' => explode('T', $entry -> {'updated'} -> __toString())[0],
+ 'content' => $content,
+ 'date' => $date,
'link' => $entry -> {'link'} -> attributes() -> {'href'} -> __toString(),
'title' => $entry -> {'title'} -> __toString()
);