Modified Special:Categories to subclass SpecialPage
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 21 Aug 2010 15:39:07 +0000 (15:39 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 21 Aug 2010 15:39:07 +0000 (15:39 +0000)
includes/AutoLoader.php
includes/SpecialPage.php
includes/specials/SpecialCategories.php

index 4040ed9..97fbeda 100644 (file)
@@ -599,6 +599,7 @@ $wgAutoloadLocalClasses = array(
        'SpecialBlankpage' => 'includes/specials/SpecialBlankpage.php',
        'SpecialBlockme' => 'includes/specials/SpecialBlockme.php',
        'SpecialBookSources' => 'includes/specials/SpecialBooksources.php',
+       'SpecialCategories' => 'includes/specials/SpecialCategories.php',
        'SpecialComparePages' => 'includes/specials/SpecialComparePages.php',
        'SpecialExport' => 'includes/specials/SpecialExport.php',
        'SpecialFilepath' => 'includes/specials/SpecialFilepath.php',
index 97b3c05..e273f28 100644 (file)
@@ -111,7 +111,7 @@ class SpecialPage {
                # List of pages
                'Allpages'                  => 'SpecialAllpages',
                'Prefixindex'               => 'SpecialPrefixindex',
-               'Categories'                => array( 'SpecialPage', 'Categories' ),
+               'Categories'                => 'SpecialCategories',
                'Disambiguations'           => array( 'SpecialPage', 'Disambiguations' ),
                'Listredirects'             => array( 'SpecialPage', 'Listredirects' ),
 
index b24975e..35dadf9 100644 (file)
  * @ingroup SpecialPage
  */
 
-function wfSpecialCategories( $par=null ) {
-       global $wgOut, $wgRequest;
+/**
+ * @ingroup SpecialPage
+ */
+class SpecialCategories extends SpecialPage {
+
+       function __construct() {
+               parent::__construct( 'Categories' );
+       }
 
-       if( $par == '' ) {
-               $from = $wgRequest->getText( 'from' );
-       } else {
-               $from = $par;
+       function execute( $par ) {
+               global $wgOut, $wgRequest;
+
+               $this->setHeaders();
+               $this->outputHeader();
+
+               $from = $wgRequest->getText( 'from', $par );
+
+               $cap = new CategoryPager( $from );
+               $cap->doQuery();
+
+               $wgOut->addHTML(
+                       Html::openElement( 'div', array( 'class' => 'mw-spcontent' ) ) .
+                       wfMsgExt( 'categoriespagetext', array( 'parse' ), $cap->getNumRows() ) .
+                       $cap->getStartForm( $from ) .
+                       $cap->getNavigationBar() .
+                       '<ul>' . $cap->getBody() . '</ul>' .
+                       $cap->getNavigationBar() .
+                       Html::closeElement( 'div' )
+               );
        }
-       $cap = new CategoryPager( $from );
-       $cap->doQuery();
-       $wgOut->addHTML(
-               Xml::openElement( 'div', array('class' => 'mw-spcontent') ) .
-               wfMsgExt( 'categoriespagetext', array( 'parse' ), $cap->getNumRows() ) .
-               $cap->getStartForm( $from ) .
-               $cap->getNavigationBar() .
-               '<ul>' . $cap->getBody() . '</ul>' .
-               $cap->getNavigationBar() .
-               Xml::closeElement( 'div' )
-       );
 }
 
 /**