use Friendica\Core\Hook;
use Friendica\Core\Logger;
use Friendica\Core\System;
+use Friendica\DI;
use Friendica\Network\CurlResult;
class Network
{
$stamp1 = microtime(true);
- $a = \get_app();
+ $a = DI::app();
if (strlen($url) > 1000) {
Logger::log('URL is longer than 1000 characters. Callstack: ' . System::callstack(20), Logger::DEBUG);
@curl_close($ch);
- $a->getProfiler()->saveTimestamp($stamp1, 'network', System::callstack());
+ DI::profiler()->saveTimestamp($stamp1, 'network', System::callstack());
return $curlResponse;
}
return CurlResult::createErrorCurl($url);
}
- $a = \get_app();
+ $a = DI::app();
$ch = curl_init($url);
if (($redirects > 8) || (!$ch)) {
curl_close($ch);
- $a->getProfiler()->saveTimestamp($stamp1, 'network', System::callstack());
+ DI::profiler()->saveTimestamp($stamp1, 'network', System::callstack());
// Very old versions of Lighttpd don't like the "Expect" header, so we remove it when needed
if ($curlResponse->getReturnCode() == 417) {
Hook::callAll('avatar_lookup', $avatar);
if (! $avatar['success']) {
- $avatar['url'] = System::baseUrl() . '/images/person-300.jpg';
+ $avatar['url'] = DI::baseUrl() . '/images/person-300.jpg';
}
Logger::log('Avatar: ' . $avatar['email'] . ' ' . $avatar['url'], Logger::DEBUG);
*/
public static function finalUrl(string $url, int $depth = 1, bool $fetchbody = false)
{
- $a = \get_app();
+ $a = DI::app();
$url = self::stripTrackingQueryParams($url);
$http_code = $curl_info['http_code'];
curl_close($ch);
- $a->getProfiler()->saveTimestamp($stamp1, "network", System::callstack());
+ DI::profiler()->saveTimestamp($stamp1, "network", System::callstack());
if ($http_code == 0) {
return $url;
$body = curl_exec($ch);
curl_close($ch);
- $a->getProfiler()->saveTimestamp($stamp1, "network", System::callstack());
+ DI::profiler()->saveTimestamp($stamp1, "network", System::callstack());
if (trim($body) == "") {
return $url;