From: Chad Horohoe Date: Wed, 15 Apr 2009 04:39:49 +0000 (+0000) Subject: Make Whatlinkshere subclass SpecialPage. X-Git-Tag: 1.31.0-rc.0~42140 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=9d91ed5e93d3634b76f0b6df9854963b032049e8;p=lhc%2Fweb%2Fwiklou.git Make Whatlinkshere subclass SpecialPage. --- diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index 12cbdab083..7235ba2754 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -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', diff --git a/includes/SpecialPage.php b/includes/SpecialPage.php index 31b438395c..fae2df1c1b 100644 --- a/includes/SpecialPage.php +++ b/includes/SpecialPage.php @@ -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 diff --git a/includes/specials/SpecialWhatlinkshere.php b/includes/specials/SpecialWhatlinkshere.php index be008525c6..dd8eee33b3 100644 --- a/includes/specials/SpecialWhatlinkshere.php +++ b/includes/specials/SpecialWhatlinkshere.php @@ -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