5 * @subpackage SpecialPage
11 function wfSpecialSpecialpages() {
14 $wgOut->setRobotpolicy( 'index,nofollow' );
16 /** Pages available to all */
17 wfSpecialSpecialpages_gen( SpecialPage
::getRegularPages(), 'spheading' );
19 /** Restricted special pages */
20 wfSpecialSpecialpages_gen( SpecialPage
::getRestrictedPages(), 'restrictedpheading' );
24 * sub function generating the list of pages
25 * @param $pages the list of pages
26 * @param $heading header to be used
28 function wfSpecialSpecialpages_gen( $pages, $heading ) {
29 global $wgOut, $wgSortSpecialPages;
31 if( count( $pages ) == 0 ) {
32 # Yeah, that was pointless. Thanks for coming.
36 /** Put them into a sortable array */
37 $sortedPages = array();
38 foreach ( $pages as $name => $page ) {
39 if ( $page->isListed() ) {
40 $sortedPages[$page->getDescription()] = $page->getTitle();
45 if ( $wgSortSpecialPages ) {
46 ksort( $sortedPages );
49 /** Now output the HTML */
50 $wgOut->addHTML( '<h2>' . wfMsgHtml( $heading ) . "</h2>\n<ul>" );
51 foreach ( $sortedPages as $desc => $title ) {
52 $link = Linker
::makeKnownLinkObj( $title, $desc );
53 $wgOut->addHTML( "<li>{$link}</li>\n" );
55 $wgOut->addHTML( "</ul>\n" );