diff options
author | Alessandro Cosentino <cosenal@gmail.com> | 2012-08-11 12:19:37 -0400 |
---|---|---|
committer | Alessandro Cosentino <cosenal@gmail.com> | 2012-08-11 12:19:37 -0400 |
commit | 3443468538567c2cd23dc43b101b284c6af1a2e8 (patch) | |
tree | 0404288fcea3d0db05880bb75492311f68e487a0 | |
parent | 48513e8e42c72409109f21804964b7c54527f6c0 (diff) |
fix namespace issues from previous commit
-rw-r--r-- | ajax/createfeed.php | 2 | ||||
-rw-r--r-- | ajax/populateroot.php | 2 | ||||
-rw-r--r-- | lib/utils.php | 22 |
3 files changed, 13 insertions, 13 deletions
diff --git a/ajax/createfeed.php b/ajax/createfeed.php index 896a9b1fa..5b4b31ffe 100644 --- a/ajax/createfeed.php +++ b/ajax/createfeed.php @@ -35,7 +35,7 @@ $userid = OCP\USER::getUser(); $feedurl = trim($_POST['feedurl']); $folderid = trim($_POST['folderid']); -$feedmapper = new FeedMapper(); +$feedmapper = new OCA\News\FeedMapper(); $feedid = $feedmapper->findIdFromUrl($feedurl); $l = OC_L10N::get('news'); diff --git a/ajax/populateroot.php b/ajax/populateroot.php index 6a258910a..3d1398e47 100644 --- a/ajax/populateroot.php +++ b/ajax/populateroot.php @@ -6,7 +6,7 @@ OCP\JSON::checkAppEnabled('news'); $foldermapper = new OCA\News\FolderMapper(OCP\USER::getUser()); $l = new OC_l10n('news'); -$folder = new OC_News_Folder($l->t('Everything'), 0); +$folder = new OCA\News\Folder($l->t('Everything'), 0); $allfeeds = $foldermapper->populate($folder); diff --git a/lib/utils.php b/lib/utils.php index 6418620b7..618cfc5d0 100644 --- a/lib/utils.php +++ b/lib/utils.php @@ -10,12 +10,12 @@ * */ +namespace OCA\News; + // load SimplePie library //TODO: is this file a suitable place for the following require? require_once('news/3rdparty/SimplePie/autoloader.php'); -namespace OCA\News; - class Utils { /** @@ -24,7 +24,7 @@ class Utils { * @returns an instance of OC_News_Feed */ public static function fetch($url){ - $spfeed = new SimplePie_Core(); + $spfeed = new \SimplePie_Core(); $spfeed->set_feed_url( $url ); $spfeed->enable_cache( false ); @@ -57,7 +57,7 @@ class Utils { $feed->setFavicon($favicon); } else { // try really hard to find a favicon - if( null !== ($webFavicon = discoverFavicon($url)) ) + if( null !== ($webFavicon = self::discoverFavicon($url)) ) $feed->setFavicon($webFavicon); } return $feed; @@ -68,12 +68,12 @@ class Utils { } public static function checkFavicon($favicon) { - $file = new SimplePie_File($favicon); + $file = new \SimplePie_File($favicon); // size in bytes $filesize = strlen($file->body); if($file->success && $filesize > 0 && $filesize < 50000) { - $sniffer = new SimplePie_Content_Type_Sniffer($file); + $sniffer = new \SimplePie_Content_Type_Sniffer($file); if(substr($sniffer->get_type(), 0, 6) === 'image/') { return true; } @@ -83,13 +83,13 @@ class Utils { public static function discoverFavicon($url) { //try webroot favicon - $favicon = SimplePie_Misc::absolutize_url('/favicon.ico', $url); + $favicon = \SimplePie_Misc::absolutize_url('/favicon.ico', $url); - if(checkFavicon($favicon)) + if(self::checkFavicon($favicon)) return $favicon; //try to extract favicon from web page - $absoluteUrl = SimplePie_Misc::absolutize_url('/', $url); + $absoluteUrl = \SimplePie_Misc::absolutize_url('/', $url); $handle = curl_init ( ); curl_setopt ( $handle, CURLOPT_URL, $absoluteUrl ); @@ -112,14 +112,14 @@ class Utils { elseif ( 0===strpos(parse_url($favicon,PHP_URL_PATH),'/') ) { $url_token = parse_url($meta['final']); sprintf( '%s://%s/%s', $url_token['scheme'], $url_token['host'], $favicon ); - if(checkFavicon($favicon)) + if(self::checkFavicon($favicon)) return $favicon; } // so it appears to be a relative path else { $url_token = parse_url($meta['final']); sprintf( '%s://%s%s%s', $url_token['scheme'], $url_token['host'], dirname($url_token['path']), $favicon ); - if(checkFavicon($favicon)) + if(self::checkFavicon($favicon)) return $favicon; } } |