index : archweb32 | |
Archlinux32 website | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2019-11-14 12:13:59 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2019-11-14 12:13:59 +0100 |
commit | 8ea14b8c6bd740bfc69bd4a65eadd7eb3916b48a (patch) | |
tree | b3397d031d5c831f113d0173182f82a3b87343b6 | |
parent | 26182b2b47754c5cbc480526e23884feb8c3788b (diff) |
-rw-r--r-- | index.php | 11 |
@@ -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() ); |