* http://www.gnu.org/copyleft/gpl.html
*
* @file
- * @license GPL 2+
*/
+use MediaWiki\MediaWikiServices;
+
/**
* A class to convert page titles on a foreign wiki (ForeignTitle objects) into
* page titles on the local wiki (Title objects), using a default namespace
* @return Title|null
*/
public function createTitleFromForeignTitle( ForeignTitle $foreignTitle ) {
- global $wgContLang;
-
if ( $foreignTitle->isNamespaceIdKnown() ) {
$foreignNs = $foreignTitle->getNamespaceId();
// Do we have a local namespace by the same name as the foreign
// namespace?
- $targetNs = $wgContLang->getNsIndex( $foreignTitle->getNamespaceName() );
+ $targetNs = MediaWikiServices::getInstance()->getContentLanguage()->getNsIndex(
+ $foreignTitle->getNamespaceName() );
if ( $targetNs !== false ) {
return Title::makeTitleSafe( $targetNs, $foreignTitle->getText() );
}