MediaWiki fundraising/REL1_35
NamespaceImportTitleFactory.php
Go to the documentation of this file.
1<?php
22
30 protected $ns;
31
35 public function __construct( $ns ) {
36 if ( !MediaWikiServices::getInstance()->getNamespaceInfo()->exists( $ns ) ) {
37 throw new MWException( "Namespace $ns doesn't exist on this wiki" );
38 }
39 $this->ns = $ns;
40 }
41
50 public function createTitleFromForeignTitle( ForeignTitle $foreignTitle ) {
51 return Title::makeTitleSafe( $this->ns, $foreignTitle->getText() );
52 }
53}
A simple, immutable structure to hold the title of a page on a foreign MediaWiki installation.
MediaWiki exception.
MediaWikiServices is the service locator for the application scope of MediaWiki.
A class to convert page titles on a foreign wiki (ForeignTitle objects) into page titles on the local...
createTitleFromForeignTitle(ForeignTitle $foreignTitle)
Determines which local title best corresponds to the given foreign title.
Represents an object that can convert page titles on a foreign wiki (ForeignTitle objects) into page ...