1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-08 07:36:44 +02:00

AdminerEditCalendar: Avoid work in constructor

This commit is contained in:
Jakub Vrana
2025-03-23 18:41:09 +01:00
parent 6a64c7771b
commit 4477f95426
2 changed files with 7 additions and 10 deletions

View File

@@ -48,8 +48,7 @@ if (
echo "<p>" . lang('Loaded plugins') . ":\n<ul>\n"; echo "<p>" . lang('Loaded plugins') . ":\n<ul>\n";
foreach ($adminer->plugins as $plugin) { foreach ($adminer->plugins as $plugin) {
$reflection = new \ReflectionObject($plugin); $reflection = new \ReflectionObject($plugin);
preg_match('~^/[\s*]+(.+)\n~', $reflection->getDocComment(), $match); echo "<li><b>" . get_class($plugin) . "</b>" . h(preg_match('~^/[\s*]+(.+)~', $reflection->getDocComment(), $match) ? ": $match[1]" : "") . "\n";
echo "<li><b>" . get_class($plugin) . "</b>" . h($match ? ": $match[1]" : "") . "\n";
} }
echo "</ul>\n"; echo "</ul>\n";
} }

View File

@@ -16,19 +16,17 @@ class AdminerEditCalendar {
* @param string path to language file, %s stands for language code * @param string path to language file, %s stands for language code
*/ */
function __construct($prepend = null, $langPath = "jquery-ui/i18n/jquery.ui.datepicker-%s.js") { function __construct($prepend = null, $langPath = "jquery-ui/i18n/jquery.ui.datepicker-%s.js") {
if ($prepend === null) {
$prepend = "<link rel='stylesheet' type='text/css' href='jquery-ui/jquery-ui.css'>\n"
. Adminer\script_src("jquery-ui/jquery.js")
. Adminer\script_src("jquery-ui/jquery-ui.js")
. Adminer\script_src("jquery-ui/jquery-ui-timepicker-addon.js")
;
}
$this->prepend = $prepend; $this->prepend = $prepend;
$this->langPath = $langPath; $this->langPath = $langPath;
} }
function head($dark = null) { function head($dark = null) {
echo $this->prepend; echo ($this->prepend !== null ? $this->prepend :
"<link rel='stylesheet' type='text/css' href='jquery-ui/jquery-ui.css'>\n"
. Adminer\script_src("jquery-ui/jquery.js")
. Adminer\script_src("jquery-ui/jquery-ui.js")
. Adminer\script_src("jquery-ui/jquery-ui-timepicker-addon.js")
);
if ($this->langPath) { if ($this->langPath) {
$lang = Adminer\get_lang(); $lang = Adminer\get_lang();
$lang = ($lang == "zh" ? "zh-CN" : ($lang == "zh-tw" ? "zh-TW" : $lang)); $lang = ($lang == "zh" ? "zh-CN" : ($lang == "zh-tw" ? "zh-TW" : $lang));