MediaWiki REL1_39
SpecialRedirectToSpecial.php
Go to the documentation of this file.
1<?php
31 protected $redirName;
32
34 protected $redirSubpage;
35
45 public function __construct(
46 $name, $redirName, $redirSubpage = false,
47 $allowedRedirectParams = [], $addedRedirectParams = []
48 ) {
49 parent::__construct( $name );
50 $this->redirName = $redirName;
51 $this->redirSubpage = $redirSubpage;
52 $this->mAllowedRedirectParams = $allowedRedirectParams;
53 $this->mAddedRedirectParams = $addedRedirectParams;
54 }
55
60 public function getRedirect( $subpage ) {
61 if ( $this->redirSubpage === false ) {
62 return SpecialPage::getTitleFor( $this->redirName, $subpage );
63 }
64
65 return SpecialPage::getTitleFor( $this->redirName, $this->redirSubpage );
66 }
67}
Shortcut to construct a special page alias.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
string $redirName
Name of redirect target.
string false $redirSubpage
Name of subpage of redirect target.
__construct( $name, $redirName, $redirSubpage=false, $allowedRedirectParams=[], $addedRedirectParams=[])