From f76a3fc34b3cc97db9fbb4c6be807979e02ce27c Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Thu, 20 May 2004 14:13:03 +0000 Subject: [PATCH] Fixing special pages, esp. dropdown list in the nostalgia skin --- includes/QueryPage.php | 9 ++++----- includes/Skin.php | 24 ++++++++---------------- includes/SpecialPage.php | 17 +++++++++++++++++ includes/SpecialSpecialpages.php | 18 ++++-------------- 4 files changed, 33 insertions(+), 35 deletions(-) diff --git a/includes/QueryPage.php b/includes/QueryPage.php index 5b68965c57..6ffd116623 100644 --- a/includes/QueryPage.php +++ b/includes/QueryPage.php @@ -8,8 +8,7 @@ require_once ( "Feed.php" ); class QueryPage { # Subclasses return their name here. Make sure the name is also - # specified in Language.php, both in the $wgValidSpecialPagesEn - # variable, and as a language message param. + # specified in SpecialPage.php and in Language.php as a language message param. function getName() { return ""; @@ -203,9 +202,9 @@ class QueryPage { function feedTitle() { global $wgLanguageCode, $wgSitename, $wgLang; - $pages = $wgLang->getValidSpecialPages(); - $title = $pages[$this->getName()]; - return "$wgSitename - $title [$wgLanguageCode]"; + $page = SpecialPage::getPage( $this->getName() ); + $desc = $page->getDescription(); + return "$wgSitename - $desc [$wgLanguageCode]"; } function feedDesc() { diff --git a/includes/Skin.php b/includes/Skin.php index 336a868c58..91faf5b5d5 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -1033,29 +1033,21 @@ class Skin { { global $wgUser, $wgOut, $wgLang, $wgServer, $wgRedirectScript; $a = array(); - - $validSP = $wgLang->getValidSpecialPages(); - - foreach ( $validSP as $name => $desc ) { - if ( "" == $desc ) { continue; } - $a[$name] = $desc; + $pages = SpecialPage::getPages(); + + foreach ( $pages[""] as $name => $page ) { + $a[$name] = $page->getDescription(); } if ( $wgUser->isSysop() ) { - $sysopSP = $wgLang->getSysopSpecialPages(); - - foreach ( $sysopSP as $name => $desc ) { - if ( "" == $desc ) { continue; } - $a[$name] = $desc ; + foreach ( $pages["sysop"] as $name => $page ) { + $a[$name] = $page->getDescription(); } } if ( $wgUser->isDeveloper() ) { - $devSP = $wgLang->getDeveloperSpecialPages(); - - foreach ( $devSP as $name => $desc ) { - if ( "" == $desc ) { continue; } - $a[$name] = $desc ; + foreach ( $pages["developer"] as $name => $page ) { + $a[$name] = $page->getDescription() ; } } $go = wfMsg( "go" ); diff --git a/includes/SpecialPage.php b/includes/SpecialPage.php index 01e71858a6..6d131e12a6 100644 --- a/includes/SpecialPage.php +++ b/includes/SpecialPage.php @@ -68,6 +68,23 @@ class SpecialPage } } + # Return categorised listable special pages + /* static */ function getPages() { + global $wgSpecialPages; + $pages = array( + "" => array(), + "sysop" => array(), + "developer" => array() + ); + + foreach ( $wgSpecialPages as $name => $page ) { + if ( $page->isListed() ) { + $pages[$page->getRestriction()][$page->getName()] =& $wgSpecialPages[$name]; + } + } + return $pages; + } + # Execute a special page path, which may contain slashes /* static */ function executePath( &$title ) { global $wgSpecialPages, $wgOut, $wgTitle; diff --git a/includes/SpecialSpecialpages.php b/includes/SpecialSpecialpages.php index 094ae61388..e60910f83a 100644 --- a/includes/SpecialSpecialpages.php +++ b/includes/SpecialSpecialpages.php @@ -2,23 +2,13 @@ function wfSpecialSpecialpages() { - global $wgLang, $wgOut, $wgUser, $wgSpecialPages; + global $wgLang, $wgOut, $wgUser; $wgOut->setRobotpolicy( "index,nofollow" ); $sk = $wgUser->getSkin(); - - # Categorise special pages - - $pages = array( - "" => array(), - "sysop" => array(), - "developer" => array() - ); - - foreach ( $wgSpecialPages as $page ) { - $pages[$page->getRestriction()][$page->getName()] = $page; - } - + + # Get listable pages + $pages = SpecialPage::getPages(); # all users special pages wfSpecialSpecialpages_gen($pages[""],"spheading",$sk); -- 2.20.1