MediaWiki  1.23.16
SpecialGoToInterwiki.php
Go to the documentation of this file.
1 <?php
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\getGroupName
getGroupName()
Definition: SpecialGoToInterwiki.php:76
Title\newFromText
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:189
SpecialGoToInterwiki\__construct
__construct( $name='GoToInterwiki')
Definition: SpecialGoToInterwiki.php:37
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
SpecialGoToInterwiki\requiresWrite
requiresWrite()
Definition: SpecialGoToInterwiki.php:69
SpecialPage\getOutput
getOutput()
Get the OutputPage being used for this instance.
Definition: SpecialPage.php:535
UnlistedSpecialPage
Shortcut to construct a special page which is unlisted by default.
Definition: UnlistedSpecialPage.php:29
SpecialPage\setHeaders
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
Definition: SpecialPage.php:352
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:336
SpecialGoToInterwiki\execute
execute( $par)
Default execute method Checks user permissions, calls the function given in mFunction.
Definition: SpecialGoToInterwiki.php:41
SpecialGoToInterwiki
Landing page for non-local interwiki links.
Definition: SpecialGoToInterwiki.php:36