N°3928 - Polishing: Impact analysis

This commit is contained in:
acognet
2021-10-13 14:25:55 +02:00
parent ceaa98f4ef
commit 96ae91494b

View File

@@ -57,6 +57,27 @@ class Branding
],
];
/**
* @param string $sType
* @param string $sLinkPath
*
* @return string
*/
protected static function GetLogoPath(string $sType, string $sLinkPath): string
{
$sDefaultLogoPath = static::$aLogoPaths[$sType]['default'];
$sWorkingPath = APPROOT.'env-'.utils::GetCurrentEnvironment().'/';
$aThemeParameters = json_decode(@file_get_contents($sWorkingPath.'branding/logos.json'), true);
if (isset($aThemeParameters[$sType])) {
$sCustomLogoPath = $aThemeParameters[$sType];
if (file_exists($sWorkingPath.$sCustomLogoPath)) {
return $sLinkPath.$sCustomLogoPath.'?t='.utils::GetCacheBusterTimestamp();
}
}
return $sLinkPath.$sDefaultLogoPath.'?t='.utils::GetCacheBusterTimestamp();
}
/**
* Return the absolute URL for the type of logo defined by $sType
*
@@ -68,17 +89,7 @@ class Branding
*/
public static function GetLogoAbsoluteUrl($sType = self::DEFAULT_LOGO_TYPE)
{
$sDefaultLogoPath = static::$aLogoPaths[$sType]['default'];
$sWorkingPath = APPROOT.'env-'.utils::GetCurrentEnvironment().'/';
$aThemeParameters = json_decode(@file_get_contents($sWorkingPath.'branding/logos.json'), true);
if (isset($aThemeParameters[$sType])) {
$sCustomLogoPath = $aThemeParameters[$sType];
if (file_exists($sWorkingPath.$sCustomLogoPath)) {
return utils::GetAbsoluteUrlModulesRoot().$sCustomLogoPath.'?t='.utils::GetCacheBusterTimestamp();
}
}
return utils::GetAbsoluteUrlAppRoot().$sDefaultLogoPath.'?t='.utils::GetCacheBusterTimestamp();
return self::GetLogoPath($sType, utils::GetAbsoluteUrlModulesRoot());
}
/**
@@ -92,17 +103,7 @@ class Branding
*/
public static function GetLogoRelativePath($sType = self::DEFAULT_LOGO_TYPE)
{
$sDefaultLogoPath = static::$aLogoPaths[$sType]['default'];
$sWorkingPath = APPROOT.'env-'.utils::GetCurrentEnvironment().'/';
$aThemeParameters = json_decode(@file_get_contents($sWorkingPath.'branding/logos.json'), true);
if (isset($aThemeParameters[$sType])) {
$sCustomLogoPath = $aThemeParameters[$sType];
if (file_exists($sWorkingPath.$sCustomLogoPath)) {
return $sWorkingPath.$sCustomLogoPath;
}
}
return $sWorkingPath.$sDefaultLogoPath;
return self::GetLogoPath($sType, APPROOT.'env-'.utils::GetCurrentEnvironment().'/');
}
/**
@@ -148,4 +149,5 @@ class Branding
{
return static::GetLogoAbsoluteUrl(static::ENUM_LOGO_TYPE_LOGIN_LOGO);
}
}