diff options
author | Yaco <franco@reevo.org> | 2022-03-08 13:08:34 +0000 |
---|---|---|
committer | Yaco <franco@reevo.org> | 2022-03-08 13:08:34 +0000 |
commit | c985c40d3f3fc6a2be3be3186df3bf2f32189475 (patch) | |
tree | cee11f5e5a7e351ee0fec36d58d72cbee4f7e49b /platform/www/inc/FeedParserFile.php |
first commit after acervus codebase
Diffstat (limited to 'platform/www/inc/FeedParserFile.php')
-rw-r--r-- | platform/www/inc/FeedParserFile.php | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/platform/www/inc/FeedParserFile.php b/platform/www/inc/FeedParserFile.php new file mode 100644 index 0000000..be3417e --- /dev/null +++ b/platform/www/inc/FeedParserFile.php @@ -0,0 +1,62 @@ +<?php + +namespace dokuwiki; + +use dokuwiki\HTTP\DokuHTTPClient; + +/** + * Fetch an URL using our own HTTPClient + * + * Replaces SimplePie's own class + */ +class FeedParserFile extends \SimplePie_File +{ + protected $http; + /** @noinspection PhpMissingParentConstructorInspection */ + + /** + * Inititializes the HTTPClient + * + * We ignore all given parameters - they are set in DokuHTTPClient + * + * @inheritdoc + */ + public function __construct( + $url, + $timeout = 10, + $redirects = 5, + $headers = null, + $useragent = null, + $force_fsockopen = false, + $curl_options = array() + ) { + $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; + + $this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_FSOCKOPEN; + + return $this->success; + } + + /** @inheritdoc */ + public function headers() + { + return $this->headers; + } + + /** @inheritdoc */ + public function body() + { + return $this->body; + } + + /** @inheritdoc */ + public function close() + { + return true; + } +} |