зеркало из https://github.com/nextcloud/news.git
put getUrlContent into api
This commit is contained in:
Родитель
711c260bfe
Коммит
45d81beb6c
|
@ -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){
|
||||
|
|
|
@ -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 );
|
||||
|
|
Загрузка…
Ссылка в новой задаче