Extension:NonincludableNamespaces

This extension is designed to emulate and extend the function of the $wgNonincludableNamespaces configuration variable, which was introduced in MediaWiki v1.10.0.


 * In versions of MW < 1.10.0, it emulates the functionality of the config variable, along with the additional functionality detailed below.
 * In versions of MW >= 1.10.0, there is already code to handle this variable correctly, but the extension adds a couple of configuration short-cuts that make things a bit more flexible.

Usage
This extension adds the full functionality of, plus the enhancements below, to versions of MediaWiki < 1.10.0. From 1.10.0 upwards,  exists natively in the software, in which case the extension simply implements the additional features.

Emulated features

 * If  is not set, then all transclusion is allowed.
 * If  is an array then transclusion is not allowed for any namespaces included in the array.  Elements must be numeric namespace ids.

Additional features

 * If  is not an array then it is evaluated as a boolean with the following results:
 * If  then no transclusion is allowed, except from the template namespace.
 * If  then no transclusion is allowed at all.

Developers
The extension defines the constant  when it is loaded, so extension developers can check whether the   variable is supported, either via MW or this extension, by using the following code:

if ( version_compare($wgVersion, '1.10.0', '>=') || NIN_Installed ) { // Installed }

Source
Available on my test wiki.