about summary refs log tree commit diff
path: root/pkgs/by-name/ad/adminerevo/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/ad/adminerevo/index.php')
-rw-r--r--pkgs/by-name/ad/adminerevo/index.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/pkgs/by-name/ad/adminerevo/index.php b/pkgs/by-name/ad/adminerevo/index.php
new file mode 100644
index 0000000000000..838b5948ae4d3
--- /dev/null
+++ b/pkgs/by-name/ad/adminerevo/index.php
@@ -0,0 +1,35 @@
+<?php
+
+namespace nixos {
+	function adminer_object() {
+		require_once(__DIR__ . '/plugins/plugin.php');
+
+		$plugins = [];
+		if (file_exists(__DIR__ . '/plugins.json')) {
+			$names = json_decode(file_get_contents(__DIR__ . '/plugins.json'), true);
+
+			foreach ($names as $name) {
+				$plugin = __DIR__ . '/plugins/' . $name . '.php';
+				if (is_readable($plugin)) {
+					require($plugin);
+
+					preg_match_all('/(\w+)/', $name, $matches);
+
+					$className = 'Adminer'. implode('', array_map('ucfirst', $matches[1]));
+
+					$plugins[] = new $className;
+				}
+			}
+		}
+
+		return new \AdminerPlugin($plugins);
+	}
+}
+
+namespace {
+	function adminer_object() {
+		return \nixos\adminer_object();
+	}
+
+	require(__DIR__ . '/adminer.php');
+}