<table class="hcalendar">
<tbody>
<?php

date_default_timezone_set
("Europe/London");

$feeds = array(
    
"adactio"        =>    "http://adactio.com/journal/rss",
    
"domscripting"    =>    "http://domscripting.com/blog/rss",
    
"link"            =>    "http://del.icio.us/rss/adactio",
    
"picture"        =>    "http://www.flickr.com/services/feeds/photos_public.gne?id=74105777@N00&format=rss_200",
    
"song"            =>    "http://ws.audioscrobbler.com/1.0/user/adactio/recenttracks.rss",
    
"message"        =>    "http://twitter.com/statuses/user_timeline/11250.rss"
);

$details = array("title","link");

$list = array();

$rss = new DOMDocument();

foreach (
$feeds as $name => $feed) {

    
$rss -> load($feed);

    
$items $rss -> getElementsByTagName("item");

    foreach (
$items as $item) {

        if (
$item -> getElementsByTagName("pubDate") -> item(0)) {
            
$date $item -> getElementsByTagName("pubDate") -> item(0) -> nodeValue;
        } else {
            
$date $item -> getElementsByTagName("date") -> item(0) -> nodeValue;
        }
        
$date strtotime(substr($date,0,25));

        
$list[$date]["name"] = $name;

        foreach (
$details as $detail) {

            
$list[$date][$detail] = $item -> getElementsByTagName($detail) -> item(0) -> nodeValue;

        }
    }
}

krsort($list);

$day "";

foreach (
$list as $timestamp => $item) {

    
$this_day date("F jS",$timestamp);

    if (
$day != $this_day) {

        echo 
"</tbody>\n";
        echo 
"<thead>\n";
        echo 
"<tr>\n";
        echo 
"<th colspan=\"3\">";
        echo 
$this_day;
        echo 
"</th>\n";
        echo 
"</tr>\n";
        echo 
"</thead>\n";
        echo 
"<tbody>\n";

        
$day $this_day;

    }

    echo 
"<tr class=\"vevent ";
    echo 
$item["name"];
    echo 
"\">\n";
    echo 
"<th>";
    echo 
"<abbr class=\"dtstart\" title=\"";
    echo 
date("c",$timestamp);
    echo 
"\">";
    echo 
date("g:ia",$timestamp);
    echo 
"</abbr>";
    echo 
"</th>\n";
    echo 
"<td>";
    echo 
"<a class=\"url summary\" href=\"";
    echo 
$item["link"];
    echo 
"\">";
    echo 
$item["title"];
    echo 
"</a>";
    echo 
"</td>\n";
    echo 
"<td>";
    echo 
"<img src=\"images/";
    echo 
$item["name"];
    echo 
".gif\" alt=\"";
    echo 
$item["name"];
    echo 
"\" />";
    echo 
"</td>\n";
    echo 
"</tr>\n";

}

?>
</tbody>
</table>