/**
* Validate the variant
- * @param string $variant The variant to validate
+ * @param string|null $variant The variant to validate
* @return mixed Returns the variant if it is valid, null otherwise
*/
public function validateVariant( $variant = null ) {
/**
* Get the variant specified in the URL
*
- * @return mixed Variant if one found, false otherwise.
+ * @return mixed Variant if one found, null otherwise
*/
public function getURLVariant() {
global $wgRequest;
/**
* Determine if the user has a variant set.
*
- * @return mixed Variant if one found, false otherwise.
+ * @return mixed Variant if one found, null otherwise
*/
protected function getUserVariant() {
- global $wgUser, $wgContLang;
+ global $wgUser;
// memoizing this function wreaks havoc on parserTest.php
/*
return false;
}
if ( $wgUser->isLoggedIn() ) {
- if ( $this->mMainLanguageCode == $wgContLang->getCode() ) {
+ if (
+ $this->mMainLanguageCode ==
+ MediaWikiServices::getInstance()->getContentLanguage()->getCode()
+ ) {
$ret = $wgUser->getOption( 'variant' );
} else {
$ret = $wgUser->getOption( 'variant-' . $this->mMainLanguageCode );
/**
* Determine the language variant from the Accept-Language header.
*
- * @return mixed Variant if one found, false otherwise.
+ * @return mixed Variant if one found, null otherwise
*/
protected function getHeaderVariant() {
global $wgRequest;