From 1fc0ad5a56ee9f3bb75668d3e1cc5024083fa8b3 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Sat, 21 Aug 2010 15:39:07 +0000 Subject: [PATCH] Modified Special:Categories to subclass SpecialPage --- includes/AutoLoader.php | 1 + includes/SpecialPage.php | 2 +- includes/specials/SpecialCategories.php | 45 +++++++++++++++---------- 3 files changed, 30 insertions(+), 18 deletions(-) diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index 4040ed97c5..97fbeda5df 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -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', diff --git a/includes/SpecialPage.php b/includes/SpecialPage.php index 97b3c055c3..e273f28f27 100644 --- a/includes/SpecialPage.php +++ b/includes/SpecialPage.php @@ -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' ), diff --git a/includes/specials/SpecialCategories.php b/includes/specials/SpecialCategories.php index b24975e1d6..35dadf9fac 100644 --- a/includes/specials/SpecialCategories.php +++ b/includes/specials/SpecialCategories.php @@ -21,25 +21,36 @@ * @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() . + '' . + $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() . - '' . - $cap->getNavigationBar() . - Xml::closeElement( 'div' ) - ); } /** -- 2.20.1