MediaWiki REL1_30
NaiveImportTitleFactory.php
Go to the documentation of this file.
1<?php
42 public function createTitleFromForeignTitle( ForeignTitle $foreignTitle ) {
43 global $wgContLang;
44
45 if ( $foreignTitle->isNamespaceIdKnown() ) {
46 $foreignNs = $foreignTitle->getNamespaceId();
47
48 // For built-in namespaces (0 <= ID < 100), we try to find a local NS with
49 // the same namespace ID
50 if ( $foreignNs < 100 && MWNamespace::exists( $foreignNs ) ) {
51 return Title::makeTitleSafe( $foreignNs, $foreignTitle->getText() );
52 }
53 }
54
55 // Do we have a local namespace by the same name as the foreign
56 // namespace?
57 $targetNs = $wgContLang->getNsIndex( $foreignTitle->getNamespaceName() );
58 if ( $targetNs !== false ) {
59 return Title::makeTitleSafe( $targetNs, $foreignTitle->getText() );
60 }
61
62 // Otherwise, just fall back to main namespace
63 return Title::makeTitleSafe( 0, $foreignTitle->getFullText() );
64 }
65}
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 ...