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

Use script_src for <script src>

This commit is contained in:
Jakub Vrana
2018-01-13 16:25:11 +01:00
parent 144c7de27f
commit 9d532fc0a1
8 changed files with 34 additions and 23 deletions

View File

@@ -16,7 +16,14 @@ class AdminerEditCalendar {
* @param string text to append before first calendar usage
* @param string path to language file, %s stands for language code
*/
function __construct($prepend = "<script src='jquery-ui/jquery.js'></script>\n<script src='jquery-ui/jquery-ui.js'></script>\n<script src='jquery-ui/jquery-ui-timepicker-addon.js'></script>\n<link rel='stylesheet' type='text/css' href='jquery-ui/jquery-ui.css'>\n", $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"
. script_src("jquery-ui/jquery.js")
. script_src("jquery-ui/jquery-ui.js")
. script_src("jquery-ui/jquery-ui-timepicker-addon.js")
;
}
$this->prepend = $prepend;
$this->langPath = $langPath;
}
@@ -27,7 +34,7 @@ class AdminerEditCalendar {
$lang = get_lang();
$lang = ($lang == "zh" ? "zh-CN" : ($lang == "zh-tw" ? "zh-TW" : $lang));
if ($lang != "en" && file_exists(sprintf($this->langPath, $lang))) {
printf("<script src='$this->langPath'></script>\n", $lang);
echo script_src(sprintf($this->langPath, $lang));
echo script("jQuery(function () { jQuery.timepicker.setDefaults(jQuery.datepicker.regional['$lang']); });");
}
}