r36434 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r36433‎ | r36434 | r36435 >
Date:20:45, 18 June 2008
Author:ialex
Status:old
Tags:
Comment:
Made NewpagesForm extends SpecialPage and renamed it to SpecialNewpages
Modified paths:
  • /trunk/phase3/includes/AutoLoader.php (modified) (history)
  • /trunk/phase3/includes/SpecialPage.php (modified) (history)
  • /trunk/phase3/includes/specials/Newpages.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/AutoLoader.php
@@ -407,7 +407,7 @@
408408 'MostlinkedPage' => 'includes/specials/Mostlinked.php',
409409 'MostrevisionsPage' => 'includes/specials/Mostrevisions.php',
410410 'MovePageForm' => 'includes/specials/Movepage.php',
411 - 'NewPagesForm' => 'includes/specials/Newpages.php',
 411+ 'SpecialNewpages' => 'includes/specials/Newpages.php',
412412 'NewPagesPager' => 'includes/specials/Newpages.php',
413413 'PageArchive' => 'includes/specials/Undelete.php',
414414 'PasswordResetForm' => 'includes/specials/Resetpass.php',
Index: trunk/phase3/includes/specials/Newpages.php
@@ -1,30 +1,22 @@
22 <?php
3 -/**
4 - * @file
5 - * @ingroup SpecialPage
6 - */
73
8 -
94 /**
10 - * Start point
11 - */
12 -function wfSpecialNewPages( $par, $sp ) {
13 - $page = new NewPagesForm();
14 - $page->execute( $par, $sp->including() );
15 -}
16 -
17 -/**
185 * implements Special:Newpages
196 * @ingroup SpecialPage
207 */
21 -class NewPagesForm {
 8+class SpecialNewpages extends SpecialPage {
229
2310 // Stored objects
24 - protected $opts, $title, $skin;
 11+ protected $opts, $skin;
2512
2613 // Some internal settings
2714 protected $showNavigation = false;
2815
 16+ public function __construct(){
 17+ parent::__construct( 'Newpages' );
 18+ $this->includable( true );
 19+ }
 20+
2921 protected function setup( $par ) {
3022 global $wgRequest, $wgUser, $wgEnableNewpagesUserFilter;
3123
@@ -52,7 +44,6 @@
5345
5446 // Store some objects
5547 $this->skin = $wgUser->getSkin();
56 - $this->title = SpecialPage::getTitleFor( 'NewPages' );
5748 }
5849
5950 protected function parseParams( $par ) {
@@ -89,16 +80,18 @@
9081 * Show a form for filtering namespace and username
9182 *
9283 * @param string $par
93 - * @param bool $including true if the page is being included with {{Special:Newpages}}
9484 * @return string
9585 */
96 - public function execute( $par, $including ) {
 86+ public function execute( $par ) {
9787 global $wgLang, $wgGroupPermissions, $wgUser, $wgOut;
9888
99 - $this->showNavigation = !$including; // Maybe changed in setup
 89+ $this->setHeaders();
 90+ $this->outputHeader();
 91+
 92+ $this->showNavigation = !$this->including(); // Maybe changed in setup
10093 $this->setup( $par );
10194
102 - if( !$including ) {
 95+ if( !$this->including() ) {
10396 // Settings
10497 $this->form();
10598
@@ -146,9 +139,10 @@
147140 $changed = $this->opts->getChangedValues();
148141 unset($changed['offset']); // Reset offset if query type changes
149142
 143+ $self = $this->getTitle();
150144 foreach ( $filters as $key => $msg ) {
151145 $onoff = 1 - $this->opts->getValue($key);
152 - $link = $this->skin->makeKnownLinkObj( $this->title, $showhide[$onoff],
 146+ $link = $this->skin->makeKnownLinkObj( $self, $showhide[$onoff],
153147 wfArrayToCGI( array( $key => $onoff ), $changed )
154148 );
155149 $links[$key] = wfMsgHtml( $msg, $link );
@@ -177,7 +171,7 @@
178172 $hidden = implode( "\n", $hidden );
179173
180174 $form = Xml::openElement( 'form', array( 'action' => $wgScript ) ) .
181 - Xml::hidden( 'title', $this->title->getPrefixedDBkey() ) .
 175+ Xml::hidden( 'title', $this->getTitle()->getPrefixedDBkey() ) .
182176 Xml::fieldset( wfMsg( 'newpages' ) ) .
183177 Xml::openElement( 'table', array( 'id' => 'mw-newpages-table' ) ) .
184178 "<tr>
@@ -284,7 +278,7 @@
285279 $feed = new $wgFeedClasses[$type](
286280 $this->feedTitle(),
287281 wfMsg( 'tagline' ),
288 - $this->title->getFullUrl() );
 282+ $this->getTitle()->getFullUrl() );
289283
290284 $pager = new NewPagesPager( $this, $this->opts );
291285 $limit = $this->opts->getValue( 'limit' );
@@ -369,7 +363,7 @@
370364 function getTitle(){
371365 static $title = null;
372366 if ( $title === null )
373 - $title = SpecialPage::getTitleFor( 'Newpages' );
 367+ $title = $this->mForm->getTitle();
374368 return $title;
375369 }
376370
Index: trunk/phase3/includes/SpecialPage.php
@@ -116,7 +116,7 @@
117117 'Fewestrevisions' => array( 'SpecialPage', 'Fewestrevisions' ),
118118 'Shortpages' => array( 'SpecialPage', 'Shortpages' ),
119119 'Longpages' => array( 'SpecialPage', 'Longpages' ),
120 - 'Newpages' => array( 'IncludableSpecialPage', 'Newpages' ),
 120+ 'Newpages' => 'SpecialNewpages',
121121 'Ancientpages' => array( 'SpecialPage', 'Ancientpages' ),
122122 'Deadendpages' => array( 'SpecialPage', 'Deadendpages' ),
123123 'Protectedpages' => array( 'SpecialPage', 'Protectedpages' ),

Status & tagging log