splitbrain /
dokuwiki
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Class used to parse RSS and ATOM feeds |
||
| 4 | * |
||
| 5 | * @author Andreas Gohr <[email protected]> |
||
| 6 | */ |
||
| 7 | |||
| 8 | if(!defined('DOKU_INC')) die('meh.'); |
||
| 9 | |||
| 10 | /** |
||
| 11 | * We override some methods of the original SimplePie class here |
||
| 12 | */ |
||
| 13 | class FeedParser extends SimplePie { |
||
| 14 | |||
| 15 | /** |
||
| 16 | * Constructor. Set some defaults |
||
| 17 | */ |
||
| 18 | function __construct(){ |
||
| 19 | parent::__construct(); |
||
| 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 | */ |
||
| 37 | class 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 __construct($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); |
||
| 54 | |||
| 55 | $this->headers = $this->http->resp_headers; |
||
|
0 ignored issues
–
show
|
|||
| 56 | $this->body = $this->http->resp_body; |
||
|
0 ignored issues
–
show
The property
resp_body cannot be accessed from this context as it is declared private in class HTTPClient.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
|
|||
| 57 | $this->error = $this->http->error; |
||
|
0 ignored issues
–
show
The property
error cannot be accessed from this context as it is declared private in class HTTPClient.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
|
|||
| 58 | |||
| 59 | $this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_FSOCKOPEN; |
||
| 60 | |||
| 61 | return $this->success; |
||
| 62 | } |
||
| 63 | |||
| 64 | function headers(){ |
||
| 65 | return $this->headers; |
||
| 66 | } |
||
| 67 | |||
| 68 | function body(){ |
||
| 69 | return $this->body; |
||
| 70 | } |
||
| 71 | |||
| 72 | function close(){ |
||
| 73 | return true; |
||
| 74 | } |
||
| 75 | |||
| 76 | } |
||
| 77 |
This check looks for access to properties that are not accessible from the current context.
If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.