From aeb7799605e3abce159018da1cca14de768bb231 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Thu, 17 Sep 2009 08:33:07 +0000 Subject: [PATCH] Add setting $wgAJAXCategoriesNamespaces to allow configuring namespaces for where the category add/remove widget is used when $wgUseAJAXCategories is set to true. Default behaviour has been left unchanged. --- includes/DefaultSettings.php | 8 ++++++++ includes/OutputPage.php | 8 +++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index bc4d85f1c2..3997a1fef3 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -4236,6 +4236,14 @@ $wgMemoryLimit = "50M"; */ $wgUseAJAXCategories = false; +/** + * Only enable AJAXCategories on configured namespaces. Default is all. + * + * Example: + * $wgAJAXCategoriesNamespaces = array( NS_MAIN, NS_PROJECT ); + */ +$wgAJAXCategoriesNamespaces = array(); + /** * To disable file delete/restore temporarily */ diff --git a/includes/OutputPage.php b/includes/OutputPage.php index abf33fee1b..68eacc8aba 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -1160,7 +1160,13 @@ class OutputPage { global $wgUseAJAXCategories; if ($wgUseAJAXCategories) { - $this->addScriptClass( 'ajaxCategories' ); + global $wgAJAXCategoriesNamespaces; + + $title = $this->getTitle(); + + if( empty( $wgAJAXCategoriesNamespaces ) || in_array( $title->getNamespace(), $wgAJAXCategoriesNamespaces ) ) { + $this->addScriptClass( 'ajaxCategories' ); + } } if( $wgUniversalEditButton ) { -- 2.20.1