From 3db95bec49bcc5481c2b68517d7db3c0c40a1cc6 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 14 Apr 2006 13:00:47 +0200 Subject: feed aggregation revamped Feeds are now parsed with SimplePie. The feed syntax was enhanced darcs-hash:20060414110047-7ad00-6dd4b96845baab8683a2f837d6ad6fcb2fd53131.gz --- inc/parser/xhtml.php | 61 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 46 insertions(+), 15 deletions(-) (limited to 'inc/parser/xhtml.php') diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index b3b341f9b..682551169 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -780,34 +780,65 @@ class Doku_Renderer_xhtml extends Doku_Renderer { } /** - * Renders an RSS feed using Magpie + * Renders an RSS feed * * @author Andreas Gohr */ - function rss ($url){ + function rss ($url,$params){ global $lang; - define('MAGPIE_CACHE_ON', false); //we do our own caching - define('MAGPIE_DIR', DOKU_INC.'inc/magpie/'); - define('MAGPIE_OUTPUT_ENCODING','UTF-8'); //return all feeds as UTF-8 - require_once(MAGPIE_DIR.'/rss_fetch.inc'); + global $conf; + + require_once(DOKU_INC.'inc/FeedParser.php'); + $feed = new FeedParser(); + $feed->feed_url($url); //disable warning while fetching $elvl = error_reporting(E_ERROR); - $rss = fetch_rss($url); + $rc = $feed->init(); error_reporting($elvl); + //decide on start and end + if($params['reverse']){ + $mod = -1; + $start = $feed->get_item_quantity()-1; + $end = $start - ($params['max']); + $end = ($end < 0) ? 0 : $end; + }else{ + $mod = 1; + $start = 0; + $end = $feed->get_item_quantity(); + $end = ($end > $params['max']) ? $params['max'] : $end;; + } + $this->doc .= ''; } @@ -1067,4 +1098,4 @@ class Doku_Renderer_xhtml extends Doku_Renderer { } } -//Setup VIM: ex: et ts=4 enc=utf-8 : \ No newline at end of file +//Setup VIM: ex: et ts=4 enc=utf-8 : -- cgit v1.2.3