summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2012-08-17 12:42:48 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2012-08-17 12:42:48 +0200
commit2c48b7ff48f8fa9d77ad843473d3e3f7cce967ac (patch)
tree2d1e627877940a0ef2106c22293de2b17bb177aa /lib
parent383d16e8fbacd574e9d53239f56f912b2ebd64c1 (diff)
parent63a9acb95a384253750391c631e240420c36f286 (diff)
Merge branch 'newsapp' of git://gitorious.org/owncloud/apps into newsapp
Diffstat (limited to 'lib')
-rw-r--r--lib/utils.php34
1 files changed, 10 insertions, 24 deletions
diff --git a/lib/utils.php b/lib/utils.php
index 1ecc92245..28b77e155 100644
--- a/lib/utils.php
+++ b/lib/utils.php
@@ -17,27 +17,27 @@ namespace OCA\News;
require_once('news/3rdparty/SimplePie/autoloader.php');
class Utils {
-
+
/**
* @brief Transform a date from UNIX timestamp format to MDB2 timestamp format
- * @param dbtimestamp
- * @returns
- */
+ * @param dbtimestamp
+ * @returns
+ */
public static function unixtimeToDbtimestamp($unixtime) {
$dt = \DateTime::createFromFormat('U', $unixtime);
return $dt->format('Y-m-d H:i:s');
}
-
+
/**
* @brief Transform a date from MDB2 timestamp format to UNIX timestamp format
- * @param dbtimestamp
- * @returns
+ * @param dbtimestamp
+ * @returns
*/
public static function dbtimestampToUnixtime($dbtimestamp) {
$dt = \DateTime::createFromFormat('Y-m-d H:i:s', $dbtimestamp);
return $dt->format('U');
}
-
+
/**
* @brief Fetch a feed from remote
* @param url remote url of the feed
@@ -70,11 +70,11 @@ class Utils {
if ($itemAuthor !== null) {
$item->setAuthor($itemAuthor->get_name());
}
-
+
//date in Item is stored in UNIX timestamp format
$itemDate = $spitem->get_date('U');
$item->setDate($itemDate);
-
+
$items[] = $item;
}
}
@@ -139,20 +139,6 @@ class Utils {
if(self::checkFavicon($favicon))
return $favicon;
}
- // test for an absolute path
- 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(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(self::checkFavicon($favicon))
- return $favicon;
- }
}
}
return null;