MWNamespace Class Reference

This is a utility class with only static functions for dealing with namespaces that encodes all the "magic" behaviors of them based on index. More...

Inherited by Namespace.

List of all members.

Static Public Member Functions

static isMovable ($index)
 Can pages in the given namespace be moved?
static isMain ($index)
 Is the given namespace is a subject (non-talk) namespace?
static isTalk ($index)
 Is the given namespace a talk namespace?
static getTalk ($index)
 Get the talk namespace index for a given namespace.
static getSubject ($index)
 Get the subject namespace index for a given namespace.
static exists ($index)
 Returns whether the specified namespace exists.
static getCanonicalName ($index)
 Returns the canonical (English Wikipedia) name for a given index.
static getCanonicalIndex ($name)
 Returns the index for a given canonical name, or NULL The input *must* be converted to lower case first.
static canTalk ($index)
 Can this namespace ever have a talk namespace?
static isContent ($index)
 Does this namespace contain content, for the purposes of calculating statistics, etc?
static isWatchable ($index)
 Can pages in a namespace be watched?
static hasSubpages ($index)
 Does the namespace allow subpages?
static isCapitalized ($index)
 Is the namespace first-letter capitalized?

Static Private Attributes

static $alwaysCapitalizedNamespaces = array( NS_SPECIAL, NS_USER, NS_MEDIAWIKI )
 These namespaces should always be first-letter capitalized, now and forevermore.


Detailed Description

This is a utility class with only static functions for dealing with namespaces that encodes all the "magic" behaviors of them based on index.

The textual names of the namespaces are handled by Language.php.

These are synonyms for the names given in the language file Users and translators should not change them

Definition at line 46 of file Namespace.php.


Member Function Documentation

static MWNamespace::canTalk ( index  )  [static]

Can this namespace ever have a talk namespace?

Parameters:
$index Int: namespace index
Returns:
bool

Definition at line 164 of file Namespace.php.

Referenced by Title::canTalk().

static MWNamespace::exists ( index  )  [static]

Returns whether the specified namespace exists.

Definition at line 114 of file Namespace.php.

References $wgCanonicalNamespaceNames.

Referenced by Title::getNamespaceKey(), Title::getNsText(), Skin::makeGlobalVariablesScript(), and SkinTemplate::outputPage().

static MWNamespace::getCanonicalIndex ( name  )  [static]

Returns the index for a given canonical name, or NULL The input *must* be converted to lower case first.

Parameters:
$name String: namespace name
Returns:
int

Definition at line 142 of file Namespace.php.

References $i, $name, and $wgCanonicalNamespaceNames.

Referenced by Language::getNsIndex().

static MWNamespace::getCanonicalName ( index  )  [static]

Returns the canonical (English Wikipedia) name for a given index.

Parameters:
$index Int: namespace index
Returns:
string or false if no canonical definition.

Definition at line 126 of file Namespace.php.

References $wgCanonicalNamespaceNames.

Referenced by ApiQuerySiteinfo::appendNamespaces(), SpecialListGroupRights::execute(), Linker::formatLinksInCommentCallback(), SpecialStatistics::getGroupStats(), Title::getNamespaceKey(), Title::getNsText(), Skin::makeGlobalVariablesScript(), Title::moveSubpages(), and SkinTemplate::outputPage().

static MWNamespace::getSubject ( index  )  [static]

Get the subject namespace index for a given namespace.

Parameters:
$index Int: Namespace index
Returns:
int

Definition at line 105 of file Namespace.php.

References isTalk().

Referenced by WatchedItem::addWatch(), Title::getNamespaceKey(), Title::getSubjectNsText(), Title::getSubjectPage(), ApiQueryInfo::getTSIDs(), isCapitalized(), SpecialSearch::powerSearchBox(), WatchedItem::removeWatch(), and SkinTemplate::tabAction().

static MWNamespace::getTalk ( index  )  [static]

Get the talk namespace index for a given namespace.

Parameters:
$index Int: namespace index
Returns:
int

Definition at line 93 of file Namespace.php.

References isTalk().

Referenced by WatchedItem::addWatch(), Title::getTalkNsText(), Title::getTalkPage(), ApiQueryInfo::getTSIDs(), and WatchedItem::removeWatch().

static MWNamespace::hasSubpages ( index  )  [static]

static MWNamespace::isCapitalized ( index  )  [static]

Is the namespace first-letter capitalized?

Parameters:
$index int Index to check
Returns:
bool

Definition at line 207 of file Namespace.php.

References $wgCapitalLinkOverrides, $wgCapitalLinks, and getSubject().

Referenced by FileRepo::__construct(), ApiQuerySiteinfo::appendNamespaces(), Title::capitalize(), FileRepo::getNameFromTitle(), and XmlDumpWriter::namespaces().

static MWNamespace::isContent ( index  )  [static]

Does this namespace contain content, for the purposes of calculating statistics, etc?

Parameters:
$index Int: index to check
Returns:
bool

Definition at line 175 of file Namespace.php.

References $wgContentNamespaces.

Referenced by ApiQuerySiteinfo::appendNamespaces(), Linker::getLinkColour(), and Title::isContentPage().

static MWNamespace::isMain ( index  )  [static]

Is the given namespace is a subject (non-talk) namespace?

Parameters:
$index Int: namespace index
Returns:
bool

Definition at line 72 of file Namespace.php.

References isTalk().

Referenced by GenerateSitemap::guessPriority().

static MWNamespace::isMovable ( index  )  [static]

Can pages in the given namespace be moved?

Parameters:
$index Int: namespace index
Returns:
bool

Definition at line 61 of file Namespace.php.

References $wgAllowImageMoving.

Referenced by Title::getUserPermissionsErrorsInternal().

static MWNamespace::isTalk ( index  )  [static]

Is the given namespace a talk namespace?

Parameters:
$index Int: namespace index
Returns:
bool

Definition at line 82 of file Namespace.php.

Referenced by getSubject(), getTalk(), ApiQueryInfo::getTSIDs(), isMain(), Title::isTalkPage(), and DumpNotalkFilter::pass().

static MWNamespace::isWatchable ( index  )  [static]

Can pages in a namespace be watched?

Parameters:
$index Int
Returns:
bool

Definition at line 186 of file Namespace.php.


Member Data Documentation

MWNamespace::$alwaysCapitalizedNamespaces = array( NS_SPECIAL, NS_USER, NS_MEDIAWIKI ) [static, private]

These namespaces should always be first-letter capitalized, now and forevermore.

Historically, they could've probably been lowercased too, but some things are just too ingrained now. :)

Definition at line 53 of file Namespace.php.


The documentation for this class was generated from the following file:

Generated on Sat Apr 30 22:57:44 2011 for MediaWiki by  doxygen 1.5.9