MediaWiki REL1_37
LinkRendererFactory.php
Go to the documentation of this file.
1<?php
21namespace MediaWiki\Linker;
22
23use LinkCache;
29
35
40
44 private $linkCache;
45
49 private $nsInfo;
50
55
60
69 public function __construct(
75 ) {
76 $this->titleFormatter = $titleFormatter;
77 $this->linkCache = $linkCache;
78 $this->nsInfo = $nsInfo;
79 $this->specialPageFactory = $specialPageFactory;
80 $this->hookContainer = $hookContainer;
81 }
82
86 public function create() {
87 return new LinkRenderer(
88 $this->titleFormatter, $this->linkCache, $this->nsInfo, $this->specialPageFactory,
89 $this->hookContainer
90 );
91 }
92
99 public function createForUser( UserIdentity $user ) {
100 wfDeprecated( __METHOD__, '1.37' );
101 return $this->create();
102 }
103
108 public function createFromLegacyOptions( array $options ) {
109 $linkRenderer = $this->create();
110
111 if ( in_array( 'forcearticlepath', $options, true ) ) {
112 $linkRenderer->setForceArticlePath( true );
113 }
114
115 if ( in_array( 'http', $options, true ) ) {
116 $linkRenderer->setExpandURLs( PROTO_HTTP );
117 } elseif ( in_array( 'https', $options, true ) ) {
118 $linkRenderer->setExpandURLs( PROTO_HTTPS );
119 }
120
121 return $linkRenderer;
122 }
123}
const PROTO_HTTPS
Definition Defines.php:193
const PROTO_HTTP
Definition Defines.php:192
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that a deprecated feature was used.
Cache for article titles (prefixed DB keys) and ids linked from one source.
Definition LinkCache.php:41
Factory to create LinkRender objects.
__construct(TitleFormatter $titleFormatter, LinkCache $linkCache, NamespaceInfo $nsInfo, SpecialPageFactory $specialPageFactory, HookContainer $hookContainer)
Class that generates HTML links for pages.
Factory for handling the special page list and generating SpecialPage objects.
This is a utility class for dealing with namespaces that encodes all the "magic" behaviors of them ba...
Interface for objects representing user identity.
A title formatter service for MediaWiki.