MediaWiki  master
MWNamespace Class Reference

Static Public Member Functions

static equals ( $ns1, $ns2)
 Returns whether the specified namespaces are the same namespace. More...
 
static exists ( $index)
 Returns whether the specified namespace exists. More...
 
static getAssociated ( $index)
 Get the associated namespace. More...
 
static getCanonicalIndex ( $name)
 Returns the index for a given canonical name, or NULL The input must be converted to lower case first. More...
 
static getCanonicalName ( $index)
 Returns the canonical (English) name for a given index. More...
 
static getCanonicalNamespaces ()
 Returns array of all defined namespaces with their canonical (English) names. More...
 
static getCategoryLinkType ( $index)
 Returns the link type to be used for categories. More...
 
static getContentNamespaces ()
 Get a list of all namespace indices which are considered to contain content. More...
 
static getNamespaceContentModel ( $index)
 Get the default content model for a namespace This does not mean that all pages in that namespace have the model. More...
 
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. More...
 
static getSubject ( $index)
 Get the subject namespace index for a given namespace Special namespaces (NS_MEDIA, NS_SPECIAL) are always the subject. More...
 
static getSubjectNamespaces ()
 List all namespace indices which are considered subject, aka not a talk or special namespace. More...
 
static getTalk ( $index)
 Get the talk namespace index for a given namespace. More...
 
static getTalkNamespaces ()
 List all namespace indices which are considered talks, aka not a subject or special namespace. More...
 
static getValidNamespaces ()
 Returns an array of the namespaces (by integer id) that exist on the wiki. More...
 
static hasGenderDistinction ( $index)
 Does the namespace (potentially) have different aliases for different genders. More...
 
static hasSubpages ( $index)
 Does the namespace allow subpages? More...
 
static hasTalkNamespace ( $index)
 Does this namespace ever have a talk namespace? More...
 
static isCapitalized ( $index)
 Is the namespace first-letter capitalized? More...
 
static isContent ( $index)
 Does this namespace contain content, for the purposes of calculating statistics, etc? More...
 
static isMovable ( $index)
 Can pages in the given namespace be moved? More...
 
static isNonincludable ( $index)
 It is not possible to use pages from this namespace as template? More...
 
static isSubject ( $index)
 Is the given namespace is a subject (non-talk) namespace? More...
 
static isTalk ( $index)
 Is the given namespace a talk namespace? More...
 
static isWatchable ( $index)
 Can pages in a namespace be watched? More...
 
static subjectEquals ( $ns1, $ns2)
 Returns whether the specified namespaces share the same subject. More...
 
static wantSignatures ( $index)
 Might pages in this namespace require the use of the Signature button on the edit toolbar? More...
 

Detailed Description

Deprecated:
since 1.34, use NamespaceInfo instead

Definition at line 27 of file MWNamespace.php.

Member Function Documentation

◆ equals()

static MWNamespace::equals (   $ns1,
  $ns2 
)
static

Returns whether the specified namespaces are the same namespace.

Note
It's possible that in the future we may start using something other than just namespace indexes. Under that circumstance making use of this function rather than directly doing comparison will make sure that code will not potentially break.
Parameters
int$ns1The first namespace index
int$ns2The second namespace index
Returns
bool
Since
1.19
Deprecated:
since 1.34, hard deprecated since 1.37

Definition at line 139 of file MWNamespace.php.

References wfDeprecated().

◆ exists()

static MWNamespace::exists (   $index)
static

Returns whether the specified namespace exists.

Parameters
int$index
Returns
bool
Since
1.19
Deprecated:
since 1.34, hard deprecated since 1.38

Definition at line 119 of file MWNamespace.php.

References wfDeprecated().

◆ getAssociated()

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

Deprecated:
since 1.34, hard deprecated since 1.37
Parameters
int$indexNamespace index
Returns
int|null If no associated namespace could be found

Definition at line 105 of file MWNamespace.php.

References wfDeprecated().

◆ getCanonicalIndex()

static MWNamespace::getCanonicalIndex (   $name)
static

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

