32 parent::__construct(
'Specialpages' );
39 $out->setPreventClickjacking(
false );
40 $out->addModuleStyles(
'mediawiki.special' );
42 $groups = $this->getPageGroups();
44 if ( $groups ===
false ) {
49 $this->outputPageList( $groups );
52 private function getPageGroups() {
55 if ( $pages === [] ) {
63 foreach ( $pages as $page ) {
64 $group = $page->getFinalGroupName();
65 if ( !isset( $groups[$group] ) ) {
68 $groups[$group][$page->getDescription()] = [
69 $page->getPageTitle(),
70 $page->isRestricted(),
76 foreach ( $groups as $group => $sortedPages ) {
77 ksort( $groups[$group] );
81 if ( array_key_exists(
'other', $groups ) ) {
82 $other = $groups[
'other'];
83 unset( $groups[
'other'] );
84 $groups[
'other'] = $other;
90 private function outputPageList( $groups ) {
93 $includesRestrictedPages =
false;
94 $includesCachedPages =
false;
96 foreach ( $groups as $group => $sortedPages ) {
97 if ( strpos( $group,
'/' ) !==
false ) {
98 list( $group, $subGroup ) = explode(
'/', $group, 2 );
100 "<h3 class=\"mw-specialpagessubgroup\">$1</h3>\n",
101 "specialpages-group-$group-$subGroup"
105 "<h2 class=\"mw-specialpagesgroup\" id=\"mw-specialpagesgroup-$group\">$1</h2>\n",
106 "specialpages-group-$group"
110 Html::openElement(
'div', [
'class' =>
'mw-specialpages-list' ] )
113 foreach ( $sortedPages as $desc => [
$title, $restricted, $cached ] ) {
116 $includesCachedPages =
true;
117 $pageClasses[] =
'mw-specialpagecached';
120 $includesRestrictedPages =
true;
121 $pageClasses[] =
'mw-specialpagerestricted';
125 $out->addHTML( Html::rawElement(
127 [
'class' => $pageClasses ],
132 Html::closeElement(
'ul' ) .
133 Html::closeElement(
'div' )
139 if ( $includesRestrictedPages ) {
140 $restricedMsg = $this->
msg(
'specialpages-note-restricted' );
141 if ( !$restricedMsg->isDisabled() ) {
142 $notes[] = $restricedMsg->plain();
145 if ( $includesCachedPages ) {
146 $cachedMsg = $this->
msg(
'specialpages-note-cached' );
147 if ( !$cachedMsg->isDisabled() ) {
148 $notes[] = $cachedMsg->plain();
151 if ( $notes !== [] ) {
153 "<h2 class=\"mw-specialpages-note-top\">$1</h2>",
'specialpages-note-top'
155 $out->wrapWikiTextAsInterface(
156 'mw-specialpages-notes',
157 implode(
"\n", $notes )
Parent class for all special pages.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getOutput()
Get the OutputPage being used for this instance.
getUser()
Shortcut to get the User executing this instance.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
A special page that lists special pages.
execute( $par)
Default execute method Checks user permissions.
Shortcut to construct a special page which is unlisted by default.