]> git.joonet.de Git - adminer.git/commitdiff
Plugin to auto-include adminer.js when present
authorRoy-Orbison <Roy-Orbison@users.noreply.github.com>
Mon, 7 Aug 2023 05:09:29 +0000 (14:39 +0930)
committerJakub Vrana <jakub@vrana.cz>
Wed, 19 Feb 2025 10:16:40 +0000 (11:16 +0100)
plugins/adminer.js.php [new file with mode: 0644]

diff --git a/plugins/adminer.js.php b/plugins/adminer.js.php
new file mode 100644 (file)
index 0000000..7e8cf89
--- /dev/null
@@ -0,0 +1,20 @@
+<?php
+
+/**
+ * Enables auto-detection and inclusion of adminer.js, like adminer.css
+ *
+ * @author Roy Orbitson, https://github.com/Roy-Orbison
+ *
+ * @license https://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
+ */
+class AdminerDotJs
+{
+       const FileName = "adminer.js";
+
+       function head() {
+               if (file_exists(self::FileName)) {
+                       echo script_src(self::FileName . "?v=" . crc32(file_get_contents(self::FileName))), "\n";
+               }
+       }
+}