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()->getNamespaceInfo()->
322  getRestrictionLevels( $index, $user );
323  }
324 
335  public static function getCategoryLinkType( $index ) {
336  return MediaWikiServices::getInstance()->getNamespaceInfo()->
337  getCategoryLinkType( $index );
338  }
339 }
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
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.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency MediaWikiServices
Definition: injection.txt:23
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.
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not null
Definition: hooks.txt:780
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?
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
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.
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:271
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.
return true to allow those checks to and false if checking is done & $user
Definition: hooks.txt:1473
static getCategoryLinkType( $index)
Returns the link type to be used for categories.