MediaWiki
REL1_34
SpecialFilepath.php
Go to the documentation of this file.
1
<?php
29
class
SpecialFilepath
extends
RedirectSpecialPage
{
30
public
function
__construct
() {
31
parent::__construct(
'Filepath'
);
32
$this->mAllowedRedirectParams = [
'width'
,
'height'
];
33
}
34
41
public
function
getRedirect
( $par ) {
42
$file
= $par ?: $this->
getRequest
()->getText(
'file'
);
43
44
$redirect =
null
;
45
if
(
$file
) {
46
$redirect =
SpecialPage::getSafeTitleFor
(
'Redirect'
,
"file/$file"
);
47
}
48
if
( $redirect ===
null
) {
49
// The user input is empty or an invalid title,
50
// redirect to form of Special:Redirect with the invalid value prefilled
51
$this->mAddedRedirectParams[
'wpvalue'
] =
$file
;
52
$redirect =
SpecialPage::getSafeTitleFor
(
'Redirect'
,
'file'
);
53
}
54
return
$redirect;
55
}
56
57
protected
function
getGroupName
() {
58
return
'media'
;
59
}
60
}
RedirectSpecialPage
Shortcut to construct a special page alias.
Definition
RedirectSpecialPage.php:29
SpecialFilepath
A special page that redirects to the URL of a given file.
Definition
SpecialFilepath.php:29
SpecialFilepath\__construct
__construct()
Definition
SpecialFilepath.php:30
SpecialFilepath\getGroupName
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Definition
SpecialFilepath.php:57
SpecialFilepath\getRedirect
getRedirect( $par)
Implement by redirecting through Special:Redirect/file.
Definition
SpecialFilepath.php:41
SpecialPage\getSafeTitleFor
static getSafeTitleFor( $name, $subpage=false)
Get a localised Title object for a page name with a possibly unvalidated subpage.
Definition
SpecialPage.php:112
SpecialPage\getRequest
getRequest()
Get the WebRequest being used for this instance.
Definition
SpecialPage.php:709
$file
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.
Definition
router.php:42
includes
specials
SpecialFilepath.php
Generated on Mon Nov 25 2024 16:05:52 for MediaWiki by
1.10.0