20 'wgArticlePath' =>
'/wiki/$1',
21 'wgServer' =>
'//example.org',
22 'wgCanonicalServer' =>
'http://example.org',
23 'wgScriptPath' =>
'/w',
24 'wgScript' =>
'/w/index.php',
26 $this->factory = MediaWikiServices::getInstance()->getLinkRendererFactory();
41 '<a href="/wiki/Special:BlankPage" class="new foobar" '
42 .
'title="Special:BlankPage (page does not exist)" bar="baz">'
43 .
'Special:BlankPage</a>',
54 '<a href="/w/index.php?title=Foobar&foo=bar" ' .
'title="Foobar">Foobar</a>',
55 $linkRenderer->makeKnownLink( $target,
null, [], [
'foo' =>
'bar' ] )
61 '<a href="/wiki/Foobar?foo=bar" title="Foobar">Foobar</a>',
62 $linkRenderer->makeKnownLink( $target,
null, [], [
'foo' =>
'bar' ] )
69 '<a href="https://example.org/wiki/Foobar" title="Foobar">Foobar</a>',
81 '<a href="/w/index.php?title=Foobar&action=edit&redlink=1" '
82 .
'class="new" title="Foobar (page does not exist)">Foobar</a>',
88 '<a href="/w/index.php?title=Foobar&action=foobar" class="new" '
89 .
'title="Foobar (page does not exist)">Foobar</a>',
90 $linkRenderer->makeBrokenLink( $target,
null, [], [
'action' =>
'foobar' ] )
95 '<a href="/wiki/Special:Foobar" class="new" title="Special:Foobar '
96 .
'(page does not exist)">Special:Foobar</a>',
102 '<a href="/w/index.php?title=Foobar&action=edit&redlink=1" '
103 .
'class="new" title="Foobar (page does not exist)">Foobar</a>',
104 $linkRenderer->makeBrokenLink( $target->createFragmentTarget(
'foobar' ) )
113 '<a href="/wiki/Special:Foobar" class="new" title="Special:Foobar '
114 .
'(page does not exist)">foo</a>',
119 '<a href="/wiki/Special:BlankPage" title="Special:BlankPage">blank</a>',
124 '<a href="/wiki/Special:Foobar" class="new" title="Special:Foobar '
125 .
'(page does not exist)"><script>evil()</script></a>',
126 $linkRenderer->makeLink( $foobar,
'<script>evil()</script>' )
130 '<a href="/wiki/Special:Foobar" class="new" title="Special:Foobar '
131 .
'(page does not exist)"><script>evil()</script></a>',
136 '<a href="#fragment">fragment</a>',
142 $wanCache = ObjectCache::getMainWANInstance();
143 $titleFormatter = MediaWikiServices::getInstance()->getTitleFormatter();
144 $linkCache =
new LinkCache( $titleFormatter, $wanCache );
148 $linkCache->addGoodLinkObj(
154 $linkCache->addGoodLinkObj(
161 $linkCache->addGoodLinkObj(
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
Marks HTML that shouldn't be escaped.
Cache for article titles (prefixed DB keys) and ids linked from one source.
MediaWiki\Linker\LinkRenderer.
LinkRendererFactory $factory
Represents a page (or page fragment) title within MediaWiki.
usually copyright or history_copyright This message must be in HTML not wikitext & $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 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 before processing starts Return false to skip default processing and return $ret $linkRenderer
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