Go to the documentation of this file.
14 'wgLanguageCode' =>
'en',
18 'wgAllowUserJs' =>
false,
19 'wgDefaultLanguageVariant' =>
false,
29 foreach ( range( 1, 255 )
as $num ) {
31 if ( strpos(
"#[]{}<>|", $chr ) !==
false || preg_match(
"/[\\x00-\\x1f\\x7f]/", $chr ) ) {
32 $this->assertFalse( (
bool)preg_match(
"/[$titlechars]/", $chr ),
"chr($num) = $chr is not a valid titlechar" );
34 $this->assertTrue( (
bool)preg_match(
"/[$titlechars]/", $chr ),
"chr($num) = $chr is a valid titlechar" );
47 'wgLocalInterwikis' =>
array(
'localtestiw' ),
49 'InterwikiLoadPrefix' =>
array(
50 function ( $prefix, &$data ) {
51 if ( $prefix ===
'localtestiw' ) {
52 $data =
array(
'iw_url' =>
'localtestiw' );
53 } elseif ( $prefix ===
'remotetestiw' ) {
54 $data =
array(
'iw_url' =>
'remotetestiw' );
74 'File_talk:Example.svg',
79 'Category:' . str_repeat(
'x', 248 ),
80 str_repeat(
'x', 252 ),
82 'localtestiw: #anchor',
84 'localtestiw: foo # anchor',
85 'localtestiw: Talk: Sandbox # anchor',
87 'remotetestiw: Talk: # anchor',
89 'remotetestiw: Talk:',
90 'remotetestiw: Talk: Foo'
120 'Talk:File:Example.svg',
134 str_repeat(
'x', 256 ),
142 'localtestiw: Talk: # anchor',
152 ' %!"$&\'()*,\\-.\\/0-9:;=?@A-Z\\\\^_`a-z~\\x80-\\xFF+',
153 ' %!"$&\'()*,\\-./0-9:;=?@A-Z\\\\\\^_`a-z~+\\u0080-\\uFFFF',
157 'QWERTYf-\\x7F+\\u0080-\\uFFFF',
160 'QWERTY\\x66-\\xFD+',
161 'QWERTYf-\\x7F+\\u0080-\\uFFFF',
169 'QWERTYf-\\x7F+\\u0080-\\uFFFF',
172 'QWERTY\\x66-\\x80+\\x23',
173 'QWERTYf-\\x7F+#\\u0080-\\uFFFF',
176 'QWERTY\\x66-\\x80+\\xD3',
177 'QWERTYf-\\x7F+\\u0080-\\uFFFF',
181 '\\\\\\u0080-\\uFFFF',
185 '\\-\\u0080-\\uFFFF',
189 'QWERTY\\-\\u0080-\\uFFFF',
197 'A-\\x7F\\u0080-\\uFFFF',
200 '\\x66-\\x77QWERTY\\x88-\\x91FXZ',
201 'f-wQWERTYFXZ\\u0080-\\uFFFF',
204 '\\x66-\\x99QWERTY\\xAA-\\xEEFXZ',
205 'f-\\x7FQWERTYFXZ\\u0080-\\uFFFF',
225 $fixed =
$title->fixSpecialName();
226 $stuff = explode(
'/', $fixed->getDBkey(), 2 );
227 if ( count( $stuff ) == 2 ) {
232 $this->assertEquals( $expectedParam, $par,
"Bug 31100 regression check: Title->fixSpecialName() should preserve parameter" );
237 array(
'Special:Version',
null ),
238 array(
'Special:Version/',
'' ),
239 array(
'Special:Version/param',
'param' ),
256 $errors =
$title->isValidMoveOperation( $nt,
false );
257 if ( $expected ===
true ) {
258 $this->assertTrue( $errors );
262 $this->assertContains(
$error, $errors );
272 array(
'Test',
'Test',
'selfmove' ),
273 array(
'File:Test.jpg',
'Page',
'imagenocrossnamespace' )
293 if ( is_string( $whitelistRegexp ) ) {
294 $whitelistRegexp =
array( $whitelistRegexp );
299 global $wgGroupPermissions;
300 $oldPermissions = $wgGroupPermissions;
302 $wgGroupPermissions =
array();
303 $wgGroupPermissions[
'*'][
'read'] =
false;
306 $oldWhitelist = $wgWhitelistRead;
310 $wgWhitelistRead =
array(
'some random non sense title' );
312 global $wgWhitelistReadRegexp;
313 $oldWhitelistRegexp = $wgWhitelistReadRegexp;
314 $wgWhitelistReadRegexp = $whitelistRegexp;
324 $wgGroupPermissions = $oldPermissions;
325 $wgWhitelistRead = $oldWhitelist;
326 $wgWhitelistReadRegexp = $oldWhitelistRegexp;
328 if ( is_bool( $expected ) ) {
329 # Forge the assertion message depending on the assertion expectation
330 $allowableness = $expected
331 ?
" should be allowed"
332 :
" should NOT be allowed";
333 $this->assertEquals( $expected, $errors,
"User action '$action' on [[$source]] $allowableness." );
337 $this->assertContains(
$error, $errors );
351 array(
'/.*/',
'Main_Page',
'read', $ALLOWED ),
352 array(
'/.*/',
'Main_Page',
'edit', $DISALLOWED ),
355 array(
'/^Main_Page$/',
'Main_Page',
'read', $DISALLOWED ),
357 array(
'/^Main/',
'Main_Page',
'read', $ALLOWED ),
358 array(
'/^Main.*/',
'Main_Page',
'read', $ALLOWED ),
360 array(
'/Mic\sCheck/',
'Mic Check',
'read', $ALLOWED ),
363 array(
'/Unicode Test . Yes/',
'Unicode Test Ñ Yes',
'read', $DISALLOWED ),
365 array(
'/Unicode Test . Yes/u',
'Unicode Test Ñ Yes',
'read', $ALLOWED ),
367 array(
'/MiC ChEcK/',
'mic check',
'read', $DISALLOWED ),
368 array(
'/MiC ChEcK/i',
'mic check',
'read', $ALLOWED ),
371 array(
"@^UsEr.*@i",
'User is banned',
'read', $ALLOWED ),
372 array(
"@^UsEr.*@i",
'User:John Doe',
'read', $ALLOWED ),
375 array(
'/^Special:NewPages$/',
'Special:NewPages',
'read', $ALLOWED ),
376 array(
null,
'Special:Newpages',
'read', $DISALLOWED ),
392 array(
'Test',
'Test',
'selfmove' ),
393 array(
'File:Test.jpg',
'Page',
'imagenocrossnamespace' )
405 $wgLanguageCode = $contLang;
408 $wgDefaultLanguageVariant = $variant;
409 $wgAllowUserJs =
true;
412 $this->assertInstanceOf(
'Title',
$title,
413 "Test must be passed a valid title text, you gave '$titleText'"
415 $this->assertEquals( $expected,
416 $title->getPageViewLanguage()->getCode(),
425 # - wgContLang (expected in most case)
426 # - wgLang (on some specific pages)
427 # - wgDefaultLanguageVariant
430 array(
'fr',
'Help:I_need_somebody',
'fr',
'fr',
false ),
431 array(
'es',
'Help:I_need_somebody',
'es',
'zh-tw',
false ),
432 array(
'zh',
'Help:I_need_somebody',
'zh',
'zh-tw',
false ),
434 array(
'es',
'Help:I_need_somebody',
'es',
'zh-tw',
'zh-cn' ),
435 array(
'es',
'MediaWiki:About',
'es',
'zh-tw',
'zh-cn' ),
436 array(
'es',
'MediaWiki:About/',
'es',
'zh-tw',
'zh-cn' ),
437 array(
'de',
'MediaWiki:About/de',
'es',
'zh-tw',
'zh-cn' ),
438 array(
'en',
'MediaWiki:Common.js',
'es',
'zh-tw',
'zh-cn' ),
439 array(
'en',
'MediaWiki:Common.css',
'es',
'zh-tw',
'zh-cn' ),
440 array(
'en',
'User:JohnDoe/Common.js',
'es',
'zh-tw',
'zh-cn' ),
441 array(
'en',
'User:JohnDoe/Monobook.css',
'es',
'zh-tw',
'zh-cn' ),
443 array(
'zh-cn',
'Help:I_need_somebody',
'zh',
'zh-tw',
'zh-cn' ),
444 array(
'zh',
'MediaWiki:About',
'zh',
'zh-tw',
'zh-cn' ),
445 array(
'zh',
'MediaWiki:About/',
'zh',
'zh-tw',
'zh-cn' ),
446 array(
'de',
'MediaWiki:About/de',
'zh',
'zh-tw',
'zh-cn' ),
447 array(
'zh-cn',
'MediaWiki:About/zh-cn',
'zh',
'zh-tw',
'zh-cn' ),
448 array(
'zh-tw',
'MediaWiki:About/zh-tw',
'zh',
'zh-tw',
'zh-cn' ),
449 array(
'en',
'MediaWiki:Common.js',
'zh',
'zh-tw',
'zh-cn' ),
450 array(
'en',
'MediaWiki:Common.css',
'zh',
'zh-tw',
'zh-cn' ),
451 array(
'en',
'User:JohnDoe/Common.js',
'zh',
'zh-tw',
'zh-cn' ),
452 array(
'en',
'User:JohnDoe/Monobook.css',
'zh',
'zh-tw',
'zh-cn' ),
454 array(
'zh-tw',
'Special:NewPages',
'es',
'zh-tw',
'zh-cn' ),
455 array(
'zh-tw',
'Special:NewPages',
'zh',
'zh-tw',
'zh-cn' ),
466 $this->assertEquals( $expected,
475 array(
'User:John_Doe/subOne/subTwo',
'John Doe/subOne' ),
476 array(
'User:Foo/Bar/Baz',
'Foo/Bar' ),
486 $this->assertEquals( $expected,
495 array(
'User:John_Doe/subOne/subTwo',
'John Doe' ),
496 array(
'User:Foo/Bar/Baz',
'Foo' ),
507 $this->assertEquals( $expected,
516 array(
'User:John_Doe/subOne/subTwo',
'subTwo' ),
517 array(
'User:John_Doe/subOne',
'subOne' ),
535 $dbkey = str_replace(
' ',
'_',
$value->getText() );
536 $this->assertEquals( $dbkey,
$title->getDBkey() );
537 $this->assertEquals(
$value->getNamespace(),
$title->getNamespace() );
538 $this->assertEquals(
$value->getFragment(),
$title->getFragment() );
545 array(
'User:Hansi_Maier' ),
556 $dbkey = str_replace(
' ',
'_',
$value->getText() );
557 $this->assertEquals(
$title->getDBkey(), $dbkey );
558 $this->assertEquals(
$title->getNamespace(),
$value->getNamespace() );
559 $this->assertEquals(
$title->getFragment(),
$value->getFragment() );
565 array(
'Foo#bar',
'bar' ),
566 array(
'Foo#bär',
'bär' ),
569 array(
'Foo#bar_bar',
'bar bar' ),
570 array(
'Foo#bar bar',
'bar bar' ),
571 array(
'Foo#bar bar',
'bar bar' ),
575 array(
'Foo#_bar_bar_',
' bar bar' ),
576 array(
'Foo# bar bar ',
' bar bar' ),
588 $this->assertEquals( $fragment,
$title->getFragment() );
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message. Please note the header message cannot receive/use parameters. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item. $reader:XMLReader object $logInfo:Array of information Return false to stop further processing of the tag 'ImportHandlePageXMLTag':When parsing a XML tag in a page. $reader:XMLReader object $pageInfo:Array of information Return false to stop further processing of the tag 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information Return false to stop further processing of the tag 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. $reader:XMLReader object Return false to stop further processing of the tag 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. $reader:XMLReader object $revisionInfo:Array of information Return false to stop further processing of the tag 'InfoAction':When building information to display on the action=info page. $context:IContextSource object & $pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect. $title:Title object for the current page $request:WebRequest $ignoreRedirect:boolean to skip redirect check $target:Title/string of redirect target $article:Article object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not. Return true without providing an interwiki to continue interwiki search. $prefix:interwiki prefix we are looking for. & $iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InternalParseBeforeSanitize':during Parser 's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings. Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InternalParseBeforeLinks':during Parser 's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InvalidateEmailComplete':Called after a user 's email has been invalidated successfully. $user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification. Callee may modify $url and $query, URL will be constructed as $url . $query & $url:URL to index.php & $query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) $article:article(object) being checked 'IsTrustedProxy':Override the result of wfIsTrustedProxy() $ip:IP being check $result:Change this value to override the result of wfIsTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from & $allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of User::isValidEmailAddr(), for instance to return false if the domain name doesn 't match your organization. $addr:The e-mail address entered by the user & $result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user & $result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we 're looking for a messages file for & $file:The messages file path, you can override this to change the location. 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces. Do not use this hook to add namespaces. Use CanonicalNamespaces for that. & $namespaces:Array of namespaces indexed by their numbers 'LanguageGetMagic':DEPRECATED, use $magicWords in a file listed in $wgExtensionMessagesFiles instead. Use this to define synonyms of magic words depending of the language $magicExtensions:associative array of magic words synonyms $lang:language code(string) 'LanguageGetSpecialPageAliases':DEPRECATED, use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead. Use to define aliases of special pages names depending of the language $specialPageAliases:associative array of magic words synonyms $lang:language code(string) 'LanguageGetTranslatedLanguageNames':Provide translated language names. & $names:array of language code=> language name $code language of the preferred translations 'LanguageLinks':Manipulate a page 's language links. This is called in various places to allow extensions to define the effective language links for a page. $title:The page 's Title. & $links:Associative array mapping language codes to prefixed links of the form "language:title". & $linkFlags:Associative array mapping prefixed links to arrays of flags. Currently unused, but planned to provide support for marking individual language links in the UI, e.g. for featured articles. 'LinkBegin':Used when generating internal and interwiki links in Linker::link(), before processing starts. Return false to skip default processing and return $ret. See documentation for Linker::link() for details on the expected meanings of parameters. $skin:the Skin object $target:the Title that the link is pointing to & $html:the contents that the< a > tag should have(raw HTML) $result
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
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
testLegalChars()
@covers Title::legalChars
static provideConvertByteClassToUnicodeClass()
testConvertByteClassToUnicodeClass( $byteClass, $unicodeClass)
@dataProvider provideConvertByteClassToUnicodeClass @covers Title::convertByteClassToUnicodeClass
testGetPageViewLanguage( $expected, $titleText, $contLang, $lang, $variant, $msg='')
@dataProvider provideGetPageViewLanguage @covers Title::getPageViewLanguage
static provideBaseTitleCases()
static provideSubpageTitleCases()
testSecureAndSplit()
See also mediawiki.Title.test.js @covers Title::secureAndSplit.
static provideTestIsValidMoveOperation()
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the content language as $wgContLang
static convertByteClassToUnicodeClass( $byteClass)
Utility method for converting a character sequence from bytes to Unicode.
testGetSubpageText( $title, $expected, $msg='')
testGetFragment( $full, $fragment)
@dataProvider provideGetFragment
dataWgWhitelistReadRegexp()
Provides test parameter values for testWgWhitelistReadRegexp()
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
testIsValidMoveOperation( $source, $target, $expected)
Auth-less test of Title::isValidMoveOperation.
when a variable name is used in a it is silently declared as a new masking the global
@group Database ^— needed for language cache stuff
dataTestIsValidMoveOperation()
Provides test parameter values for testIsValidMoveOperation()
static provideGetPageViewLanguage()
static newFromTitleValue(TitleValue $titleValue)
Create a new Title from a TitleValue.
presenting them properly to the user as errors is done by the caller $title
flattenErrorsArray( $errors)
static newFromDBkey( $key)
Create a new Title from a prefixed DB key.
testGetBaseText( $title, $expected, $msg='')
@dataProvider provideBaseTitleCases @covers Title::getBaseText
testNewFromTitleValue(TitleValue $value)
@dataProvider provideNewFromTitleValue
testGetTitleValue( $text)
@dataProvider provideGetTitleValue
provideNewFromTitleValue()
Represents a title within MediaWiki.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as $wgLang
static provideRootTitleCases()
testGetRootText( $title, $expected, $msg='')
@dataProvider provideRootTitleCases @covers Title::getRootText
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
if(PHP_SAPI !='cli') $source
testBug31100FixSpecialName( $text, $expectedParam)
@dataProvider provideBug31100 @covers Title::fixSpecialName
static factory( $code)
Get a cached or new language object for a given language code.
testWgWhitelistReadRegexp( $whitelistRegexp, $source, $action, $expected)
Auth-less test of Title::userCan.
static legalChars()
Get a regex character class describing the legal characters in a link.
usually copyright or history_copyright This message must be in HTML not wikitext $subpages will be ignored and the rest of subPageSubtitle() will run. 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink' whether MediaWiki currently thinks this is a CSS JS page Hooks may change this value to override the return value of Title::isCssOrJsPage(). 'TitleIsAlwaysKnown' whether MediaWiki currently thinks this page is known isMovable() always returns false. $title whether MediaWiki currently thinks this page is movable Hooks may change this value to override the return value of Title::isMovable(). 'TitleIsWikitextPage' whether MediaWiki currently thinks this is a wikitext page Hooks may change this value to override the return value of Title::isWikitextPage() 'TitleMove' use UploadVerification and UploadVerifyFile instead where the first element is the message key and the remaining elements are used as parameters to the message based on mime etc Preferred in most cases over UploadVerification object with all info about the upload string as detected by MediaWiki Handlers will typically only apply for specific mime types object & $error
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing after in associative array form externallinks including delete and has completed for all link tables default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a message
Represents a page (or page fragment) title within MediaWiki.