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 }
MWNamespace\subjectEquals
static subjectEquals( $ns1, $ns2)
Returns whether the specified namespaces share the same subject.
Definition: MWNamespace.php:133
MWNamespace\isNonincludable
static isNonincludable( $index)
It is not possible to use pages from this namespace as template?
Definition: MWNamespace.php:291
MWNamespace\getCanonicalNamespaces
static getCanonicalNamespaces()
Returns array of all defined namespaces with their canonical (English) names.
Definition: MWNamespace.php:145
MWNamespace\getValidNamespaces
static getValidNamespaces()
Returns an array of the namespaces (by integer id) that exist on the wiki.
Definition: MWNamespace.php:175
MWNamespace\hasGenderDistinction
static hasGenderDistinction( $index)
Does the namespace (potentially) have different aliases for different genders.
Definition: MWNamespace.php:279
MWNamespace\isTalk
static isTalk( $index)
Is the given namespace a talk namespace?
Definition: MWNamespace.php:55
MWNamespace\getTalkNamespaces
static getTalkNamespaces()
List all namespace indices which are considered talks, aka not a subject or special namespace.
Definition: MWNamespace.php:257
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:155
MWNamespace\getNamespaceContentModel
static getNamespaceContentModel( $index)
Get the default content model for a namespace This does not mean that all pages in that namespace hav...
Definition: MWNamespace.php:306
MWNamespace\getSubjectNamespaces
static getSubjectNamespaces()
List all namespace indices which are considered subject, aka not a talk or special namespace.
Definition: MWNamespace.php:247
MWNamespace\getContentNamespaces
static getContentNamespaces()
Get a list of all namespace indices which are considered to contain content.
Definition: MWNamespace.php:237
MWNamespace\getCanonicalIndex
static getCanonicalIndex( $name)
Returns the index for a given canonical name, or NULL The input must be converted to lower case first...
Definition: MWNamespace.php:166
MWNamespace\isContent
static isContent( $index)
Does this namespace contain content, for the purposes of calculating statistics, etc?
Definition: MWNamespace.php:198
MWNamespace\hasTalkNamespace
static hasTalkNamespace( $index)
Does this namespace ever have a talk namespace?
Definition: MWNamespace.php:187
MWNamespace\hasSubpages
static hasSubpages( $index)
Does the namespace allow subpages?
Definition: MWNamespace.php:229
MWNamespace
Definition: MWNamespace.php:27
MWNamespace\getRestrictionLevels
static getRestrictionLevels( $index, User $user=null)
Determine which restriction levels it makes sense to use in a namespace, optionally filtered by a use...
Definition: MWNamespace.php:320
MWNamespace\isSubject
static isSubject( $index)
Is the given namespace is a subject (non-talk) namespace?
Definition: MWNamespace.php:45
MWNamespace\wantSignatures
static wantSignatures( $index)
Might pages in this namespace require the use of the Signature button on the edit toolbar?
Definition: MWNamespace.php:209
MWNamespace\isMovable
static isMovable( $index)
Can pages in the given namespace be moved?
Definition: MWNamespace.php:34
MWNamespace\exists
static exists( $index)
Returns whether the specified namespace exists.
Definition: MWNamespace.php:100
MWNamespace\equals
static equals( $ns1, $ns2)
Returns whether the specified namespaces are the same namespace.
Definition: MWNamespace.php:118
MWNamespace\getCategoryLinkType
static getCategoryLinkType( $index)
Returns the link type to be used for categories.
Definition: MWNamespace.php:336
MWNamespace\isCapitalized
static isCapitalized( $index)
Is the namespace first-letter capitalized?
Definition: MWNamespace.php:267
MWNamespace\isWatchable
static isWatchable( $index)
Can pages in a namespace be watched?
Definition: MWNamespace.php:219
MWNamespace\getTalk
static getTalk( $index)
Get the talk namespace index for a given namespace.
Definition: MWNamespace.php:65
MWNamespace\getSubject
static getSubject( $index)
Get the subject namespace index for a given namespace Special namespaces (NS_MEDIA,...
Definition: MWNamespace.php:76
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:55
MWNamespace\getAssociated
static getAssociated( $index)
Get the associated namespace.
Definition: MWNamespace.php:88
MWNamespace\getCanonicalName
static getCanonicalName( $index)
Returns the canonical (English) name for a given index.
Definition: MWNamespace.php:155