Fixing whitespace.
[mediawiki.git] / includes / SpecialSpecialpages.php
blobbb202358216f9599ee0936b56cf293eb1ee7950f
1 <?php
2 /**
4 * @addtogroup SpecialPage
5 */
7 /**
9 */
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 );
19 /** Restricted special pages */
20 wfSpecialSpecialpages_gen( SpecialPage::getRestrictedPages(), 'restrictedpheading', $sk );
23 /**
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 ???
29 function wfSpecialSpecialpages_gen($pages,$heading,$sk) {
30 global $wgOut, $wgSortSpecialPages;
32 if( count( $pages ) == 0 ) {
33 # Yeah, that was pointless. Thanks for coming.
34 return;
37 /** Put them into a sortable array */
38 $sortedPages = array();
39 foreach ( $pages as $page ) {
40 if ( $page->isListed() ) {
41 $sortedPages[$page->getDescription()] = $page->getTitle();
45 /** Sort */
46 if ( $wgSortSpecialPages ) {
47 ksort( $sortedPages );
50 /** Now output the HTML */
51 $wgOut->addHTML( '<h2>' . wfMsgHtml( $heading ) . "</h2>\n<ul>" );
52 foreach ( $sortedPages as $desc => $title ) {
53 $link = $sk->makeKnownLinkObj( $title , htmlspecialchars( $desc ) );
54 $wgOut->addHTML( "<li>{$link}</li>\n" );
56 $wgOut->addHTML( "</ul>\n" );