Factor out code for generating JS inclusion.
This commit is contained in:
@@ -673,4 +673,19 @@ function PMA_linkURL($url) {
|
|||||||
return './url.php?url=' . $url;
|
return './url.php?url=' . $url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns HTML code to include javascript file.
|
||||||
|
*
|
||||||
|
* @param string $url Location of javascript, relative to js/ folder.
|
||||||
|
*
|
||||||
|
* @return string HTML code for javascript inclusion.
|
||||||
|
*/
|
||||||
|
function PMA_includeJS($url) {
|
||||||
|
if (strpos($js_script_file, '?') === FALSE) {
|
||||||
|
return '<script src="./js/' . $js_script_file . '?ts=' . filemtime('./js/' . $js_script_file) . '" type="text/javascript"></script>' . "\n";
|
||||||
|
} else {
|
||||||
|
return '<script src="./js/' . $js_script_file . '" type="text/javascript"></script>' . "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
@@ -47,11 +47,7 @@ $GLOBALS['js_include'][] = 'messages.php' . PMA_generate_common_url($params);
|
|||||||
// avoid loading twice a js file
|
// avoid loading twice a js file
|
||||||
$GLOBALS['js_include'] = array_unique($GLOBALS['js_include']);
|
$GLOBALS['js_include'] = array_unique($GLOBALS['js_include']);
|
||||||
foreach ($GLOBALS['js_include'] as $js_script_file) {
|
foreach ($GLOBALS['js_include'] as $js_script_file) {
|
||||||
if (strpos($js_script_file, '?') === FALSE) {
|
echo PMA_includeJS($js_script_file);
|
||||||
echo '<script src="./js/' . $js_script_file . '?ts=' . filemtime('./js/' . $js_script_file) . '" type="text/javascript"></script>' . "\n";
|
|
||||||
} else {
|
|
||||||
echo '<script src="./js/' . $js_script_file . '" type="text/javascript"></script>' . "\n";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
Reference in New Issue
Block a user