mirror of
https://github.com/friendica/friendica
synced 2025-04-26 18:30:11 +00:00
Make "HTTPRequest::fetchUrl" dynamic
This commit is contained in:
parent
3b4cf87c95
commit
1aa07f87a4
20 changed files with 26 additions and 46 deletions
|
@ -31,7 +31,6 @@ use Friendica\Core\Hook;
|
|||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Network\HTTPRequest;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\ParseUrl;
|
||||
|
@ -96,7 +95,7 @@ class OEmbed
|
|||
|
||||
if (!in_array($ext, $noexts)) {
|
||||
// try oembed autodiscovery
|
||||
$html_text = HTTPRequest::fetchUrl($embedurl, false, 15, 'text/*');
|
||||
$html_text = DI::httpRequest()->fetchUrl($embedurl, false, 15, 'text/*');
|
||||
if ($html_text) {
|
||||
$dom = @DOMDocument::loadHTML($html_text);
|
||||
if ($dom) {
|
||||
|
@ -104,14 +103,14 @@ class OEmbed
|
|||
$entries = $xpath->query("//link[@type='application/json+oembed']");
|
||||
foreach ($entries as $e) {
|
||||
$href = $e->getAttributeNode('href')->nodeValue;
|
||||
$json_string = HTTPRequest::fetchUrl($href . '&maxwidth=' . $a->videowidth);
|
||||
$json_string = DI::httpRequest()->fetchUrl($href . '&maxwidth=' . $a->videowidth);
|
||||
break;
|
||||
}
|
||||
|
||||
$entries = $xpath->query("//link[@type='text/json+oembed']");
|
||||
foreach ($entries as $e) {
|
||||
$href = $e->getAttributeNode('href')->nodeValue;
|
||||
$json_string = HTTPRequest::fetchUrl($href . '&maxwidth=' . $a->videowidth);
|
||||
$json_string = DI::httpRequest()->fetchUrl($href . '&maxwidth=' . $a->videowidth);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ use Friendica\Model\Contact;
|
|||
use Friendica\Model\Event;
|
||||
use Friendica\Model\Photo;
|
||||
use Friendica\Model\Tag;
|
||||
use Friendica\Network\HTTPRequest;
|
||||
use Friendica\Object\Image;
|
||||
use Friendica\Protocol\Activity;
|
||||
use Friendica\Util\Images;
|
||||
|
@ -486,7 +485,7 @@ class BBCode
|
|||
continue;
|
||||
}
|
||||
|
||||
$curlResult = HTTPRequest::curl($mtch[1], true);
|
||||
$curlResult = DI::httpRequest()->curl($mtch[1], true);
|
||||
if (!$curlResult->isSuccess()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -1107,7 +1106,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 = HTTPRequest::fetchUrl($match[1]);
|
||||
$body = DI::httpRequest()->fetchUrl($match[1]);
|
||||
|
||||
$doc = new DOMDocument();
|
||||
@$doc->loadHTML($body);
|
||||
|
@ -1186,7 +1185,7 @@ class BBCode
|
|||
}
|
||||
|
||||
// if its not a picture then look if its a page that contains a picture link
|
||||
$body = HTTPRequest::fetchUrl($match[1]);
|
||||
$body = DI::httpRequest()->fetchUrl($match[1]);
|
||||
|
||||
$doc = new DOMDocument();
|
||||
@$doc->loadHTML($body);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue