}
function execute( $par ) {
+ $out = $this->getOutput();
$this->setHeaders();
$this->outputHeader();
+ $out->allowClickjacking();
+ $out->addModuleStyles( 'mediawiki.special' );
$groups = $this->getPageGroups();
private function getPageGroups() {
global $wgSortSpecialPages;
- $pages = SpecialPage::getUsablePages();
+ $pages = SpecialPageFactory::getUsablePages( $this->getUser() );
if( !count( $pages ) ) {
# Yeah, that was pointless. Thanks for coming.
$groups = array();
foreach ( $pages as $page ) {
if ( $page->isListed() ) {
- $group = SpecialPage::getGroup( $page );
+ $group = SpecialPageFactory::getGroup( $page );
if( !isset( $groups[$group] ) ) {
$groups[$group] = array();
}
- $groups[$group][$page->getDescription()] = array( $page->getTitle(), $page->isRestricted() );
+ $groups[$group][$page->getDescription()] = array(
+ $page->getTitle(),
+ $page->isRestricted(),
+ $page->isCached()
+ );
}
}
}
private function outputPageList( $groups ) {
- global $wgUser, $wgOut;
+ $out = $this->getOutput();
- $sk = $wgUser->getSkin();
$includesRestrictedPages = false;
+ $includesCachedPages = false;
foreach ( $groups as $group => $sortedPages ) {
- $middle = ceil( count( $sortedPages )/2 );
$total = count( $sortedPages );
+ $middle = ceil( $total / 2 );
$count = 0;
- $wgOut->wrapWikiMsg( "<h4 class=\"mw-specialpagesgroup\" id=\"mw-specialpagesgroup-$group\">$1</h4>\n", "specialpages-group-$group" );
- $wgOut->addHTML(
+ $out->wrapWikiMsg( "<h2 class=\"mw-specialpagesgroup\" id=\"mw-specialpagesgroup-$group\">$1</h2>\n", "specialpages-group-$group" );
+ $out->addHTML(
Html::openElement( 'table', array( 'style' => 'width:100%;', 'class' => 'mw-specialpages-table' ) ) ."\n" .
Html::openElement( 'tr' ) . "\n" .
Html::openElement( 'td', array( 'style' => 'width:30%;vertical-align:top' ) ) . "\n" .
Html::openElement( 'ul' ) . "\n"
);
foreach( $sortedPages as $desc => $specialpage ) {
- list( $title, $restricted ) = $specialpage;
- $link = $sk->linkKnown( $title , htmlspecialchars( $desc ) );
+ list( $title, $restricted, $cached ) = $specialpage;
+
+ $pageClasses = array();
+ if ( $cached ) {
+ $includesCachedPages = true;
+ $pageClasses[] = 'mw-specialpagecached';
+ }
if( $restricted ) {
$includesRestrictedPages = true;
- $wgOut->addHTML( Html::rawElement( 'li', array( 'class' => 'mw-specialpages-page mw-specialpagerestricted' ), Html::rawElement( 'strong', array(), $link ) ) . "\n" );
- } else {
- $wgOut->addHTML( Html::rawElement( 'li', array(), $link ) . "\n" );
+ $pageClasses[] = 'mw-specialpagerestricted';
}
+ $link = Linker::linkKnown( $title , htmlspecialchars( $desc ) );
+ $out->addHTML( Html::rawElement( 'li', array( 'class' => implode( ' ', $pageClasses ) ), $link ) . "\n" );
+
# Split up the larger groups
$count++;
if( $total > 3 && $count == $middle ) {
- $wgOut->addHTML(
+ $out->addHTML(
Html::closeElement( 'ul' ) . Html::closeElement( 'td' ) .
Html::element( 'td', array( 'style' => 'width:10%' ), '' ) .
Html::openElement( 'td', array( 'style' => 'width:30%' ) ) . Html::openElement( 'ul' ) . "\n"
);
}
}
- $wgOut->addHTML(
+ $out->addHTML(
Html::closeElement( 'ul' ) . Html::closeElement( 'td' ) .
Html::element( 'td', array( 'style' => 'width:30%' ), '' ) .
Html::closeElement( 'tr' ) . Html::closeElement( 'table' ) . "\n"
);
}
- if ( $includesRestrictedPages ) {
- $wgOut->wrapWikiMsg( "<div class=\"mw-specialpages-notes\">\n$1\n</div>", 'specialpages-note' );
+ if ( $includesRestrictedPages || $includesCachedPages ) {
+ $out->wrapWikiMsg( "<div class=\"mw-specialpages-notes\">\n$1\n</div>", 'specialpages-note' );
}
}
}