The branch, master has been updated
via 394c6734d011c2b79fe0c12b836b6be427cdcf37 (commit)
via fca6631236b3976013baa9494b5c91bd27c52e59 (commit)
via 1208ed935f5ca51bf26ecac547a7de56a9089c07 (commit)
from b694a590ddd216d09ff849d7b14591c65fc7ae4f (commit)
- Log -----------------------------------------------------------------
commit 394c6734d011c2b79fe0c12b836b6be427cdcf37
Author: Michal Čihař <mcihar(a)novell.com>
Date: Tue Feb 8 09:27:02 2011 +0100
Use PMA_includeJS from top level page.
This prevents loading files twice, each time with different URL.
commit fca6631236b3976013baa9494b5c91bd27c52e59
Author: Michal Čihař <mcihar(a)novell.com>
Date: Tue Feb 8 09:25:51 2011 +0100
Replace manual <script> tag with common code.
commit 1208ed935f5ca51bf26ecac547a7de56a9089c07
Author: Michal Čihař <mcihar(a)novell.com>
Date: Tue Feb 8 09:25:27 2011 +0100
Factor out code for generating JS inclusion.
-----------------------------------------------------------------------
Summary of changes:
index.php | 8 +++++---
libraries/core.lib.php | 15 +++++++++++++++
libraries/header_scripts.inc.php | 10 ++--------
3 files changed, 22 insertions(+), 11 deletions(-)
diff --git a/index.php b/index.php
index 644a123..5d19758 100644
--- a/index.php
+++ b/index.php
@@ -152,9 +152,11 @@ header('Content-Type: text/html; charset=' . $GLOBALS['charset']);
};
// ]]>
</script>
-<script src="./js/jquery/jquery-1.4.4.js" type="text/javascript"></script>
-<script src="./js/update-location.js" type="text/javascript"></script>
-<script src="./js/common.js" type="text/javascript"></script>
+<?php
+echo PMA_includeJS('jquery/jquery-1.4.4.js');
+echo PMA_includeJS('update-location.js');
+echo PMA_includeJS('common.js');
+?>
</head>
<frameset cols="<?php
if ($GLOBALS['text_dir'] === 'rtl') {
diff --git a/libraries/core.lib.php b/libraries/core.lib.php
index a3d80f5..c2c82fb 100644
--- a/libraries/core.lib.php
+++ b/libraries/core.lib.php
@@ -673,4 +673,19 @@ function PMA_linkURL($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";
+ }
+}
?>
diff --git a/libraries/header_scripts.inc.php b/libraries/header_scripts.inc.php
index 76b0852..6bd87f6 100644
--- a/libraries/header_scripts.inc.php
+++ b/libraries/header_scripts.inc.php
@@ -16,9 +16,7 @@ require_once './libraries/common.inc.php';
// Cross-framing protection
if ( false === $GLOBALS['cfg']['AllowThirdPartyFraming']) {
-?>
-<script src="./js/cross_framing_protection.js" type="text/javascript"></script>
-<?php
+ echo PMA_includeJS('cross_framing_protection.js');
}
// generate title
$title = PMA_expandUserString(
@@ -47,11 +45,7 @@ $GLOBALS['js_include'][] = 'messages.php' . PMA_generate_common_url($params);
// avoid loading twice a js file
$GLOBALS['js_include'] = array_unique($GLOBALS['js_include']);
foreach ($GLOBALS['js_include'] as $js_script_file) {
- if (strpos($js_script_file, '?') === FALSE) {
- 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";
- }
+ echo PMA_includeJS($js_script_file);
}
?>
<script type="text/javascript">
hooks/post-receive
--
phpMyAdmin