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 canTalk( $index ) {
188  wfDeprecated( __METHOD__, '1.30' );
189  return self::hasTalkNamespace( $index );
190  }
191 
200  public static function hasTalkNamespace( $index ) {
201  return MediaWikiServices::getInstance()->getNamespaceInfo()->hasTalkNamespace( $index );
202  }
203 
211  public static function isContent( $index ) {
212  return MediaWikiServices::getInstance()->getNamespaceInfo()->isContent( $index );
213  }
214 
222  public static function wantSignatures( $index ) {
223  return MediaWikiServices::getInstance()->getNamespaceInfo()->wantSignatures( $index );
224  }
225 
232  public static function isWatchable( $index ) {
233  return MediaWikiServices::getInstance()->getNamespaceInfo()->isWatchable( $index );
234  }
235 
242  public static function hasSubpages( $index ) {
243  return MediaWikiServices::getInstance()->getNamespaceInfo()->hasSubpages( $index );
244  }
245 
250  public static function getContentNamespaces() {
251  return MediaWikiServices::getInstance()->getNamespaceInfo()->getContentNamespaces();
252  }
253 
260  public static function getSubjectNamespaces() {
261  return MediaWikiServices::getInstance()->getNamespaceInfo()->getSubjectNamespaces();
262  }
263 
270  public static function getTalkNamespaces() {
271  return MediaWikiServices::getInstance()->getNamespaceInfo()->getTalkNamespaces();
272  }
273 
280  public static function isCapitalized( $index ) {
281  return MediaWikiServices::getInstance()->getNamespaceInfo()->isCapitalized( $index );
282  }
283 
292  public static function hasGenderDistinction( $index ) {
293  return MediaWikiServices::getInstance()->getNamespaceInfo()->
294  hasGenderDistinction( $index );
295  }
296 
304  public static function isNonincludable( $index ) {
305  return MediaWikiServices::getInstance()->getNamespaceInfo()->isNonincludable( $index );
306  }
307 
319  public static function getNamespaceContentModel( $index ) {
320  return MediaWikiServices::getInstance()->getNamespaceInfo()->
321  getNamespaceContentModel( $index );
322  }
323 
333  public static function getRestrictionLevels( $index, User $user = null ) {
334  return MediaWikiServices::getInstance()->getNamespaceInfo()->
335  getRestrictionLevels( $index, $user );
336  }
337 
348  public static function getCategoryLinkType( $index ) {
349  return MediaWikiServices::getInstance()->getNamespaceInfo()->
350  getCategoryLinkType( $index );
351  }
352 }
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 canTalk( $index)
Does this namespace ever have a talk 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:48
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
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
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.