MediaWiki REL1_31
NaiveImportTitleFactory.php
Go to the documentation of this file.
1<?php
41 public function createTitleFromForeignTitle( ForeignTitle $foreignTitle ) {
42 global $wgContLang;
43
44 if ( $foreignTitle->isNamespaceIdKnown() ) {
45 $foreignNs = $foreignTitle->getNamespaceId();
46
47 // For built-in namespaces (0 <= ID < 100), we try to find a local NS with
48 // the same namespace ID
49 if ( $foreignNs < 100 && MWNamespace::exists( $foreignNs ) ) {
50 return Title::makeTitleSafe( $foreignNs, $foreignTitle->getText() );
51 }
52 }
53
54 // Do we have a local namespace by the same name as the foreign
55 // namespace?
56 $targetNs = $wgContLang->getNsIndex( $foreignTitle->getNamespaceName() );
57 if ( $targetNs !== false ) {
58 return Title::makeTitleSafe( $targetNs, $foreignTitle->getText() );
59 }
60
61 // Otherwise, just fall back to main namespace
62 return Title::makeTitleSafe( 0, $foreignTitle->getFullText() );
63 }
64}
A simple, immutable structure to hold the title of a page on a foreign MediaWiki installation.
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.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
Definition design.txt:57
Represents an object that can convert page titles on a foreign wiki (ForeignTitle objects) into page ...