summaryrefslogtreecommitdiffstats
path: root/pkgs/development/web/csslint
AgeCommit message (Expand)Author
2023-05-23csslint: 0.10.0 → 1.0.5, fix broken executablenicoo
2021-01-11treewide: with stdenv.lib; in meta -> with lib;Profpatsch
2020-04-10treewide: Per RFC45, remove all unquoted URLsMichael Reilly
2019-08-15treewide: name -> pname (easy cases) (#66585)volth
2018-06-28treewide: http -> https sources (#42676)Silvan Mosberger
2017-08-22treewide: homepage URL fixes (#28475)Matthew Justin Bauer
2016-06-20Captialize meta.description of all packagesBjørn Forsman
2013-12-18csslint: update from 0.5.0 to 0.10.0Nixpkgs Monitor
2012-01-18* "ensureDir" -> "mkdir -p". "ensureDir" is a rather pointlessEelco Dolstra
2011-08-21Adding csslint, this uses node as an interpreter. It detects problems in CSS ...Cillian de Roiste
er Mirror of https://github.com/nextcloud/newsmatthias
summaryrefslogtreecommitdiffstats
path: root/lib/utils.php
blob: e42e304bbb35a231c5293010989918f810dd2680 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/**
* ownCloud - News app
*
* @author Alessandro Cosentino
* Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com>
* 
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file
* 
*/

// load SimplePie library
//TODO: is this file a suitable place for the following require?
require_once(OC::$APPSROOT . '/apps/news/3rdparty/SimplePie/SimplePieAutoloader.php');

class OC_News_Utils {

	/**
	 * @brief Fetch a feed from remote
	 * @param url remote url of the feed 
	 * @returns 
	 */
	public static function fetch($url){
	//TODO: handle the case where fetching of the feed fails
		$spfeed = new SimplePie_Core();
		$spfeed->set_feed_url( $url );
		$spfeed->enable_cache( false );
		$spfeed->init();
		$spfeed->handle_content_type();
		$title = $spfeed->get_title();
		
		$spitems = $spfeed->get_items();
		$items = array();
		foreach($spitems as $spitem) { //FIXME: maybe we can avoid this loop
			$itemUrl = $spitem->get_permalink();
			$itemTitle = $spitem->get_title();
			$itemGUID = $spitem->get_id();
			$itemBody = $spitem->get_content();
			$items[] = new OC_News_Item($itemUrl, $itemTitle, $itemGUID, $itemBody); 
		}

		$feed = new OC_News_Feed($url, $title, $items);
		return $feed;
	}
}