diff options
author | sembrestels <sembrestels@riseup.net> | 2011-10-13 15:23:11 +0200 |
---|---|---|
committer | sembrestels <sembrestels@riseup.net> | 2011-10-13 15:23:11 +0200 |
commit | 74bd6999c5e5c23ebbf90dbb6bdaabbddd7594cf (patch) | |
tree | 834c120d692be288f261bcae169eedd3d6b31d74 /vendors/dokuwiki/inc/FeedParser.php | |
parent | f8be8643f0faadb2c0ce87d553b7b9d569af5afd (diff) | |
download | elgg-74bd6999c5e5c23ebbf90dbb6bdaabbddd7594cf.tar.gz elgg-74bd6999c5e5c23ebbf90dbb6bdaabbddd7594cf.tar.bz2 |
Rename lib/dokuwiki to vendors/dokuwiki
Diffstat (limited to 'vendors/dokuwiki/inc/FeedParser.php')
-rw-r--r-- | vendors/dokuwiki/inc/FeedParser.php | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/vendors/dokuwiki/inc/FeedParser.php b/vendors/dokuwiki/inc/FeedParser.php new file mode 100644 index 000000000..f37888f01 --- /dev/null +++ b/vendors/dokuwiki/inc/FeedParser.php @@ -0,0 +1,76 @@ +<?php +/** + * Class used to parse RSS and ATOM feeds + * + * @author Andreas Gohr <andi@splitbrain.org> + */ + +if(!defined('DOKU_INC')) die('meh.'); +require_once(DOKU_INC.'inc/HTTPClient.php'); +require_once(DOKU_INC.'inc/SimplePie.php'); + + +/** + * We override some methods of the original SimplePie class here + */ +class FeedParser extends SimplePie { + + /** + * Constructor. Set some defaults + */ + function FeedParser(){ + $this->SimplePie(); + $this->enable_cache(false); + $this->set_file_class('FeedParser_File'); + } + + /** + * Backward compatibility for older plugins + */ + function feed_url($url){ + $this->set_feed_url($url); + } +} + +/** + * 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; + + /** + * Inititializes the HTTPClient + * + * We ignore all given parameters - they are set in DokuHTTPClient + */ + 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; + } + +} |