Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/apporder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2022-04-04 19:24:36 +0300
committerJulius Härtl <jus@bitgrid.net>2022-04-04 19:24:36 +0300
commit01996b48f16b4c106aa920348892b54945b31bcf (patch)
tree7885036ae2d73e3cd53a7fd74801b70bed18d435
parent588be60e0d3106b66e423e5f4637004ccaa1f615 (diff)
Move to IBootstrap (fixes #105)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
-rw-r--r--appinfo/app.php25
-rw-r--r--lib/AppInfo/Application.php32
-rw-r--r--lib/Listener/BeforeTemplateRenderedListener.php16
3 files changed, 48 insertions, 25 deletions
diff --git a/appinfo/app.php b/appinfo/app.php
deleted file mode 100644
index 688afc9..0000000
--- a/appinfo/app.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2016 Julius Härtl <jus@bitgrid.net>
- *
- * @author Julius Härtl <jus@bitgrid.net>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-\OCP\Util::addStyle('apporder', 'apporder');
-\OCP\Util::addScript('apporder', 'apporder');
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php
new file mode 100644
index 0000000..62d362b
--- /dev/null
+++ b/lib/AppInfo/Application.php
@@ -0,0 +1,32 @@
+<?php
+
+namespace OCA\AppOrder\AppInfo;
+
+use OCA\AppOrder\Listener\BeforeTemplateRenderedListener;
+use OCP\AppFramework\App;
+use OCP\AppFramework\Bootstrap\IBootContext;
+use OCP\AppFramework\Bootstrap\IBootstrap;
+use OCP\AppFramework\Bootstrap\IRegistrationContext;
+use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent;
+
+class Application extends App implements IBootstrap {
+
+ public const APP_ID = 'apporder';
+
+ public function __construct(array $urlParams = []) {
+ parent::__construct(self::APP_ID, $urlParams);
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function register(IRegistrationContext $context): void {
+ $context->registerEventListener(BeforeTemplateRenderedEvent::class, BeforeTemplateRenderedListener::class);
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function boot(IBootContext $context): void {
+ }
+}
diff --git a/lib/Listener/BeforeTemplateRenderedListener.php b/lib/Listener/BeforeTemplateRenderedListener.php
new file mode 100644
index 0000000..7f4aaed
--- /dev/null
+++ b/lib/Listener/BeforeTemplateRenderedListener.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace OCA\AppOrder\Listener;
+
+use OCP\EventDispatcher\Event;
+
+class BeforeTemplateRenderedListener implements \OCP\EventDispatcher\IEventListener {
+
+ /**
+ * @inheritDoc
+ */
+ public function handle(Event $event): void {
+ \OCP\Util::addStyle('apporder', 'apporder');
+ \OCP\Util::addScript('apporder', 'apporder');
+ }
+}