Skip to content

Commit abe9de8

Browse files
committed
Update ThemeManager.php
1 parent 733ab6b commit abe9de8

File tree

1 file changed

+22
-12
lines changed

1 file changed

+22
-12
lines changed

webfiori/framework/ThemeManager.php

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -141,18 +141,28 @@ public static function resetRegistered() {
141141
* @since 1.0.1
142142
*/
143143
private static function registerResourcesRoutes(Theme $theme) {
144-
145-
$publicPath = ROOT_PATH.DS.PUBLIC_FOLDER.DS;
146-
$themePath = $publicPath.$theme->getDirectoryName();
147-
148-
if (!is_dir($themePath)) {
149-
mkdir($themePath, 0777);
150-
mkdir($themePath.DS.$theme->getJsDirName(), 0777);
151-
copy($theme->getAbsolutePath().DS.'assets'.DS.$theme->getJsDirName(), $themePath.DS.$theme->getJsDirName());
152-
mkdir($themePath.DS.$theme->getCssDirName(), 0777);
153-
copy($theme->getAbsolutePath().DS.'assets'.DS.$theme->getCssDirName(), $themePath.DS.$theme->getCssDirName());
154-
mkdir($themePath.DS.$theme->getImagesDirName(), 0777);
155-
copy($theme->getAbsolutePath().DS.'assets'.DS.$theme->getImagesDirName(), $themePath.DS.$theme->getImagesDirName());
144+
$assetsFolderName = 'assets';
145+
$publicPath = ROOT_PATH.DS.PUBLIC_FOLDER.DS.$assetsFolderName.DS;
146+
$themeResourcesPath = $theme->getAbsolutePath().DS.$assetsFolderName.DS;
147+
$themePublicPath = $publicPath.DS.$theme->getDirectoryName();
148+
149+
if (!is_dir($themePublicPath)) {
150+
mkdir($themePublicPath, 0777);
151+
$jsDir = $themeResourcesPath.$theme->getJsDirName();
152+
if (is_dir($jsDir)) {
153+
mkdir($themePublicPath.DS.$theme->getJsDirName());
154+
copy($jsDir, $themePublicPath.DS.$theme->getJsDirName());
155+
}
156+
$cssDir = $themeResourcesPath.$theme->getCssDirName();
157+
if (is_dir($cssDir)) {
158+
mkdir($themePublicPath.DS.$theme->getCssDirName());
159+
copy($cssDir, $themePublicPath.DS.$theme->getCssDirName());
160+
}
161+
$ImagesDir = $themeResourcesPath.$theme->getImagesDirName();
162+
if (is_dir($ImagesDir)) {
163+
mkdir($themePublicPath.DS.$theme->getImagesDirName());
164+
copy($ImagesDir, $themePublicPath.DS.$theme->getImagesDirName());
165+
}
156166
}
157167

158168
self::createAssetsRoutes($theme->getDirectoryName(), $theme->getJsDirName());

0 commit comments

Comments
 (0)