Fix LS_THEME usage

This commit is contained in:
Benjamin Renard 2018-05-24 12:19:39 +02:00
parent c66e3bffc8
commit 37e573a247

View file

@ -132,6 +132,20 @@ class LStemplate {
}
}
/**
* Return the default directory path of files
*
* Return LS_THEME contanst value or 'default' if not defined
*
* @retval string The default directory path of files
**/
public static function getDefaultDir() {
if (defined('LS_THEME'))
return LS_THEME;
else
return 'default';
}
/**
* Return the path of the file to use
*
@ -144,7 +158,7 @@ class LStemplate {
**/
public static function getFilePath($file, $root_dir, $default_dir=null, $with_nocache=false) {
if ($default_dir === null)
$default_dir = 'default';
$default_dir = self :: getDefaultDir();
foreach(self :: $directories as $dir) {
if (file_exists($root_dir.'/'.$dir.'/'.$file)) {
$path = $root_dir.'/'.$dir.'/'.$file;
@ -173,7 +187,7 @@ class LStemplate {
$path = self :: getFilePath("$image.$ext", self :: $config['image_dir'], False, $with_nocache);
if ($path) return $path;
}
return self :: $config['image_dir']."/default/$image.png";
return self :: $config['image_dir']."/".self :: getDefaultDir()."/$image.png";
}
/**