/**#@-*/
protected $mRevisionId; // The revision ID we're looking at, null if not applicable.
protected $skinname = 'standard';
- // @fixme Should be protected :-\
+ // @todo Fixme: should be protected :-\
var $mTitle = null;
/** Constructor, call parent constructor */
# Weird back-compat stuff.
$skinName = $skinName['skinname'];
}
- global $wgScript, $wgTitle, $wgStylePath, $wgUser;
+ global $wgScript, $wgTitle, $wgStylePath, $wgUser, $wgScriptExtension;
global $wgArticlePath, $wgScriptPath, $wgServer, $wgContLang, $wgLang;
- global $wgCanonicalNamespaceNames, $wgOut, $wgArticle;
+ global $wgOut, $wgArticle;
global $wgBreakFrames, $wgRequest, $wgVariantArticlePath, $wgActionPaths;
global $wgUseAjax, $wgAjaxWatch;
global $wgVersion, $wgEnableAPI, $wgEnableWriteAPI;
- global $wgRestrictionTypes, $wgLivePreview;
+ global $wgRestrictionTypes;
global $wgMWSuggestTemplate, $wgDBname, $wgEnableMWSuggest;
+ global $wgSitename;
$ns = $wgTitle->getNamespace();
- $nsname = isset( $wgCanonicalNamespaceNames[ $ns ] ) ? $wgCanonicalNamespaceNames[ $ns ] : $wgTitle->getNsText();
+ $nsname = MWNamespace::exists( $ns ) ? MWNamespace::getCanonicalName( $ns ) : $wgTitle->getNsText();
$separatorTransTable = $wgContLang->separatorTransformTable();
$separatorTransTable = $separatorTransTable ? $separatorTransTable : array();
$compactSeparatorTransTable = array(
$vars = array(
'skin' => $skinName,
'stylepath' => $wgStylePath,
+ 'urlprotocols' => wfUrlProtocols(),
'wgArticlePath' => $wgArticlePath,
'wgScriptPath' => $wgScriptPath,
+ 'wgScriptExtension' => $wgScriptExtension,
'wgScript' => $wgScript,
'wgVariantArticlePath' => $wgVariantArticlePath,
'wgActionPaths' => (object)$wgActionPaths,
'wgServer' => $wgServer,
'wgCanonicalNamespace' => $nsname,
- 'wgCanonicalSpecialPageName' => SpecialPage::resolveAlias( $wgTitle->getDBkey() ),
+ 'wgCanonicalSpecialPageName' => $ns == NS_SPECIAL ?
+ SpecialPage::resolveAlias( $wgTitle->getDBkey() ) : false, # bug 21115
'wgNamespaceNumber' => $wgTitle->getNamespace(),
'wgPageName' => $wgTitle->getPrefixedDBKey(),
'wgTitle' => $wgTitle->getText(),
'wgAction' => $wgRequest->getText( 'action', 'view' ),
'wgArticleId' => $wgTitle->getArticleId(),
'wgIsArticle' => $wgOut->isArticle(),
- 'wgUserName' => $wgUser->isAnon() ? NULL : $wgUser->getName(),
- 'wgUserGroups' => $wgUser->isAnon() ? NULL : $wgUser->getEffectiveGroups(),
+ 'wgUserName' => $wgUser->isAnon() ? null : $wgUser->getName(),
+ 'wgUserGroups' => $wgUser->isAnon() ? null : $wgUser->getEffectiveGroups(),
'wgUserLanguage' => $wgLang->getCode(),
'wgContentLanguage' => $wgContLang->getCode(),
'wgBreakFrames' => $wgBreakFrames,
'wgMainPageTitle' => $mainPage ? $mainPage->getPrefixedText() : null,
'wgFormattedNamespaces' => $wgContLang->getFormattedNamespaces(),
'wgNamespaceIds' => $wgContLang->getNamespaceIds(),
+ 'wgSiteName' => $wgSitename,
+ 'wgCategories' => $wgOut->getCategories(),
);
if ( $wgContLang->hasVariants() ) {
$vars['wgUserVariant'] = $wgContLang->getPreferredVariant();
if( SpecialPage::resolveAlias( $wgTitle->getDBkey() ) == "Upload" ) {
global $wgFileExtensions, $wgAjaxUploadInterface;
$vars['wgFileExtensions'] = $wgFileExtensions;
- $vars['wgAjaxUploadInterface'] = $wgAjaxUploadInterface;
}
if( $wgUseAjax && $wgEnableMWSuggest && !$wgUser->getOption( 'disablesuggest', false ) ){
foreach( $wgRestrictionTypes as $type )
$vars['wgRestriction' . ucfirst( $type )] = $wgTitle->getRestrictions( $type );
- if ( $wgLivePreview && $wgUser->getOption( 'uselivepreview' ) ) {
- $vars['wgLivepreviewMessageLoading'] = wfMsg( 'livepreview-loading' );
- $vars['wgLivepreviewMessageReady'] = wfMsg( 'livepreview-ready' );
- $vars['wgLivepreviewMessageFailed'] = wfMsg( 'livepreview-failed' );
- $vars['wgLivepreviewMessageError'] = wfMsg( 'livepreview-error' );
- }
-
if ( $wgOut->isArticleRelated() && $wgUseAjax && $wgAjaxWatch && $wgUser->isLoggedIn() ) {
$msgs = (object)array();
- foreach ( array( 'watch', 'unwatch', 'watching', 'unwatching' ) as $msgName ) {
+ foreach ( array( 'watch', 'unwatch', 'watching', 'unwatching',
+ 'tooltip-ca-watch', 'tooltip-ca-unwatch' ) as $msgName ) {
$msgs->{$msgName . 'Msg'} = wfMsg( $msgName );
}
$vars['wgAjaxWatch'] = $msgs;
return self::makeVariablesScript( $vars );
}
- /**
- * Return a random selection of the scripts we want in the header,
- * according to no particular rhyme or reason. Various other scripts are
- * returned from a haphazard assortment of other functions scattered over
- * various files. This entire hackish system needs to be burned to the
- * ground and rebuilt.
- *
- * @param $out OutputPage object, should be $wgOut
- *
- * @return string Raw HTML to output to <head>
- */
- function getHeadScripts( OutputPage $out ) {
- global $wgStylePath, $wgUser, $wgJsMimeType, $wgStyleVersion, $wgOut;
- global $wgUseSiteJs;
-
- $vars = self::makeGlobalVariablesScript( $this->getSkinName() );
-
- if( $wgUseSiteJs ) {
- $jsCache = $wgUser->isLoggedIn() ? '&smaxage=0' : '';
- $wgOut->addScriptFile( self::makeUrl( '-',
- "action=raw$jsCache&gen=js&useskin=" .
- urlencode( $this->getSkinName() )
- )
- );
- }
- if( $out->isUserJsAllowed() && $wgUser->isLoggedIn() ) {
- $userpage = $wgUser->getUserPage();
- $userjs = self::makeUrl(
- $userpage->getPrefixedText() . '/' . $this->getSkinName() . '.js',
- 'action=raw&ctype=' . $wgJsMimeType );
- $wgOut->addScriptFile( $userjs );
- }
- return $vars . "\n" . $out->mScripts;
- }
/**
* To make it harder for someone to slip a user a fake
*
* @param string $action
* @return bool
- * @private
*/
- function userCanPreview( $action ) {
+ public function userCanPreview( $action ) {
global $wgRequest, $wgUser;
if( $action != 'submit' )
if( $wgUser->getOption( 'highlightbroken' ) ) {
$s .= "a.new, #quickbar a.new { color: #CC2200; }\n";
} else {
- $s .= <<<END
+ $s .= <<<CSS
a.new, #quickbar a.new,
a.stub, #quickbar a.stub {
color: inherit;
content: "!";
color: #772233;
}
-END;
+CSS;
}
if( $wgUser->getOption( 'justify' ) ) {
$s .= "#article, #bodyContent, #mw_content { text-align: justify; }\n";
$action = $wgRequest->getVal( 'action' );
# If we're previewing the CSS page, use it
if( $this->mTitle->isCssSubpage() && $this->userCanPreview( $action ) ) {
- $previewCss = $wgRequest->getText( 'wpTextbox1' );
// @FIXME: properly escape the cdata!
- $this->usercss = "/*<![CDATA[*/\n" . $previewCss . "/*]]>*/";
+ $out->addInlineStyle( $wgRequest->getText( 'wpTextbox1' ) );
} else {
$out->addStyle( self::makeUrl( $this->userpage . '/' . $this->getSkinName() .'.css',
'action=raw&ctype=text/css' ) );
$catlinks = $this->getCategoryLinks();
$classes = 'catlinks';
-
+
// Check what we're showing
global $wgOut, $wgUser;
$allCats = $wgOut->getCategoryLinks();
else
$ret .= str_repeat( "<ul><li>\n", $diff );
$ret .= $display . "\n";
-
+
$curIdent = $ident;
}
$ret .= str_repeat( '</li></ul>', $curIdent ) . '</li>';
}
$bar = array();
- $lines = explode( "\n", wfMsgForContent( 'sidebar' ) );
+ $this->addToSidebar( $bar, 'sidebar' );
+
+ wfRunHooks( 'SkinBuildSidebar', array( $this, &$bar ) );
+ if ( $wgEnableSidebarCache ) $parserMemc->set( $key, $bar, $wgSidebarCacheExpiry );
+ wfProfileOut( __METHOD__ );
+ return $bar;
+ }
+ /**
+ * Add content from a sidebar system message
+ * Currently only used for MediaWiki:Sidebar (but may be used by Extensions)
+ *
+ * @param &$bar array
+ * @param $message String
+ */
+ function addToSidebar( &$bar, $message ) {
+ $lines = explode( "\n", wfMsgForContent( $message ) );
$heading = '';
foreach( $lines as $line ) {
if( strpos( $line, '*' ) !== 0 )
} else { continue; }
}
}
- wfRunHooks( 'SkinBuildSidebar', array( $this, &$bar ) );
- if ( $wgEnableSidebarCache ) $parserMemc->set( $key, $bar, $wgSidebarCacheExpiry );
- wfProfileOut( __METHOD__ );
- return $bar;
}
/**