@@ -34,74 +34,74 @@ |
||
34 | 34 | use Psr\Log\LoggerInterface; |
35 | 35 | |
36 | 36 | class CSSResourceLocator extends ResourceLocator { |
37 | - public function __construct(LoggerInterface $logger) { |
|
38 | - parent::__construct($logger); |
|
39 | - } |
|
37 | + public function __construct(LoggerInterface $logger) { |
|
38 | + parent::__construct($logger); |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * @param string $style |
|
43 | - */ |
|
44 | - public function doFind($style) { |
|
45 | - $app = substr($style, 0, strpos($style, '/')); |
|
46 | - if ($this->appendIfExist($this->serverroot, $style.'.css') |
|
47 | - || $this->appendIfExist($this->serverroot, 'core/'.$style.'.css') |
|
48 | - ) { |
|
49 | - return; |
|
50 | - } |
|
51 | - $style = substr($style, strpos($style, '/') + 1); |
|
52 | - $app_path = \OC_App::getAppPath($app); |
|
53 | - $app_url = \OC_App::getAppWebPath($app); |
|
41 | + /** |
|
42 | + * @param string $style |
|
43 | + */ |
|
44 | + public function doFind($style) { |
|
45 | + $app = substr($style, 0, strpos($style, '/')); |
|
46 | + if ($this->appendIfExist($this->serverroot, $style.'.css') |
|
47 | + || $this->appendIfExist($this->serverroot, 'core/'.$style.'.css') |
|
48 | + ) { |
|
49 | + return; |
|
50 | + } |
|
51 | + $style = substr($style, strpos($style, '/') + 1); |
|
52 | + $app_path = \OC_App::getAppPath($app); |
|
53 | + $app_url = \OC_App::getAppWebPath($app); |
|
54 | 54 | |
55 | - if ($app_path === false && $app_url === false) { |
|
56 | - $this->logger->error('Could not find resource {resource} to load', [ |
|
57 | - 'resource' => $app . '/' . $style . '.css', |
|
58 | - 'app' => 'cssresourceloader', |
|
59 | - ]); |
|
60 | - return; |
|
61 | - } |
|
55 | + if ($app_path === false && $app_url === false) { |
|
56 | + $this->logger->error('Could not find resource {resource} to load', [ |
|
57 | + 'resource' => $app . '/' . $style . '.css', |
|
58 | + 'app' => 'cssresourceloader', |
|
59 | + ]); |
|
60 | + return; |
|
61 | + } |
|
62 | 62 | |
63 | - // Account for the possibility of having symlinks in app path. Doing |
|
64 | - // this here instead of above as an empty argument to realpath gets |
|
65 | - // turned into cwd. |
|
66 | - $app_path = realpath($app_path); |
|
63 | + // Account for the possibility of having symlinks in app path. Doing |
|
64 | + // this here instead of above as an empty argument to realpath gets |
|
65 | + // turned into cwd. |
|
66 | + $app_path = realpath($app_path); |
|
67 | 67 | |
68 | - $this->append($app_path, $style.'.css', $app_url); |
|
69 | - } |
|
68 | + $this->append($app_path, $style.'.css', $app_url); |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * @param string $style |
|
73 | - */ |
|
74 | - public function doFindTheme($style) { |
|
75 | - $theme_dir = 'themes/'.$this->theme.'/'; |
|
76 | - $this->appendIfExist($this->serverroot, $theme_dir.'apps/'.$style.'.css') |
|
77 | - || $this->appendIfExist($this->serverroot, $theme_dir.$style.'.css') |
|
78 | - || $this->appendIfExist($this->serverroot, $theme_dir.'core/'.$style.'.css'); |
|
79 | - } |
|
71 | + /** |
|
72 | + * @param string $style |
|
73 | + */ |
|
74 | + public function doFindTheme($style) { |
|
75 | + $theme_dir = 'themes/'.$this->theme.'/'; |
|
76 | + $this->appendIfExist($this->serverroot, $theme_dir.'apps/'.$style.'.css') |
|
77 | + || $this->appendIfExist($this->serverroot, $theme_dir.$style.'.css') |
|
78 | + || $this->appendIfExist($this->serverroot, $theme_dir.'core/'.$style.'.css'); |
|
79 | + } |
|
80 | 80 | |
81 | - public function append($root, $file, $webRoot = null, $throw = true, $scss = false) { |
|
82 | - if (!$scss) { |
|
83 | - parent::append($root, $file, $webRoot, $throw); |
|
84 | - } else { |
|
85 | - if (!$webRoot) { |
|
86 | - $webRoot = $this->findWebRoot($root); |
|
81 | + public function append($root, $file, $webRoot = null, $throw = true, $scss = false) { |
|
82 | + if (!$scss) { |
|
83 | + parent::append($root, $file, $webRoot, $throw); |
|
84 | + } else { |
|
85 | + if (!$webRoot) { |
|
86 | + $webRoot = $this->findWebRoot($root); |
|
87 | 87 | |
88 | - if ($webRoot === null) { |
|
89 | - $webRoot = ''; |
|
90 | - $this->logger->error('ResourceLocator can not find a web root (root: {root}, file: {file}, webRoot: {webRoot}, throw: {throw})', [ |
|
91 | - 'app' => 'lib', |
|
92 | - 'root' => $root, |
|
93 | - 'file' => $file, |
|
94 | - 'webRoot' => $webRoot, |
|
95 | - 'throw' => $throw ? 'true' : 'false' |
|
96 | - ]); |
|
88 | + if ($webRoot === null) { |
|
89 | + $webRoot = ''; |
|
90 | + $this->logger->error('ResourceLocator can not find a web root (root: {root}, file: {file}, webRoot: {webRoot}, throw: {throw})', [ |
|
91 | + 'app' => 'lib', |
|
92 | + 'root' => $root, |
|
93 | + 'file' => $file, |
|
94 | + 'webRoot' => $webRoot, |
|
95 | + 'throw' => $throw ? 'true' : 'false' |
|
96 | + ]); |
|
97 | 97 | |
98 | - if ($throw && $root === '/') { |
|
99 | - throw new ResourceNotFoundException($file, $webRoot); |
|
100 | - } |
|
101 | - } |
|
102 | - } |
|
98 | + if ($throw && $root === '/') { |
|
99 | + throw new ResourceNotFoundException($file, $webRoot); |
|
100 | + } |
|
101 | + } |
|
102 | + } |
|
103 | 103 | |
104 | - $this->resources[] = [$webRoot ?: \OC::$WEBROOT, $webRoot, $file]; |
|
105 | - } |
|
106 | - } |
|
104 | + $this->resources[] = [$webRoot ?: \OC::$WEBROOT, $webRoot, $file]; |
|
105 | + } |
|
106 | + } |
|
107 | 107 | } |