$this->mPagetitle = $nameWithTags;
# change "<i>foo&bar</i>" to "foo&bar"
- $this->setHTMLTitle( $this->msg( 'pagetitle' )->rawParams( htmlspecialchars( Sanitizer::stripAllTags( $nameWithTags ) ) ) );
+ $this->setHTMLTitle( $this->msg( 'pagetitle' )->rawParams( Sanitizer::stripAllTags( $nameWithTags ) ) );
}
/**
/**
* Add new language links
*
- * @param $newLinkArray Associative array mapping language code to the page
+ * @param $newLinkArray array Associative array mapping language code to the page
* name
*/
public function addLanguageLinks( $newLinkArray ) {
/**
* Reset the language links and add new language links
*
- * @param $newLinkArray Associative array mapping language code to the page
+ * @param $newLinkArray array Associative array mapping language code to the page
* name
*/
public function setLanguageLinks( $newLinkArray ) {
/**
* Set the displayed file version
*
- * @param $file File|false
+ * @param $file File|bool
* @return Mixed: previous value
*/
public function setFileVersion( $file ) {
wfProfileIn( __METHOD__ );
- wfIncrStats( 'pcache_not_possible' );
-
$popts = $this->parserOptions();
$oldTidy = $popts->setTidy( $tidy );
$popts->setInterfaceMessage( (bool) $interface );
$params = array(
'id' => 'wpTextbox1',
'name' => 'wpTextbox1',
+ 'cols' => $this->getUser()->getOption( 'cols' ),
'rows' => $this->getUser()->getOption( 'rows' ),
'readonly' => 'readonly',
'lang' => $pageLang->getHtmlCode(),
*/
public function headElement( Skin $sk, $includeStyle = true ) {
global $wgContLang;
+
$userdir = $this->getLanguage()->getDir();
$sitedir = $wgContLang->getDir();
}
$bodyAttrs['class'] .= ' ' . $sk->getPageClasses( $this->getTitle() );
$bodyAttrs['class'] .= ' skin-' . Sanitizer::escapeClass( $sk->getSkinName() );
+ $bodyAttrs['class'] .= ' action-' . Sanitizer::escapeClass( Action::getActionName( $this->getContext() ) );
$sk->addToBodyAttributes( $this, $bodyAttrs ); // Allow skins to add body attributes they need
wfRunHooks( 'OutputPageBodyAttributes', array( $this, $sk, &$bodyAttrs ) );
* Add the default ResourceLoader modules to this object
*/
private function addDefaultModules() {
- global $wgIncludeLegacyJavaScript, $wgUseAjax, $wgAjaxWatch, $wgEnableMWSuggest;
+ global $wgIncludeLegacyJavaScript, $wgPreloadJavaScriptMwUtil, $wgUseAjax,
+ $wgAjaxWatch, $wgEnableMWSuggest;
// Add base resources
$this->addModules( array(
'mediawiki.user',
- 'mediawiki.util',
'mediawiki.page.startup',
'mediawiki.page.ready',
) );
$this->addModules( 'mediawiki.legacy.wikibits' );
}
+ if ( $wgPreloadJavaScriptMwUtil ) {
+ $this->addModules( 'mediawiki.util' );
+ }
+
+ MWDebug::addModules( $this );
+
// Add various resources if required
if ( $wgUseAjax ) {
$this->addModules( 'mediawiki.legacy.ajax' );
);
// Load embeddable private modules before any loader links
+ // This needs to be TYPE_COMBINED so these modules are properly wrapped
+ // in mw.loader.implement() calls and deferred until mw.user is available
$embedScripts = array( 'user.options', 'user.tokens' );
$scripts .= $this->makeResourceLoaderLink( $embedScripts, ResourceLoaderModule::TYPE_COMBINED );
if ( $modules ) {
$scripts .= Html::inlineScript(
ResourceLoader::makeLoaderConditionalScript(
- "mw.loader.setBlocking( true );\n" .
- Xml::encodeJsCall( 'mw.loader.load', array( $modules ) ) .
- "\nmw.loader.setBlocking( false );"
+ Xml::encodeJsCall( 'mw.loader.load', array( $modules, null, true ) )
)
);
}
* @return array
*/
public function getJSVars() {
- global $wgUseAjax, $wgEnableMWSuggest, $mediaWiki;
+ global $wgUseAjax, $wgEnableMWSuggest;
+
+ $latestRevID = 0;
+ $pageID = 0;
+ $canonicalName = false; # bug 21115
$title = $this->getTitle();
$ns = $title->getNamespace();
$nsname = MWNamespace::exists( $ns ) ? MWNamespace::getCanonicalName( $ns ) : $title->getNsText();
+
if ( $ns == NS_SPECIAL ) {
list( $canonicalName, /*...*/ ) = SpecialPageFactory::resolveAlias( $title->getDBkey() );
- } else {
- $canonicalName = false; # bug 21115
+ } elseif ( $this->canUseWikiPage() ) {
+ $wikiPage = $this->getWikiPage();
+ $latestRevID = $wikiPage->getLatest();
+ $pageID = $wikiPage->getId();
}
$lang = $title->getPageLanguage();
'wgNamespaceNumber' => $title->getNamespace(),
'wgPageName' => $title->getPrefixedDBKey(),
'wgTitle' => $title->getText(),
- 'wgCurRevisionId' => $title->getLatestRevID(),
- 'wgArticleId' => $title->getArticleId(),
+ 'wgCurRevisionId' => $latestRevID,
+ 'wgArticleId' => $pageID,
'wgIsArticle' => $this->isArticle(),
- 'wgAction' => $mediaWiki->getPerformedAction(),
+ 'wgAction' => Action::getActionName( $this->getContext() ),
'wgUserName' => $this->getUser()->isAnon() ? null : $this->getUser()->getName(),
'wgUserGroups' => $this->getUser()->getEffectiveGroups(),
'wgCategories' => $this->getCategories(),
// Per-user preference styles
if ( $wgAllowUserCssPrefs ) {
- $moduleStyles[] = 'user.options';
+ $moduleStyles[] = 'user.cssprefs';
}
foreach ( $moduleStyles as $name ) {