Simplify app css locating for layout pages
This commit is contained in:
parent
26e2672a5a
commit
ea4ae857a1
|
@ -64,25 +64,8 @@ class OC_TemplateLayout extends OC_Template {
|
|||
$root = $info[0];
|
||||
$web = $info[1];
|
||||
$file = $info[2];
|
||||
$paths = explode('/', $file);
|
||||
|
||||
$in_root = false;
|
||||
foreach(OC::$APPSROOTS as $app_root) {
|
||||
if($root == $app_root['path']) {
|
||||
$in_root = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if($in_root ) {
|
||||
$app = $paths[0];
|
||||
unset($paths[0]);
|
||||
$path = implode('/', $paths);
|
||||
$this->append( 'cssfiles', OC_Helper::linkTo($app, $path) . $versionParameter);
|
||||
}
|
||||
else {
|
||||
$this->append( 'cssfiles', $web.'/'.$file);
|
||||
}
|
||||
$this->append( 'cssfiles', $web.'/'.$file . $versionParameter);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,20 +106,15 @@ class OC_TemplateLayout extends OC_Template {
|
|||
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "core/$style.css" )) {
|
||||
|
||||
}else{
|
||||
$append = false;
|
||||
// or in apps?
|
||||
foreach( OC::$APPSROOTS as $apps_dir)
|
||||
{
|
||||
if(self::appendIfExist($files, $apps_dir['path'], $apps_dir['url'], "$style$fext.css")) {
|
||||
$append = true;
|
||||
break;
|
||||
}
|
||||
elseif(self::appendIfExist($files, $apps_dir['path'], $apps_dir['url'], "$style.css")) {
|
||||
$append = true;
|
||||
break;
|
||||
}
|
||||
$app = substr($style, 0, strpos($style, '/'));
|
||||
$style = substr($style, strpos($style, '/')+1);
|
||||
$app_path = OC_App::getAppPath($app);
|
||||
$app_url = OC::$WEBROOT . '/index.php/apps/' . $app;
|
||||
if(self::appendIfExist($files, $app_path, $app_url, "$style$fext.css")) {
|
||||
}
|
||||
if(! $append) {
|
||||
elseif(self::appendIfExist($files, $app_path, $app_url, "$style.css")) {
|
||||
}
|
||||
else {
|
||||
echo('css file not found: style:'.$style.' formfactor:'.$fext
|
||||
.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT);
|
||||
die();
|
||||
|
|
Loading…
Reference in New Issue