Make Whatlinkshere subclass SpecialPage.
authorChad Horohoe <demon@users.mediawiki.org>
Wed, 15 Apr 2009 04:39:49 +0000 (04:39 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Wed, 15 Apr 2009 04:39:49 +0000 (04:39 +0000)
includes/AutoLoader.php
includes/SpecialPage.php
includes/specials/SpecialWhatlinkshere.php

index 12cbdab..7235ba2 100644 (file)
@@ -506,6 +506,7 @@ $wgAutoloadLocalClasses = array(
        'SpecialStatistics' => 'includes/specials/SpecialStatistics.php',
        'SpecialTags' => 'includes/specials/SpecialTags.php',
        'SpecialVersion' => 'includes/specials/SpecialVersion.php',
+       'SpecialWhatlinkshere' => 'includes/specials/SpecialWhatlinkshere.php',
        'UncategorizedCategoriesPage' => 'includes/specials/SpecialUncategorizedcategories.php',
        'UncategorizedPagesPage' => 'includes/specials/SpecialUncategorizedpages.php',
        'UncategorizedTemplatesPage' => 'includes/specials/SpecialUncategorizedtemplates.php',
@@ -522,7 +523,6 @@ $wgAutoloadLocalClasses = array(
        'WantedFilesPage' => 'includes/specials/SpecialWantedfiles.php',
        'WantedPagesPage' => 'includes/specials/SpecialWantedpages.php',
        'WantedTemplatesPage' => 'includes/specials/SpecialWantedtemplates.php',
-       'WhatLinksHerePage' => 'includes/specials/SpecialWhatlinkshere.php',
        'WikiImporter' => 'includes/Import.php',
        'WikiRevision' => 'includes/Import.php',
        'WithoutInterwikiPage' => 'includes/specials/SpecialWithoutinterwiki.php',
index 31b4383..fae2df1 100644 (file)
@@ -167,7 +167,7 @@ class SpecialPage
                'Export'                    => 'SpecialExport',
                'Import'                    => 'SpecialImport',
                'Undelete'                  => array( 'SpecialPage', 'Undelete', 'deletedhistory' ),
-               'Whatlinkshere'             => array( 'SpecialPage', 'Whatlinkshere' ),
+               'Whatlinkshere'             => 'SpecialWhatlinkshere',
                'MergeHistory'              => array( 'SpecialPage', 'MergeHistory', 'mergehistory' ),  
                
                # Other
index be00852..dd8eee3 100644 (file)
@@ -6,41 +6,28 @@
  * @ingroup SpecialPage
  */
 
-/**
- * Entry point
- * @param $par String: An article name ??
- */
-function wfSpecialWhatlinkshere($par = NULL) {
-       global $wgRequest;
-       $page = new WhatLinksHerePage( $wgRequest, $par );
-       $page->execute();
-}
-
 /**
  * implements Special:Whatlinkshere
  * @ingroup SpecialPage
  */
-class WhatLinksHerePage {
-       // Stored data
-       protected $par;
+class SpecialWhatLinksHere extends SpecialPage {
 
        // Stored objects
        protected $opts, $target, $selfTitle;
 
        // Stored globals
-       protected $skin, $request;
+       protected $skin;
 
        protected $limits = array( 20, 50, 100, 250, 500 );
 
-       function WhatLinksHerePage( $request, $par = null ) {
+       public function __construct() {
+               parent::__construct( 'Whatlinkshere' );
                global $wgUser;
-               $this->request = $request;
                $this->skin = $wgUser->getSkin();
-               $this->par = $par;
        }
 
-       function execute() {
-               global $wgOut;
+       function execute( $par ) {
+               global $wgOut, $wgRequest;
 
                $opts = new FormOptions();
 
@@ -54,12 +41,12 @@ class WhatLinksHerePage {
                $opts->add( 'hidelinks', false );
                $opts->add( 'hideimages', false );
 
-               $opts->fetchValuesFromRequest( $this->request );
+               $opts->fetchValuesFromRequest( $wgRequest );
                $opts->validateIntBounds( 'limit', 0, 5000 );
 
                // Give precedence to subpage syntax
-               if ( isset($this->par) ) {
-                       $opts->setValue( 'target', $this->par );
+               if ( isset($par) ) {
+                       $opts->setValue( 'target', $par );
                }
 
                // Bind to member variable