diff --git a/app/Theming/ThemeService.php b/app/Theming/ThemeService.php index 895108e3e..44605bf32 100644 --- a/app/Theming/ThemeService.php +++ b/app/Theming/ThemeService.php @@ -45,7 +45,7 @@ class ThemeService public function readThemeActions() { $themeActionsFile = theme_path('functions.php'); - if (file_exists($themeActionsFile)) { + if ($themeActionsFile && file_exists($themeActionsFile)) { require $themeActionsFile; } } diff --git a/app/Translation/FileLoader.php b/app/Translation/FileLoader.php index 0b4a93de6..e65146677 100644 --- a/app/Translation/FileLoader.php +++ b/app/Translation/FileLoader.php @@ -20,7 +20,8 @@ class FileLoader extends BaseLoader } if (is_null($namespace) || $namespace === '*') { - $themeTranslations = $this->loadPath(theme_path('lang'), $locale, $group); + $themePath = theme_path('lang'); + $themeTranslations = $themePath ? $this->loadPath($themePath, $locale, $group) : []; $originalTranslations = $this->loadPath($this->path, $locale, $group); return array_merge($originalTranslations, $themeTranslations); } diff --git a/app/helpers.php b/app/helpers.php index c1d72b91d..a5a04f113 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -94,13 +94,15 @@ function setting(string $key = null, $default = null) /** * Get a path to a theme resource. + * Returns null if a theme is not configured and + * therefore a full path is not available for use. */ -function theme_path(string $path = ''): string +function theme_path(string $path = ''): ?string { $theme = config('view.theme'); if (!$theme) { - return ''; + return null; } return base_path('themes/' . $theme .($path ? DIRECTORY_SEPARATOR.$path : $path));