Merge pull request #3439 from dokuwiki-translate/lang_update_275_1616098692
[dokuwiki.git] / inc / FeedParserFile.php
blobbe3417e9ba06dac8aa899883125c5697e1571284
1 <?php
3 namespace dokuwiki;
5 use dokuwiki\HTTP\DokuHTTPClient;
7 /**
8 * Fetch an URL using our own HTTPClient
10 * Replaces SimplePie's own class
12 class FeedParserFile extends \SimplePie_File
14 protected $http;
15 /** @noinspection PhpMissingParentConstructorInspection */
17 /**
18 * Inititializes the HTTPClient
20 * We ignore all given parameters - they are set in DokuHTTPClient
22 * @inheritdoc
24 public function __construct(
25 $url,
26 $timeout = 10,
27 $redirects = 5,
28 $headers = null,
29 $useragent = null,
30 $force_fsockopen = false,
31 $curl_options = array()
32 ) {
33 $this->http = new DokuHTTPClient();
34 $this->success = $this->http->sendRequest($url);
36 $this->headers = $this->http->resp_headers;
37 $this->body = $this->http->resp_body;
38 $this->error = $this->http->error;
40 $this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_FSOCKOPEN;
42 return $this->success;
45 /** @inheritdoc */
46 public function headers()
48 return $this->headers;
51 /** @inheritdoc */
52 public function body()
54 return $this->body;
57 /** @inheritdoc */
58 public function close()
60 return true;