Lighter version using a sub function to avoid repetiting code. Will ease futur status...
[lhc/web/wiklou.git] / includes / SpecialSpecialpages.php
1 <?php
2
3 function wfSpecialSpecialpages()
4 {
5 global $wgLang, $wgOut, $wgUser;
6
7 # sub function generating the list of pages
8 # $SP : the list of pages
9 # $heading : header to be used
10 # $sk : skin object ???
11
12 function wfSpecialSpecialpages_gen($SP,$heading,$sk)
13 {
14 global $wgLang, $wgOut;
15
16 $wgOut->addHTML( "<h2>" . wfMsg( $heading ) . "</h2>\n<ul>" );
17 foreach ( $SP as $name => $desc ) {
18 if ( "" == $desc ) { continue; }
19 $link = $sk->makeKnownLink( $wgLang->specialPage( $name ), $desc );
20 $wgOut->addHTML( "<li>{$link}</li>\n" );
21 }
22 $wgOut->addHTML( "</ul>\n" );
23 }
24
25 $wgOut->setRobotpolicy( "index,nofollow" );
26 $sk = $wgUser->getSkin();
27
28 # all users special pages
29 wfSpecialSpecialpages_gen($wgLang->getValidSpecialPages(),"spheading",$sk);
30
31 # sysops only special pages
32 if ( $wgUser->isSysop() ) {
33 wfSpecialSpecialpages_gen($wgLang->getSysopSpecialPages(),"sysopspheading",$sk);
34 }
35
36 # developers only special pages
37 if ( $wgUser->isDeveloper() ) {
38 wfSpecialSpecialpages_gen($wgLang->getDeveloperSpecialPages(),"developerspheading",$sk);
39
40 }
41 }
42
43 ?>