From a307fd7ad74b8985f80754dc26c38963d4fe6f5f Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Mon, 12 Mar 2007 21:34:19 +0100 Subject: fix for the new SimplePie SimplePie changed the method to fetch the feed, this patch restores the usage of DokuWiki's own HTTP client. darcs-hash:20070312203419-7ad00-a3ef0c6d810d59f618165b3968e61b6d8a5a68a0.gz --- inc/FeedParser.php | 46 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 6 deletions(-) (limited to 'inc/FeedParser.php') diff --git a/inc/FeedParser.php b/inc/FeedParser.php index 7c0071af0..f110ef132 100644 --- a/inc/FeedParser.php +++ b/inc/FeedParser.php @@ -20,16 +20,50 @@ class FeedParser extends SimplePie { */ function FeedParser(){ $this->SimplePie(); - $this->caching = false; + $this->enable_caching(false); + $this->set_file_class('FeedParser_File'); } +} + +/** + * Fetch an URL using our own HTTPClient + * + * Replaces SimplePie's own class + */ +class FeedParser_File extends SimplePie_File { + var $http; + var $useragent; + var $success = true; + var $headers = array(); + var $body; + var $error; /** - * Fetch an URL using our own HTTPClient + * Inititializes the HTTPClient * - * Overrides SimplePie's own method + * We ignore all given parameters - they are set in DokuHTTPClient */ - function get_file($url){ - $http = new DokuHTTPClient(); - return $http->get($url,true); + function FeedParser_File($url, $timeout=10, $redirects=5, + $headers=null, $useragent=null, $force_fsockopen=false) { + $this->http = new DokuHTTPClient(); + $this->success = $this->http->sendRequest($url); + + $this->headers = $this->http->resp_headers; + $this->body = $this->http->resp_body; + $this->error = $this->http->error; + return $this->success; } + + function headers(){ + return $this->headers; + } + + function body(){ + return $this->body; + } + + function close(){ + return true; + } + } -- cgit v1.2.3