MediaWiki REL1_33
SpecialFilepath.php
Go to the documentation of this file.
1<?php
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}
Shortcut to construct a special page alias.
A special page that redirects to the URL of a given file.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
getRedirect( $par)
Implement by redirecting through Special:Redirect/file.
static getSafeTitleFor( $name, $subpage=false)
Get a localised Title object for a page name with a possibly unvalidated subpage.
getRequest()
Get the WebRequest being used for this instance.
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Definition router.php:42