mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
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:
parent
d3c7ad41fd
commit
16736e25a4
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user