MediaWiki master
SpecialRedirectToSpecial.php
Go to the documentation of this file.
1<?php
10namespace MediaWiki\SpecialPage;
11
13
21 protected $redirName;
22
24 protected $redirSubpage;
25
35 public function __construct(
36 $name, $redirName, $redirSubpage = false,
37 $allowedRedirectParams = [], $addedRedirectParams = []
38 ) {
39 parent::__construct( $name );
40 $this->redirName = $redirName;
41 $this->redirSubpage = $redirSubpage;
42 $this->mAllowedRedirectParams = $allowedRedirectParams;
43 $this->mAddedRedirectParams = $addedRedirectParams;
44 }
45
50 public function getRedirect( $subpage ) {
51 if ( $this->redirSubpage === false ) {
52 return SpecialPage::getTitleFor( $this->redirName, $subpage );
53 }
54
55 return SpecialPage::getTitleFor( $this->redirName, $this->redirSubpage );
56 }
57}
58
60class_alias( SpecialRedirectToSpecial::class, 'SpecialRedirectToSpecial' );
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 false $redirSubpage
Name of subpage of redirect target.
__construct( $name, $redirName, $redirSubpage=false, $allowedRedirectParams=[], $addedRedirectParams=[])
Represents a title within MediaWiki.
Definition Title.php:69