4242use OCP \Template \ITemplateManager ;
4343use OCP \Util ;
4444
45- class TemplateLayout {
45+ class TemplateLayout
46+ {
4647 private string $ versionHash = '' ;
4748 /** @var string[] */
4849 private array $ cacheBusterCache = [];
@@ -59,10 +60,10 @@ public function __construct(
5960 private ITemplateManager $ templateManager ,
6061 private ServerVersion $ serverVersion ,
6162 private IRequest $ request ,
62- ) {
63- }
63+ ) {}
6464
65- public function getPageTemplate (string $ renderAs , string $ appId ): ITemplate {
65+ public function getPageTemplate (string $ renderAs , string $ appId ): ITemplate
66+ {
6667 // Add fallback theming variables if not rendered as user
6768 if ($ renderAs !== TemplateResponse::RENDER_AS_USER ) {
6869 // TODO cache generated default theme if enabled for fallback if server is erroring ?
@@ -92,6 +93,8 @@ public function getPageTemplate(string $renderAs, string $appId): ITemplate {
9293 Util::addScript ('core ' , 'unified-search ' , 'core ' );
9394 }
9495
96+ Util::addScript ('core ' , 'appmenu ' , 'core ' );
97+
9598 // Set logo link target
9699 $ logoUrl = $ this ->config ->getSystemValueString ('logo_url ' , '' );
97100 $ page ->assign ('logoUrl ' , $ logoUrl );
@@ -267,7 +270,8 @@ public function getPageTemplate(string $renderAs, string $appId): ITemplate {
267270
268271 // Do not initialise scss appdata until we have a fully installed instance
269272 // Do not load scss for update, errors, installation or login page
270- if ($ this ->config ->getSystemValueBool ('installed ' , false )
273+ if (
274+ $ this ->config ->getSystemValueBool ('installed ' , false )
271275 && !Util::needUpgrade ()
272276 && $ pathInfo !== ''
273277 && !preg_match ('/^\/login/ ' , $ pathInfo )
@@ -315,7 +319,8 @@ public function getPageTemplate(string $renderAs, string $appId): ITemplate {
315319 return $ page ;
316320 }
317321
318- protected function getVersionHashSuffix (string $ path = '' , string $ file = '' ): string {
322+ protected function getVersionHashSuffix (string $ path = '' , string $ file = '' ): string
323+ {
319324 if ($ this ->config ->getSystemValueBool ('debug ' , false )) {
320325 // allows chrome workspace mapping in debug mode
321326 return '' ;
@@ -346,7 +351,8 @@ protected function getVersionHashSuffix(string $path = '', string $file = ''): s
346351 return '?v= ' . $ hash . $ themingSuffix ;
347352 }
348353
349- private function getVersionHashByPath (string $ path ): string |false {
354+ private function getVersionHashByPath (string $ path ): string |false
355+ {
350356 if (array_key_exists ($ path , $ this ->cacheBusterCache ) === false ) {
351357 // Not yet cached, so lets find the cache buster string
352358 $ appId = $ this ->getAppNamefromPath ($ path );
@@ -373,15 +379,17 @@ private function getVersionHashByPath(string $path): string|false {
373379 return $ this ->cacheBusterCache [$ path ];
374380 }
375381
376- private function findStylesheetFiles (array $ styles ): array {
382+ private function findStylesheetFiles (array $ styles ): array
383+ {
377384 if ($ this ->cssLocator === null ) {
378385 $ this ->cssLocator = Server::get (CSSResourceLocator::class);
379386 }
380387 $ this ->cssLocator ->find ($ styles );
381388 return $ this ->cssLocator ->getResources ();
382389 }
383390
384- public function getAppNamefromPath (string $ path ): string |false {
391+ public function getAppNamefromPath (string $ path ): string |false
392+ {
385393 if ($ path !== '' ) {
386394 $ pathParts = explode ('/ ' , $ path );
387395 if ($ pathParts [0 ] === 'css ' ) {
@@ -395,7 +403,8 @@ public function getAppNamefromPath(string $path): string|false {
395403 return false ;
396404 }
397405
398- private function findJavascriptFiles (array $ scripts ): array {
406+ private function findJavascriptFiles (array $ scripts ): array
407+ {
399408 if ($ this ->jsLocator === null ) {
400409 $ this ->jsLocator = Server::get (JSResourceLocator::class);
401410 }
@@ -409,7 +418,8 @@ private function findJavascriptFiles(array $scripts): array {
409418 * @return string Relative path
410419 * @throws \Exception If $filePath is not under \OC::$SERVERROOT
411420 */
412- public static function convertToRelativePath (string $ filePath ) {
421+ public static function convertToRelativePath (string $ filePath )
422+ {
413423 $ relativePath = explode (\OC ::$ SERVERROOT , $ filePath );
414424 if (count ($ relativePath ) !== 2 ) {
415425 throw new \Exception ('$filePath is not under the \OC::$SERVERROOT ' );
0 commit comments