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
1 changed files with 12 additions and 9 deletions

View File

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