MediaWiki  master
SpecialRedirectToSpecial.php
Go to the documentation of this file.
1 <?php
25 
33  protected $redirName;
34 
36  protected $redirSubpage;
37 
47  public function __construct(
48  $name, $redirName, $redirSubpage = false,
49  $allowedRedirectParams = [], $addedRedirectParams = []
50  ) {
51  parent::__construct( $name );
52  $this->redirName = $redirName;
53  $this->redirSubpage = $redirSubpage;
54  $this->mAllowedRedirectParams = $allowedRedirectParams;
55  $this->mAddedRedirectParams = $addedRedirectParams;
56  }
57 
62  public function getRedirect( $subpage ) {
63  if ( $this->redirSubpage === false ) {
64  return SpecialPage::getTitleFor( $this->redirName, $subpage );
65  }
66 
67  return SpecialPage::getTitleFor( $this->redirName, $this->redirSubpage );
68  }
69 }
Represents a title within MediaWiki.
Definition: Title.php:82
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=[])