MediaWiki
REL1_30
SpecialGoToInterwiki.php
Go to the documentation of this file.
1
<?php
36
class
SpecialGoToInterwiki
extends
UnlistedSpecialPage
{
37
public
function
__construct
( $name =
'GoToInterwiki'
) {
38
parent::__construct( $name );
39
}
40
41
public
function
execute
( $par ) {
42
$this->
setHeaders
();
43
$target = Title::newFromText( $par );
44
// Disallow special pages as a precaution against
45
// possible redirect loops.
46
if
( !$target || $target->isSpecialPage() ) {
47
$this->
getOutput
()->setStatusCode( 404 );
48
$this->
getOutput
()->addWikiMsg(
'gotointerwiki-invalid'
);
49
return
;
50
}
51
52
$url = $target->getFullURL();
53
if
( !$target->isExternal() || $target->isLocal() ) {
54
// Either a normal page, or a local interwiki.
55
// just redirect.
56
$this->
getOutput
()->redirect( $url,
'301'
);
57
}
else
{
58
$this->
getOutput
()->addWikiMsg(
59
'gotointerwiki-external'
,
60
$url,
61
$target->getFullText()
62
);
63
}
64
}
65
69
public
function
requiresWrite
() {
70
return
false
;
71
}
72
76
protected
function
getGroupName
() {
77
return
'redirects'
;
78
}
79
}
SpecialGoToInterwiki
Landing page for non-local interwiki links.
Definition
SpecialGoToInterwiki.php:36
SpecialGoToInterwiki\__construct
__construct( $name='GoToInterwiki')
Definition
SpecialGoToInterwiki.php:37
SpecialGoToInterwiki\requiresWrite
requiresWrite()
Definition
SpecialGoToInterwiki.php:69
SpecialGoToInterwiki\getGroupName
getGroupName()
Definition
SpecialGoToInterwiki.php:76
SpecialGoToInterwiki\execute
execute( $par)
Default execute method Checks user permissions.
Definition
SpecialGoToInterwiki.php:41
SpecialPage\setHeaders
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
Definition
SpecialPage.php:527
SpecialPage\getOutput
getOutput()
Get the OutputPage being used for this instance.
Definition
SpecialPage.php:721
UnlistedSpecialPage
Shortcut to construct a special page which is unlisted by default.
Definition
UnlistedSpecialPage.php:29
includes
specials
SpecialGoToInterwiki.php
Generated on Mon Nov 25 2024 15:42:55 for MediaWiki by
1.10.0