function getHeadScripts() {
global $wgStylePath, $wgUser, $wgAllowUserJs, $wgJsMimeType;
- $r = "<script type=\"{$wgJsMimeType}\" src=\"{$wgStylePath}/common/wikibits.js\"></script>\n";
+ global $wgArticlePath, $wgScriptPath, $wgServer, $wgContLang, $wgLang;
+ global $wgTitle, $wgCanonicalNamespaceNames;
+
+ $nsname = @$wgCanonicalNamespaceNames[ $wgTitle->getNamespace() ];
+ if ( $nsname === NULL ) $nsname = $wgTitle->getNsText();
+
+ $r = '<script type= "'.$wgJsMimeType.'">
+ var skin = "' . Xml::escapeJsString( $this->getSkinName() ) . '";
+ var stylepath = "' . Xml::escapeJsString( $wgStylePath ) . '";
+
+ var wgArticlePath = "' . Xml::escapeJsString( $wgArticlePath ) . '";
+ var wgScriptPath = "' . Xml::escapeJsString( $wgScriptPath ) . '";
+ var wgServer = "' . Xml::escapeJsString( $wgServer ) . '";
+
+ var wgCanonicalNamespace = "' . Xml::escapeJsString( $nsname ) . '";
+ var wgPageName = "' . Xml::escapeJsString( $wgTitle->getPrefixedDBKey() ) . '";
+ var wgTitle = "' . Xml::escapeJsString( $wgTitle->getText() ) . '";
+ var wgArticleId = ' . (int)$wgTitle->getArticleId() . ';
+
+ var wgUserName = ' . ( $wgUser->isAnon() ? 'null' : ( '"' . Xml::escapeJsString( $wgUser->getName() ) . '"' ) ) . ';
+ var wgUserLanguage = "' . Xml::escapeJsString( $wgLang->getCode() ) . '";
+ var wgContentLanguage = "' . Xml::escapeJsString( $wgContLang->getCode() ) . '";
+ var wgSkinClass = "' . Xml::escapeJsString( get_class( $this ) ) . '";
+ </script>
+ ';
+
+ $r .= "<script type=\"{$wgJsMimeType}\" src=\"{$wgStylePath}/common/wikibits.js\"></script>\n";
if( $wgAllowUserJs && $wgUser->isLoggedIn() ) {
$userpage = $wgUser->getUserPage();
$userjs = htmlspecialchars( $this->makeUrl(
global $wgPageShowWatchingUsers;
global $wgUseTrackbacks;
global $wgDBname;
+ global $wgArticlePath, $wgScriptPath, $wgServer, $wgLang, $wgCanonicalNamespaceNames;
$fname = 'SkinTemplate::outputPage';
wfProfileIn( $fname );
$tpl->set( 'pagetitle', $wgOut->getHTMLTitle() );
$tpl->set( 'displaytitle', $wgOut->mPageLinkTitle );
+ $nsname = @$wgCanonicalNamespaceNames[ $this->mTitle->getNamespace() ];
+ if ( $nsname === NULL ) $nsname = $this->mTitle->getNsText();
+
+ $tpl->set( 'nscanonical', $nsname );
+ $tpl->set( 'titleprefixeddbkey', $this->mTitle->getPrefixedDBKey() );
+ $tpl->set( 'titletext', $this->mTitle->getText() );
+ $tpl->set( 'articleid', $this->mTitle->getArticleId() );
+
$tpl->setRef( "thispage", $this->thispage );
$subpagestr = $this->subPageSubtitle();
$tpl->set(
$tpl->set('headscripts', $out->getScript() );
$tpl->setRef( 'wgScript', $wgScript );
$tpl->setRef( 'skinname', $this->skinname );
+ $tpl->set( 'skinclass', get_class( $this ) );
$tpl->setRef( 'stylename', $this->stylename );
$tpl->set( 'printable', $wgRequest->getBool( 'printable' ) );
$tpl->setRef( 'loggedin', $this->loggedin );
$tpl->set( 'searchaction', $this->escapeSearchLink() );
$tpl->set( 'search', trim( $wgRequest->getVal( 'search' ) ) );
$tpl->setRef( 'stylepath', $wgStylePath );
+ $tpl->setRef( 'articlepath', $wgArticlePath );
+ $tpl->setRef( 'scriptpath', $wgScriptPath );
+ $tpl->setRef( 'serverurl', $wgServer );
$tpl->setRef( 'logopath', $wgLogo );
$tpl->setRef( "lang", $wgContLanguageCode );
$tpl->set( 'dir', $wgContLang->isRTL() ? "rtl" : "ltr" );
$tpl->set( 'rtl', $wgContLang->isRTL() );
$tpl->set( 'langname', $wgContLang->getLanguageName( $wgContLanguageCode ) );
$tpl->set( 'showjumplinks', $wgUser->getOption( 'showjumplinks' ) );
- $tpl->setRef( 'username', $this->username );
+ $tpl->set( 'username', $wgUser->isAnon() ? NULL : $this->username );
$tpl->setRef( 'userpage', $this->userpage);
$tpl->setRef( 'userpageurl', $this->userpageUrlDetails['href']);
+ $tpl->set( 'userlang', $wgLang->getCode() );
$tpl->set( 'pagecss', $this->setupPageCss() );
$tpl->setRef( 'usercss', $this->usercss);
$tpl->setRef( 'userjs', $this->userjs);
echo htmlspecialchars( $this->data[$str] );
}
+ /**
+ * @private
+ */
+ function jstext( $str ) {
+ echo Xml::escapeJsString( $this->data[$str] );
+ }
+
/**
* @private
*/
<!--[if IE 7]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE70Fixes.css?1";</style><![endif]-->
<!--[if lt IE 7]><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath') ?>/common/IEFixes.js"></script>
<meta http-equiv="imagetoolbar" content="no" /><![endif]-->
- <script type="<?php $this->text('jsmimetype') ?>">var skin = '<?php $this->text('skinname')?>';var stylepath = '<?php $this->text('stylepath')?>';</script>
+
+ <script type="<?php $this->text('jsmimetype') ?>">
+ var skin = "<?php $this->jstext('skinname')?>";
+ var stylepath = "<?php $this->jstext('stylepath')?>";
+
+ var wgArticlePath = "<?php $this->jstext( 'articlepath' ); ?>";
+ var wgScriptPath = "<?php $this->jstext( 'scriptpath' ); ?>";
+ var wgServer = "<?php $this->jstext( 'serverurl' ); ?>";
+
+ var wgCanonicalNamespace = "<?php $this->jstext( 'nscanonical' ); ?>";
+ var wgPageName = "<?php $this->jstext( 'titleprefixeddbkey' ); ?>";
+ var wgTitle = "<?php $this->jstext( 'titletext' ); ?>";
+ var wgArticleId = <?php (int) $this->jstext( 'articleid' ); ?>;
+
+<?php if($this->data['username']) { ?>
+ var wgUserName = "<?php $this->jstext( 'username' ); ?>";
+ var wgUserLanguage = "<?php $this->jstext( 'userlang' ); ?>";
+<?php } else { ?>
+ var wgUserName = null;
+ var wgUserLanguage = "<?php $this->jstext( 'userlang' ); ?>";
+<?php } ?>
+ var wgContentLanguage = "<?php $this->jstext( 'lang' ); ?>";
+ var wgSkinClass = "<?php $this->jstext( 'skinclass' ); ?>";
+ </script>
+
<script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath' ) ?>/common/wikibits.js?1"><!-- wikibits js --></script>
<?php if($this->data['jsvarurl' ]) { ?>
<script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('jsvarurl' ) ?>"><!-- site js --></script>