]> git.joonet.de Git - adminer.git/commitdiff
Add plugin for switching designs
authorJakub Vrana <jakub@vrana.cz>
Tue, 23 Jan 2018 11:15:38 +0000 (12:15 +0100)
committerJakub Vrana <jakub@vrana.cz>
Tue, 23 Jan 2018 11:15:38 +0000 (12:15 +0100)
adminer/include/adminer.inc.php
adminer/include/design.inc.php
editor/include/adminer.inc.php
plugins/plugin.php
readme.txt

index 20e144631e3a9f5a814601c23bfabf6f64c6206b..7029e2cdb418c063b0581fe0ec59a02e272096bd 100644 (file)
@@ -78,7 +78,7 @@ class Adminer {
        }
 
        /** Print HTML code inside <head>
-       * @return bool true to link adminer.css if exists
+       * @return bool true to link favicon.ico and adminer.css if exists
        */
        function head() {
                ?>
@@ -87,6 +87,18 @@ class Adminer {
                return true;
        }
 
+       /** Get URLs of the CSS files
+       * @return array of strings
+       */
+       function css() {
+               $return = array();
+               $filename = "adminer.css";
+               if (file_exists($filename)) {
+                       $return[] = $filename;
+               }
+               return $return;
+       }
+
        /** Print login form
        * @return null
        */
index 102b898d9328d4085f7febbfe770b12d009c3c17..17a76c8a4ac3c51e4990c86ca5548d602d268d04 100644 (file)
@@ -27,8 +27,8 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
 <?php if ($adminer->head()) { ?>
 <link rel="shortcut icon" type="image/x-icon" href="../adminer/static/favicon.ico">
 <link rel="apple-touch-icon" href="../adminer/static/favicon.ico">
-<?php if (file_exists("adminer.css")) { ?>
-<link rel="stylesheet" type="text/css" href="adminer.css">
+<?php foreach ($adminer->css() as $css) { ?>
+<link rel="stylesheet" type="text/css" href="<?php echo h($css); ?>">
 <?php } ?>
 <?php } ?>
 
index 16d90ec83933aef6691be25dd83fe08a0cce3a69..12442f976b88c6a507b5ea96ebaf1af9b9b677a5 100644 (file)
@@ -55,6 +55,15 @@ class Adminer {
                return true;
        }
 
+       function css() {
+               $return = array();
+               $filename = "adminer.css";
+               if (file_exists($filename)) {
+                       $return[] = $filename;
+               }
+               return $return;
+       }
+
        function loginForm() {
                ?>
 <table cellspacing="0">
index 0b1d1c329a5f90ee891391f97cade1ab9b04b7da..11aca9aaad4f2c5cd5bfce8c9bb5387d41b4569e 100644 (file)
@@ -137,6 +137,11 @@ class AdminerPlugin extends Adminer {
                return $this->_applyPlugin(__FUNCTION__, $args);
        }
 
+       function css() {
+               $args = func_get_args();
+               return $this->_applyPlugin(__FUNCTION__, $args);
+       }
+
        function loginForm() {
                $args = func_get_args();
                return $this->_applyPlugin(__FUNCTION__, $args);
index 8a9d74b18f97a5ee4d42f9ffa7be58dc680ed085..6956bfd3a6931fa98ccec9d25fcaca18d9cef2f1 100644 (file)
@@ -12,6 +12,7 @@ editor/example.php - Example customization
 plugins/readme.txt - Plugins for Adminer and Adminer Editor
 adminer/plugin.php - Plugin demo
 adminer/sqlite.php - Development version of Adminer with SQLite allowed
+adminer/designs.php - Development version of Adminer with adminer.css switcher
 compile.php - Create a single file version
 lang.php - Update translations
 tests/selenium.html - Selenium test suite