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() {
|
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user