MediaWiki REL1_28
Go to the documentation of this file.
36 public function __construct() {
37 parent::__construct( 'MyLanguage' );
38 }
47 public function getRedirect( $subpage ) {
48 $title = $this->findTitle( $subpage );
49 // Go to the main page if given invalid title.
50 if ( !$title ) {
51 $title = Title::newMainPage();
52 }
53 return $title;
54 }
65 public function findTitle( $subpage ) {
66 // base = title without language code suffix
67 // provided = the title as it was given
68 $base = $provided = null;
69 if ( $subpage !== null ) {
70 $provided = Title::newFromText( $subpage );
71 $base = $provided;
72 }
74 if ( $provided && strpos( $subpage, '/' ) !== false ) {
75 $pos = strrpos( $subpage, '/' );
76 $basepage = substr( $subpage, 0, $pos );
77 $code = substr( $subpage, $pos + 1 );
78 if ( strlen( $code ) && Language::isKnownLanguageTag( $code ) ) {
79 $base = Title::newFromText( $basepage );
80 }
81 }
83 if ( !$base ) {
84 return null;
85 }
87 if ( $base->isRedirect() ) {
88 $page = new WikiPage( $base );
89 $base = $page->getRedirectTarget();
90 }
92 $uiCode = $this->getLanguage()->getCode();
93 $proposed = $base->getSubpage( $uiCode );
94 if ( $proposed && $proposed->exists() && $uiCode !== $base->getPageLanguage()->getCode() ) {
95 return $proposed;
96 } elseif ( $provided && $provided->exists() ) {
97 return $provided;
98 } else {
99 return $base;
100 }
101 }
111 return true;
112 }
Superclass for any RedirectSpecialPage which redirects the user to a particular article (as opposed t...
Unlisted special page just to redirect the user to the translated version of a page,...
findTitle( $subpage)
Assuming the user's interface language is fi.
getRedirect( $subpage)
If the special page is a redirect, then get the Title object it redirects to.
Target can identify a specific user's language preference.
Shortcut to get user's language.
Class representing a MediaWiki article and history.
Definition WikiPage.php:32
namespace and then decline to actually register it file or subcat img or subcat $title
Definition hooks.txt:986
namespace are movable Hooks may change this value to override the return value of MWNamespace::isMovable(). 'NewDifferenceEngine' do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached $page
Definition hooks.txt:2534
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable & $code
Definition hooks.txt:887
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition injection.txt:37