Allow the main functionality of ULS to be disabled
Allow the cache-breaking toolbar and cookie-based user language selection features to be disabled, while still allowing Wikibase to have its language autocompletion drop-downs on special pages. Change-Id: Iba18f666fdcf5b87b7068ab6b1537c868c8fe861
This commit is contained in:
@@ -26,6 +26,11 @@ class UniversalLanguageSelectorHooks {
|
||||
* @return bool
|
||||
*/
|
||||
public static function addModules( $out, $skin ) {
|
||||
global $wgULSEnable;
|
||||
if ( !$wgULSEnable ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$out->addModules( 'ext.uls.init' );
|
||||
$out->addModules( 'ext.uls.geoclient' );
|
||||
|
||||
@@ -54,7 +59,11 @@ class UniversalLanguageSelectorHooks {
|
||||
* Hooks: SkinTemplateNavigation, SkinTemplateTabs
|
||||
*/
|
||||
static function addTrigger( array &$personal_urls, &$title ) {
|
||||
global $wgLang;
|
||||
global $wgULSEnable, $wgLang;
|
||||
if ( !$wgULSEnable ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$personal_urls = array(
|
||||
'uls' => array(
|
||||
'text' => $wgLang->getLanguageName( $wgLang->getCode() ),
|
||||
@@ -113,7 +122,11 @@ class UniversalLanguageSelectorHooks {
|
||||
* @return bool
|
||||
*/
|
||||
public static function getLanguage( $user, &$code ) {
|
||||
global $wgRequest, $wgULSLanguageDetection;
|
||||
global $wgULSEnable, $wgRequest, $wgULSLanguageDetection;
|
||||
|
||||
if ( !$wgULSEnable ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$languageToSave = $wgRequest->getVal( 'setlang' );
|
||||
if ( $wgRequest->getVal( 'uselang' ) && !$languageToSave ) {
|
||||
|
||||
@@ -68,6 +68,14 @@ $wgULSIMEEnabled = true;
|
||||
*/
|
||||
$wgULSLanguageDetection = true;
|
||||
|
||||
/**
|
||||
* Enable language selection. If language selection is disabled, the classes
|
||||
* and RL modules are registered for the use of other extensions, but no
|
||||
* language selection toolbar is shown, and it will not be possible to change
|
||||
* the interface language using a cookie.
|
||||
*/
|
||||
$wgULSEnable = true;
|
||||
|
||||
$dir = __DIR__;
|
||||
|
||||
// Internationalization
|
||||
|
||||
Reference in New Issue
Block a user