MediaWiki
REL1_19
|
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...
Static Public Member Functions | |
static | canTalk ($index) |
Can this namespace ever have a talk namespace? | |
static | equals ($ns1, $ns2) |
Returns whether the specified namespaces are the same namespace. | |
static | exists ($index) |
Returns whether the specified namespace exists. | |
static | getAssociated ($index) |
Get the associated namespace. | |
static | getCanonicalIndex ($name) |
Returns the index for a given canonical name, or NULL The input *must* be converted to lower case first. | |
static | getCanonicalName ($index) |
Returns the canonical (English) name for a given index. | |
static | getCanonicalNamespaces () |
Returns array of all defined namespaces with their canonical (English) names. | |
static | getContentNamespaces () |
Get a list of all namespace indices which are considered to contain content. | |
static | getSubject ($index) |
Get the subject namespace index for a given namespace Special namespaces (NS_MEDIA, NS_SPECIAL) are always the subject. | |
static | getTalk ($index) |
Get the talk namespace index for a given namespace. | |
static | getValidNamespaces () |
Returns an array of the namespaces (by integer id) that exist on the wiki. | |
static | hasGenderDistinction ($index) |
Does the namespace (potentially) have different aliases for different genders. | |
static | hasSubpages ($index) |
Does the namespace allow subpages? | |
static | isCapitalized ($index) |
Is the namespace first-letter capitalized? | |
static | isContent ($index) |
Does this namespace contain content, for the purposes of calculating statistics, etc? | |
static | isMain ($index) |
static | isMovable ($index) |
Can pages in the given namespace be moved? | |
static | isSubject ($index) |
Is the given namespace is a subject (non-talk) namespace? | |
static | isTalk ($index) |
Is the given namespace a talk namespace? | |
static | isWatchable ($index) |
Can pages in a namespace be watched? | |
static | subjectEquals ($ns1, $ns2) |
Returns whether the specified namespaces share the same subject. | |
Static Private Member Functions | |
static | isMethodValidFor ($index, $method) |
Throw an exception when trying to get the subject or talk page for a given namespace where it does not make sense. | |
Static Private Attributes | |
static | $alwaysCapitalizedNamespaces = array( NS_SPECIAL, NS_USER, NS_MEDIAWIKI ) |
These namespaces should always be first-letter capitalized, now and forevermore. |
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 18 of file Namespace.php.
static MWNamespace::canTalk | ( | $ | index | ) | [static] |
Can this namespace ever have a talk namespace?
$index | Int: namespace index |
Definition at line 266 of file Namespace.php.
Referenced by Title\canTalk(), and ChangesFeed\generateFeed().
static MWNamespace::equals | ( | $ | ns1, |
$ | ns2 | ||
) | [static] |
Returns whether the specified namespaces are the same namespace.
$ns1 | int The first namespace index |
$ns2 | int The second namespae index |
Definition at line 165 of file Namespace.php.
Referenced by MWNamespaceTest\testEquals().
static MWNamespace::exists | ( | $ | index | ) | [static] |
Returns whether the specified namespace exists.
$index |
Definition at line 146 of file Namespace.php.
References getCanonicalNamespaces().
Referenced by OutputPage\getJSVars(), Title\getNamespaceKey(), and Title\getNsText().
static MWNamespace::getAssociated | ( | $ | index | ) | [static] |
Get the associated namespace.
For talk namespaces, returns the subject (non-talk) namespace For subject (non-talk) namespaces, returns the talk namespace
$index | Int: namespace index |
Definition at line 126 of file Namespace.php.
References getSubject(), getTalk(), and isMethodValidFor().
Referenced by SpecialRecentChanges\buildMainQueryConds(), ContribsPager\getNamespaceCond(), MWNamespaceTest\testGetAssociated(), MWNamespaceTest\testGetAssociatedExceptionsForNsMedia(), and MWNamespaceTest\testGetAssociatedExceptionsForNsSpecial().
static MWNamespace::getCanonicalIndex | ( | $ | name | ) | [static] |
Returns the index for a given canonical name, or NULL The input *must* be converted to lower case first.
$name | String: namespace name |
Definition at line 226 of file Namespace.php.
Referenced by Language\getNsIndex().
static MWNamespace::getCanonicalName | ( | $ | index | ) | [static] |
Returns the canonical (English) name for a given index.
$index | Int: namespace index |
Definition at line 210 of file Namespace.php.
References getCanonicalNamespaces().
Referenced by MWNamespaceTest\__call(), ApiQuerySiteinfo\appendNamespaces(), SpecialListGroupRights\execute(), Linker\formatLinksInCommentCallback(), SpecialStatistics\getGroupStats(), OutputPage\getJSVars(), Title\getNamespaceKey(), Title\getNsText(), and Title\moveSubpages().
static MWNamespace::getCanonicalNamespaces | ( | ) | [static] |
Returns array of all defined namespaces with their canonical (English) names.
Definition at line 191 of file Namespace.php.
References $wgCanonicalNamespaceNames, $wgExtraNamespaces, and wfRunHooks().
Referenced by NamespaceConflictChecker\checkAll(), MysqlUpdater\doPagelinksUpdate(), exists(), getCanonicalName(), ResourceLoaderStartUpModule\getConfig(), and Language\getNamespaces().
static MWNamespace::getContentNamespaces | ( | ) | [static] |
Get a list of all namespace indices which are considered to contain content.
Definition at line 307 of file Namespace.php.
References $wgContentNamespaces.
Referenced by RandomPage\__construct(), SiteStatsInit\articles(), UncategorizedPagesPage\getOrderFields(), LonelyPagesPage\getOrderFields(), DeadendPagesPage\getOrderFields(), AncientPagesPage\getQueryInfo(), MostcategoriesPage\getQueryInfo(), DisambiguationsPage\getQueryInfo(), PopularPagesPage\getQueryInfo(), FewestrevisionsPage\getQueryInfo(), UncategorizedPagesPage\getQueryInfo(), LonelyPagesPage\getQueryInfo(), DeadendPagesPage\getQueryInfo(), and WithoutInterwikiPage\getQueryInfo().
static MWNamespace::getSubject | ( | $ | index | ) | [static] |
Get the subject namespace index for a given namespace Special namespaces (NS_MEDIA, NS_SPECIAL) are always the subject.
$index | Int: Namespace index |
Definition at line 107 of file Namespace.php.
References isTalk().
Referenced by WatchedItem\addWatch(), getAssociated(), Title\getNamespaceKey(), Title\getSubjectNsText(), Title\getSubjectPage(), ApiQueryInfo\getTSIDs(), isCapitalized(), SpecialSearch\powerSearchBox(), WatchedItem\removeWatch(), subjectEquals(), SkinTemplate\tabAction(), and MWNamespaceTest\testGetSubject().
static MWNamespace::getTalk | ( | $ | index | ) | [static] |
Get the talk namespace index for a given namespace.
$index | Int: namespace index |
Definition at line 93 of file Namespace.php.
References isMethodValidFor(), and isTalk().
Referenced by WatchedItem\addWatch(), getAssociated(), Title\getTalkNsText(), Title\getTalkPage(), ApiQueryInfo\getTSIDs(), WatchedItem\removeWatch(), MWNamespaceTest\testGetTalk(), MWNamespaceTest\testGetTalkExceptionsForNsMedia(), and MWNamespaceTest\testGetTalkExceptionsForNsSpecial().
static MWNamespace::getValidNamespaces | ( | ) | [static] |
Returns an array of the namespaces (by integer id) that exist on the wiki.
Used primarily by the api in help documentation.
Definition at line 246 of file Namespace.php.
Referenced by ApiBase\makeHelpMsgParameters().
static MWNamespace::hasGenderDistinction | ( | $ | index | ) | [static] |
Does the namespace (potentially) have different aliases for different genders.
Not all languages make a distinction here.
$index | int Index to check |
Definition at line 352 of file Namespace.php.
Referenced by GenderCache\doLinkBatch(), Title\getNsText(), and MWNamespaceTest\testHasGenderDistinction().
static MWNamespace::hasSubpages | ( | $ | index | ) | [static] |
Does the namespace allow subpages?
$index | int Index to check |
Definition at line 298 of file Namespace.php.
References $wgNamespacesWithSubpages.
Referenced by ApiQuerySiteinfo\appendNamespaces(), Parser\areSubpagesAllowed(), MovePageForm\doSubmit(), Title\getBaseText(), Title\getSubpages(), Title\getSubpageText(), Title\hasSubpages(), Title\moveSubpages(), Linker\normalizeSubpageLink(), EditPage\showHeader(), MovePageForm\showSubpages(), and Skin\subPageSubtitle().
static MWNamespace::isCapitalized | ( | $ | index | ) | [static] |
Is the namespace first-letter capitalized?
$index | int Index to check |
Definition at line 324 of file Namespace.php.
References $wgCapitalLinkOverrides, $wgCapitalLinks, and getSubject().
Referenced by FileRepo\__construct(), UploadForm\addUploadJS(), ApiQuerySiteinfo\appendNamespaces(), Title\capitalize(), ResourceLoaderStartUpModule\getConfig(), FileRepo\getNameFromTitle(), XmlDumpWriter\namespaces(), and MWNamespaceTest\testIsCapitalizedHardcodedAssertions().
static MWNamespace::isContent | ( | $ | index | ) | [static] |
Does this namespace contain content, for the purposes of calculating statistics, etc?
$index | Int: index to check |
Definition at line 277 of file Namespace.php.
References $wgContentNamespaces.
Referenced by ApiQuerySiteinfo\appendNamespaces(), and Title\isContentPage().
static MWNamespace::isMain | ( | $ | index | ) | [static] |
Definition at line 71 of file Namespace.php.
References isSubject(), and wfDeprecated().
Referenced by GenerateSitemap\guessPriority(), and MWNamespaceTest\testIsSubject().
static MWNamespace::isMethodValidFor | ( | $ | index, |
$ | method | ||
) | [static, private] |
Throw an exception when trying to get the subject or talk page for a given namespace where it does not make sense.
Special namespaces are defined in includes/Defines.php and have a value below 0 (ex: NS_SPECIAL = -1 , NS_MEDIA = -2)
$index | |
$method |
Definition at line 38 of file Namespace.php.
Referenced by getAssociated(), and getTalk().
static MWNamespace::isMovable | ( | $ | index | ) | [static] |
Can pages in the given namespace be moved?
$index | Int: namespace index |
Definition at line 51 of file Namespace.php.
References $wgAllowImageMoving.
Referenced by Title\checkActionPermissions(), Title\isMovable(), and MWNamespaceTest\testIsMovable().
static MWNamespace::isSubject | ( | $ | index | ) | [static] |
Is the given namespace is a subject (non-talk) namespace?
$index | Int: namespace index |
Definition at line 63 of file Namespace.php.
References isTalk().
Referenced by isMain(), and MWNamespaceTest\testIsSubject().
static MWNamespace::isTalk | ( | $ | index | ) | [static] |
Is the given namespace a talk namespace?
$index | Int: namespace index |
Definition at line 82 of file Namespace.php.
Referenced by getSubject(), getTalk(), ApiQueryInfo\getTSIDs(), SpecialEditWatchlist\getWatchlistInfo(), isSubject(), Title\isTalkPage(), and DumpNotalkFilter\pass().
static MWNamespace::isWatchable | ( | $ | index | ) | [static] |
Can pages in a namespace be watched?
$index | Int |
Definition at line 288 of file Namespace.php.
static MWNamespace::subjectEquals | ( | $ | ns1, |
$ | ns2 | ||
) | [static] |
Returns whether the specified namespaces share the same subject.
eg: NS_USER and NS_USER wil return true, as well NS_USER and NS_USER_TALK will return true.
$ns1 | int The first namespace index |
$ns2 | int The second namespae index |
Definition at line 180 of file Namespace.php.
References getSubject().
Referenced by MWNamespaceTest\assertDifferentSubject(), MWNamespaceTest\assertSameSubject(), and Title\hasSubjectNamespace().
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 25 of file Namespace.php.