* @ingroup SpecialPage
*/
+use MediaWiki\MediaWikiServices;
+
/**
* A special page that lists special pages
*
}
private function getPageGroups() {
- $pages = SpecialPageFactory::getUsablePages( $this->getUser() );
+ $pages = MediaWikiServices::getInstance()->getSpecialPageFactory()->
+ getUsablePages( $this->getUser() );
- if ( !count( $pages ) ) {
+ if ( $pages === [] ) {
# Yeah, that was pointless. Thanks for coming.
return false;
}
$includesCachedPages = false;
foreach ( $groups as $group => $sortedPages ) {
- $out->wrapWikiMsg(
- "<h2 class=\"mw-specialpagesgroup\" id=\"mw-specialpagesgroup-$group\">$1</h2>\n",
- "specialpages-group-$group"
- );
+ if ( strpos( $group, '/' ) !== false ) {
+ list( $group, $subGroup ) = explode( '/', $group, 2 );
+ $out->wrapWikiMsg(
+ "<h3 class=\"mw-specialpagessubgroup\">$1</h3>\n",
+ "specialpages-group-$group-$subGroup"
+ );
+ } else {
+ $out->wrapWikiMsg(
+ "<h2 class=\"mw-specialpagesgroup\" id=\"mw-specialpagesgroup-$group\">$1</h2>\n",
+ "specialpages-group-$group"
+ );
+ }
$out->addHTML(
Html::openElement( 'div', [ 'class' => 'mw-specialpages-list' ] )
. '<ul>'
);
}
- if ( $includesRestrictedPages || $includesCachedPages ) {
- $out->wrapWikiMsg( "<h2 class=\"mw-specialpages-note-top\">$1</h2>", 'specialpages-note-top' );
- $out->wrapWikiMsg( "<div class=\"mw-specialpages-notes\">\n$1\n</div>", 'specialpages-note' );
+ // add legend
+ $notes = [];
+ if ( $includesRestrictedPages ) {
+ $restricedMsg = $this->msg( 'specialpages-note-restricted' );
+ if ( !$restricedMsg->isDisabled() ) {
+ $notes[] = $restricedMsg->plain();
+ }
+ }
+ if ( $includesCachedPages ) {
+ $cachedMsg = $this->msg( 'specialpages-note-cached' );
+ if ( !$cachedMsg->isDisabled() ) {
+ $notes[] = $cachedMsg->plain();
+ }
+ }
+ if ( $notes !== [] ) {
+ $out->wrapWikiMsg(
+ "<h2 class=\"mw-specialpages-note-top\">$1</h2>", 'specialpages-note-top'
+ );
+ $out->wrapWikiTextAsInterface(
+ 'mw-specialpages-notes',
+ implode( "\n", $notes )
+ );
}
}
}