# there's already an action specified, or unless 'edit' makes no sense
# (i.e., for a nonexistent special page).
if ( in_array( 'broken', $options ) && empty( $query['action'] )
- && $target->getNamespace() != NS_SPECIAL ) {
+ && !$target->isSpecialPage() ) {
$query['action'] = 'edit';
$query['redlink'] = '1';
}
* @return Title
*/
static function normaliseSpecialPage( Title $title ) {
- if ( $title->getNamespace() == NS_SPECIAL ) {
+ if ( $title->isSpecialPage() ) {
list( $name, $subpage ) = SpecialPageFactory::resolveAlias( $title->getDBkey() );
if ( !$name ) {
return $title;
$params[1] = $lang->timeanddate( $params[1] );
break;
default:
- if( $title->getNamespace() == NS_SPECIAL ) {
+ if( $title->isSpecialPage() ) {
list( $name, $par ) = SpecialPageFactory::resolveAlias( $title->getDBkey() );
# Use the language name for log titles, rather than Log/X
$titles = array( $user->getUserPage(), $user->getTalkPage() );
// Other tab link
- if ( $this->getTitle()->getNamespace() == NS_SPECIAL ) {
+ if ( $this->getTitle()->isSpecialPage() ) {
// nothing
} elseif ( $this->getTitle()->isTalkPage() ) {
$titles[] = $this->getTitle()->getSubjectPage();
function getPageClasses( $title ) {
$numeric = 'ns-' . $title->getNamespace();
- if ( $title->getNamespace() == NS_SPECIAL ) {
+ if ( $title->isSpecialPage() ) {
$type = 'ns-special';
// bug 23315: provide a class based on the canonical special page name without subpages
list( $canonicalName ) = SpecialPageFactory::resolveAlias( $title->getDBkey() );
$variants = $lang->getVariants();
if ( !$wgDisableLangConversion && sizeof( $variants ) > 1
- && $title->getNamespace() != NS_SPECIAL ) {
+ && !$title->isSpecialPage() ) {
foreach ( $variants as $code ) {
$varname = $lang->getVariantname( $code );
global $wgOut;
$title = $this->getSkin()->getTitle();
- if ( $title->getNamespace() == NS_SPECIAL ) {
+ if ( $title->isSpecialPage() ) {
return '';
}
$tpl->set( 'printable', $out->isPrintable() );
$tpl->set( 'handheld', $request->getBool( 'handheld' ) );
$tpl->setRef( 'loggedin', $this->loggedin );
- $tpl->set( 'notspecialpage', $this->getTitle()->getNamespace() != NS_SPECIAL );
+ $tpl->set( 'notspecialpage', !$this->getTitle()->isSpecialPage() );
/* XXX currently unused, might get useful later
- $tpl->set( 'editable', ( $this->getTitle()->getNamespace() != NS_SPECIAL ) );
+ $tpl->set( 'editable', ( !$this->getTitle()->isSpecialPage() ) );
$tpl->set( 'exists', $this->getTitle()->getArticleID() != 0 );
$tpl->set( 'watch', $this->getTitle()->userIsWatching() ? 'unwatch' : 'watch' );
$tpl->set( 'protect', count( $this->getTitle()->isProtected() ) ? 'unprotect' : 'protect' );
# thickens, because $wgTitle is altered for special pages, so doesn't
# contain the original alias-with-subpage.
$origTitle = Title::newFromText( $request->getText( 'title' ) );
- if( $origTitle instanceof Title && $origTitle->getNamespace() == NS_SPECIAL ) {
+ if( $origTitle instanceof Title && $origTitle->isSpecialPage() ) {
list( $spName, $spPar ) = SpecialPageFactory::resolveAlias( $origTitle->getText() );
$active = $spName == 'Contributions'
&& ( ( $spPar && $spPar == $this->username )
wfRunHooks( 'SkinTemplatePreventOtherActiveTabs', array( &$this, &$preventActiveTabs ) );
// Checks if page is some kind of content
- if( $title->getNamespace() != NS_SPECIAL ) {
+ if( !$title->isSpecialPage() ) {
// Gets page objects for the related namespaces
$subjectPage = $title->getSubjectPage();
$talkPage = $title->getTalkPage();
array( &$this, &$content_navigation ) );
}
- if ( !$wgDisableLangConversion && $title->getNamespace() != NS_SPECIAL ) {
+ if ( !$wgDisableLangConversion && !$title->isSpecialPage() ) {
$pageLang = $title->getPageLanguage();
// Gets list of language variants
$variants = $pageLang->getVariants();
$restrictionTypes = $this->getRestrictionTypes();
# Special pages have inherent protection
- if( $this->getNamespace() == NS_SPECIAL ) {
+ if( $this->isSpecialPage() ) {
return true;
}
}
# If it's a special page, ditch the subpage bit and check again
- if ( $this->getNamespace() == NS_SPECIAL ) {
+ if ( $this->isSpecialPage() ) {
$name = $this->getDBkey();
list( $name, /* $subpage */ ) = SpecialPageFactory::resolveAlias( $name );
if ( $name === false ) {
* @return boolean
*/
public function isSpecial( $name ) {
- if ( $this->getNamespace() == NS_SPECIAL ) {
+ if ( $this->isSpecialPage() ) {
list( $thisName, /* $subpage */ ) = SpecialPageFactory::resolveAlias( $this->getDBkey() );
if ( $name == $thisName ) {
return true;
* @return Title
*/
public function fixSpecialName() {
- if ( $this->getNamespace() == NS_SPECIAL ) {
+ if ( $this->isSpecialPage() ) {
list( $canonicalName, $par ) = SpecialPageFactory::resolveAlias( $this->mDbkeyform );
if ( $canonicalName ) {
$localName = SpecialPageFactory::getLocalNameFor( $canonicalName, $par );
* @return array applicable restriction types
*/
public function getRestrictionTypes() {
- if ( $this->getNamespace() == NS_SPECIAL ) {
+ if ( $this->isSpecialPage() ) {
return array();
}
*/
public function getPageLanguage() {
global $wgLang;
- if ( $this->getNamespace() == NS_SPECIAL ) {
+ if ( $this->isSpecialPage() ) {
// special pages are in the user language
return $wgLang;
} elseif ( $this->isCssOrJsPage() ) {
}
}
// For non-special titles, check for implicit titles
- if ( is_null( $ret ) || $ret->getNamespace() != NS_SPECIAL ) {
+ if ( is_null( $ret ) || !$ret->isSpecialPage() ) {
// We can have urls with just ?diff=,?oldid= or even just ?diff=
$oldid = $request->getInt( 'oldid' );
$oldid = $oldid ? $oldid : $request->getInt( 'diff' );
&& !count( $request->getValueNames( array( 'action', 'title' ) ) )
&& wfRunHooks( 'TestCanonicalRedirect', array( $request, $title, $output ) ) )
{
- if ( $title->getNamespace() == NS_SPECIAL ) {
+ if ( $title->isSpecialPage() ) {
list( $name, $subpage ) = SpecialPageFactory::resolveAlias( $title->getDBkey() );
if ( $name ) {
$title = SpecialPage::getTitleFor( $name, $subpage );
return $rt->getFullURL( 'rdfrom=' . urlencode( $source ) );
}
} else {
- if ( $rt->getNamespace() == NS_SPECIAL ) {
+ if ( $rt->isSpecialPage() ) {
// Gotta handle redirects to special pages differently:
// Fill the HTTP response "Location" header and ignore
// the rest of the page we're on.
$vals = array();
ApiQueryBase::addTitleInfo( $vals, $title );
$vals['special'] = '';
- if ( $title->getNamespace() == NS_SPECIAL &&
+ if ( $title->isSpecialPage() &&
!SpecialPageFactory::exists( $title->getDbKey() ) ) {
$vals['missing'] = '';
} elseif ( $title->getNamespace() == NS_MEDIA &&
wfProfileIn( $titleProfileIn ); // template in
wfProfileIn( __METHOD__ . '-loadtpl' );
if ( !$title->isExternal() ) {
- if ( $title->getNamespace() == NS_SPECIAL
+ if ( $title->isSpecialPage()
&& $this->mOptions->getAllowSpecialInclusion()
&& $this->ot['html'] )
{
return null;
}
- if ( $title->getNamespace() == NS_SPECIAL || $title->isExternal() || $title->exists() ) {
+ if ( $title->isSpecialPage() || $title->isExternal() || $title->exists() ) {
return $title;
}
array(),
array( 'page' => $this->targetObj->getPrefixedText() )
);
- if ( $this->targetObj->getNamespace() != NS_SPECIAL ) {
+ if ( !$this->targetObj->isSpecialPage() ) {
# Give a link to the page history
$links[] = Linker::linkKnown(
$this->targetObj,