* Correct case for formatNum
[lhc/web/wiklou.git] / includes / Namespace.php
index 6b468c8..3d618e6 100644 (file)
@@ -16,8 +16,8 @@ $wgCanonicalNamespaceNames = array(
        NS_USER_TALK        => 'User_talk',
        NS_PROJECT          => 'Project',
        NS_PROJECT_TALK     => 'Project_talk',
-       NS_IMAGE            => 'Image',
-       NS_IMAGE_TALK       => 'Image_talk',
+       NS_FILE             => 'File',
+       NS_FILE_TALK        => 'File_talk',
        NS_MEDIAWIKI        => 'MediaWiki',
        NS_MEDIAWIKI_TALK   => 'MediaWiki_talk',
        NS_TEMPLATE         => 'Template',
@@ -53,7 +53,7 @@ class MWNamespace {
         */
        public static function isMovable( $index ) {
                global $wgAllowImageMoving;
-               return !( $index < NS_MAIN || ($index == NS_IMAGE && !$wgAllowImageMoving)  || $index == NS_CATEGORY );
+               return !( $index < NS_MAIN || ($index == NS_FILE && !$wgAllowImageMoving)  || $index == NS_CATEGORY );
        }
 
        /**
@@ -105,11 +105,15 @@ class MWNamespace {
         * Returns the canonical (English Wikipedia) name for a given index
         *
         * @param $index Int: namespace index
-        * @return string
+        * @return string or false if no canonical definition.
         */
        public static function getCanonicalName( $index ) {
                global $wgCanonicalNamespaceNames;
-               return $wgCanonicalNamespaceNames[$index];
+               if( isset( $wgCanonicalNamespaceNames[$index] ) ) {
+                       return $wgCanonicalNamespaceNames[$index];
+               } else {
+                       return false;
+               }
        }
 
        /**
@@ -146,8 +150,8 @@ class MWNamespace {
         }
 
        /**
-        * Does this namespace contain content, for the purposes
-        * of calculating statistics, etc?
+        * Does this namespace contain content, for the purposes of calculating
+        * statistics, etc?
         *
         * @param $index Int: index to check
         * @return bool
@@ -167,4 +171,15 @@ class MWNamespace {
                return $index >= NS_MAIN;
        }
 
+       /**
+        * Does the namespace allow subpages?
+        *
+        * @param $index int Index to check
+        * @return bool
+        */
+       public static function hasSubpages( $index ) {
+               global $wgNamespacesWithSubpages;
+               return !empty( $wgNamespacesWithSubpages[$index] );
+       }
+
 }