Deprecated:
since 1.34, hard deprecated since 1.38
Parameters
string$nameNamespace name
Returns
int

Definition at line 199 of file MWNamespace.php.

References wfDeprecated().

◆ getCanonicalName()

static MWNamespace::getCanonicalName (   $index)
static

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

Deprecated:
since 1.34, hard deprecated since 1.38
Parameters
int$indexNamespace index
Returns
string|bool If no canonical definition.

Definition at line 185 of file MWNamespace.php.

References wfDeprecated().

◆ getCanonicalNamespaces()

static MWNamespace::getCanonicalNamespaces ( )
static

Returns array of all defined namespaces with their canonical (English) names.

Returns
array
Since
1.17
Deprecated:
since 1.34, hard deprecated since 1.38

Definition at line 172 of file MWNamespace.php.

References wfDeprecated().

◆ getCategoryLinkType()

static MWNamespace::getCategoryLinkType (   $index)
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.

Deprecated:
since 1.34, hard deprecated since 1.37
Since
1.32
Parameters
int$indexNamespace index
Returns
string One of 'subcat', 'file', 'page'

Definition at line 410 of file MWNamespace.php.

References wfDeprecated().

◆ getContentNamespaces()

static MWNamespace::getContentNamespaces ( )
static

Get a list of all namespace indices which are considered to contain content.

Deprecated:
since 1.34, hard deprecated since 1.38
Returns
int[] Array of namespace indices

Definition at line 292 of file MWNamespace.php.

References wfDeprecated().

◆ getNamespaceContentModel()

static MWNamespace::getNamespaceContentModel (   $index)
static

Get the default content model for a namespace This does not mean that all pages in that namespace have the model.

Note
To determine the default model for a new page's main slot, or any slot in general, use SlotRoleHandler::getDefaultModel() together with SlotRoleRegistry::getRoleHandler().
Deprecated:
since 1.34, hard deprecated since 1.37
Since
1.21
Parameters
int$indexIndex to check
Returns
null|string Default model name for the given namespace, if set

Definition at line 376 of file MWNamespace.php.

References wfDeprecated().

◆ getRestrictionLevels()

static MWNamespace::getRestrictionLevels (   $index,
User  $user = null 
)
static

Determine which restriction levels it makes sense to use in a namespace, optionally filtered by a user's rights.

Deprecated:
since 1.34, hard deprecated since 1.37
Since
1.23
Parameters
int$indexIndex to check
User | null$userUser to check
Returns
array

Definition at line 392 of file MWNamespace.php.

References wfDeprecated().

◆ getSubject()

static MWNamespace::getSubject (   $index)
static

Get the subject namespace index for a given namespace Special namespaces (NS_MEDIA, NS_SPECIAL) are always the subject.

Deprecated:
since 1.34, hard deprecated since 1.37
Parameters
int$indexNamespace index
Returns
int

Definition at line 90 of file MWNamespace.php.

References wfDeprecated().

◆ getSubjectNamespaces()

static MWNamespace::getSubjectNamespaces ( )
static

List all namespace indices which are considered subject, aka not a talk or special namespace.

See also MWNamespace::isSubject

Deprecated:
since 1.34, hard deprecated since 1.37
Returns
int[] Array of namespace indices

Definition at line 305 of file MWNamespace.php.

References wfDeprecated().

◆ getTalk()

static MWNamespace::getTalk (   $index)
static

Get the talk namespace index for a given namespace.

Deprecated:
since 1.34, hard deprecated since 1.37
Parameters
int$indexNamespace index
Returns
int

Definition at line 76 of file MWNamespace.php.

References wfDeprecated().

◆ getTalkNamespaces()

static MWNamespace::getTalkNamespaces ( )
static

List all namespace indices which are considered talks, aka not a subject or special namespace.

See also MWNamespace::isTalk

Deprecated:
since 1.34, hard deprecated since 1.37
Returns
int[] Array of namespace indices

Definition at line 318 of file MWNamespace.php.

References wfDeprecated().

◆ getValidNamespaces()

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.

