You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

59 lines
1.1 KiB

  1. <?php
  2. namespace dokuwiki;
  3. use SimplePie\File;
  4. use SimplePie\SimplePie;
  5. use dokuwiki\HTTP\DokuHTTPClient;
  6. /**
  7. * Fetch an URL using our own HTTPClient
  8. *
  9. * Replaces SimplePie's own class
  10. */
  11. class FeedParserFile extends File
  12. {
  13. protected $http;
  14. /** @noinspection PhpMissingParentConstructorInspection */
  15. /**
  16. * Inititializes the HTTPClient
  17. *
  18. * We ignore all given parameters - they are set in DokuHTTPClient
  19. *
  20. * @inheritdoc
  21. */
  22. public function __construct(
  23. $url
  24. ) {
  25. $this->http = new DokuHTTPClient();
  26. $this->success = $this->http->sendRequest($url);
  27. $this->headers = $this->http->resp_headers;
  28. $this->body = $this->http->resp_body;
  29. $this->error = $this->http->error;
  30. $this->method = SimplePie::FILE_SOURCE_REMOTE | SimplePie::FILE_SOURCE_FSOCKOPEN;
  31. return $this->success;
  32. }
  33. /** @inheritdoc */
  34. public function headers()
  35. {
  36. return $this->headers;
  37. }
  38. /** @inheritdoc */
  39. public function body()
  40. {
  41. return $this->body;
  42. }
  43. /** @inheritdoc */
  44. public function close()
  45. {
  46. return true;
  47. }
  48. }