13 public function testUserLink( $expected, $userId, $userName, $altUserName =
false, $msg =
'' ) {
15 'wgArticlePath' =>
'/wiki/$1',
18 $this->assertEquals( $expected,
28 # - optional altUserName
32 # ## ANONYMOUS USER ########################################
34 '<a href="/wiki/Special:Contributions/JohnDoe" '
35 .
'title="Special:Contributions/JohnDoe" '
36 .
'class="mw-userlink mw-anonuserlink">JohnDoe</a>',
40 '<a href="/wiki/Special:Contributions/::1" '
41 .
'title="Special:Contributions/::1" '
42 .
'class="mw-userlink mw-anonuserlink">::1</a>',
44 'Anonymous with pretty IPv6'
47 '<a href="/wiki/Special:Contributions/0:0:0:0:0:0:0:1" '
48 .
'title="Special:Contributions/0:0:0:0:0:0:0:1" '
49 .
'class="mw-userlink mw-anonuserlink">::1</a>',
50 0,
'0:0:0:0:0:0:0:1',
false,
51 'Anonymous with almost pretty IPv6'
54 '<a href="/wiki/Special:Contributions/0000:0000:0000:0000:0000:0000:0000:0001" '
55 .
'title="Special:Contributions/0000:0000:0000:0000:0000:0000:0000:0001" '
56 .
'class="mw-userlink mw-anonuserlink">::1</a>',
57 0,
'0000:0000:0000:0000:0000:0000:0000:0001',
false,
58 'Anonymous with full IPv6'
61 '<a href="/wiki/Special:Contributions/::1" '
62 .
'title="Special:Contributions/::1" '
63 .
'class="mw-userlink mw-anonuserlink">AlternativeUsername</a>',
64 0,
'::1',
'AlternativeUsername',
65 'Anonymous with pretty IPv6 and an alternative username'
70 '<a href="/wiki/Special:Contributions/127.0.0.1" '
71 .
'title="Special:Contributions/127.0.0.1" '
72 .
'class="mw-userlink mw-anonuserlink">127.0.0.1</a>',
73 0,
'127.0.0.1',
false,
77 '<a href="/wiki/Special:Contributions/127.0.0.1" '
78 .
'title="Special:Contributions/127.0.0.1" '
79 .
'class="mw-userlink mw-anonuserlink">AlternativeUsername</a>',
80 0,
'127.0.0.1',
'AlternativeUsername',
81 'Anonymous with IPv4 and an alternative username'
84 # ## Regular user ##########################################
96 $expected,
$comment,
$title =
false, $local =
false, $wikiId = null
101 'enwiki' =>
'//en.example.org',
102 'dewiki' =>
'//de.example.org',
109 $conf->suffixes = [
'wiki' ];
112 'wgScript' =>
'/wiki/index.php',
113 'wgArticlePath' =>
'/wiki/$1',
114 'wgCapitalLinks' =>
true,
144 "'''not bolded'''",
148 "try <script>evil</scipt> things",
149 "try <script>evil</scipt> things",
153 '<a href="/wiki/Special:BlankPage#autocomment" title="Special:BlankPage">→</a><span dir="auto"><span class="autocomment">autocomment</span></span>',
157 '<a href="/wiki/Special:BlankPage#linkie.3F" title="Special:BlankPage">→</a><span dir="auto"><span class="autocomment"><a href="/wiki/index.php?title=Linkie%3F&action=edit&redlink=1" class="new" title="Linkie? (page does not exist)">linkie?</a></span></span>',
161 '<a href="/wiki/Special:BlankPage#autocomment" title="Special:BlankPage">→</a><span dir="auto"><span class="autocomment">autocomment: </span> post</span>',
162 "/* autocomment */ post",
165 'pre <a href="/wiki/Special:BlankPage#autocomment" title="Special:BlankPage">→</a><span dir="auto"><span class="autocomment">autocomment</span></span>',
166 "pre /* autocomment */",
169 'pre <a href="/wiki/Special:BlankPage#autocomment" title="Special:BlankPage">→</a><span dir="auto"><span class="autocomment">autocomment: </span> post</span>',
170 "pre /* autocomment */ post",
173 '<a href="/wiki/Special:BlankPage#autocomment" title="Special:BlankPage">→</a><span dir="auto"><span class="autocomment">autocomment: </span> multiple? <a href="/wiki/Special:BlankPage#autocomment2" title="Special:BlankPage">→</a><span dir="auto"><span class="autocomment">autocomment2: </span> </span></span>',
174 "/* autocomment */ multiple? /* autocomment2 */ ",
177 '<a href="/wiki/Special:BlankPage#autocomment_containing_.2F.2A" title="Special:BlankPage">→</a><span dir="auto"><span class="autocomment">autocomment containing /*: </span> T70361</span>',
178 "/* autocomment containing /* */ T70361"
181 '<a href="/wiki/Special:BlankPage#autocomment_containing_.22quotes.22" title="Special:BlankPage">→</a><span dir="auto"><span class="autocomment">autocomment containing "quotes"</span></span>',
182 "/* autocomment containing \"quotes\" */"
185 '<a href="/wiki/Special:BlankPage#autocomment_containing_.3Cscript.3Etags.3C.2Fscript.3E" title="Special:BlankPage">→</a><span dir="auto"><span class="autocomment">autocomment containing <script>tags</script></span></span>',
186 "/* autocomment containing <script>tags</script> */"
189 '<a href="#autocomment">→</a><span dir="auto"><span class="autocomment">autocomment</span></span>',
194 '<span dir="auto"><span class="autocomment">autocomment</span></span>',
199 '<a href="/wiki/Special:BlankPage#autocomment" title="Special:BlankPage">→</a><span dir="auto"><span class="autocomment">autocomment</span></span>',
204 '<a class="external" rel="nofollow" href="//en.example.org/w/Special:BlankPage#autocomment">→</a><span dir="auto"><span class="autocomment">autocomment</span></span>',
206 false,
false, $wikiId
210 'abc <a href="/wiki/index.php?title=Link&action=edit&redlink=1" class="new" title="Link (page does not exist)">link</a> def',
214 'abc <a href="/wiki/index.php?title=Link&action=edit&redlink=1" class="new" title="Link (page does not exist)">text</a> def',
215 "abc [[link|text]] def",
218 'abc <a href="/wiki/Special:BlankPage" title="Special:BlankPage">Special:BlankPage</a> def',
219 "abc [[Special:BlankPage|]] def",
222 'abc <a href="/wiki/index.php?title=%C4%84%C5%9B%C5%BC&action=edit&redlink=1" class="new" title="Ąśż (page does not exist)">ąśż</a> def',
223 "abc [[%C4%85%C5%9B%C5%BC]] def",
226 'abc <a href="/wiki/Special:BlankPage#section" title="Special:BlankPage">#section</a> def',
227 "abc [[#section]] def",
230 'abc <a href="/wiki/index.php?title=/subpage&action=edit&redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a> def',
231 "abc [[/subpage]] def",
234 'abc <a href="/wiki/index.php?title=%22evil!%22&action=edit&redlink=1" class="new" title=""evil!" (page does not exist)">"evil!"</a> def',
235 "abc [[\"evil!\"]] def",
238 'abc [[<script>very evil</script>]] def',
239 "abc [[<script>very evil</script>]] def",
246 'abc <a href="/wiki/index.php?title=Link&action=edit&redlink=1" class="new" title="Link (page does not exist)">link</a> def',
251 'abc <a class="external" rel="nofollow" href="//en.example.org/w/Link">link</a> def',
253 false,
false, $wikiId
268 'enwiki' =>
'//en.example.org'
274 $conf->suffixes = [
'wiki' ];
276 'wgScript' =>
'/wiki/index.php',
277 'wgArticlePath' =>
'/wiki/$1',
278 'wgCapitalLinks' =>
true,
292 'foo bar <a href="/wiki/Special:BlankPage" title="Special:BlankPage">Special:BlankPage</a>',
293 'foo bar [[Special:BlankPage]]',
297 '<a class="external" rel="nofollow" href="//en.example.org/w/Foo%27bar">Foo\'bar</a>',
302 'foo bar <a class="external" rel="nofollow" href="//en.example.org/w/Special:BlankPage">Special:BlankPage</a>',
303 'foo bar [[Special:BlankPage]]',
testFormatLinksInComment($expected, $input, $wiki)
Linker::formatLinksInComment provideCasesForFormatLinksInComment.
processing should stop and the error should be shown to the user * false
testUserLink($expected, $userId, $userName, $altUserName=false, $msg= '')
provideCasesForUserLink Linker::userLink
static newFromText($text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
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 true
testFormatComment($expected, $comment, $title=false, $local=false, $wikiId=null)
provideCasesForFormatComment Linker::formatComment Linker::formatAutocomments Linker::formatLinksInCo...
static formatLinksInComment($comment, $title=null, $local=false, $wikiId=null)
Formats wiki links and media links in text; all other wiki formatting is ignored. ...
static provideCasesForFormatLinksInComment()
static provideCasesForUserLink()
namespace and then decline to actually register it file or subcat img or subcat $title
static formatComment($comment, $title=null, $local=false, $wikiId=null)
This function is called by all recent changes variants, by the page history, and by the user contribu...
provideCasesForFormatComment()
static userLink($userId, $userName, $altUserName=false)
Make user link (or user contributions for unregistered users)
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
This is a class for holding configuration settings, particularly for multi-wiki sites.