From e0283543f369c7f53b75f673d362e16cec3bef72 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Sat, 15 Mar 2025 08:51:51 +0100 Subject: [PATCH] Support adminer.css + adminer-dark.css together --- adminer/include/design.inc.php | 22 ++++++++++------------ changes.txt | 2 +- compile.php | 2 +- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/adminer/include/design.inc.php b/adminer/include/design.inc.php index 97a78447..38c621c5 100644 --- a/adminer/include/design.inc.php +++ b/adminer/include/design.inc.php @@ -31,23 +31,21 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") { css(); - $dark = ($css == array_filter($css, function ($filename) { - return preg_match('~-dark~', $filename); - })); - if ($dark) { // we need to load this before user styles - echo "\n"; - } - foreach ($css as $val) { - echo "\n"; + $dark = (count($css) == 1 ? !!preg_match('~-dark~', $css[0]) : null); + if ($dark !== false) { + echo "\n"; } // this is matched by compile.php echo script_src("../adminer/static/functions.js"); echo script_src("static/editing.js"); + if ($adminer->head($dark)) { + echo "\n"; + echo "\n"; + } + foreach ($css as $val) { + echo "\n"; + } ?> -head($css ? $dark : null)) { ?> - - - .*~', '', $file); // merged into default.css or dark.css $file = preg_replace_callback("~compile_file\\('([^']+)'(?:, '([^']*)')?\\)~", 'compile_file', $file); // integrate static files $replace = 'preg_replace("~\\\\\\\\?.*~", "", ME) . "?file=\1&version=' . $VERSION . '"'; -$file = preg_replace('~\.\./adminer/static/(default\.css|favicon\.ico)~', '', $file); +$file = preg_replace('~\.\./adminer/static/(default\.css)~', '', $file); $file = preg_replace('~"\.\./adminer/static/(functions\.js)"~', $replace, $file); $file = preg_replace('~\.\./adminer/static/([^\'"]*)~', '" . h(' . $replace . ') . "', $file); $file = preg_replace('~"\.\./externals/jush/modules/(jush\.js)"~', $replace, $file);