Index: trunk/phase3/includes/StubObject.php |
— | — | @@ -167,53 +167,6 @@ |
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
171 | | - * Stub object for the user variant. It depends of the user preferences and |
172 | | - * "variant" parameter that can be passed to index.php. This object have to be |
173 | | - * in $wgVariant global. |
174 | | - */ |
175 | | -class StubUserVariant extends StubObject { |
176 | | - |
177 | | - function __construct() { |
178 | | - parent::__construct( 'wgVariant' ); |
179 | | - } |
180 | | - |
181 | | - function __call( $name, $args ) { |
182 | | - return $this->_call( $name, $args ); |
183 | | - } |
184 | | - |
185 | | - function _newObject() { |
186 | | - global $wgContLanguageCode, $wgRequest, $wgUser, $wgContLang; |
187 | | - |
188 | | - if( $wgContLang->hasVariants() ) { |
189 | | - $code = $wgRequest->getVal( 'variant', $wgUser->getOption( 'variant' ) ); |
190 | | - } else { |
191 | | - $code = $wgRequest->getVal( 'variant', $wgUser->getOption( 'language' ) ); |
192 | | - } |
193 | | - |
194 | | - // if variant is explicitely selected, use it instead the one from wgUser |
195 | | - // see bug #7605 |
196 | | - if( $wgContLang->hasVariants() && in_array($code, $wgContLang->getVariants()) ){ |
197 | | - $variant = $wgContLang->getPreferredVariant(); |
198 | | - if( $variant != $wgContLanguageCode ) |
199 | | - $code = $variant; |
200 | | - } |
201 | | - |
202 | | - # Validate $code |
203 | | - if( empty( $code ) || !preg_match( '/^[a-z-]+$/', $code ) || ( $code === 'qqq' ) ) { |
204 | | - wfDebug( "Invalid user variant code\n" ); |
205 | | - $code = $wgContLanguageCode; |
206 | | - } |
207 | | - |
208 | | - if( $code === $wgContLanguageCode ) { |
209 | | - return $wgContLang; |
210 | | - } else { |
211 | | - $obj = Language::factory( $code ); |
212 | | - return $obj; |
213 | | - } |
214 | | - } |
215 | | -} |
216 | | - |
217 | | -/** |
218 | 171 | * Stub object for the user. The initialisation of the will depend of |
219 | 172 | * $wgCommandLineMode. If it's true, it will be an anonymous user and if it's |
220 | 173 | * false, the user will be loaded from credidentails provided by cookies. This |
Index: trunk/phase3/includes/Setup.php |
— | — | @@ -270,7 +270,6 @@ |
271 | 271 | |
272 | 272 | $wgUser = new StubUser; |
273 | 273 | $wgLang = new StubUserLang; |
274 | | -$wgVariant = new StubUserVariant; |
275 | 274 | $wgOut = new StubObject( 'wgOut', 'OutputPage' ); |
276 | 275 | $wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) ); |
277 | 276 | |
Index: trunk/phase3/includes/Skin.php |
— | — | @@ -356,7 +356,7 @@ |
357 | 357 | $skinName = $skinName['skinname']; |
358 | 358 | } |
359 | 359 | global $wgScript, $wgTitle, $wgStylePath, $wgUser; |
360 | | - global $wgArticlePath, $wgScriptPath, $wgServer, $wgContLang, $wgLang, $wgVariant; |
| 360 | + global $wgArticlePath, $wgScriptPath, $wgServer, $wgContLang, $wgLang; |
361 | 361 | global $wgCanonicalNamespaceNames, $wgOut, $wgArticle; |
362 | 362 | global $wgBreakFrames, $wgRequest, $wgVariantArticlePath, $wgActionPaths; |
363 | 363 | global $wgUseAjax, $wgAjaxWatch; |
— | — | @@ -399,7 +399,6 @@ |
400 | 400 | 'wgIsArticle' => $wgOut->isArticle(), |
401 | 401 | 'wgUserName' => $wgUser->isAnon() ? NULL : $wgUser->getName(), |
402 | 402 | 'wgUserGroups' => $wgUser->isAnon() ? NULL : $wgUser->getEffectiveGroups(), |
403 | | - 'wgUserVariant' => $wgVariant->getCode(), |
404 | 403 | 'wgUserLanguage' => $wgLang->getCode(), |
405 | 404 | 'wgContentLanguage' => $wgContLang->getCode(), |
406 | 405 | 'wgBreakFrames' => $wgBreakFrames, |
— | — | @@ -411,8 +410,8 @@ |
412 | 411 | 'wgDigitTransformTable' => $compactDigitTransTable, |
413 | 412 | 'wgMainPageTitle' => $mainPage ? $mainPage->getPrefixedText() : null, |
414 | 413 | ); |
415 | | - if ( !( $wgContLang->hasVariants() ) ) { |
416 | | - unset( $vars['wgUserVariant'] ); |
| 414 | + if ( $wgContLang->hasVariants() ) { |
| 415 | + $vars['wgUserVariant'] = $wgContLang->getPreferredVariant(); |
417 | 416 | } |
418 | 417 | |
419 | 418 | //if on upload page output the extension list & js_upload |