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 = array(); /** @var SpecialPage $page */ foreach ( $pages as $page ) { if ( $page->isListed() ) { $group = $page->getFinalGroupName(); if ( !isset( $groups[$group] ) ) { $groups[$group] = array(); } $groups[$group][$page->getDescription()] = array( $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', array( 'class' => 'mw-specialpages-list' ) ) . '