BUGFIX Check if SimplePie exists before attempting to create a new instance of it, since it's a 3rd party class

This commit is contained in:
Sean Harvey 2008-10-23 23:07:19 +00:00
parent d3c7ad41fd
commit 16736e25a4

View File

@ -44,16 +44,19 @@ class RSSWidget extends Widget {
function FeedItems() { function FeedItems() {
$output = new DataObjectSet(); $output = new DataObjectSet();
$this->feed = new SimplePie($this->AbsoluteRssUrl);
$this->feed->init(); if(class_exists('SimplePie')) {
if($items = $this->feed->get_items(0, $this->NumberToShow)) { $this->feed = new SimplePie($this->AbsoluteRssUrl);
foreach($items as $item) { $this->feed->init();
$output->push(new ArrayData(array( if($items = $this->feed->get_items(0, $this->NumberToShow)) {
"Title" => $item->get_title(), foreach($items as $item) {
"Link" => $item->get_link() $output->push(new ArrayData(array(
))); "Title" => $item->get_title(),
"Link" => $item->get_link()
)));
}
return $output;
} }
return $output;
} }
} }
} }