Deprecated:
since 1.34, hard deprecated since 1.38
Returns
array

Definition at line 212 of file MWNamespace.php.

References wfDeprecated().

◆ hasGenderDistinction()

static MWNamespace::hasGenderDistinction (   $index)
static

Does the namespace (potentially) have different aliases for different genders.

Not all languages make a distinction here.

Deprecated:
since 1.34, hard deprecated since 1.37
Since
1.18
Parameters
int$indexIndex to check
Returns
bool

Definition at line 345 of file MWNamespace.php.

References wfDeprecated().

◆ hasSubpages()

static MWNamespace::hasSubpages (   $index)
static

Does the namespace allow subpages?

Deprecated:
since 1.34, hard deprecated since 1.38
Parameters
int$indexIndex to check
Returns
bool

Definition at line 280 of file MWNamespace.php.

References wfDeprecated().

◆ hasTalkNamespace()

static MWNamespace::hasTalkNamespace (   $index)
static

Does this namespace ever have a talk namespace?

Deprecated:
since 1.34, hard deprecated since 1.37
Since
1.30
Parameters
int$indexNamespace ID
Returns
bool True if this namespace either is or has a corresponding talk namespace.

Definition at line 226 of file MWNamespace.php.

References wfDeprecated().

◆ isCapitalized()

static MWNamespace::isCapitalized (   $index)
static

Is the namespace first-letter capitalized?

Deprecated:
since 1.34, hard deprecated since 1.37
Parameters
int$indexIndex to check
Returns
bool

Definition at line 331 of file MWNamespace.php.

References wfDeprecated().

◆ isContent()

static MWNamespace::isContent (   $index)
static

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

Deprecated:
since 1.34, hard deprecated since 1.38
Parameters
int$indexIndex to check
Returns
bool

Definition at line 240 of file MWNamespace.php.

References wfDeprecated().

◆ isMovable()

static MWNamespace::isMovable (   $index)
static

Can pages in the given namespace be moved?

Deprecated:
since 1.34, hard deprecated since 1.37
Parameters
int$indexNamespace index
Returns
bool

Definition at line 36 of file MWNamespace.php.

References wfDeprecated().

◆ isNonincludable()

static MWNamespace::isNonincludable (   $index)
static

It is not possible to use pages from this namespace as template?

Deprecated:
since 1.34, hard deprecated since 1.37
Since
1.20
Parameters
int$indexIndex to check
Returns
bool

Definition at line 359 of file MWNamespace.php.

References wfDeprecated().

◆ isSubject()

static MWNamespace::isSubject (   $index)
static

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

Deprecated:
since 1.34, hard deprecated since 1.37
Parameters
int$indexNamespace index
Returns
bool
Since
1.19

Definition at line 50 of file MWNamespace.php.

References wfDeprecated().

◆ isTalk()

static MWNamespace::isTalk (   $index)
static

Is the given namespace a talk namespace?

Deprecated:
since 1.34, hard deprecated since 1.38
Parameters
int$indexNamespace index
Returns
bool

Definition at line 63 of file MWNamespace.php.

References wfDeprecated().

◆ isWatchable()

static MWNamespace::isWatchable (   $index)
static

Can pages in a namespace be watched?

Deprecated:
since 1.34, hard deprecated since 1.37
Parameters
int$index
Returns
bool

Definition at line 267 of file MWNamespace.php.

References wfDeprecated().

◆ subjectEquals()

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.

Deprecated:
since 1.34, hard deprecated since 1.37
Parameters
int$ns1The first namespace index
int$ns2The second namespace index
Returns
bool
Since
1.19
Deprecated:
since 1.34

Definition at line 158 of file MWNamespace.php.

References wfDeprecated().

◆ wantSignatures()

static MWNamespace::wantSignatures (   $index)
static

Might pages in this namespace require the use of the Signature button on the edit toolbar?

Deprecated:
since 1.34, hard deprecated since 1.37
Parameters
int$indexIndex to check
Returns
bool

Definition at line 254 of file MWNamespace.php.

References wfDeprecated().


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