MediaWiki  master
MWNamespace.php
Go to the documentation of this file.
1 <?php
23 
27 class MWNamespace {
34  public static function isMovable( $index ) {
35  return MediaWikiServices::getInstance()->getNamespaceInfo()->isMovable( $index );
36  }
37 
45  public static function isSubject( $index ) {
46  return MediaWikiServices::getInstance()->getNamespaceInfo()->isSubject( $index );
47  }
48 
55  public static function isTalk( $index ) {
56  return MediaWikiServices::getInstance()->getNamespaceInfo()->isTalk( $index );
57  }
58 
65  public static function getTalk( $index ) {
66  return MediaWikiServices::getInstance()->getNamespaceInfo()->getTalk( $index );
67  }
68 
76  public static function getSubject( $index ) {
77  return MediaWikiServices::getInstance()->getNamespaceInfo()->getSubject( $index );
78  }
79 
88  public static function getAssociated( $index ) {
89  return MediaWikiServices::getInstance()->getNamespaceInfo()->getAssociated( $index );
90  }
91 
100  public static function exists( $index ) {
101  return MediaWikiServices::getInstance()->getNamespaceInfo()->exists( $index );
102  }
103 
118  public static function equals( $ns1, $ns2 ) {
119  return MediaWikiServices::getInstance()->getNamespaceInfo()->equals( $ns1, $ns2 );
120  }
121 
133  public static function subjectEquals( $ns1, $ns2 ) {
134  return MediaWikiServices::getInstance()->getNamespaceInfo()->
135  subjectEquals( $ns1, $ns2 );
136  }
137 
145  public static function getCanonicalNamespaces() {
146  return MediaWikiServices::getInstance()->getNamespaceInfo()->getCanonicalNamespaces();
147  }
148 
155  public static function getCanonicalName( $index ) {
156  return MediaWikiServices::getInstance()->getNamespaceInfo()->getCanonicalName( $index );
157  }
158 
166  public static function getCanonicalIndex( $name ) {
167  return MediaWikiServices::getInstance()->getNamespaceInfo()->getCanonicalIndex( $name );
168  }
169 
175  public static function getValidNamespaces() {
176  return MediaWikiServices::getInstance()->getNamespaceInfo()->getValidNamespaces();
177  }
178 
187  public static function hasTalkNamespace( $index ) {
188  return MediaWikiServices::getInstance()->getNamespaceInfo()->hasTalkNamespace( $index );
189  }
190 
198  public static function isContent( $index ) {
199  return MediaWikiServices::getInstance()->getNamespaceInfo()->isContent( $index );
200  }
201 
209  public static function wantSignatures( $index ) {
210  return MediaWikiServices::getInstance()->getNamespaceInfo()->wantSignatures( $index );
211  }
212 
219  public static function isWatchable( $index ) {
220  return MediaWikiServices::getInstance()->getNamespaceInfo()->isWatchable( $index );
221  }
222 
229  public static function hasSubpages( $index ) {
230  return MediaWikiServices::getInstance()->getNamespaceInfo()->hasSubpages( $index );
231  }
232 
237  public static function getContentNamespaces() {
238  return MediaWikiServices::getInstance()->getNamespaceInfo()->getContentNamespaces();
239  }
240 
247  public static function getSubjectNamespaces() {
248  return MediaWikiServices::getInstance()->getNamespaceInfo()->getSubjectNamespaces();
249  }
250 
257  public static function getTalkNamespaces() {
258  return MediaWikiServices::getInstance()->getNamespaceInfo()->getTalkNamespaces();
259  }
260 
267  public static function isCapitalized( $index ) {
268  return MediaWikiServices::getInstance()->getNamespaceInfo()->isCapitalized( $index );
269  }
270 
279  public static function hasGenderDistinction( $index ) {
280  return MediaWikiServices::getInstance()->getNamespaceInfo()->
281  hasGenderDistinction( $index );
282  }
283 
291  public static function isNonincludable( $index ) {
292  return MediaWikiServices::getInstance()->getNamespaceInfo()->isNonincludable( $index );
293  }
294 
306  public static function getNamespaceContentModel( $index ) {
307  return MediaWikiServices::getInstance()->getNamespaceInfo()->
308  getNamespaceContentModel( $index );
309  }
310 
320  public static function getRestrictionLevels( $index, User $user = null ) {
321  return MediaWikiServices::getInstance()
322  ->getPermissionManager()
323  ->getNamespaceRestrictionLevels( $index, $user );
324  }
325 
336  public static function getCategoryLinkType( $index ) {
337  return MediaWikiServices::getInstance()->getNamespaceInfo()->
338  getCategoryLinkType( $index );
339  }
340 }
static getSubjectNamespaces()
List all namespace indices which are considered subject, aka not a talk or special namespace...
static getSubject( $index)
Get the subject namespace index for a given namespace Special namespaces (NS_MEDIA, NS_SPECIAL) are always the subject.
Definition: MWNamespace.php:76
static getAssociated( $index)
Get the associated namespace.
Definition: MWNamespace.php:88
static getCanonicalIndex( $name)
Returns the index for a given canonical name, or NULL The input must be converted to lower case first...
static getCanonicalNamespaces()
Returns array of all defined namespaces with their canonical (English) names.
static isTalk( $index)
Is the given namespace a talk namespace?
Definition: MWNamespace.php:55
static getTalkNamespaces()
List all namespace indices which are considered talks, aka not a subject or special namespace...
static isNonincludable( $index)
It is not possible to use pages from this namespace as template?
static isContent( $index)
Does this namespace contain content, for the purposes of calculating statistics, etc?
static getNamespaceContentModel( $index)
Get the default content model for a namespace This does not mean that all pages in that namespace hav...
static hasTalkNamespace( $index)
Does this namespace ever have a talk namespace?
The User object encapsulates all of the user-specific settings (user_id, name, rights, email address, options, last login time).
Definition: User.php:51
static isMovable( $index)
Can pages in the given namespace be moved?
Definition: MWNamespace.php:34
static exists( $index)
Returns whether the specified namespace exists.
static getContentNamespaces()
Get a list of all namespace indices which are considered to contain content.
static isWatchable( $index)
Can pages in a namespace be watched?
static equals( $ns1, $ns2)
Returns whether the specified namespaces are the same namespace.
static isCapitalized( $index)
Is the namespace first-letter capitalized?
static getCanonicalName( $index)
Returns the canonical (English) name for a given index.
static hasSubpages( $index)
Does the namespace allow subpages?
static getTalk( $index)
Get the talk namespace index for a given namespace.
Definition: MWNamespace.php:65
static getRestrictionLevels( $index, User $user=null)
Determine which restriction levels it makes sense to use in a namespace, optionally filtered by a use...
static isSubject( $index)
Is the given namespace is a subject (non-talk) namespace?
Definition: MWNamespace.php:45
static hasGenderDistinction( $index)
Does the namespace (potentially) have different aliases for different genders.
static wantSignatures( $index)
Might pages in this namespace require the use of the Signature button on the edit toolbar...
static subjectEquals( $ns1, $ns2)
Returns whether the specified namespaces share the same subject.
static getValidNamespaces()
Returns an array of the namespaces (by integer id) that exist on the wiki.
static getCategoryLinkType( $index)
Returns the link type to be used for categories.