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 = SpecialPageFactory::getUsablePages( $this->getUser() ); if ( !count( $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 ) { $out->wrapWikiMsg( "

$1

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