/**
* initialize various variables and generate the template
*
- * @param OutputPage $out
+ * @param OutputPage|null $out
*/
function outputPage( OutputPage $out = null ) {
Profiler::instance()->setTemplated( true );
* @return QuickTemplate The template to be executed by outputPage
*/
protected function prepareQuickTemplate() {
- global $wgContLang, $wgScript, $wgStylePath, $wgMimeType, $wgJsMimeType,
+ global $wgScript, $wgStylePath, $wgMimeType, $wgJsMimeType,
$wgSitename, $wgLogo, $wgMaxCredits,
$wgShowCreditsIfMax, $wgArticlePath,
$wgScriptPath, $wgServer;
// heading for the page title. Defaults to empty string.
$tpl->set( 'prebodyhtml', '' );
- if ( $userLangCode !== $wgContLang->getHtmlCode() || $userLangDir !== $wgContLang->getDir() ) {
+ $contLang = MediaWikiServices::getInstance()->getContentLanguage();
+ if (
+ $userLangCode !== $contLang->getHtmlCode() ||
+ $userLangDir !== $contLang->getDir()
+ ) {
$escUserlang = htmlspecialchars( $userLangCode );
$escUserdir = htmlspecialchars( $userLangDir );
// Attributes must be in double quotes because htmlspecialchars() doesn't
*
* @since 1.31
*
- * @param array $personalTools
+ * @param array|null $personalTools
* @param array $options
* @return string
*/
# so it doesn't contain the original alias-with-subpage.
$origTitle = Title::newFromText( $request->getText( 'title' ) );
if ( $origTitle instanceof Title && $origTitle->isSpecialPage() ) {
- list( $spName, $spPar ) = SpecialPageFactory::resolveAlias( $origTitle->getText() );
+ list( $spName, $spPar ) =
+ MediaWikiServices::getInstance()->getSpecialPageFactory()->
+ resolveAlias( $origTitle->getText() );
$active = $spName == 'Contributions'
&& ( ( $spPar && $spPar == $this->username )
|| $request->getText( 'target' ) == $this->username );
if ( $msg->exists() ) {
$text = $msg->text();
} else {
- global $wgContLang;
- $text = $wgContLang->getConverter()->convertNamespace(
- MWNamespace::getSubject( $title->getNamespace() ) );
+ $text = MediaWikiServices::getInstance()->getContentLanguage()->getConverter()->
+ convertNamespace( MWNamespace::getSubject( $title->getNamespace() ) );
}
// Avoid PHP 7.1 warning of passing $this by reference
if ( $userCanRead && !$wgDisableLangConversion ) {
$pageLang = $title->getPageLanguage();
- // Gets list of language variants
- $variants = $pageLang->getVariants();
// Checks that language conversion is enabled and variants exist
// And if it is not in the special namespace
- if ( count( $variants ) > 1 ) {
+ if ( $pageLang->hasVariants() ) {
+ // Gets list of language variants
+ $variants = $pageLang->getVariants();
// Gets preferred variant (note that user preference is
// only possible for wiki content language variant)
$preferred = $pageLang->getPreferredVariant();