<?php
class Feed {
  function 
Feed($channel$item) {
    
$this->channel $channel;
    
$this->item $item;
  }

  function 
title() {
    return 
$this->item['title'];
  }

  function 
channeltitle() {
    return 
$this->channel['title'];
  }

  function 
link() {
    return 
$this->item['link'];
  }

  function 
channellink() {
    return 
$this->channel['link'];
  }

  function 
date() {
    if (isset(
$this->item['dc:date'])) {
    } elseif (isset(
$this->item['pubDate'])) {
    }
    return 
$this->item['dc:date'];
  }

  function 
toString() {
    return 
"[" $this->channeltitle() . "] " $this->title();
  }

  function 
toHtml() {
    return 
"[<a href='" $this->channellink() . "'>" $this->channeltitle() . "</a>] <a href='" $this->link() . "'>" $this->title() . "</a>";
  }
}

require_once 
"XML/RSS.php";
class 
Rss
{
  function 
Rss($url='') {
    
$this->rss =& new XML_RSS($url);
    
$this->rss->parse();
    
$items $this->rss->getItems();
    
$channel $this->rss->getChannelInfo();
    
$this->feeds = Array();
    foreach (
$items as $item) {
      
array_push($this->feeds, new Feed($channel$item));
    }
  }

  function 
getFeeds() {
    return 
$this->feeds;
  }

  function 
getChannelInfo() {
    return 
$this->rss->getChannelInfo();
  }

  function 
count() {
    return 
sizeof($this->feeds);
  }
}

class 
CompositedRss {
  function 
CompositedRss() {
    
$this->rss_array = Array();
  }

  function 
add($url) {
    
array_push($this->rss_array, new Rss($url));
  }

  function 
count() {
    
$count 0;
    foreach (
$this->rss_array as $rss) {
      
$count += $rss->count();
    }
    return 
$count;
  }

  function 
getFeeds() {
    
$feeds = array();
    foreach (
$this->rss_array as $rss) {
      
$feeds array_merge($feeds$rss->getFeeds());
    }
    return 
$feeds;
  }
}
?>