Introducing $wgFeed variable. Allows tuning sydication feeds off, when desired.
[lhc/web/wiklou.git] / includes / SpecialSpecialpages.php
1 <?php
2 /**
3 *
4 * @addtogroup SpecialPage
5 */
6
7 /**
8 *
9 */
10 function wfSpecialSpecialpages() {
11 global $wgOut, $wgUser, $wgMessageCache;
12
13 $wgMessageCache->loadAllMessages();
14
15 $wgOut->setRobotpolicy( 'noindex,nofollow' ); # Is this really needed?
16 $sk = $wgUser->getSkin();
17
18 /** Pages available to all */
19 wfSpecialSpecialpages_gen( SpecialPage::getRegularPages(), 'spheading', $sk );
20
21 /** Restricted special pages */
22 wfSpecialSpecialpages_gen( SpecialPage::getRestrictedPages(), 'restrictedpheading', $sk );
23 }
24
25 /**
26 * sub function generating the list of pages
27 * @param $pages the list of pages
28 * @param $heading header to be used
29 * @param $sk skin object ???
30 */
31 function wfSpecialSpecialpages_gen($pages,$heading,$sk) {
32 global $wgOut, $wgSortSpecialPages;
33
34 if( count( $pages ) == 0 ) {
35 # Yeah, that was pointless. Thanks for coming.
36 return;
37 }
38
39 /** Put them into a sortable array */
40 $sortedPages = array();
41 foreach ( $pages as $page ) {
42 if ( $page->isListed() ) {
43 $sortedPages[$page->getDescription()] = $page->getTitle();
44 }
45 }
46
47 /** Sort */
48 if ( $wgSortSpecialPages ) {
49 ksort( $sortedPages );
50 }
51
52 /** Now output the HTML */
53 $wgOut->addHTML( '<h2>' . wfMsgHtml( $heading ) . "</h2>\n<ul>" );
54 foreach ( $sortedPages as $desc => $title ) {
55 $link = $sk->makeKnownLinkObj( $title , htmlspecialchars( $desc ) );
56 $wgOut->addHTML( "<li>{$link}</li>\n" );
57 }
58 $wgOut->addHTML( "</ul>\n" );
59 }
60
61