diff options
author | Brice Maron <brice@bmaron.net> | 2012-10-23 18:54:55 +0000 |
---|---|---|
committer | Brice Maron <brice@bmaron.net> | 2012-10-23 18:54:55 +0000 |
commit | f0b81aa614493414605f335bfd711af8a4ffb80f (patch) | |
tree | cc31d5f45cf5e0fe1a32ae6ae617211f80ee38c4 /lib/utils.php | |
parent | 999bb0fb5429398a1cd9e7554422fd66540b35ce (diff) |
Small Style fix in news and gallery
Diffstat (limited to 'lib/utils.php')
-rw-r--r-- | lib/utils.php | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/lib/utils.php b/lib/utils.php index e7ae2107e..97c55ffaf 100644 --- a/lib/utils.php +++ b/lib/utils.php @@ -52,51 +52,51 @@ class Utils { return null; } - //temporary try-catch to bypass SimplePie bugs - try { - $spfeed->handle_content_type(); - $title = $spfeed->get_title(); - - $items = array(); - if ($spitems = $spfeed->get_items()) { - foreach($spitems as $spitem) { - $itemUrl = $spitem->get_permalink(); - $itemTitle = $spitem->get_title(); - $itemGUID = $spitem->get_id(); - $itemBody = $spitem->get_content(); - $item = new Item($itemUrl, $itemTitle, $itemGUID, $itemBody); - - $spAuthor = $spitem->get_author(); - if ($spAuthor !== null) { - $item->setAuthor($spAuthor->get_name()); + //temporary try-catch to bypass SimplePie bugs + try { + $spfeed->handle_content_type(); + $title = $spfeed->get_title(); + + $items = array(); + if ($spitems = $spfeed->get_items()) { + foreach($spitems as $spitem) { + $itemUrl = $spitem->get_permalink(); + $itemTitle = $spitem->get_title(); + $itemGUID = $spitem->get_id(); + $itemBody = $spitem->get_content(); + $item = new Item($itemUrl, $itemTitle, $itemGUID, $itemBody); + + $spAuthor = $spitem->get_author(); + if ($spAuthor !== null) { + $item->setAuthor($spAuthor->get_name()); + } + + //date in Item is stored in UNIX timestamp format + $itemDate = $spitem->get_date('U'); + $item->setDate($itemDate); + + $items[] = $item; } - - //date in Item is stored in UNIX timestamp format - $itemDate = $spitem->get_date('U'); - $item->setDate($itemDate); - - $items[] = $item; } - } - $feed = new Feed($url, $title, $items); + $feed = new Feed($url, $title, $items); - $favicon = $spfeed->get_image_url(); + $favicon = $spfeed->get_image_url(); - if ($favicon !== null && self::checkFavicon($favicon)) { // use favicon from feed - $feed->setFavicon($favicon); - } - else { // try really hard to find a favicon - $webFavicon = self::discoverFavicon($url); - if ($webFavicon !== null) { - $feed->setFavicon($webFavicon); + if ($favicon !== null && self::checkFavicon($favicon)) { // use favicon from feed + $feed->setFavicon($favicon); } + else { // try really hard to find a favicon + $webFavicon = self::discoverFavicon($url); + if ($webFavicon !== null) { + $feed->setFavicon($webFavicon); + } + } + return $feed; } - return $feed; - } - catch (Exception $e) { - return null; - } + catch (Exception $e) { + return null; + } } /** |