From 45d81beb6cc66e720e2983fc29d1a0a82d8bf9c1 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Tue, 2 Apr 2013 10:41:01 +0200 Subject: [PATCH] put getUrlContent into api --- dependencyinjection/dicontainer.php | 2 +- utility/feedfetcher.php | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dependencyinjection/dicontainer.php b/dependencyinjection/dicontainer.php index efbd28252..4350ac276 100644 --- a/dependencyinjection/dicontainer.php +++ b/dependencyinjection/dicontainer.php @@ -126,7 +126,7 @@ class DIContainer extends BaseContainer { * Utility */ $this['FeedFetcher'] = $this->share(function($c){ - return new FeedFetcher(); + return new FeedFetcher($c['API']); }); $this['StatusFlag'] = $this->share(function($c){ diff --git a/utility/feedfetcher.php b/utility/feedfetcher.php index 0fa805883..9bfe1ed31 100644 --- a/utility/feedfetcher.php +++ b/utility/feedfetcher.php @@ -25,12 +25,20 @@ namespace OCA\News\Utility; +use \OCA\AppFramework\Core\API; + use \OCA\News\Db\Item; use \OCA\News\Db\Feed; class FeedFetcher { + private $api; + + public function __construct(API $api){ + $this->api = $api; + } + /** * Fetch a feed from remote @@ -139,7 +147,7 @@ class FeedFetcher { //try to extract favicon from web page $absoluteUrl = \SimplePie_Misc::absolutize_url('/', $url); - $page = \OC_Util::getUrlContent($absoluteUrl); + $page = $this->api->getUrlContent($absoluteUrl); if ( FALSE !== $page ) { preg_match ( '/<[^>]*link[^>]*(rel=["\']icon["\']|rel=["\']shortcut icon["\']) .*href=["\']([^>]*)["\'].*>/iU', $page, $match );