summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2013-04-19 11:08:26 +0200
committerBart Visscher <bartv@thisnet.nl>2013-04-26 14:21:50 +0200
commitea4ae857a1713038f5f0d888f434633222345480 (patch)
treeb5e2fa3764b857b9f2789ef9002f07885c9bff5a /lib
parent26e2672a5a35b8fa417b7f8650bede78f01b70d7 (diff)
downloadnextcloud-server-ea4ae857a1713038f5f0d888f434633222345480.tar.gz
nextcloud-server-ea4ae857a1713038f5f0d888f434633222345480.zip
Simplify app css locating for layout pages
Diffstat (limited to 'lib')
-rw-r--r--lib/templatelayout.php40
1 files changed, 9 insertions, 31 deletions
diff --git a/lib/templatelayout.php b/lib/templatelayout.php
index 3c496f56e41..92837658a5f 100644
--- a/lib/templatelayout.php
+++ b/lib/templatelayout.php
@@ -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();