* @since 1.21
*/
public function getNormalizedTitlesAsResult( $result = null ) {
- global $wgContLang;
-
$values = [];
+ $contLang = MediaWikiServices::getInstance()->getContentLanguage();
foreach ( $this->getNormalizedTitles() as $rawTitleStr => $titleStr ) {
- $encode = ( $wgContLang->normalize( $rawTitleStr ) !== $rawTitleStr );
+ $encode = $contLang->normalize( $rawTitleStr ) !== $rawTitleStr;
$values[] = [
'fromencoded' => $encode,
'from' => $encode ? rawurlencode( $rawTitleStr ) : $rawTitleStr,
$this->mInterwikiTitles[$unconvertedTitle] = $titleObj->getInterwiki();
} else {
// Variants checking
- global $wgContLang;
- if ( $this->mConvertTitles &&
- $wgContLang->hasVariants() &&
- !$titleObj->exists()
+ $contLang = MediaWikiServices::getInstance()->getContentLanguage();
+ if (
+ $this->mConvertTitles && $contLang->hasVariants() && !$titleObj->exists()
) {
// Language::findVariantLink will modify titleText and titleObj into
// the canonical variant if possible
$titleText = is_string( $title ) ? $title : $titleObj->getPrefixedText();
- $wgContLang->findVariantLink( $titleText, $titleObj );
+ $contLang->findVariantLink( $titleText, $titleObj );
$titleWasConverted = $unconvertedTitle !== $titleObj->getPrefixedText();
}
if ( isset( $data[$toPageId] ) &&
isset( $this->mGeneratorData[$fromNs][$fromDBkey] )
) {
- // It is necesary to set both $data and add to $result, if an ApiResult,
+ // It is necessary to set both $data and add to $result, if an ApiResult,
// to ensure multiple redirects to the same destination are all merged.
$data[$toPageId] = call_user_func(
$this->mRedirectMergePolicy,