Adminer - Prispôsobenie

Adminer i Editor poskytujú podporu pre rozšírenia. Časť predvolenej funkcionality Admineru je možné prepísať vlastným kódom. Jediné, čo k tomu potrebujete, je definovať funkciu adminer_object, ktorá vracia objekt rozširujúci základnú triedu Adminer\Adminer. Potom už len vložte pôvodný adminer.php alebo editor.php:

<?php
function adminer_object() {

  class AdminerSoftware extends Adminer\Adminer {

    function name() {
      // custom name in title and heading
      return 'Software';
    }

    function permanentLogin() {
      // key used for permanent login
      return '93b80771ec6ed83b92ad563cd5b961b6';
    }

    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 == '3y3wXAkO');
    }

    function tableName($tableStatus) {
      // tables without comments would return empty string and will be ignored by Adminer
      return Adminer\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']) ? Adminer\h($field['comment']) : '');
    }

  }

  return new AdminerSoftware;
}

include './editor.php';

Pokiaľ chcete vytvoriť prispôsobenie Adminer Editoru pre iné ovládače ako MySQL, tak musíte definovať vlastnú metódu loginForm a vyplniť pole auth[driver] hodnotou svojho ovládača (pgsql, sqlite, ...). Obvykle by ste mali implementovať aj metódu database. Príklad: editor/sqlite.php.

Adminer podporuje aj rozšírenia, čo sú prispôsobenia pripravené na použitie.

Prehľad API

Obrázok Admineru s rozširujúcimi metódami

Všetko je v mennom priestore Adminer. Aliasy typov

Objekt môže prepísať nasledujúce metódy:

Je možné používať nasledujúce funkcie v mennom priestore Adminer.

Pomôcky pre HTML:

Funkcie špecifické pre preklady:

Funkcie špecifické pre ovládač:

Driver:

Db:

Funkcie špecifické pre Adminer:

Funkcie špecifické pre Editor: