X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FNamespace.php;h=46af0029a2f4bee33e283b897aafb934dd6c0e06;hb=75ef257c2986ffc9ddab85800367932b7fdb1fa1;hp=bdccca16eb67c099aef49b56ff98217a0fbe2105;hpb=3d7f9d6fee486a2bd8dd5037bb0d2dac9c57644d;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Namespace.php b/includes/Namespace.php index bdccca16eb..46af0029a2 100644 --- a/includes/Namespace.php +++ b/includes/Namespace.php @@ -1,6 +1,22 @@ '' ) + $wgCanonicalNamespaceNames; if ( is_array( $wgExtraNamespaces ) ) { @@ -316,6 +342,33 @@ class MWNamespace { return $wgContentNamespaces; } } + + /** + * List all namespace indices which are considered subject, aka not a talk + * or special namespace. See also MWNamespace::isSubject + * + * @return array of namespace indices + */ + public static function getSubjectNamespaces() { + return array_filter( + MWNamespace::getValidNamespaces(), + 'MWNamespace::isSubject' + ); + } + + /** + * List all namespace indices which are considered talks, aka not a subject + * or special namespace. See also MWNamespace::isTalk + * + * @return array of namespace indices + */ + public static function getTalkNamespaces() { + return array_filter( + MWNamespace::getValidNamespaces(), + 'MWNamespace::isTalk' + ); + } + /** * Is the namespace first-letter capitalized? * @@ -361,9 +414,23 @@ class MWNamespace { * @param $index int Index to check * @return bool */ - public static function isNonincludableNamespace( $index ) { + public static function isNonincludable( $index ) { global $wgNonincludableNamespaces; return $wgNonincludableNamespaces && in_array( $index, $wgNonincludableNamespaces ); } + /** + * Get the default content model for a namespace + * This does not mean that all pages in that namespace have the model + * + * @since 1.21 + * @param $index int Index to check + * @return null|string default model name for the given namespace, if set + */ + public static function getNamespaceContentModel( $index ) { + global $wgNamespaceContentModels; + return isset( $wgNamespaceContentModels[$index] ) + ? $wgNamespaceContentModels[$index] + : null; + } }