* @since 1.18
*/
public static function canonicalTitle( Title $title ) {
- if ( $title->getInterwiki() ) {
+ if ( $title->isExternal() ) {
return $title->getPrefixedText();
}
return Status::newFatal( 'import-noarticle' );
}
$link = Title::newFromText( "$interwiki:Special:Export/$page" );
- if ( is_null( $link ) || $link->getInterwiki() == '' ) {
+ if ( is_null( $link ) || !$link->isExternal() ) {
return Status::newFatal( 'importbadinterwiki' );
} else {
$params = array();
$target = Title::newFromText( $linkTarget );
if ( $target ) {
- if ( $target->getText() == '' && $target->getInterwiki() === ''
+ if ( $target->getText() == '' && !$target->isExternal()
&& !self::$commentLocal && self::$commentContextTitle
) {
$newTarget = clone ( self::$commentContextTitle );
// Find a Title which is not an interwiki and is in NS_MAIN
$title = Title::newFromText( $search );
- if ( $title && $title->getInterwiki() == '' ) {
+ if ( $title && !$title->isExternal() ) {
$ns = array( $title->getNamespace() );
if ( $ns[0] == NS_MAIN ) {
$ns = $namespaces; // no explicit prefix, use default namespaces
$title = Title::newFromText( $search . 'Dummy' );
if ( $title && $title->getText() == 'Dummy'
&& $title->getNamespace() != NS_MAIN
- && $title->getInterwiki() == '' ) {
+ && !$title->isExternal() ) {
return self::searchBackend(
array( $title->getNamespace() ), '', $limit );
}
* @return Bool TRUE if this is an in-project interwiki link or a wikilink, FALSE otherwise
*/
public function isLocal() {
- if ( $this->mInterwiki != '' ) {
+ if ( $this->isExternal() ) {
$iw = Interwiki::fetch( $this->mInterwiki );
if ( $iw ) {
return $iw->isLocal();
* @return Bool TRUE if this is transcludable
*/
public function isTrans() {
- if ( $this->mInterwiki == '' ) {
+ if ( !$this->isExternal() ) {
return false;
}
* @return String the DB name
*/
public function getTransWikiID() {
- if ( $this->mInterwiki == '' ) {
+ if ( !$this->isExternal() ) {
return false;
}
public function getNsText() {
global $wgContLang;
- if ( $this->mInterwiki != '' ) {
+ if ( $this->isExternal() ) {
// This probably shouldn't even happen. ohh man, oh yuck.
// But for interwiki transclusion it sometimes does.
// Shit. Shit shit shit.
* @return Bool TRUE or FALSE
*/
public function isMovable() {
- if ( !MWNamespace::isMovable( $this->getNamespace() ) || $this->getInterwiki() != '' ) {
+ if ( !MWNamespace::isMovable( $this->getNamespace() ) || $this->isExternal() ) {
// Interwiki title or immovable namespace. Hooks don't get to override here
return false;
}
*/
private function prefix( $name ) {
$p = '';
- if ( $this->mInterwiki != '' ) {
+ if ( $this->isExternal() ) {
$p = $this->mInterwiki . ':';
}
* interwiki link
*/
public function getEditURL() {
- if ( $this->mInterwiki != '' ) {
+ if ( $this->isExternal() ) {
return '';
}
$s = $this->getLocalURL( 'action=edit' );
} while ( true );
# We already know that some pages won't be in the database!
- if ( $this->mInterwiki != '' || NS_SPECIAL == $this->mNamespace ) {
+ if ( $this->isExternal() || NS_SPECIAL == $this->mNamespace ) {
$this->mArticleID = 0;
}
$fragment = strstr( $dbkey, '#' );
# and [[Foo]] point to the same place. Don't force it for interwikis, since the
# other site might be case-sensitive.
$this->mUserCaseDBKey = $dbkey;
- if ( $this->mInterwiki == '' ) {
+ if ( !$this->isExternal() ) {
$dbkey = self::capitalize( $dbkey, $this->mNamespace );
}
# Can't make a link to a namespace alone... "empty" local links can only be
# self-links with a fragment identifier.
- if ( $dbkey == '' && $this->mInterwiki == '' && $this->mNamespace != NS_MAIN ) {
+ if ( $dbkey == '' && !$this->isExternal() && $this->mNamespace != NS_MAIN ) {
return false;
}
if ( !$this->isMovable() ) {
$errors[] = array( 'immobile-source-namespace', $this->getNsText() );
}
- if ( $nt->getInterwiki() != '' ) {
+ if ( $nt->isExternal() ) {
$errors[] = array( 'immobile-target-namespace-iw' );
}
if ( !$nt->isMovable() ) {
return $isKnown;
}
- if ( $this->mInterwiki != '' ) {
+ if ( $this->isExternal() ) {
return true; // any interwiki link might be viewable, for all we know
}
$ret = Title::newMainPage();
}
- if ( $ret === null || ( $ret->getDBkey() == '' && $ret->getInterwiki() == '' ) ) {
+ if ( $ret === null || ( $ret->getDBkey() == '' && !$ret->isExternal() ) ) {
$ret = SpecialPage::getTitleFor( 'Badtitle' );
}
wfRunHooks( 'BeforeInitialize', array( &$title, &$unused, &$output, &$user, $request, $this ) );
// Invalid titles. Bug 21776: The interwikis must redirect even if the page name is empty.
- if ( is_null( $title ) || ( $title->getDBkey() == '' && $title->getInterwiki() == '' )
+ if ( is_null( $title ) || ( $title->getDBkey() == '' && !$title->isExternal() )
|| $title->isSpecial( 'Badtitle' )
) {
$this->context->setTitle( SpecialPage::getTitleFor( 'Badtitle' ) );
$pageView = false; // was an article or special page viewed?
// Interwiki redirects
- if ( $title->getInterwiki() != '' ) {
+ if ( $title->isExternal() ) {
$rdfrom = $request->getVal( 'rdfrom' );
if ( $rdfrom ) {
$url = $title->getFullURL( array( 'rdfrom' => $rdfrom ) );
if ( !$t ) {
$this->dieUsageMsg( array( 'invalidtitle', $titlePart ) );
}
- if ( $defaultNamespace != $t->getNamespace() || $t->getInterwiki() !== '' ) {
+ if ( $defaultNamespace != $t->getNamespace() || $t->isExternal() ) {
// This can happen in two cases. First, if you call titlePartToKey with a title part
// that looks like a namespace, but with $defaultNamespace = NS_MAIN. It would be very
// difficult to handle such a case. Such cases cannot exist and are therefore treated
}
$seenTitles[$titleText] = true;
- if ( $title->getInterwiki() ) {
+ if ( $title->isExternal() ) {
// If the target is interwiki, we have to break early (bug 40352).
// Otherwise it will look up a row in the local page table
// with the namespace/page of the interwiki target which can cause
* @throws MWException if given invalid input
*/
function addInterwikiLink( $title ) {
- $prefix = $title->getInterwiki();
- if ( $prefix == '' ) {
+ if ( !$title->isExternal() ) {
throw new MWException( 'Non-interwiki link passed, internal parser error.' );
}
+ $prefix = $title->getInterwiki();
if ( !isset( $this->mInterwikiLinks[$prefix] ) ) {
$this->mInterwikiLinks[$prefix] = array();
}
foreach ( explode( "\n", $page ) as $pageName ) {
$pageName = trim( $pageName );
$title = Title::newFromText( $pageName );
- if ( $title && $title->getInterwiki() == '' && $title->getText() !== '' ) {
+ if ( $title && !$title->isExternal() && $title->getText() !== '' ) {
// Only record each page once!
$pageSet[$title->getPrefixedText()] = true;
}
}
$outputPage = $this->getOutput();
$title = Title::newFromURL( $target );
- if ( !$title || $title->getInterwiki() != '' ) {
+ if ( !$title || $title->isExternal() ) {
$outputPage->addHtml( '<div class="errorbox">' . $this->msg( 'allpagesbadtitle' )->parse() . '</div>' );
return false;
}