10 function wfSpecialSpecialpages() {
11 global $wgOut, $wgUser, $wgMessageCache, $wgSortSpecialPages;
13 $wgMessageCache->loadAllMessages();
15 $wgOut->setRobotpolicy( 'noindex,nofollow' ); # Is this really needed?
16 $sk = $wgUser->getSkin();
18 $pages = SpecialPage
::getUsablePages();
20 if( count( $pages ) == 0 ) {
21 # Yeah, that was pointless. Thanks for coming.
25 /** Put them into a sortable array */
27 foreach ( $pages as $page ) {
28 if ( $page->isListed() ) {
29 $group = SpecialPage
::getGroup( $page );
30 if( !isset($groups[$group]) ) {
31 $groups[$group] = array();
33 $groups[$group][$page->getDescription()] = array( $page->getTitle(), $page->isRestricted() );
38 if ( $wgSortSpecialPages ) {
39 foreach( $groups as $group => $sortedPages ) {
40 ksort( $groups[$group] );
44 /** Always move "other" to end */
45 if( array_key_exists('other',$groups) ) {
46 $other = $groups['other'];
47 unset( $groups['other'] );
48 $groups['other'] = $other;
51 /** Now output the HTML */
52 $restrictedPages = false;
53 foreach ( $groups as $group => $sortedPages ) {
54 $wgOut->addHTML( "<h4 class='mw-specialpagesgroup'>".wfMsgHtml("specialpages-group-$group")."</h4>\n" );
55 $wgOut->addHTML( "<ul class='mw-specialpages-section'>" );
56 foreach ( $sortedPages as $desc => $specialpage ) {
57 list( $title, $restricted ) = $specialpage;
58 $link = $sk->makeKnownLinkObj( $title , htmlspecialchars( $desc ) );
60 $wgOut->addHTML( "<li class='mw-specialpages-page mw-specialpagerestricted'>{$link}</li>\n" );
61 $restrictedPages = true;
63 $wgOut->addHTML( "<li class='mw-specialpages-page'>{$link}</li>\n" );
66 $wgOut->addHTML( "</ul>\n" );
69 Xml
::openElement('div', array( 'class' => 'mw-specialpages-notes' )).
70 wfMsgWikiHtml('specialpages-note').
71 Xml
::closeElement('div')