[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/ -> MWNamespace.php (summary)

Provide things related to namespaces. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

File Size: 496 lines (14 kb)
Included or required:0 times
Referenced: 1 time
Includes or requires: 0 files

Defines 1 class

MWNamespace:: (26 methods):
  isMethodValidFor()
  isMovable()
  isSubject()
  isTalk()
  getTalk()
  getSubject()
  getAssociated()
  exists()
  equals()
  subjectEquals()
  getCanonicalNamespaces()
  getCanonicalName()
  getCanonicalIndex()
  getValidNamespaces()
  canTalk()
  isContent()
  isWatchable()
  hasSubpages()
  getContentNamespaces()
  getSubjectNamespaces()
  getTalkNamespaces()
  isCapitalized()
  hasGenderDistinction()
  isNonincludable()
  getNamespaceContentModel()
  getRestrictionLevels()


Class: MWNamespace  - X-Ref

This is a utility class with only static functions
for dealing with namespaces that encodes all the
"magic" behaviors of them based on index.  The textual
names of the namespaces are handled by Language.php.

These are synonyms for the names given in the language file
Users and translators should not change them

isMethodValidFor( $index, $method )   X-Ref
Throw an exception when trying to get the subject or talk page
for a given namespace where it does not make sense.
Special namespaces are defined in includes/Defines.php and have
a value below 0 (ex: NS_SPECIAL = -1 , NS_MEDIA = -2)

param: int $index
param: string $method
return: bool

isMovable( $index )   X-Ref
Can pages in the given namespace be moved?

param: int $index Namespace index
return: bool

isSubject( $index )   X-Ref
Is the given namespace is a subject (non-talk) namespace?

param: int $index Namespace index
return: bool

isTalk( $index )   X-Ref
Is the given namespace a talk namespace?

param: int $index Namespace index
return: bool

getTalk( $index )   X-Ref
Get the talk namespace index for a given namespace

param: int $index Namespace index
return: int

getSubject( $index )   X-Ref
Get the subject namespace index for a given namespace
Special namespaces (NS_MEDIA, NS_SPECIAL) are always the subject.

param: int $index Namespace index
return: int

getAssociated( $index )   X-Ref
Get the associated namespace.
For talk namespaces, returns the subject (non-talk) namespace
For subject (non-talk) namespaces, returns the talk namespace

param: int $index Namespace index
return: int|null If no associated namespace could be found

exists( $index )   X-Ref
Returns whether the specified namespace exists

param: int $index
return: bool

equals( $ns1, $ns2 )   X-Ref
Returns whether the specified namespaces are the same namespace

param: int $ns1 The first namespace index
param: int $ns2 The second namespace index
return: bool

subjectEquals( $ns1, $ns2 )   X-Ref
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.

param: int $ns1 The first namespace index
param: int $ns2 The second namespace index
return: bool

getCanonicalNamespaces( $rebuild = false )   X-Ref
Returns array of all defined namespaces with their canonical
(English) names.

param: bool $rebuild Rebuild namespace list (default = false). Used for testing.
return: array

getCanonicalName( $index )   X-Ref
Returns the canonical (English) name for a given index

param: int $index Namespace index
return: string|bool If no canonical definition.

getCanonicalIndex( $name )   X-Ref
Returns the index for a given canonical name, or NULL
The input *must* be converted to lower case first

param: string $name Namespace name
return: int

getValidNamespaces()   X-Ref
Returns an array of the namespaces (by integer id) that exist on the
wiki. Used primarily by the api in help documentation.

return: array

canTalk( $index )   X-Ref
Can this namespace ever have a talk namespace?

param: int $index Namespace index
return: bool

isContent( $index )   X-Ref
Does this namespace contain content, for the purposes of calculating
statistics, etc?

param: int $index Index to check
return: bool

isWatchable( $index )   X-Ref
Can pages in a namespace be watched?

param: int $index
return: bool

hasSubpages( $index )   X-Ref
Does the namespace allow subpages?

param: int $index Index to check
return: bool

getContentNamespaces()   X-Ref
Get a list of all namespace indices which are considered to contain content

return: array Array of namespace indices

getSubjectNamespaces()   X-Ref
List all namespace indices which are considered subject, aka not a talk
or special namespace. See also MWNamespace::isSubject

return: array Array of namespace indices

getTalkNamespaces()   X-Ref
List all namespace indices which are considered talks, aka not a subject
or special namespace. See also MWNamespace::isTalk

return: array Array of namespace indices

isCapitalized( $index )   X-Ref
Is the namespace first-letter capitalized?

param: int $index Index to check
return: bool

hasGenderDistinction( $index )   X-Ref
Does the namespace (potentially) have different aliases for different
genders. Not all languages make a distinction here.

param: int $index Index to check
return: bool

isNonincludable( $index )   X-Ref
It is not possible to use pages from this namespace as template?

param: int $index Index to check
return: bool

getNamespaceContentModel( $index )   X-Ref
Get the default content model for a namespace
This does not mean that all pages in that namespace have the model

param: int $index Index to check
return: null|string Default model name for the given namespace, if set

getRestrictionLevels( $index, User $user = null )   X-Ref
Determine which restriction levels it makes sense to use in a namespace,
optionally filtered by a user's rights.

param: int $index Index to check
param: User $user User to check
return: array



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1