MediaWiki master
SpecialRedirectToSpecial.php
Go to the documentation of this file.
1<?php
24namespace MediaWiki\SpecialPage;
25
27
35 protected $redirName;
36
38 protected $redirSubpage;
39
49 public function __construct(
50 $name, $redirName, $redirSubpage = false,
51 $allowedRedirectParams = [], $addedRedirectParams = []
52 ) {
53 parent::__construct( $name );
54 $this->redirName = $redirName;
55 $this->redirSubpage = $redirSubpage;
56 $this->mAllowedRedirectParams = $allowedRedirectParams;
57 $this->mAddedRedirectParams = $addedRedirectParams;
58 }
59
64 public function getRedirect( $subpage ) {
65 if ( $this->redirSubpage === false ) {
66 return SpecialPage::getTitleFor( $this->redirName, $subpage );
67 }
68
69 return SpecialPage::getTitleFor( $this->redirName, $this->redirSubpage );
70 }
71}
72
74class_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:78