4 * @addtogroup SpecialPage
10 function wfSpecialSpecialpages() {
11 global $wgOut, $wgUser;
13 $wgOut->setRobotpolicy( 'index,nofollow' );
14 $sk = $wgUser->getSkin();
16 /** Pages available to all */
17 wfSpecialSpecialpages_gen( SpecialPage
::getRegularPages(), 'spheading', $sk, false );
19 /** Restricted special pages */
20 wfSpecialSpecialpages_gen( SpecialPage
::getRestrictedPages(), 'restrictedpheading', $sk, true );
24 * sub function generating the list of pages
25 * @param $pages the list of pages
26 * @param $heading header to be used
27 * @param $sk skin object ???
28 * @param $restricted, restricted pages or not
30 function wfSpecialSpecialpages_gen($pages,$heading,$sk,$restricted) {
31 global $wgOut, $wgUser, $wgSortSpecialPages, $wgLogRestrictions, $wgLogNames;
33 if( count( $pages ) == 0 ) {
34 # Yeah, that was pointless. Thanks for coming.
38 /** Put them into a sortable array */
39 $sortedPages = array();
40 foreach ( $pages as $page ) {
41 if ( $page->isListed() ) {
42 $sortedPages[$page->getDescription()] = $page->getTitle();
47 if ( $restricted && isset($wgLogRestrictions) ) {
48 foreach ( $wgLogRestrictions as $type => $restriction ) {
49 $page = SpecialPage
::getTitleFor( 'Log', $type );
50 if ( $restriction != '' && $wgUser->isAllowed( $restriction ) ) {
51 $name = wfMsgHtml( $wgLogNames[$type] );
52 $sortedPages[$name] = $page;
58 if ( $wgSortSpecialPages ) {
59 ksort( $sortedPages );
62 /** Now output the HTML */
63 $wgOut->addHTML( '<h2>' . wfMsgHtml( $heading ) . "</h2>\n<ul>" );
64 foreach ( $sortedPages as $desc => $title ) {
65 $link = $sk->makeKnownLinkObj( $title , htmlspecialchars( $desc ) );
66 $wgOut->addHTML( "<li>{$link}</li>\n" );
68 $wgOut->addHTML( "</ul>\n" );