Adminer - Erweiterungen

Sowohl Adminer als auch der Editor unterstützen Erweiterungen. So ist es möglich voreingestellte Funktionen durch eigene Funktionen zu ersetzen. Alles was sie hierzu tun müssen ist es eine Adminer_Object Function zu definieren, die eine Objekt mit einer Erweiterung der orginal Adminer Klasse zurückgibt. Dann können sie den original adminer.php oder editor.php einfügen:

<?php
function adminer_object() {
  
  class AdminerSoftware extends Adminer {
    
    function name() {
      // custom name in title and heading
      return 'Software';
    }
    
    function permanentLogin() {
      // key used for permanent login
      return '0f607d641a68eb09958c6584a2834264';
    }
    
    function credentials() {
      // server, username and password for connecting to database
      return array('localhost', 'ODBC', '');
    }
    
    function database() {
      // database name, will be escaped by Adminer
      return 'software';
    }
    
    function login($login, $password) {
      // validate user submitted credentials
      return ($login == 'admin' && $password == '5cqxFkYq');
    }
    
    function tableName($tableStatus) {
      // tables without comments would return empty string and will be ignored by Adminer
      return h($tableStatus['Comment']);
    }
    
    function fieldName($field, $order = 0) {
      // only columns with comments will be displayed and only the first five in select
      return ($order <= 5 && !preg_match('~_(md5|sha1)$~', $field['field']) ? h($field['comment']) : '');
    }
    
  }
  
  return new AdminerSoftware;
}

include './editor.php';

To create an Adminer Editor customization for other drivers than MySQL, you have to define own loginForm method and fill the auth[driver] field value by your driver (pgsql, sqlite, ...). You usually also need to implement the database method. Example: editor/sqlite.php.

Adminer also supports plugins which are ready to use extensions.

API Referenz

Adminer screenshot with extension methods

Das Objekt kann die folgenden Methoden überschreiben:

Es ist möglich die folgenden globalen Functionen zu benutzen.

Language specific functions.

Driver specific functions:

Min_Driver:

Adminer specific functions:

Editor specific functions: