@@ -26,13 +26,13 @@ discard block |
||
26 | 26 | * @param string $script |
27 | 27 | */ |
28 | 28 | public function doFind($script) { |
29 | - $theme_dir = 'themes/' . $this->theme . '/'; |
|
29 | + $theme_dir = 'themes/'.$this->theme.'/'; |
|
30 | 30 | |
31 | 31 | // Extracting the appId and the script file name |
32 | 32 | $app = substr($script, 0, strpos($script, '/')); |
33 | 33 | $scriptName = basename($script); |
34 | 34 | // Get the app root path |
35 | - $appRoot = $this->serverroot . '/apps/'; |
|
35 | + $appRoot = $this->serverroot.'/apps/'; |
|
36 | 36 | $appWebRoot = null; |
37 | 37 | try { |
38 | 38 | // We need the dir name as getAppPath appends the appid |
@@ -52,29 +52,29 @@ discard block |
||
52 | 52 | // For language files we try to load them all, so themes can overwrite |
53 | 53 | // single l10n strings without having to translate all of them. |
54 | 54 | $found = 0; |
55 | - $found += $this->appendScriptIfExist($this->serverroot, 'core/' . $script); |
|
56 | - $found += $this->appendScriptIfExist($this->serverroot, $theme_dir . 'core/' . $script); |
|
55 | + $found += $this->appendScriptIfExist($this->serverroot, 'core/'.$script); |
|
56 | + $found += $this->appendScriptIfExist($this->serverroot, $theme_dir.'core/'.$script); |
|
57 | 57 | $found += $this->appendScriptIfExist($this->serverroot, $script); |
58 | - $found += $this->appendScriptIfExist($this->serverroot, $theme_dir . $script); |
|
58 | + $found += $this->appendScriptIfExist($this->serverroot, $theme_dir.$script); |
|
59 | 59 | $found += $this->appendScriptIfExist($appRoot, $script, $appWebRoot); |
60 | - $found += $this->appendScriptIfExist($this->serverroot, $theme_dir . 'apps/' . $script); |
|
60 | + $found += $this->appendScriptIfExist($this->serverroot, $theme_dir.'apps/'.$script); |
|
61 | 61 | |
62 | 62 | if ($found) { |
63 | 63 | return; |
64 | 64 | } |
65 | - } elseif ($this->appendScriptIfExist($this->serverroot, $theme_dir . 'apps/' . $script) |
|
66 | - || $this->appendScriptIfExist($this->serverroot, $theme_dir . $script) |
|
65 | + } elseif ($this->appendScriptIfExist($this->serverroot, $theme_dir.'apps/'.$script) |
|
66 | + || $this->appendScriptIfExist($this->serverroot, $theme_dir.$script) |
|
67 | 67 | || $this->appendScriptIfExist($this->serverroot, $script) |
68 | - || $this->appendScriptIfExist($this->serverroot, $theme_dir . "dist/$app-$scriptName") |
|
68 | + || $this->appendScriptIfExist($this->serverroot, $theme_dir."dist/$app-$scriptName") |
|
69 | 69 | || $this->appendScriptIfExist($this->serverroot, "dist/$app-$scriptName") |
70 | 70 | || $this->appendScriptIfExist($appRoot, $script, $appWebRoot) |
71 | - || $this->cacheAndAppendCombineJsonIfExist($this->serverroot, $script . '.json') |
|
72 | - || $this->cacheAndAppendCombineJsonIfExist($appRoot, $script . '.json', $app) |
|
73 | - || $this->appendScriptIfExist($this->serverroot, $theme_dir . 'core/' . $script) |
|
74 | - || $this->appendScriptIfExist($this->serverroot, 'core/' . $script) |
|
75 | - || (strpos($scriptName, '/') === -1 && ($this->appendScriptIfExist($this->serverroot, $theme_dir . "dist/core-$scriptName") |
|
71 | + || $this->cacheAndAppendCombineJsonIfExist($this->serverroot, $script.'.json') |
|
72 | + || $this->cacheAndAppendCombineJsonIfExist($appRoot, $script.'.json', $app) |
|
73 | + || $this->appendScriptIfExist($this->serverroot, $theme_dir.'core/'.$script) |
|
74 | + || $this->appendScriptIfExist($this->serverroot, 'core/'.$script) |
|
75 | + || (strpos($scriptName, '/') === -1 && ($this->appendScriptIfExist($this->serverroot, $theme_dir."dist/core-$scriptName") |
|
76 | 76 | || $this->appendScriptIfExist($this->serverroot, "dist/core-$scriptName"))) |
77 | - || $this->cacheAndAppendCombineJsonIfExist($this->serverroot, 'core/' . $script . '.json') |
|
77 | + || $this->cacheAndAppendCombineJsonIfExist($this->serverroot, 'core/'.$script.'.json') |
|
78 | 78 | ) { |
79 | 79 | return; |
80 | 80 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | |
87 | 87 | $this->logger->error('Could not find resource {resource} to load', [ |
88 | - 'resource' => $script . '.js', |
|
88 | + 'resource' => $script.'.js', |
|
89 | 89 | 'app' => 'jsresourceloader', |
90 | 90 | ]); |
91 | 91 | } |
@@ -101,14 +101,14 @@ discard block |
||
101 | 101 | * @see appendIfExist() |
102 | 102 | */ |
103 | 103 | protected function appendScriptIfExist(string $root, string $file, ?string $webRoot = null) { |
104 | - if (!$this->appendIfExist($root, $file . '.mjs', $webRoot)) { |
|
105 | - return $this->appendIfExist($root, $file . '.js', $webRoot); |
|
104 | + if (!$this->appendIfExist($root, $file.'.mjs', $webRoot)) { |
|
105 | + return $this->appendIfExist($root, $file.'.js', $webRoot); |
|
106 | 106 | } |
107 | 107 | return true; |
108 | 108 | } |
109 | 109 | |
110 | 110 | protected function cacheAndAppendCombineJsonIfExist($root, $file, $app = 'core') { |
111 | - if (is_file($root . '/' . $file)) { |
|
111 | + if (is_file($root.'/'.$file)) { |
|
112 | 112 | if ($this->jsCombiner->process($root, $file, $app)) { |
113 | 113 | $this->append($this->serverroot, $this->jsCombiner->getCachedJS($app, $file), false, false); |
114 | 114 | } else { |