X-Git-Url: http://git.cyclocoop.org/%7B%7B%20url_for%28%27admin_vote_add%27%29%20%7D%7D?a=blobdiff_plain;f=includes%2FMWNamespace.php;h=e03a29b80f08f68dbf59ec10f7f7c6411cfefd98;hb=495331ff0705dd93239ec6ab449921d84f33a6c9;hp=73fdd826eb80121601c435e5d7c40f1c234f7791;hpb=1669047884543d3678825ac8d93b7381b5d0d79d;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/MWNamespace.php b/includes/MWNamespace.php index 73fdd826eb..e03a29b80f 100644 --- a/includes/MWNamespace.php +++ b/includes/MWNamespace.php @@ -477,7 +477,7 @@ class MWNamespace { * * @since 1.23 * @param int $index Index to check - * @param User $user User to check + * @param User|null $user User to check * @return array */ public static function getRestrictionLevels( $index, User $user = null ) { @@ -540,4 +540,26 @@ class MWNamespace { return $usableLevels; } + + /** + * Returns the link type to be used for categories. + * + * This determines which section of a category page titles + * in the namespace will appear within. + * + * @since 1.32 + * @param int $index Namespace index + * @return string One of 'subcat', 'file', 'page' + */ + public static function getCategoryLinkType( $index ) { + self::isMethodValidFor( $index, __METHOD__ ); + + if ( $index == NS_CATEGORY ) { + return 'subcat'; + } elseif ( $index == NS_FILE ) { + return 'file'; + } else { + return 'page'; + } + } }