source: documentation/trunk/packages/dokuwiki-2011-05-25a/inc/FeedParser.php@ 30098

Last change on this file since 30098 was 25027, checked in by jmt12, 12 years ago

Adding the packages directory, and within it a configured version of dokuwiki all ready to run

File size: 1.6 KB
Line 
1<?php
2/**
3 * Class used to parse RSS and ATOM feeds
4 *
5 * @author Andreas Gohr <[email protected]>
6 */
7
8if(!defined('DOKU_INC')) die('meh.');
9
10/**
11 * We override some methods of the original SimplePie class here
12 */
13class FeedParser extends SimplePie {
14
15 /**
16 * Constructor. Set some defaults
17 */
18 function FeedParser(){
19 $this->SimplePie();
20 $this->enable_cache(false);
21 $this->set_file_class('FeedParser_File');
22 }
23
24 /**
25 * Backward compatibility for older plugins
26 */
27 function feed_url($url){
28 $this->set_feed_url($url);
29 }
30}
31
32/**
33 * Fetch an URL using our own HTTPClient
34 *
35 * Replaces SimplePie's own class
36 */
37class FeedParser_File extends SimplePie_File {
38 var $http;
39 var $useragent;
40 var $success = true;
41 var $headers = array();
42 var $body;
43 var $error;
44
45 /**
46 * Inititializes the HTTPClient
47 *
48 * We ignore all given parameters - they are set in DokuHTTPClient
49 */
50 function FeedParser_File($url, $timeout=10, $redirects=5,
51 $headers=null, $useragent=null, $force_fsockopen=false) {
52 parent::__construct();
53 $this->http = new DokuHTTPClient();
54 $this->success = $this->http->sendRequest($url);
55
56 $this->headers = $this->http->resp_headers;
57 $this->body = $this->http->resp_body;
58 $this->error = $this->http->error;
59 return $this->success;
60 }
61
62 function headers(){
63 return $this->headers;
64 }
65
66 function body(){
67 return $this->body;
68 }
69
70 function close(){
71 return true;
72 }
73
74}
Note: See TracBrowser for help on using the repository browser.