index : archweb32 | |
Archlinux32 website | gitolite user |
summaryrefslogtreecommitdiff |
-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() ); |