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',
*/
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 );
}
/**
* 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;
+ }
}
/**
}
/**
- * 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
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] );
+ }
+
}