diff --git a/.phpcs.xml b/.phpcs.xml index ca97268f..5493f8fa 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -2,7 +2,6 @@ - . diff --git a/includes/CategoryTreeCategoryViewer.php b/includes/CategoryTreeCategoryViewer.php index ea7f2558..9915cbee 100644 --- a/includes/CategoryTreeCategoryViewer.php +++ b/includes/CategoryTreeCategoryViewer.php @@ -30,14 +30,12 @@ class CategoryTreeCategoryViewer extends CategoryViewer { * @return CategoryTree */ private function getCategoryTree() { - global $wgCategoryTreeCategoryPageOptions; - if ( !isset( $this->categorytree ) ) { if ( !CategoryTreeHooks::shouldForceHeaders() ) { CategoryTree::setHeaders( $this->getOutput() ); } - $this->categorytree = new CategoryTree( $wgCategoryTreeCategoryPageOptions ); + $this->categorytree = new CategoryTree( $this->getConfig()->get( 'CategoryTreeCategoryPageOptions' ) ); } return $this->categorytree; diff --git a/includes/CategoryTreePage.php b/includes/CategoryTreePage.php index 0c945996..fa4ca4aa 100644 --- a/includes/CategoryTreePage.php +++ b/includes/CategoryTreePage.php @@ -45,12 +45,10 @@ class CategoryTreePage extends SpecialPage { * @return mixed */ private function getOption( $name ) { - global $wgCategoryTreeDefaultOptions; - if ( $this->tree ) { return $this->tree->getOption( $name ); } else { - return $wgCategoryTreeDefaultOptions[$name]; + return $this->getConfig()->get( 'CategoryTreeDefaultOptions' )[$name]; } } @@ -59,8 +57,6 @@ class CategoryTreePage extends SpecialPage { * @param string|null $par Parameters passed to the page */ public function execute( $par ) { - global $wgCategoryTreeDefaultOptions, $wgCategoryTreeSpecialPageOptions; - $this->setHeaders(); $this->addHelpLink( 'Extension:CategoryTree' ); $request = $this->getRequest(); @@ -79,11 +75,14 @@ class CategoryTreePage extends SpecialPage { $this->target = trim( $this->target ); $options = []; + $config = $this->getConfig(); # grab all known options from the request. Normalization is done by the CategoryTree class - foreach ( $wgCategoryTreeDefaultOptions as $option => $default ) { - if ( isset( $wgCategoryTreeSpecialPageOptions[$option] ) ) { - $default = $wgCategoryTreeSpecialPageOptions[$option]; + $categoryTreeDefaultOptions = $config->get( 'CategoryTreeDefaultOptions' ); + $categoryTreeSpecialPageOptions = $config->get( 'CategoryTreeSpecialPageOptions' ); + foreach ( $categoryTreeDefaultOptions as $option => $default ) { + if ( isset( $categoryTreeSpecialPageOptions[$option] ) ) { + $default = $categoryTreeSpecialPageOptions[$option]; } $options[$option] = $request->getVal( $option, $default );