MediaWiki REL1_33
LinkRendererFactory.php
Go to the documentation of this file.
1<?php
21namespace MediaWiki\Linker;
22
23use LinkCache;
25use User;
26
32
37
41 private $linkCache;
42
48 $this->titleFormatter = $titleFormatter;
49 $this->linkCache = $linkCache;
50 }
51
55 public function create() {
56 return new LinkRenderer( $this->titleFormatter, $this->linkCache );
57 }
58
63 public function createForUser( User $user ) {
64 $linkRenderer = $this->create();
65 $linkRenderer->setStubThreshold( $user->getStubThreshold() );
66
67 return $linkRenderer;
68 }
69
75 $linkRenderer = $this->create();
76
77 if ( in_array( 'forcearticlepath', $options, true ) ) {
78 $linkRenderer->setForceArticlePath( true );
79 }
80
81 if ( in_array( 'http', $options, true ) ) {
82 $linkRenderer->setExpandURLs( PROTO_HTTP );
83 } elseif ( in_array( 'https', $options, true ) ) {
84 $linkRenderer->setExpandURLs( PROTO_HTTPS );
85 }
86
87 if ( isset( $options['stubThreshold'] ) ) {
88 $linkRenderer->setStubThreshold(
89 $options['stubThreshold']
90 );
91 }
92
93 return $linkRenderer;
94 }
95}
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
Cache for article titles (prefixed DB keys) and ids linked from one source.
Definition LinkCache.php:34
Factory to create LinkRender objects.
__construct(TitleFormatter $titleFormatter, LinkCache $linkCache)
Class that generates HTML links for pages.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition User.php:48
getStubThreshold()
Get the user preferred stub threshold.
Definition User.php:3532
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 & $options
Definition hooks.txt:1999
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
Definition hooks.txt:2054
const PROTO_HTTPS
Definition Defines.php:229
const PROTO_HTTP
Definition Defines.php:228
A title formatter service for MediaWiki.
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))