From bed371083b9e864cf6656670933d931b3de59664 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Wed, 18 Jun 2008 20:45:10 +0000 Subject: [PATCH] Made NewpagesForm extends SpecialPage and renamed it to SpecialNewpages --- includes/AutoLoader.php | 2 +- includes/SpecialPage.php | 2 +- includes/specials/Newpages.php | 42 +++++++++++++++------------------- 3 files changed, 20 insertions(+), 26 deletions(-) diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index 7156f146b3..ce8e610258 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -407,7 +407,7 @@ class AutoLoader { 'MostlinkedPage' => 'includes/specials/Mostlinked.php', 'MostrevisionsPage' => 'includes/specials/Mostrevisions.php', 'MovePageForm' => 'includes/specials/Movepage.php', - 'NewPagesForm' => 'includes/specials/Newpages.php', + 'SpecialNewpages' => 'includes/specials/Newpages.php', 'NewPagesPager' => 'includes/specials/Newpages.php', 'PageArchive' => 'includes/specials/Undelete.php', 'PasswordResetForm' => 'includes/specials/Resetpass.php', diff --git a/includes/SpecialPage.php b/includes/SpecialPage.php index 4e7373a0ed..f9211e9587 100644 --- a/includes/SpecialPage.php +++ b/includes/SpecialPage.php @@ -116,7 +116,7 @@ class SpecialPage 'Fewestrevisions' => array( 'SpecialPage', 'Fewestrevisions' ), 'Shortpages' => array( 'SpecialPage', 'Shortpages' ), 'Longpages' => array( 'SpecialPage', 'Longpages' ), - 'Newpages' => array( 'IncludableSpecialPage', 'Newpages' ), + 'Newpages' => 'SpecialNewpages', 'Ancientpages' => array( 'SpecialPage', 'Ancientpages' ), 'Deadendpages' => array( 'SpecialPage', 'Deadendpages' ), 'Protectedpages' => array( 'SpecialPage', 'Protectedpages' ), diff --git a/includes/specials/Newpages.php b/includes/specials/Newpages.php index 886eb446b2..72a01836d0 100644 --- a/includes/specials/Newpages.php +++ b/includes/specials/Newpages.php @@ -1,30 +1,22 @@ execute( $par, $sp->including() ); -} /** * implements Special:Newpages * @ingroup SpecialPage */ -class NewPagesForm { +class SpecialNewpages extends SpecialPage { // Stored objects - protected $opts, $title, $skin; + protected $opts, $skin; // Some internal settings protected $showNavigation = false; + public function __construct(){ + parent::__construct( 'Newpages' ); + $this->includable( true ); + } + protected function setup( $par ) { global $wgRequest, $wgUser, $wgEnableNewpagesUserFilter; @@ -52,7 +44,6 @@ class NewPagesForm { // Store some objects $this->skin = $wgUser->getSkin(); - $this->title = SpecialPage::getTitleFor( 'NewPages' ); } protected function parseParams( $par ) { @@ -89,16 +80,18 @@ class NewPagesForm { * Show a form for filtering namespace and username * * @param string $par - * @param bool $including true if the page is being included with {{Special:Newpages}} * @return string */ - public function execute( $par, $including ) { + public function execute( $par ) { global $wgLang, $wgGroupPermissions, $wgUser, $wgOut; - $this->showNavigation = !$including; // Maybe changed in setup + $this->setHeaders(); + $this->outputHeader(); + + $this->showNavigation = !$this->including(); // Maybe changed in setup $this->setup( $par ); - if( !$including ) { + if( !$this->including() ) { // Settings $this->form(); @@ -146,9 +139,10 @@ class NewPagesForm { $changed = $this->opts->getChangedValues(); unset($changed['offset']); // Reset offset if query type changes + $self = $this->getTitle(); foreach ( $filters as $key => $msg ) { $onoff = 1 - $this->opts->getValue($key); - $link = $this->skin->makeKnownLinkObj( $this->title, $showhide[$onoff], + $link = $this->skin->makeKnownLinkObj( $self, $showhide[$onoff], wfArrayToCGI( array( $key => $onoff ), $changed ) ); $links[$key] = wfMsgHtml( $msg, $link ); @@ -177,7 +171,7 @@ class NewPagesForm { $hidden = implode( "\n", $hidden ); $form = Xml::openElement( 'form', array( 'action' => $wgScript ) ) . - Xml::hidden( 'title', $this->title->getPrefixedDBkey() ) . + Xml::hidden( 'title', $this->getTitle()->getPrefixedDBkey() ) . Xml::fieldset( wfMsg( 'newpages' ) ) . Xml::openElement( 'table', array( 'id' => 'mw-newpages-table' ) ) . " @@ -284,7 +278,7 @@ class NewPagesForm { $feed = new $wgFeedClasses[$type]( $this->feedTitle(), wfMsg( 'tagline' ), - $this->title->getFullUrl() ); + $this->getTitle()->getFullUrl() ); $pager = new NewPagesPager( $this, $this->opts ); $limit = $this->opts->getValue( 'limit' ); @@ -369,7 +363,7 @@ class NewPagesPager extends ReverseChronologicalPager { function getTitle(){ static $title = null; if ( $title === null ) - $title = SpecialPage::getTitleFor( 'Newpages' ); + $title = $this->mForm->getTitle(); return $title; } -- 2.20.1