@@ -34,17 +34,17 @@ |
||
| 34 | 34 | use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent; |
| 35 | 35 | |
| 36 | 36 | class Application extends App implements IBootstrap { |
| 37 | - public const APP_ID = 'theming'; |
|
| 37 | + public const APP_ID = 'theming'; |
|
| 38 | 38 | |
| 39 | - public function __construct() { |
|
| 40 | - parent::__construct(self::APP_ID); |
|
| 41 | - } |
|
| 39 | + public function __construct() { |
|
| 40 | + parent::__construct(self::APP_ID); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - public function register(IRegistrationContext $context): void { |
|
| 44 | - $context->registerCapability(Capabilities::class); |
|
| 45 | - $context->registerEventListener(BeforeTemplateRenderedEvent::class, BeforeTemplateRenderedListener::class); |
|
| 46 | - } |
|
| 43 | + public function register(IRegistrationContext $context): void { |
|
| 44 | + $context->registerCapability(Capabilities::class); |
|
| 45 | + $context->registerEventListener(BeforeTemplateRenderedEvent::class, BeforeTemplateRenderedListener::class); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - public function boot(IBootContext $context): void { |
|
| 49 | - } |
|
| 48 | + public function boot(IBootContext $context): void { |
|
| 49 | + } |
|
| 50 | 50 | } |
@@ -37,47 +37,47 @@ |
||
| 37 | 37 | |
| 38 | 38 | class BeforeTemplateRenderedListener implements IEventListener { |
| 39 | 39 | |
| 40 | - /** @var IInitialStateService */ |
|
| 41 | - private $initialStateService; |
|
| 42 | - /** @var IURLGenerator */ |
|
| 43 | - private $urlGenerator; |
|
| 44 | - /** @var IConfig */ |
|
| 45 | - private $config; |
|
| 46 | - /** @var IServerContainer */ |
|
| 47 | - private $serverContainer; |
|
| 40 | + /** @var IInitialStateService */ |
|
| 41 | + private $initialStateService; |
|
| 42 | + /** @var IURLGenerator */ |
|
| 43 | + private $urlGenerator; |
|
| 44 | + /** @var IConfig */ |
|
| 45 | + private $config; |
|
| 46 | + /** @var IServerContainer */ |
|
| 47 | + private $serverContainer; |
|
| 48 | 48 | |
| 49 | - public function __construct( |
|
| 50 | - IInitialStateService $initialStateService, |
|
| 51 | - IURLGenerator $urlGenerator, |
|
| 52 | - IConfig $config, |
|
| 53 | - IServerContainer $serverContainer |
|
| 54 | - ) { |
|
| 55 | - $this->initialStateService = $initialStateService; |
|
| 56 | - $this->urlGenerator = $urlGenerator; |
|
| 57 | - $this->config = $config; |
|
| 58 | - $this->serverContainer = $serverContainer; |
|
| 59 | - } |
|
| 49 | + public function __construct( |
|
| 50 | + IInitialStateService $initialStateService, |
|
| 51 | + IURLGenerator $urlGenerator, |
|
| 52 | + IConfig $config, |
|
| 53 | + IServerContainer $serverContainer |
|
| 54 | + ) { |
|
| 55 | + $this->initialStateService = $initialStateService; |
|
| 56 | + $this->urlGenerator = $urlGenerator; |
|
| 57 | + $this->config = $config; |
|
| 58 | + $this->serverContainer = $serverContainer; |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - public function handle(Event $event): void { |
|
| 62 | - $serverContainer = $this->serverContainer; |
|
| 63 | - $this->initialStateService->provideLazyInitialState(Application::APP_ID, 'data', function () use ($serverContainer) { |
|
| 64 | - return $serverContainer->query(JSDataService::class); |
|
| 65 | - }); |
|
| 61 | + public function handle(Event $event): void { |
|
| 62 | + $serverContainer = $this->serverContainer; |
|
| 63 | + $this->initialStateService->provideLazyInitialState(Application::APP_ID, 'data', function () use ($serverContainer) { |
|
| 64 | + return $serverContainer->query(JSDataService::class); |
|
| 65 | + }); |
|
| 66 | 66 | |
| 67 | - $linkToCSS = $this->urlGenerator->linkToRoute( |
|
| 68 | - 'theming.Theming.getStylesheet', |
|
| 69 | - [ |
|
| 70 | - 'v' => $this->config->getAppValue('theming', 'cachebuster', '0'), |
|
| 71 | - ] |
|
| 72 | - ); |
|
| 73 | - \OCP\Util::addHeader( |
|
| 74 | - 'link', |
|
| 75 | - [ |
|
| 76 | - 'rel' => 'stylesheet', |
|
| 77 | - 'href' => $linkToCSS, |
|
| 78 | - ] |
|
| 79 | - ); |
|
| 67 | + $linkToCSS = $this->urlGenerator->linkToRoute( |
|
| 68 | + 'theming.Theming.getStylesheet', |
|
| 69 | + [ |
|
| 70 | + 'v' => $this->config->getAppValue('theming', 'cachebuster', '0'), |
|
| 71 | + ] |
|
| 72 | + ); |
|
| 73 | + \OCP\Util::addHeader( |
|
| 74 | + 'link', |
|
| 75 | + [ |
|
| 76 | + 'rel' => 'stylesheet', |
|
| 77 | + 'href' => $linkToCSS, |
|
| 78 | + ] |
|
| 79 | + ); |
|
| 80 | 80 | |
| 81 | - \OCP\Util::addScript('theming', 'theming'); |
|
| 82 | - } |
|
| 81 | + \OCP\Util::addScript('theming', 'theming'); |
|
| 82 | + } |
|
| 83 | 83 | } |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | |
| 61 | 61 | public function handle(Event $event): void { |
| 62 | 62 | $serverContainer = $this->serverContainer; |
| 63 | - $this->initialStateService->provideLazyInitialState(Application::APP_ID, 'data', function () use ($serverContainer) { |
|
| 63 | + $this->initialStateService->provideLazyInitialState(Application::APP_ID, 'data', function() use ($serverContainer) { |
|
| 64 | 64 | return $serverContainer->query(JSDataService::class); |
| 65 | 65 | }); |
| 66 | 66 | |