Make Whatlinkshere subclass SpecialPage.
[lhc/web/wiklou.git] / includes / specials / SpecialWhatlinkshere.php
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