MediaWiki REL1_32
|
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) |
Does this namespace ever have a talk namespace? | |
static | clearCaches () |
Clear internal caches. | |
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 ( $rebuild=false) |
Returns array of all defined namespaces with their canonical (English) names. | |
static | getCategoryLinkType ( $index) |
Returns the link type to be used for categories. | |
static | getContentNamespaces () |
Get a list of all namespace indices which are considered to contain content. | |
static | getNamespaceContentModel ( $index) |
Get the default content model for a namespace This does not mean that all pages in that namespace have the model. | |
static | getRestrictionLevels ( $index, User $user=null) |
Determine which restriction levels it makes sense to use in a namespace, optionally filtered by a user's rights. | |
static | getSubject ( $index) |
Get the subject namespace index for a given namespace Special namespaces (NS_MEDIA, NS_SPECIAL) are always the subject. | |
static | getSubjectNamespaces () |
List all namespace indices which are considered subject, aka not a talk or special namespace. | |
static | getTalk ( $index) |
Get the talk namespace index for a given namespace. | |
static | getTalkNamespaces () |
List all namespace indices which are considered talks, aka not a subject or special 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 | hasTalkNamespace ( $index) |
Does this namespace ever have a talk namespace? | |
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 | isMovable ( $index) |
Can pages in the given namespace be moved? | |
static | isNonincludable ( $index) |
It is not possible to use pages from this namespace as template? | |
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 | wantSignatures ( $index) |
Might pages in this namespace require the use of the Signature button on the edit toolbar? | |
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 = [ NS_SPECIAL, NS_USER, NS_MEDIAWIKI ] |
These namespaces should always be first-letter capitalized, now and forevermore. | |
static string[] null | $canonicalNamespaces = null |
Canonical namespaces cache. | |
static array false | $namespaceIndexes = false |
Canonical namespaces index cache. | |
static int[] null | $validNamespaces = null |
Valid namespaces cache. | |
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 32 of file MWNamespace.php.
|
static |
Does this namespace ever have a talk namespace?
int | $index | Namespace index |
Definition at line 308 of file MWNamespace.php.
|
static |
Clear internal caches.
For use in unit testing when namespace configuration is changed.
Definition at line 76 of file MWNamespace.php.
|
static |
Returns whether the specified namespaces are the same namespace.
int | $ns1 | The first namespace index |
int | $ns2 | The second namespace index |
Definition at line 201 of file MWNamespace.php.
|
static |
Returns whether the specified namespace exists.
int | $index |
Definition at line 182 of file MWNamespace.php.
|
static |
Get the associated namespace.
For talk namespaces, returns the subject (non-talk) namespace For subject (non-talk) namespaces, returns the talk namespace
int | $index | Namespace index |
Definition at line 162 of file MWNamespace.php.
|
static |
Returns the index for a given canonical name, or NULL The input must be converted to lower case first.
string | $name | Namespace name |
Definition at line 267 of file MWNamespace.php.
References $name.
|
static |
Returns the canonical (English) name for a given index.
int | $index | Namespace index |
Definition at line 255 of file MWNamespace.php.
|
static |
Returns array of all defined namespaces with their canonical (English) names.
bool | $rebuild | Rebuild namespace list (default = false). Used for testing. Deprecated since 1.31, use self::clearCaches() instead. |
Definition at line 230 of file MWNamespace.php.
References $wgCanonicalNamespaceNames, $wgExtraNamespaces, ExtensionRegistry\getInstance(), and NS_MAIN.
|
static |
Returns the link type to be used for categories.
This determines which section of a category page titles in the namespace will appear within.
int | $index | Namespace index |
Definition at line 554 of file MWNamespace.php.
References NS_CATEGORY, and NS_FILE.
|
static |
Get a list of all namespace indices which are considered to contain content.
Definition at line 373 of file MWNamespace.php.
References $wgContentNamespaces, and NS_MAIN.
|
static |
Get the default content model for a namespace This does not mean that all pages in that namespace have the model.
int | $index | Index to check |
Definition at line 469 of file MWNamespace.php.
References $wgNamespaceContentModels.
|
static |
Determine which restriction levels it makes sense to use in a namespace, optionally filtered by a user's rights.
Definition at line 483 of file MWNamespace.php.
References $wgNamespaceProtection, $wgRestrictionLevels, array(), and User\getGroupsWithPermission().
Referenced by MediaWiki\EditPage\TextboxBuilder\getTextboxProtectionCSSClasses().
|
static |
Get the subject namespace index for a given namespace Special namespaces (NS_MEDIA, NS_SPECIAL) are always the subject.
int | $index | Namespace index |
Definition at line 143 of file MWNamespace.php.
References NS_MAIN.
|
static |
List all namespace indices which are considered subject, aka not a talk or special namespace.
See also MWNamespace::isSubject
Definition at line 391 of file MWNamespace.php.
|
static |
Get the talk namespace index for a given namespace.
int | $index | Namespace index |
Definition at line 129 of file MWNamespace.php.
|
static |
List all namespace indices which are considered talks, aka not a subject or special namespace.
See also MWNamespace::isTalk
Definition at line 404 of file MWNamespace.php.
|
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 286 of file MWNamespace.php.
|
static |
Does the namespace (potentially) have different aliases for different genders.
Not all languages make a distinction here.
int | $index | Index to check |
Definition at line 445 of file MWNamespace.php.
References NS_USER_TALK.
|
static |
Does the namespace allow subpages?
int | $index | Index to check |
Definition at line 364 of file MWNamespace.php.
References $wgNamespacesWithSubpages.
|
static |
Does this namespace ever have a talk namespace?
int | $index | Namespace ID |
Definition at line 320 of file MWNamespace.php.
References NS_MAIN.
|
static |
Is the namespace first-letter capitalized?
int | $index | Index to check |
Definition at line 417 of file MWNamespace.php.
References $wgCapitalLinkOverrides, $wgCapitalLinks, NS_FILE, and NS_MEDIA.
|
static |
Does this namespace contain content, for the purposes of calculating statistics, etc?
int | $index | Index to check |
Definition at line 331 of file MWNamespace.php.
References $wgContentNamespaces, and NS_MAIN.
|
staticprivate |
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)
int | $index | |
string | $method |
MWException |
Definition at line 62 of file MWNamespace.php.
References NS_MAIN.
|
static |
Can pages in the given namespace be moved?
int | $index | Namespace index |
Definition at line 88 of file MWNamespace.php.
References $result, $wgAllowImageMoving, NS_FILE, and NS_MAIN.
|
static |
It is not possible to use pages from this namespace as template?
int | $index | Index to check |
Definition at line 456 of file MWNamespace.php.
References $wgNonincludableNamespaces.
|
static |
Is the given namespace is a subject (non-talk) namespace?
int | $index | Namespace index |
Definition at line 108 of file MWNamespace.php.
|
static |
Is the given namespace a talk namespace?
int | $index | Namespace index |
Definition at line 118 of file MWNamespace.php.
References NS_MAIN.
|
static |
Can pages in a namespace be watched?
int | $index |
Definition at line 354 of file MWNamespace.php.
References NS_MAIN.
|
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.
int | $ns1 | The first namespace index |
int | $ns2 | The second namespace index |
Definition at line 216 of file MWNamespace.php.
|
static |
Might pages in this namespace require the use of the Signature button on the edit toolbar?
int | $index | Index to check |
Definition at line 343 of file MWNamespace.php.
References $wgExtraSignatureNamespaces.
|
staticprivate |
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 39 of file MWNamespace.php.
|
staticprivate |
Canonical namespaces cache.
Definition at line 42 of file MWNamespace.php.
|
staticprivate |
Canonical namespaces index cache.
Definition at line 45 of file MWNamespace.php.
|
staticprivate |
Valid namespaces cache.
Definition at line 48 of file MWNamespace.php.