@@ -67,120 +67,120 @@ |
||
67 | 67 | use Psr\Container\ContainerInterface; |
68 | 68 | |
69 | 69 | class Application extends App implements IBootstrap { |
70 | - public const APP_ID = 'files'; |
|
71 | - |
|
72 | - public function __construct(array $urlParams=[]) { |
|
73 | - parent::__construct(self::APP_ID, $urlParams); |
|
74 | - } |
|
75 | - |
|
76 | - public function register(IRegistrationContext $context): void { |
|
77 | - /** |
|
78 | - * Controllers |
|
79 | - */ |
|
80 | - $context->registerService('APIController', function (ContainerInterface $c) { |
|
81 | - /** @var IServerContainer $server */ |
|
82 | - $server = $c->get(IServerContainer::class); |
|
83 | - |
|
84 | - return new ApiController( |
|
85 | - $c->get('AppName'), |
|
86 | - $c->get(IRequest::class), |
|
87 | - $c->get(IUserSession::class), |
|
88 | - $c->get(TagService::class), |
|
89 | - $c->get(IPreview::class), |
|
90 | - $c->get(IShareManager::class), |
|
91 | - $c->get(IConfig::class), |
|
92 | - $server->getUserFolder() |
|
93 | - ); |
|
94 | - }); |
|
95 | - |
|
96 | - /** |
|
97 | - * Services |
|
98 | - */ |
|
99 | - $context->registerService(TagService::class, function (ContainerInterface $c) { |
|
100 | - /** @var IServerContainer $server */ |
|
101 | - $server = $c->get(IServerContainer::class); |
|
102 | - |
|
103 | - return new TagService( |
|
104 | - $c->get(IUserSession::class), |
|
105 | - $c->get(IActivityManager::class), |
|
106 | - $c->get(ITagManager::class)->load(self::APP_ID), |
|
107 | - $server->getUserFolder(), |
|
108 | - $server->getEventDispatcher() |
|
109 | - ); |
|
110 | - }); |
|
111 | - |
|
112 | - /* |
|
70 | + public const APP_ID = 'files'; |
|
71 | + |
|
72 | + public function __construct(array $urlParams=[]) { |
|
73 | + parent::__construct(self::APP_ID, $urlParams); |
|
74 | + } |
|
75 | + |
|
76 | + public function register(IRegistrationContext $context): void { |
|
77 | + /** |
|
78 | + * Controllers |
|
79 | + */ |
|
80 | + $context->registerService('APIController', function (ContainerInterface $c) { |
|
81 | + /** @var IServerContainer $server */ |
|
82 | + $server = $c->get(IServerContainer::class); |
|
83 | + |
|
84 | + return new ApiController( |
|
85 | + $c->get('AppName'), |
|
86 | + $c->get(IRequest::class), |
|
87 | + $c->get(IUserSession::class), |
|
88 | + $c->get(TagService::class), |
|
89 | + $c->get(IPreview::class), |
|
90 | + $c->get(IShareManager::class), |
|
91 | + $c->get(IConfig::class), |
|
92 | + $server->getUserFolder() |
|
93 | + ); |
|
94 | + }); |
|
95 | + |
|
96 | + /** |
|
97 | + * Services |
|
98 | + */ |
|
99 | + $context->registerService(TagService::class, function (ContainerInterface $c) { |
|
100 | + /** @var IServerContainer $server */ |
|
101 | + $server = $c->get(IServerContainer::class); |
|
102 | + |
|
103 | + return new TagService( |
|
104 | + $c->get(IUserSession::class), |
|
105 | + $c->get(IActivityManager::class), |
|
106 | + $c->get(ITagManager::class)->load(self::APP_ID), |
|
107 | + $server->getUserFolder(), |
|
108 | + $server->getEventDispatcher() |
|
109 | + ); |
|
110 | + }); |
|
111 | + |
|
112 | + /* |
|
113 | 113 | * Register capabilities |
114 | 114 | */ |
115 | - $context->registerCapability(Capabilities::class); |
|
116 | - |
|
117 | - $context->registerEventListener(LoadAdditionalScriptsEvent::class, LegacyLoadAdditionalScriptsAdapter::class); |
|
118 | - $context->registerEventListener(LoadSidebar::class, LoadSidebarListener::class); |
|
119 | - |
|
120 | - $context->registerSearchProvider(FilesSearchProvider::class); |
|
121 | - } |
|
122 | - |
|
123 | - public function boot(IBootContext $context): void { |
|
124 | - $context->injectFn(Closure::fromCallable([$this, 'registerCollaboration'])); |
|
125 | - $context->injectFn([Listener::class, 'register']); |
|
126 | - $context->injectFn(Closure::fromCallable([$this, 'registerNotification'])); |
|
127 | - $context->injectFn(Closure::fromCallable([$this, 'registerSearchProvider'])); |
|
128 | - $this->registerTemplates(); |
|
129 | - $context->injectFn(Closure::fromCallable([$this, 'registerNavigation'])); |
|
130 | - $this->registerHooks(); |
|
131 | - } |
|
132 | - |
|
133 | - private function registerCollaboration(IProviderManager $providerManager): void { |
|
134 | - $providerManager->registerResourceProvider(ResourceProvider::class); |
|
135 | - } |
|
136 | - |
|
137 | - private function registerNotification(IManager $notifications): void { |
|
138 | - $notifications->registerNotifierService(Notifier::class); |
|
139 | - } |
|
140 | - |
|
141 | - private function registerSearchProvider(ISearch $search): void { |
|
142 | - $search->registerProvider(File::class, ['apps' => ['files']]); |
|
143 | - } |
|
144 | - |
|
145 | - private function registerTemplates(): void { |
|
146 | - $templateManager = \OC_Helper::getFileTemplateManager(); |
|
147 | - $templateManager->registerTemplate('application/vnd.oasis.opendocument.presentation', 'core/templates/filetemplates/template.odp'); |
|
148 | - $templateManager->registerTemplate('application/vnd.oasis.opendocument.text', 'core/templates/filetemplates/template.odt'); |
|
149 | - $templateManager->registerTemplate('application/vnd.oasis.opendocument.spreadsheet', 'core/templates/filetemplates/template.ods'); |
|
150 | - } |
|
151 | - |
|
152 | - private function registerNavigation(IL10N $l10n): void { |
|
153 | - \OCA\Files\App::getNavigationManager()->add(function () use ($l10n) { |
|
154 | - return [ |
|
155 | - 'id' => 'files', |
|
156 | - 'appname' => 'files', |
|
157 | - 'script' => 'list.php', |
|
158 | - 'order' => 0, |
|
159 | - 'name' => $l10n->t('All files') |
|
160 | - ]; |
|
161 | - }); |
|
162 | - \OCA\Files\App::getNavigationManager()->add(function () use ($l10n) { |
|
163 | - return [ |
|
164 | - 'id' => 'recent', |
|
165 | - 'appname' => 'files', |
|
166 | - 'script' => 'recentlist.php', |
|
167 | - 'order' => 2, |
|
168 | - 'name' => $l10n->t('Recent') |
|
169 | - ]; |
|
170 | - }); |
|
171 | - \OCA\Files\App::getNavigationManager()->add(function () use ($l10n) { |
|
172 | - return [ |
|
173 | - 'id' => 'favorites', |
|
174 | - 'appname' => 'files', |
|
175 | - 'script' => 'simplelist.php', |
|
176 | - 'order' => 5, |
|
177 | - 'name' => $l10n->t('Favorites'), |
|
178 | - 'expandedState' => 'show_Quick_Access' |
|
179 | - ]; |
|
180 | - }); |
|
181 | - } |
|
182 | - |
|
183 | - private function registerHooks(): void { |
|
184 | - Util::connectHook('\OCP\Config', 'js', '\OCA\Files\App', 'extendJsConfig'); |
|
185 | - } |
|
115 | + $context->registerCapability(Capabilities::class); |
|
116 | + |
|
117 | + $context->registerEventListener(LoadAdditionalScriptsEvent::class, LegacyLoadAdditionalScriptsAdapter::class); |
|
118 | + $context->registerEventListener(LoadSidebar::class, LoadSidebarListener::class); |
|
119 | + |
|
120 | + $context->registerSearchProvider(FilesSearchProvider::class); |
|
121 | + } |
|
122 | + |
|
123 | + public function boot(IBootContext $context): void { |
|
124 | + $context->injectFn(Closure::fromCallable([$this, 'registerCollaboration'])); |
|
125 | + $context->injectFn([Listener::class, 'register']); |
|
126 | + $context->injectFn(Closure::fromCallable([$this, 'registerNotification'])); |
|
127 | + $context->injectFn(Closure::fromCallable([$this, 'registerSearchProvider'])); |
|
128 | + $this->registerTemplates(); |
|
129 | + $context->injectFn(Closure::fromCallable([$this, 'registerNavigation'])); |
|
130 | + $this->registerHooks(); |
|
131 | + } |
|
132 | + |
|
133 | + private function registerCollaboration(IProviderManager $providerManager): void { |
|
134 | + $providerManager->registerResourceProvider(ResourceProvider::class); |
|
135 | + } |
|
136 | + |
|
137 | + private function registerNotification(IManager $notifications): void { |
|
138 | + $notifications->registerNotifierService(Notifier::class); |
|
139 | + } |
|
140 | + |
|
141 | + private function registerSearchProvider(ISearch $search): void { |
|
142 | + $search->registerProvider(File::class, ['apps' => ['files']]); |
|
143 | + } |
|
144 | + |
|
145 | + private function registerTemplates(): void { |
|
146 | + $templateManager = \OC_Helper::getFileTemplateManager(); |
|
147 | + $templateManager->registerTemplate('application/vnd.oasis.opendocument.presentation', 'core/templates/filetemplates/template.odp'); |
|
148 | + $templateManager->registerTemplate('application/vnd.oasis.opendocument.text', 'core/templates/filetemplates/template.odt'); |
|
149 | + $templateManager->registerTemplate('application/vnd.oasis.opendocument.spreadsheet', 'core/templates/filetemplates/template.ods'); |
|
150 | + } |
|
151 | + |
|
152 | + private function registerNavigation(IL10N $l10n): void { |
|
153 | + \OCA\Files\App::getNavigationManager()->add(function () use ($l10n) { |
|
154 | + return [ |
|
155 | + 'id' => 'files', |
|
156 | + 'appname' => 'files', |
|
157 | + 'script' => 'list.php', |
|
158 | + 'order' => 0, |
|
159 | + 'name' => $l10n->t('All files') |
|
160 | + ]; |
|
161 | + }); |
|
162 | + \OCA\Files\App::getNavigationManager()->add(function () use ($l10n) { |
|
163 | + return [ |
|
164 | + 'id' => 'recent', |
|
165 | + 'appname' => 'files', |
|
166 | + 'script' => 'recentlist.php', |
|
167 | + 'order' => 2, |
|
168 | + 'name' => $l10n->t('Recent') |
|
169 | + ]; |
|
170 | + }); |
|
171 | + \OCA\Files\App::getNavigationManager()->add(function () use ($l10n) { |
|
172 | + return [ |
|
173 | + 'id' => 'favorites', |
|
174 | + 'appname' => 'files', |
|
175 | + 'script' => 'simplelist.php', |
|
176 | + 'order' => 5, |
|
177 | + 'name' => $l10n->t('Favorites'), |
|
178 | + 'expandedState' => 'show_Quick_Access' |
|
179 | + ]; |
|
180 | + }); |
|
181 | + } |
|
182 | + |
|
183 | + private function registerHooks(): void { |
|
184 | + Util::connectHook('\OCP\Config', 'js', '\OCA\Files\App', 'extendJsConfig'); |
|
185 | + } |
|
186 | 186 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | class Application extends App implements IBootstrap { |
70 | 70 | public const APP_ID = 'files'; |
71 | 71 | |
72 | - public function __construct(array $urlParams=[]) { |
|
72 | + public function __construct(array $urlParams = []) { |
|
73 | 73 | parent::__construct(self::APP_ID, $urlParams); |
74 | 74 | } |
75 | 75 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | /** |
78 | 78 | * Controllers |
79 | 79 | */ |
80 | - $context->registerService('APIController', function (ContainerInterface $c) { |
|
80 | + $context->registerService('APIController', function(ContainerInterface $c) { |
|
81 | 81 | /** @var IServerContainer $server */ |
82 | 82 | $server = $c->get(IServerContainer::class); |
83 | 83 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | /** |
97 | 97 | * Services |
98 | 98 | */ |
99 | - $context->registerService(TagService::class, function (ContainerInterface $c) { |
|
99 | + $context->registerService(TagService::class, function(ContainerInterface $c) { |
|
100 | 100 | /** @var IServerContainer $server */ |
101 | 101 | $server = $c->get(IServerContainer::class); |
102 | 102 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | } |
151 | 151 | |
152 | 152 | private function registerNavigation(IL10N $l10n): void { |
153 | - \OCA\Files\App::getNavigationManager()->add(function () use ($l10n) { |
|
153 | + \OCA\Files\App::getNavigationManager()->add(function() use ($l10n) { |
|
154 | 154 | return [ |
155 | 155 | 'id' => 'files', |
156 | 156 | 'appname' => 'files', |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | 'name' => $l10n->t('All files') |
160 | 160 | ]; |
161 | 161 | }); |
162 | - \OCA\Files\App::getNavigationManager()->add(function () use ($l10n) { |
|
162 | + \OCA\Files\App::getNavigationManager()->add(function() use ($l10n) { |
|
163 | 163 | return [ |
164 | 164 | 'id' => 'recent', |
165 | 165 | 'appname' => 'files', |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | 'name' => $l10n->t('Recent') |
169 | 169 | ]; |
170 | 170 | }); |
171 | - \OCA\Files\App::getNavigationManager()->add(function () use ($l10n) { |
|
171 | + \OCA\Files\App::getNavigationManager()->add(function() use ($l10n) { |
|
172 | 172 | return [ |
173 | 173 | 'id' => 'favorites', |
174 | 174 | 'appname' => 'files', |