diff --git a/code/widgets/RSSWidget.php b/code/widgets/RSSWidget.php index 5c3aa63..cc34979 100644 --- a/code/widgets/RSSWidget.php +++ b/code/widgets/RSSWidget.php @@ -66,10 +66,17 @@ if(class_exists('Widget')) { return $output; } - include_once(Director::getAbsFile(SAPPHIRE_DIR . '/thirdparty/simplepie/simplepie.inc')); + if(!class_exists('SimplePie')) { + throw new LogicException( + 'Please install the "simplepie/simplepie" library by adding it to the "require" ' + + 'section of your composer.json' + ); + } $t1 = microtime(true); - $feed = new SimplePie($this->AbsoluteRssUrl, TEMP_FOLDER); + $feed = new SimplePie(); + $feed->set_feed_url($this->AbsoluteRssUrl); + $feed->set_cache_location(TEMP_FOLDER); $feed->init(); if($items = $feed->get_items(0, $this->NumberToShow)) { foreach($items as $item) { diff --git a/composer.json b/composer.json index 6fd445e..25c36d0 100644 --- a/composer.json +++ b/composer.json @@ -18,9 +18,10 @@ { "silverstripe/cms": ">=3.1.x-dev,<4.0" }, - "suggests": + "suggest": { - "silverstripe/widgets": "dev-master", - "silverstripe/comments": "dev-master" + "silverstripe/widgets": "Additional 'sidebar features', e.g. a list of recent posts and a tagcloud", + "silverstripe/comments": "Enable user comments on any page type, including blog posts", + "simplepie/simplepie": "Parse RSS feeds, required for the RSS widget" } }