Remove return from hook handler
Change-Id: I3e6b79206f878cdfe3399009e1d06ec4fe2c3aac
This commit is contained in:
committed by
jenkins-bot
parent
eb6f2387f3
commit
b8944d50e1
@@ -104,7 +104,6 @@ class UniversalLanguageSelectorHooks {
|
|||||||
/**
|
/**
|
||||||
* @param OutputPage $out
|
* @param OutputPage $out
|
||||||
* @param Skin $skin
|
* @param Skin $skin
|
||||||
* @return bool
|
|
||||||
* Hook: BeforePageDisplay
|
* Hook: BeforePageDisplay
|
||||||
*/
|
*/
|
||||||
public static function addModules( $out, $skin ) {
|
public static function addModules( $out, $skin ) {
|
||||||
@@ -140,8 +139,6 @@ class UniversalLanguageSelectorHooks {
|
|||||||
} else {
|
} else {
|
||||||
$out->addModuleStyles( 'ext.uls.interlanguage' );
|
$out->addModuleStyles( 'ext.uls.interlanguage' );
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function onEventLoggingRegisterSchemas( array &$schemas ) {
|
public static function onEventLoggingRegisterSchemas( array &$schemas ) {
|
||||||
@@ -152,7 +149,6 @@ class UniversalLanguageSelectorHooks {
|
|||||||
* @param array &$testModules array of javascript testing modules. 'qunit' is fed
|
* @param array &$testModules array of javascript testing modules. 'qunit' is fed
|
||||||
* using tests/qunit/QUnitTestResources.php.
|
* using tests/qunit/QUnitTestResources.php.
|
||||||
* @param ResourceLoader $resourceLoader
|
* @param ResourceLoader $resourceLoader
|
||||||
* @return bool
|
|
||||||
* Hook: ResourceLoaderTestModules
|
* Hook: ResourceLoaderTestModules
|
||||||
*/
|
*/
|
||||||
public static function addTestModules( array &$testModules, ResourceLoader $resourceLoader ) {
|
public static function addTestModules( array &$testModules, ResourceLoader $resourceLoader ) {
|
||||||
@@ -162,8 +158,6 @@ class UniversalLanguageSelectorHooks {
|
|||||||
'localBasePath' => __DIR__,
|
'localBasePath' => __DIR__,
|
||||||
'remoteExtPath' => 'UniversalLanguageSelector',
|
'remoteExtPath' => 'UniversalLanguageSelector',
|
||||||
];
|
];
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -171,18 +165,17 @@ class UniversalLanguageSelectorHooks {
|
|||||||
* Hook: PersonalUrls
|
* Hook: PersonalUrls
|
||||||
* @param array &$personal_urls
|
* @param array &$personal_urls
|
||||||
* @param string &$title
|
* @param string &$title
|
||||||
* @return true
|
|
||||||
*/
|
*/
|
||||||
public static function addPersonalBarTrigger( array &$personal_urls, &$title ) {
|
public static function addPersonalBarTrigger( array &$personal_urls, &$title ) {
|
||||||
global $wgULSPosition;
|
global $wgULSPosition;
|
||||||
|
|
||||||
if ( $wgULSPosition !== 'personal' ) {
|
if ( $wgULSPosition !== 'personal' ) {
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$context = RequestContext::getMain();
|
$context = RequestContext::getMain();
|
||||||
if ( !self::isToolbarEnabled( $context->getUser() ) ) {
|
if ( !self::isToolbarEnabled( $context->getUser() ) ) {
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The element id will be 'pt-uls'
|
// The element id will be 'pt-uls'
|
||||||
@@ -195,8 +188,6 @@ class UniversalLanguageSelectorHooks {
|
|||||||
'active' => true
|
'active' => true
|
||||||
]
|
]
|
||||||
] + $personal_urls;
|
] + $personal_urls;
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -232,13 +223,12 @@ class UniversalLanguageSelectorHooks {
|
|||||||
* @param User $user
|
* @param User $user
|
||||||
* @param string &$code
|
* @param string &$code
|
||||||
* @param IContextSource $context
|
* @param IContextSource $context
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public static function getLanguage( User $user, &$code, IContextSource $context ) {
|
public static function getLanguage( User $user, &$code, IContextSource $context ) {
|
||||||
global $wgULSAnonCanChangeLanguage, $wgULSLanguageDetection;
|
global $wgULSAnonCanChangeLanguage, $wgULSLanguageDetection;
|
||||||
|
|
||||||
if ( !self::isToolbarEnabled( $user ) ) {
|
if ( !self::isToolbarEnabled( $user ) ) {
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$request = $context->getRequest();
|
$request = $context->getRequest();
|
||||||
@@ -247,7 +237,7 @@ class UniversalLanguageSelectorHooks {
|
|||||||
if ( !$languageToSave && $request->getText( 'uselang' ) ) {
|
if ( !$languageToSave && $request->getText( 'uselang' ) ) {
|
||||||
// uselang can be used for temporary override of language preference
|
// uselang can be used for temporary override of language preference
|
||||||
// when setlang is not provided
|
// when setlang is not provided
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Registered users - simple
|
// Registered users - simple
|
||||||
@@ -264,12 +254,12 @@ class UniversalLanguageSelectorHooks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise just use what is stored in preferences
|
// Otherwise just use what is stored in preferences
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logged out users - less simple
|
// Logged out users - less simple
|
||||||
if ( !$wgULSAnonCanChangeLanguage ) {
|
if ( !$wgULSAnonCanChangeLanguage ) {
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Language change
|
// Language change
|
||||||
@@ -277,7 +267,7 @@ class UniversalLanguageSelectorHooks {
|
|||||||
$request->response()->setCookie( 'language', $languageToSave );
|
$request->response()->setCookie( 'language', $languageToSave );
|
||||||
$code = $languageToSave;
|
$code = $languageToSave;
|
||||||
|
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try cookie
|
// Try cookie
|
||||||
@@ -285,7 +275,7 @@ class UniversalLanguageSelectorHooks {
|
|||||||
if ( Language::isSupportedLanguage( $languageToUse ) ) {
|
if ( Language::isSupportedLanguage( $languageToUse ) ) {
|
||||||
$code = $languageToUse;
|
$code = $languageToUse;
|
||||||
|
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// As last resort, try Accept-Language headers if allowed
|
// As last resort, try Accept-Language headers if allowed
|
||||||
@@ -296,15 +286,11 @@ class UniversalLanguageSelectorHooks {
|
|||||||
$code = $default;
|
$code = $default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fall back to other hooks or content language
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hook: ResourceLoaderGetConfigVars
|
* Hook: ResourceLoaderGetConfigVars
|
||||||
* @param array &$vars
|
* @param array &$vars
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public static function addConfig( &$vars ) {
|
public static function addConfig( &$vars ) {
|
||||||
global $wgULSGeoService,
|
global $wgULSGeoService,
|
||||||
@@ -346,15 +332,12 @@ class UniversalLanguageSelectorHooks {
|
|||||||
if ( isset( $wgInterwikiSortingSortPrepend ) && $wgInterwikiSortingSortPrepend !== [] ) {
|
if ( isset( $wgInterwikiSortingSortPrepend ) && $wgInterwikiSortingSortPrepend !== [] ) {
|
||||||
$vars['wgULSCompactLinksPrepend'] = $wgInterwikiSortingSortPrepend;
|
$vars['wgULSCompactLinksPrepend'] = $wgInterwikiSortingSortPrepend;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hook: MakeGlobalVariablesScript
|
* Hook: MakeGlobalVariablesScript
|
||||||
* @param array &$vars
|
* @param array &$vars
|
||||||
* @param OutputPage $out
|
* @param OutputPage $out
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public static function addVariables( &$vars, OutputPage $out ) {
|
public static function addVariables( &$vars, OutputPage $out ) {
|
||||||
global $wgULSAnonCanChangeLanguage;
|
global $wgULSAnonCanChangeLanguage;
|
||||||
@@ -383,8 +366,6 @@ class UniversalLanguageSelectorHooks {
|
|||||||
// An optimization to avoid loading all of uls.data just to get the autonym
|
// An optimization to avoid loading all of uls.data just to get the autonym
|
||||||
$langCode = $out->getLanguage()->getCode();
|
$langCode = $out->getLanguage()->getCode();
|
||||||
$vars['wgULSCurrentAutonym'] = Language::fetchLanguageName( $langCode );
|
$vars['wgULSCurrentAutonym'] = Language::fetchLanguageName( $langCode );
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function onGetPreferences( $user, &$preferences ) {
|
public static function onGetPreferences( $user, &$preferences ) {
|
||||||
@@ -414,8 +395,6 @@ class UniversalLanguageSelectorHooks {
|
|||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function onGetBetaFeaturePreferences( $user, &$prefs ) {
|
public static function onGetBetaFeaturePreferences( $user, &$prefs ) {
|
||||||
@@ -447,7 +426,6 @@ class UniversalLanguageSelectorHooks {
|
|||||||
* Hook: SkinTemplateOutputPageBeforeExec
|
* Hook: SkinTemplateOutputPageBeforeExec
|
||||||
* @param Skin $skin
|
* @param Skin $skin
|
||||||
* @param QuickTemplate $template
|
* @param QuickTemplate $template
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public static function onSkinTemplateOutputPageBeforeExec( Skin $skin,
|
public static function onSkinTemplateOutputPageBeforeExec( Skin $skin,
|
||||||
QuickTemplate $template
|
QuickTemplate $template
|
||||||
@@ -455,26 +433,23 @@ class UniversalLanguageSelectorHooks {
|
|||||||
global $wgULSPosition;
|
global $wgULSPosition;
|
||||||
|
|
||||||
if ( $wgULSPosition !== 'interlanguage' ) {
|
if ( $wgULSPosition !== 'interlanguage' ) {
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !self::isToolbarEnabled( $skin->getUser() ) ) {
|
if ( !self::isToolbarEnabled( $skin->getUser() ) ) {
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set to an empty array, just to make sure that the section appears
|
// Set to an empty array, just to make sure that the section appears
|
||||||
if ( $template->get( 'language_urls' ) === false ) {
|
if ( $template->get( 'language_urls' ) === false ) {
|
||||||
$template->set( 'language_urls', [] );
|
$template->set( 'language_urls', [] );
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add basic webfonts support to the mobile interface (via MobileFrontend extension)
|
* Add basic webfonts support to the mobile interface (via MobileFrontend extension)
|
||||||
* Hook: EnterMobileMode
|
* Hook: EnterMobileMode
|
||||||
* @param MobileContext $context
|
* @param MobileContext $context
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public static function onEnterMobileMode( $context ) {
|
public static function onEnterMobileMode( $context ) {
|
||||||
global $wgULSEnable, $wgULSMobileWebfontsEnabled;
|
global $wgULSEnable, $wgULSMobileWebfontsEnabled;
|
||||||
@@ -483,15 +458,12 @@ class UniversalLanguageSelectorHooks {
|
|||||||
if ( $wgULSEnable && $wgULSMobileWebfontsEnabled && $context->isBetaGroupMember() ) {
|
if ( $wgULSEnable && $wgULSMobileWebfontsEnabled && $context->isBetaGroupMember() ) {
|
||||||
$context->getOutput()->addModules( 'ext.uls.webfonts.mobile' );
|
$context->getOutput()->addModules( 'ext.uls.webfonts.mobile' );
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Conditionally register module ext.uls.eventlogger.
|
* Conditionally register module ext.uls.eventlogger.
|
||||||
*
|
*
|
||||||
* @param ResourceLoader $resourceLoader
|
* @param ResourceLoader $resourceLoader
|
||||||
* @return bool true
|
|
||||||
*/
|
*/
|
||||||
public static function onResourceLoaderRegisterModules( ResourceLoader $resourceLoader ) {
|
public static function onResourceLoaderRegisterModules( ResourceLoader $resourceLoader ) {
|
||||||
global $wgULSEventLogging, $wgVersion;
|
global $wgULSEventLogging, $wgVersion;
|
||||||
|
|||||||
Reference in New Issue
Block a user