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