Updated (unused) recentchangestext, some corrections (bugs and otherwise)
[mediawiki.git] / includes / Namespace.php
blob03b351f9b17fab3c214791028dada0e05b98bfd2
1 <?
2 # This is a utility class with only static functions
3 # for dealing with namespaces that encodes all the
4 # "magic" behaviors of them based on index. The textual
5 # names of the namespaces are handled by Language.php.
7 class Namespace {
9 function getSpecial() { return -1; }
10 function getUser() { return 2; }
11 function getWikipedia() { return 4; }
12 function getImage() { return 6; }
14 function isMovable( $index )
16 if ( $index < 0 || $index > 5 ) { return false; }
17 return true;
20 function isTalk( $index )
22 if ( 1 == $index || 3 == $index || 5 == $index || 7 == $index ) {
23 return true;
25 return false;
28 # Get the talk namespace corresponding to the given index
30 function getTalk( $index )
32 if ( Namespace::isTalk( $index ) ) {
33 return $index;
34 } else {
35 return $index + 1;
39 function getSubject( $index )
41 if ( Namespace::isTalk( $index ) ) {
42 return $index - 1;
43 } else {
44 return $index;