Fixing special pages, esp. dropdown list in the nostalgia skin
authorTim Starling <tstarling@users.mediawiki.org>
Thu, 20 May 2004 14:13:03 +0000 (14:13 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Thu, 20 May 2004 14:13:03 +0000 (14:13 +0000)
includes/QueryPage.php
includes/Skin.php
includes/SpecialPage.php
includes/SpecialSpecialpages.php

index 5b68965..6ffd116 100644 (file)
@@ -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() {
index 336a868..91faf5b 100644 (file)
@@ -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" );
index 01e7185..6d131e1 100644 (file)
@@ -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;
index 094ae61..e60910f 100644 (file)
@@ -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);