diff --git a/mod/message.php b/mod/message.php index 928f575ef3..d75fb240f0 100644 --- a/mod/message.php +++ b/mod/message.php @@ -54,11 +54,10 @@ function message_init(App $a) '$tabs' => $tabs, '$new' => $new, ]); - $base = DI::baseUrl(); $head_tpl = Renderer::getMarkupTemplate('message-head.tpl'); DI::page()['htmlhead'] .= Renderer::replaceMacros($head_tpl, [ - '$base' => $base + '$base' => (string)DI::baseUrl() ]); } diff --git a/src/Content/Smilies.php b/src/Content/Smilies.php index ff9d63882e..d231797b81 100644 --- a/src/Content/Smilies.php +++ b/src/Content/Smilies.php @@ -106,7 +106,7 @@ class Smilies ]; - $baseUrl = DI::baseUrl(); + $baseUrl = (string)DI::baseUrl(); $icons = [ '', diff --git a/src/Model/Photo.php b/src/Model/Photo.php index 74031a822e..1b87e82d51 100644 --- a/src/Model/Photo.php +++ b/src/Model/Photo.php @@ -918,9 +918,7 @@ class Photo */ public static function getResourceData(string $name): array { - $base = DI::baseUrl(); - - $guid = str_replace([Strings::normaliseLink($base), '/photo/'], '', Strings::normaliseLink($name)); + $guid = str_replace([Strings::normaliseLink((string)DI::baseUrl()), '/photo/'], '', Strings::normaliseLink($name)); if (parse_url($guid, PHP_URL_SCHEME)) { return []; @@ -982,9 +980,7 @@ class Photo */ public static function isLocalPage(string $name): bool { - $base = DI::baseUrl(); - - $guid = str_replace(Strings::normaliseLink($base), '', Strings::normaliseLink($name)); + $guid = str_replace(Strings::normaliseLink((string)DI::baseUrl()), '', Strings::normaliseLink($name)); $guid = preg_replace("=/photos/.*/image/(.*)=ism", '$1', $guid); if (empty($guid)) { return false; diff --git a/src/Model/User.php b/src/Model/User.php index 11d55e7f7e..3be13bebf1 100644 --- a/src/Model/User.php +++ b/src/Model/User.php @@ -167,7 +167,7 @@ class User $system['region'] = ''; $system['postal-code'] = ''; $system['country-name'] = ''; - $system['homepage'] = DI::baseUrl(); + $system['homepage'] = (string)DI::baseUrl(); $system['dob'] = '0000-00-00'; // Ensure that the user contains data diff --git a/src/Module/HCard.php b/src/Module/HCard.php index 92627125ab..ce63d77c35 100644 --- a/src/Module/HCard.php +++ b/src/Module/HCard.php @@ -64,9 +64,9 @@ class HCard extends BaseModule $page['htmlhead'] .= '' . "\r\n"; } - $baseUrl = DI::baseUrl(); + $baseUrl = (string)DI::baseUrl(); - $uri = urlencode('acct:' . $profile['nickname'] . '@' . $baseUrl->getHost() . ($baseUrl->getPath() ? '/' . $baseUrl->getPath() : '')); + $uri = urlencode('acct:' . $profile['nickname'] . '@' . DI::baseUrl()->getHost() . (DI::baseUrl()->getPath() ? '/' . DI::baseUrl()->getPath() : '')); $page['htmlhead'] .= '' . "\r\n"; $page['htmlhead'] .= '' . "\r\n"; diff --git a/src/Module/OpenSearch.php b/src/Module/OpenSearch.php index f01baafada..7c44bc510e 100644 --- a/src/Module/OpenSearch.php +++ b/src/Module/OpenSearch.php @@ -40,7 +40,7 @@ class OpenSearch extends BaseModule protected function rawContent(array $request = []) { $hostname = DI::baseUrl()->getHost(); - $baseUrl = DI::baseUrl(); + $baseUrl = (string)DI::baseUrl(); /** @var DOMDocument $xml */ XML::fromArray([ diff --git a/src/Module/Register.php b/src/Module/Register.php index e5c5840d22..d26fb0a3d3 100644 --- a/src/Module/Register.php +++ b/src/Module/Register.php @@ -298,7 +298,7 @@ class Register extends BaseModule $user = $result['user']; - $base_url = DI::baseUrl(); + $base_url = (string)DI::baseUrl(); if ($netpublish && intval(DI::config()->get('config', 'register_policy')) !== self::APPROVE) { $url = $base_url . '/profile/' . $user['nickname']; diff --git a/src/Module/WellKnown/HostMeta.php b/src/Module/WellKnown/HostMeta.php index 75976ac36b..eadc9f221a 100644 --- a/src/Module/WellKnown/HostMeta.php +++ b/src/Module/WellKnown/HostMeta.php @@ -46,7 +46,7 @@ class HostMeta extends BaseModule $config->set('system', 'site_pubkey', $res['pubkey']); } - $domain = DI::baseUrl(); + $domain = (string)DI::baseUrl(); XML::fromArray([ 'XRD' => [ diff --git a/src/Protocol/ActivityPub/Transmitter.php b/src/Protocol/ActivityPub/Transmitter.php index c24c29feec..3d945180a5 100644 --- a/src/Protocol/ActivityPub/Transmitter.php +++ b/src/Protocol/ActivityPub/Transmitter.php @@ -330,7 +330,7 @@ class Transmitter return [ 'type' => 'Service', 'name' => App::PLATFORM . " '" . App::CODENAME . "' " . App::VERSION . '-' . DB_UPDATE_VERSION, - 'url' => DI::baseUrl() + 'url' => (string)DI::baseUrl() ]; } diff --git a/view/theme/frio/php/default.php b/view/theme/frio/php/default.php index 0677ff900a..a75207a206 100644 --- a/view/theme/frio/php/default.php +++ b/view/theme/frio/php/default.php @@ -45,7 +45,7 @@ $is_singleuser_class = $is_singleuser ? "is-singleuser" : "is-not-singleuser";