From: Daniel Kinzler Date: Fri, 28 Jul 2006 22:52:46 +0000 (+0000) Subject: Factored code for global JS variables into a function X-Git-Tag: 1.31.0-rc.0~56128 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=edb2c0eea5e905877d5c75e113b95b0b23275178;p=lhc%2Fweb%2Fwiklou.git Factored code for global JS variables into a function --- diff --git a/includes/Skin.php b/includes/Skin.php index d15fca1e3b..d8dbc16ac0 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -260,6 +260,29 @@ class Skin extends Linker { $out->out( "\n" ); } + /*static*/ function makeGlobalVariablesScript( $data ) { + $r = ' + '; + + return $r; + } + function getHeadScripts() { global $wgStylePath, $wgUser, $wgAllowUserJs, $wgJsMimeType; global $wgArticlePath, $wgScriptPath, $wgServer, $wgContLang, $wgLang; @@ -268,26 +291,24 @@ class Skin extends Linker { $nsname = @$wgCanonicalNamespaceNames[ $wgTitle->getNamespace() ]; if ( $nsname === NULL ) $nsname = $wgTitle->getNsText(); - $r = ' - '; + $vars = array( + 'jsmimetype' => $wgJsMimeType, + 'skinname' => $this->getSkinName(), + 'stylepath' => $wgStylePath, + 'articlepath' => $wgArticlePath, + 'scriptpath' => $wgScriptPath, + 'serverurl' => $wgServer, + 'nscanonical' => $nsname, + 'titleprefixeddbkey' => $wgTitle->getPrefixedDBKey(), + 'titletext' => $wgTitle->getText(), + 'articleid' => $wgTitle->getArticleId(), + 'username' => $wgUser->isAnon() ? NULL : $wgUser->getName(), + 'userlang' => $wgLang->getCode(), + 'lang' => $wgContLang->getCode(), + ); + $r = Skin::makeGlobalVariablesScript( $vars ); + $r .= "\n"; if( $wgAllowUserJs && $wgUser->isLoggedIn() ) { $userpage = $wgUser->getUserPage(); diff --git a/skins/MonoBook.php b/skins/MonoBook.php index 0890be9781..9532eabede 100644 --- a/skins/MonoBook.php +++ b/skins/MonoBook.php @@ -65,29 +65,7 @@ class MonoBookTemplate extends QuickTemplate { - + data ); ?> data['jsvarurl' ]) { ?>