}
function initPage( &$out ) {
- global $wgFavicon, $wgScriptPath, $wgSitename, $wgLanguageCode, $wgLanguageNames;
+ global $wgFavicon, $wgScriptPath, $wgSitename, $wgContLang;
- $fname = 'Skin::initPage';
- wfProfileIn( $fname );
+ wfProfileIn( __METHOD__ );
if( false !== $wgFavicon ) {
$out->addLink( array( 'rel' => 'shortcut icon', 'href' => $wgFavicon ) );
}
+ $code = $wgContLang->getCode();
+ $name = $wgContLang->getLanguageName( $code );
+ $langName = $name ? $name : $code;
+
# OpenSearch description link
$out->addLink( array(
'rel' => 'search',
'type' => 'application/opensearchdescription+xml',
'href' => "$wgScriptPath/opensearch_desc.php",
- 'title' => "$wgSitename ({$wgLanguageNames[$wgLanguageCode]})",
+ 'title' => "$wgSitename ($langName)",
));
$this->addMetadataLinks($out);
$this->preloadExistence();
- wfProfileOut( $fname );
+ wfProfileOut( __METHOD__ );
}
/**
}
if($wgUseAjax && $wgAjaxWatch && $wgUser->isLoggedIn() ) {
- $msgNames = array( 'watch', 'unwatch', 'watching', 'unwatching' );
$msgs = (object)array();
foreach ( array( 'watch', 'unwatch', 'watching', 'unwatching' ) as $msgName ) {
$msgs->{$msgName . 'Msg'} = wfMsg( $msgName );
$r .= "<script type=\"{$wgJsMimeType}\" src=\"{$wgStylePath}/common/wikibits.js?$wgStyleVersion\"></script>\n";
global $wgUseSiteJs;
if ($wgUseSiteJs) {
- if ($wgUser->isLoggedIn()) {
- $r .= "<script type=\"$wgJsMimeType\" src=\"".htmlspecialchars(self::makeUrl('-','action=raw&smaxage=0&gen=js'))."\"><!-- site js --></script>\n";
- } else {
- $r .= "<script type=\"$wgJsMimeType\" src=\"".htmlspecialchars(self::makeUrl('-','action=raw&gen=js'))."\"><!-- site js --></script>\n";
- }
+ $jsCache = $wgUser->isLoggedIn() ? '&smaxage=0' : '';
+ $r .= "<script type=\"$wgJsMimeType\" src=\"".
+ htmlspecialchars(self::makeUrl('-',
+ "action=raw$jsCache&gen=js&useskin=" .
+ urlencode( $this->getSkinName() ) ) ) .
+ "\"><!-- site js --></script>\n";
}
if( $allowUserJs && $wgUser->isLoggedIn() ) {
$userpage = $wgUser->getUserPage();
}
/**
- * This returns MediaWiki:Common.js. For some bizarre reason, it does
- * *not* return any custom user JS from user subpages. Huh?
+ * This returns MediaWiki:Common.js, and derived classes may add other JS.
+ * Despite its name, it does *not* return any custom user JS from user
+ * subpages. The returned script is sitewide and publicly cacheable and
+ * therefore must not include anything that varies according to user,
+ * interface language, etc. (although it may vary by skin). See
+ * makeGlobalVariablesScript for things that can vary per page view and are
+ * not cacheable.
*
- * @return string
+ * @return string Raw JavaScript to be returned
*/
- function getUserJs() {
+ public function getUserJs() {
wfProfileIn( __METHOD__ );
global $wgStylePath;
$s = "/* generated javascript */\n";
- $s .= "var skin = '{$this->skinname}';\nvar stylepath = '{$wgStylePath}';";
+ $s .= "var skin = '" . Xml::escapeJsString( $this->getSkinName() ) . "';\n";
+ $s .= "var stylepath = '" . Xml::escapeJsString( $wgStylePath ) . "';";
$s .= "\n\n/* MediaWiki:Common.js */\n";
$commonJs = wfMsgForContent('common.js');
if ( !wfEmptyMsg ( 'common.js', $commonJs ) ) {
function reallyDoGetUserStyles() {
global $wgUser;
$s = '';
- if (($undopt = $wgUser->getOption("underline")) != 2) {
+ if (($undopt = $wgUser->getOption("underline")) < 2) {
$underline = $undopt ? 'underline' : 'none';
$s .= "a { text-decoration: $underline; }\n";
}
a.new, #quickbar a.new,
a.stub, #quickbar a.stub {
color: inherit;
- text-decoration: inherit;
}
a.new:after, #quickbar a.new:after {
content: "?";
color: #CC2200;
- text-decoration: $underline;
}
a.stub:after, #quickbar a.stub:after {
content: "!";
color: #772233;
- text-decoration: $underline;
}
END;
}
*/
function bottomScripts() {
global $wgJsMimeType;
- return "\n\t\t<script type=\"$wgJsMimeType\">if (window.runOnloadHook) runOnloadHook();</script>\n";
+ $bottomScriptText = "\n\t\t<script type=\"$wgJsMimeType\">if (window.runOnloadHook) runOnloadHook();</script>\n";
+ wfRunHooks( 'SkinAfterBottomScripts', array( $this, &$bottomScriptText ) );
+ return $bottomScriptText;
}
/** @return string Retrievied from HTML text */
}
function getUndeleteLink() {
- global $wgUser, $wgTitle, $wgContLang, $action;
+ global $wgUser, $wgTitle, $wgContLang, $wgLang, $action;
if( $wgUser->isAllowed( 'deletedhistory' ) &&
(($wgTitle->getArticleId() == 0) || ($action == "history")) &&
($n = $wgTitle->isDeleted() ) )
return wfMsg( $msg,
$this->makeKnownLinkObj(
SpecialPage::getTitleFor( 'Undelete', $wgTitle->getPrefixedDBkey() ),
- wfMsgExt( 'restorelink', array( 'parsemag', 'escape' ), $n ) ) );
+ wfMsgExt( 'restorelink', array( 'parsemag', 'escape' ), $wgLang->formatNum( $n ) ) ) );
}
return '';
}
"' AND wl_namespace=" . $wgTitle->getNamespace() ;
$res = $dbr->query( $sql, 'Skin::pageStats');
$x = $dbr->fetchObject( $res );
- $s .= ' ' . wfMsg('number_of_watching_users_pageview', $x->n );
+
+ $s .= ' ' . wfMsgExt( 'number_of_watching_users_pageview',
+ array( 'parseinline' ), $wgLang->formatNum($x->n)
+ );
}
return $s . ' ' . $this->getCopyright();
// Otherwise, we display the link for the user, described in their
// language (which may or may not be the same as the default language),
// but we make the link target be the one site-wide page.
- return $this->makeKnownLink( wfMsgForContent( $page ), wfMsg( $desc ) );
+ return $this->makeKnownLink( wfMsgForContent( $page ),
+ wfMsgExt( $desc, array( 'parsemag', 'escape' ) ) );
}
}
wfProfileOut( $fname );
return $bar;
}
-}
-
+
+}
\ No newline at end of file