summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
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()
);