Rename DI::httpRequest() into DI::httpClient()

This commit is contained in:
Philipp 2021-08-25 21:54:54 +02:00
parent 505100bdd7
commit 13a91e63aa
No known key found for this signature in database
GPG key ID: 9A28B7D4FF5667BD
38 changed files with 94 additions and 94 deletions

View file

@ -97,7 +97,7 @@ class OEmbed
if (!in_array($ext, $noexts)) {
// try oembed autodiscovery
$html_text = DI::httpRequest()->fetch($embedurl, 15, 'text/*');
$html_text = DI::httpClient()->fetch($embedurl, 15, 'text/*');
if (!empty($html_text)) {
$dom = new DOMDocument();
if (@$dom->loadHTML($html_text)) {
@ -111,7 +111,7 @@ class OEmbed
// but their OEmbed endpoint is only accessible by HTTPS ¯\_(ツ)_/¯
$href = str_replace(['http://www.youtube.com/', 'http://player.vimeo.com/'],
['https://www.youtube.com/', 'https://player.vimeo.com/'], $href);
$result = DI::httpRequest()->fetchFull($href . '&maxwidth=' . $a->getThemeInfoValue('videowidth'));
$result = DI::httpClient()->fetchFull($href . '&maxwidth=' . $a->getThemeInfoValue('videowidth'));
if ($result->getReturnCode() === 200) {
$json_string = $result->getBody();
break;

View file

@ -494,7 +494,7 @@ class BBCode
continue;
}
$curlResult = DI::httpRequest()->get($mtch[1]);
$curlResult = DI::httpClient()->get($mtch[1]);
if (!$curlResult->isSuccess()) {
continue;
}
@ -1194,7 +1194,7 @@ class BBCode
$text = DI::cache()->get($cache_key);
if (is_null($text)) {
$curlResult = DI::httpRequest()->head($match[1], [HTTPClientOptions::TIMEOUT => DI::config()->get('system', 'xrd_timeout')]);
$curlResult = DI::httpClient()->head($match[1], [HTTPClientOptions::TIMEOUT => DI::config()->get('system', 'xrd_timeout')]);
if ($curlResult->isSuccess()) {
$mimetype = $curlResult->getHeader('Content-Type')[0] ?? '';
} else {
@ -1207,7 +1207,7 @@ class BBCode
$text = "[url=" . $match[2] . ']' . $match[2] . "[/url]";
// if its not a picture then look if its a page that contains a picture link
$body = DI::httpRequest()->fetch($match[1]);
$body = DI::httpClient()->fetch($match[1]);
if (empty($body)) {
DI::cache()->set($cache_key, $text);
return $text;
@ -1265,7 +1265,7 @@ class BBCode
return $text;
}
$curlResult = DI::httpRequest()->head($match[1], [HTTPClientOptions::TIMEOUT => DI::config()->get('system', 'xrd_timeout')]);
$curlResult = DI::httpClient()->head($match[1], [HTTPClientOptions::TIMEOUT => DI::config()->get('system', 'xrd_timeout')]);
if ($curlResult->isSuccess()) {
$mimetype = $curlResult->getHeader('Content-Type')[0] ?? '';
} else {
@ -1283,7 +1283,7 @@ class BBCode
}
// if its not a picture then look if its a page that contains a picture link
$body = DI::httpRequest()->fetch($match[1]);
$body = DI::httpClient()->fetch($match[1]);
if (empty($body)) {
DI::cache()->set($cache_key, $text);
return $text;