From: Michael Date: Mon, 9 May 2022 19:16:14 +0000 (+0000) Subject: Use a constant for the avatar base path X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=34030a736d5e0aa2195c0f472cf69f863c161d83;p=friendica.git Use a constant for the avatar base path --- diff --git a/src/Contact/Avatar.php b/src/Contact/Avatar.php index 8aa72bf9ba..6377560962 100644 --- a/src/Contact/Avatar.php +++ b/src/Contact/Avatar.php @@ -39,6 +39,8 @@ use Friendica\Util\Strings; */ class Avatar { + const BASE_PATH = '/avatar/'; + /** * Returns a field array with locally cached avatar pictures * @@ -105,11 +107,11 @@ class Avatar return ''; } - $path = '/avatar/' . $filename . $size . '.' . $image->getExt(); + $path = self::BASE_PATH . $filename . $size . '.' . $image->getExt(); $filepath = DI::basePath() . $path; - $dirpath = DI::basePath() . '/avatar/'; + $dirpath = DI::basePath() . self::BASE_PATH; DI::profiler()->startRecording('file'); @@ -169,13 +171,13 @@ class Avatar return ''; } - $path = Strings::normaliseLink(DI::baseUrl() . '/avatar'); + $path = Strings::normaliseLink(DI::baseUrl() . self::BASE_PATH); if (Network::getUrlMatch($path, $avatar) != $path) { return ''; } - $filename = str_replace($path, DI::basePath(). '/avatar/', Strings::normaliseLink($avatar)); + $filename = str_replace($path, DI::basePath(). self::BASE_PATH, Strings::normaliseLink($avatar)); DI::profiler()->startRecording('file'); $exists = file_exists($filename);