MediaWiki  master
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 class to convert page titles on a foreign wiki (ForeignTitle objects) into page titles on the local...
Represents an object that can convert page titles on a foreign wiki (ForeignTitle objects) into page ...
createTitleFromForeignTitle(ForeignTitle $foreignTitle)
Determines which local title best corresponds to the given foreign title.
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:612
A simple, immutable structure to hold the title of a page on a foreign MediaWiki installation.