Move namespace constants from Language to Namespace
authorBrion Vibber <brion@users.mediawiki.org>
Sat, 15 Nov 2003 12:53:17 +0000 (12:53 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sat, 15 Nov 2003 12:53:17 +0000 (12:53 +0000)
includes/Namespace.php
languages/Language.php

index 670f880..3831ca0 100644 (file)
@@ -4,23 +4,40 @@
 # "magic" behaviors of them based on index.  The textual
 # names of the namespaces are handled by Language.php.
 
+# Virtual namespaces; these don't appear in the page database:
+define("NS_MEDIA", -2);
+define("NS_SPECIAL", -1);
+
+# Real namespaces:
+define("NS_MAIN", 0);
+define("NS_TALK", 1);
+define("NS_USER", 2);
+define("NS_USER_TALK", 3);
+define("NS_WP", 4);
+define("NS_WP_TALK", 5);
+define("NS_IMAGE", 6);
+define("NS_IMAGE_TALK", 7);
+define("NS_MEDIAWIKI", 8);
+define("NS_MEDIAWIKI_TALK", 9);
+
 class Namespace {
 
-       function getSpecial() { return -1; }
-       function getUser() { return 2; }
-       function getWikipedia() { return 4; }
-       function getImage() { return 6; }
-       function getMedia() { return -2; }
+       /* These functions are deprecated */
+       function getSpecial() { return NS_SPECIAL; }
+       function getUser() { return NS_USER; }
+       function getWikipedia() { return NS_WP; }
+       function getImage() { return NS_IMAGE; }
+       function getMedia() { return NS_MEDIA; }
 
        function isMovable( $index )
        {
-               if ( $index < 0 || $index > 5 ) { return false; }
+               if ( $index < NS_MAIN || $index > NS_WP_TALK ) { return false; }
                return true;
        }
 
        function isTalk( $index )
        {
-               if ( 1 == $index || 3 == $index || 5 == $index || 7 == $index ) {
+               if ( NS_TALK == $index || NS_USER_TALK == $index || NS_WP_TALK == $index || NS_IMAGE_TALK == $index || NS_MEDIAWIKI_TALK == $index ) {
                        return true;
                }
                return false;
@@ -33,6 +50,7 @@ class Namespace {
                if ( Namespace::isTalk( $index ) ) {
                        return $index;
                } else {
+                       # FIXME
                        return $index + 1;
                }
        }
index d75062f..89c11d1 100644 (file)
@@ -3,20 +3,6 @@
 # Constants
 #--------------------------------------------------------------------------
 
-# Namespaces
-define("NS_MEDIA", -2);
-define("NS_SPECIAL", -1);
-define("NS_MAIN", 0);
-define("NS_TALK", 1);
-define("NS_USER", 2);
-define("NS_USER_TALK", 3);
-define("NS_WP", 4);
-define("NS_WP_TALK", 5);
-define("NS_IMAGE", 6);
-define("NS_IMAGE_TALK", 7);
-define("NS_MEDIAWIKI", 8);
-define("NS_MEDIAWIKI_TALK", 9);
-
 # Magic words
 define("MAG_REDIRECT", 0);
 define("MAG_NOTOC", 1);