* Robert Treat
* RockMFR
* ST47
+* Scott Colcord
* Simon Walker
* Stefano Codari
* Str4nd
? $index - 1
: $index;
}
+
+ /**
+ * Returns whether the specified namespace exists
+ */
+ public static function exists( $index ) {
+ global $wgCanonicalNamespaceNames;
+ return isset( $wgCanonicalNamespaceNames[$index] );
+ }
+
/**
* Returns the canonical (English Wikipedia) name for a given index
}
global $wgScript, $wgTitle, $wgStylePath, $wgUser, $wgScriptExtension;
global $wgArticlePath, $wgScriptPath, $wgServer, $wgContLang, $wgLang;
- global $wgCanonicalNamespaceNames, $wgOut, $wgArticle;
+ global $wgOut, $wgArticle;
global $wgBreakFrames, $wgRequest, $wgVariantArticlePath, $wgActionPaths;
global $wgUseAjax, $wgAjaxWatch;
global $wgVersion, $wgEnableAPI, $wgEnableWriteAPI;
global $wgMWSuggestTemplate, $wgDBname, $wgEnableMWSuggest;
$ns = $wgTitle->getNamespace();
- $nsname = isset( $wgCanonicalNamespaceNames[ $ns ] ) ? $wgCanonicalNamespaceNames[ $ns ] : $wgTitle->getNsText();
+ $nsname = MWNamespace::exists( $ns ) ? MWNamespace::getCanonicalName( $ns ) : $wgTitle->getNsText();
$separatorTransTable = $wgContLang->separatorTransformTable();
$separatorTransTable = $separatorTransTable ? $separatorTransTable : array();
$compactSeparatorTransTable = array(
global $wgMaxCredits, $wgShowCreditsIfMax;
global $wgPageShowWatchingUsers;
global $wgUseTrackbacks, $wgUseSiteJs, $wgDebugComments;
- global $wgArticlePath, $wgScriptPath, $wgServer, $wgCanonicalNamespaceNames;
+ global $wgArticlePath, $wgScriptPath, $wgServer;
wfProfileIn( __METHOD__ );
$tpl->set( 'pageclass', $this->getPageClasses( $this->mTitle ) );
$tpl->set( 'skinnameclass', ( 'skin-' . Sanitizer::escapeClass( $this->getSkinName() ) ) );
- $nsname = isset( $wgCanonicalNamespaceNames[ $this->mTitle->getNamespace() ] ) ?
- $wgCanonicalNamespaceNames[ $this->mTitle->getNamespace() ] :
+ $nsname = MWNamespace::exists( $this->mTitle->getNamespace() ) ?
+ MWNamespace::getCanonicalName( $this->mTitle->getNamespace() ) :
$this->mTitle->getNsText();
$tpl->set( 'nscanonical', $nsname );
* @return \type{\string} Namespace text
*/
public function getNsText() {
- global $wgContLang, $wgCanonicalNamespaceNames;
+ global $wgContLang;
if ( '' != $this->mInterwiki ) {
// This probably shouldn't even happen. ohh man, oh yuck.
//
// Use the canonical namespaces if possible to try to
// resolve a foreign namespace.
- if( isset( $wgCanonicalNamespaceNames[$this->mNamespace] ) ) {
- return $wgCanonicalNamespaceNames[$this->mNamespace];
+ if( MWNamespace::exists( $this->mNamespace ) ) {
+ return MWNamespace::getCanonicalName( $this->mNamespace );
}
}
return $wgContLang->getNsText( $this->mNamespace );
* @return \type{\string} XML 'id' name
*/
public function getNamespaceKey( $prepend = 'nstab-' ) {
- global $wgContLang, $wgCanonicalNamespaceNames;
+ global $wgContLang;
// Gets the subject namespace if this title
$namespace = MWNamespace::getSubject( $this->getNamespace() );
// Checks if cononical namespace name exists for namespace
- if ( isset( $wgCanonicalNamespaceNames[$namespace] ) ) {
+ if ( MWNamespace::exists( $this->getNamespace() ) ) {
// Uses canonical namespace name
- $namespaceKey = $wgCanonicalNamespaceNames[$namespace];
+ $namespaceKey = MWNamespace::getCanonicalName( $namespace );
} else {
// Uses text of namespace
$namespaceKey = $this->getSubjectNsText();