getOutput(); $this->setHeaders(); $this->outputHeader(); $out->allowClickjacking(); $out->addModuleStyles( 'mediawiki.special' ); $groups = $this->getPageGroups(); if ( $groups === false ) { return; } $this->addHelpLink( 'Help:Special pages' ); $this->outputPageList( $groups ); } private function getPageGroups() { $pages = MediaWikiServices::getInstance()->getSpecialPageFactory()-> getUsablePages( $this->getUser() ); if ( $pages === [] ) { # Yeah, that was pointless. Thanks for coming. return false; } /** Put them into a sortable array */ $groups = []; /** @var SpecialPage $page */ foreach ( $pages as $page ) { if ( $page->isListed() ) { $group = $page->getFinalGroupName(); if ( !isset( $groups[$group] ) ) { $groups[$group] = []; } $groups[$group][$page->getDescription()] = [ $page->getPageTitle(), $page->isRestricted(), $page->isCached() ]; } } /** Sort */ foreach ( $groups as $group => $sortedPages ) { ksort( $groups[$group] ); } /** Always move "other" to end */ if ( array_key_exists( 'other', $groups ) ) { $other = $groups['other']; unset( $groups['other'] ); $groups['other'] = $other; } return $groups; } private function outputPageList( $groups ) { $out = $this->getOutput(); $includesRestrictedPages = false; $includesCachedPages = false; foreach ( $groups as $group => $sortedPages ) { if ( strpos( $group, '/' ) !== false ) { list( $group, $subGroup ) = explode( '/', $group, 2 ); $out->wrapWikiMsg( "

$1

\n", "specialpages-group-$group-$subGroup" ); } else { $out->wrapWikiMsg( "

$1

\n", "specialpages-group-$group" ); } $out->addHTML( Html::openElement( 'div', [ 'class' => 'mw-specialpages-list' ] ) . '