5 * @subpackage SpecialPage
11 function wfSpecialSpecialpages() {
12 global $wgOut, $wgUser;
14 $wgOut->setRobotpolicy( 'index,nofollow' );
15 $sk = $wgUser->getSkin();
17 # Get listable pages, in a 2-d array with the first dimension being user right
18 $pages = SpecialPage
::getPages();
20 /** Pages available to all */
21 wfSpecialSpecialpages_gen($pages[''],'spheading',$sk);
23 /** Restricted special pages */
25 foreach ( $pages['restricted'] as $name => $page ) {
26 if( $wgUser->isAllowed( $page->getRestriction() ) ) {
27 $rpages[$name] = $page;
30 wfSpecialSpecialpages_gen( $rpages, 'restrictedpheading', $sk );
34 * sub function generating the list of pages
35 * @param $pages the list of pages
36 * @param $heading header to be used
37 * @param $sk skin object ???
39 function wfSpecialSpecialpages_gen($pages,$heading,$sk) {
40 global $wgOut, $wgSortSpecialPages;
42 if( count( $pages ) == 0 ) {
43 # Yeah, that was pointless. Thanks for coming.
47 /** Put them into a sortable array */
48 $sortedPages = array();
49 foreach ( $pages as $name => $page ) {
50 if ( $page->isListed() ) {
51 $sortedPages[$page->getDescription()] = $page->getTitle();
56 if ( $wgSortSpecialPages ) {
57 ksort( $sortedPages );
60 /** Now output the HTML */
61 $wgOut->addHTML( '<h2>' . wfMsgHtml( $heading ) . "</h2>\n<ul>" );
62 foreach ( $sortedPages as $desc => $title ) {
63 $link = $sk->makeKnownLinkObj( $title, $desc );
64 $wgOut->addHTML( "<li>{$link}</li>\n" );
66 $wgOut->addHTML( "</ul>\n" );