3 * Class used to parse RSS and ATOM feeds
5 * @author Andreas Gohr <andi@splitbrain.org>
8 if(!defined('DOKU_INC')) die('meh.');
11 * We override some methods of the original SimplePie class here
13 class FeedParser extends SimplePie {
16 * Constructor. Set some defaults
18 function FeedParser(){
20 $this->enable_cache(false);
21 $this->set_file_class('FeedParser_File');
25 * Backward compatibility for older plugins
27 function feed_url($url){
28 $this->set_feed_url($url);
33 * Fetch an URL using our own HTTPClient
35 * Replaces SimplePie's own class
37 class FeedParser_File extends SimplePie_File {
41 var $headers = array();
46 * Inititializes the HTTPClient
48 * We ignore all given parameters - they are set in DokuHTTPClient
50 function FeedParser_File($url, $timeout=10, $redirects=5,
51 $headers=null, $useragent=null, $force_fsockopen=false) {
52 $this->http = new DokuHTTPClient();
53 $this->success = $this->http->sendRequest($url);
55 $this->headers = $this->http->resp_headers;
56 $this->body = $this->http->resp_body;
57 $this->error = $this->http->error;
59 $this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_FSOCKOPEN;
61 return $this->success;
65 return $this->headers;