MediaWiki  master
DummyLinker.php
Go to the documentation of this file.
1 <?php
2 
3 namespace MediaWiki\Linker;
4 
6 use Language;
10 use Parser;
11 
15 class DummyLinker {
16 
17  public function link(
18  $target,
19  $html = null,
20  $customAttribs = [],
21  $query = [],
22  $options = []
23  ) {
24  return Linker::link(
25  $target,
26  $html,
27  $customAttribs,
28  $query,
29  $options
30  );
31  }
32 
33  public function linkKnown(
34  $target,
35  $html = null,
36  $customAttribs = [],
37  $query = [],
38  $options = [ 'known' ]
39  ) {
40  return Linker::linkKnown(
41  $target,
42  $html,
43  $customAttribs,
44  $query,
45  $options
46  );
47  }
48 
49  public function makeSelfLinkObj(
50  $nt,
51  $html = '',
52  $query = '',
53  $trail = '',
54  $prefix = ''
55  ) {
57  $nt,
58  $html,
59  $query,
60  $trail,
61  $prefix
62  );
63  }
64 
65  public function getInvalidTitleDescription(
66  IContextSource $context,
67  $namespace,
68  $title
69  ) {
71  $context,
72  $namespace,
73  $title
74  );
75  }
76 
77  public function makeExternalImage( $url, $alt = '' ) {
78  return Linker::makeExternalImage( $url, $alt );
79  }
80 
81  public function makeImageLink(
82  Parser $parser,
83  Title $title,
84  $file,
85  $frameParams = [],
86  $handlerParams = [],
87  $time = false,
88  $query = "",
89  $widthOption = null
90  ) {
91  return Linker::makeImageLink(
92  $parser,
93  $title,
94  $file,
95  $frameParams,
96  $handlerParams,
97  $time,
98  $query,
99  $widthOption
100  );
101  }
102 
103  public function makeThumbLinkObj(
104  Title $title,
105  $file,
106  $label = '',
107  $alt = '',
108  $align = 'right',
109  $params = [],
110  $framed = false,
111  $manualthumb = ""
112  ) {
114  $title,
115  $file,
116  $label,
117  $alt,
118  $align,
119  $params,
120  $framed,
121  $manualthumb
122  );
123  }
124 
125  public function makeThumbLink2(
126  Title $title,
127  $file,
128  $frameParams = [],
129  $handlerParams = [],
130  $time = false,
131  $query = ""
132  ) {
133  return Linker::makeThumbLink2(
134  $title,
135  $file,
136  $frameParams,
137  $handlerParams,
138  $time,
139  $query
140  );
141  }
142 
143  public function processResponsiveImages( $file, $thumb, $hp ) {
145  $file,
146  $thumb,
147  $hp
148  );
149  }
150 
151  public function makeBrokenImageLinkObj(
152  $title,
153  $label = '',
154  $query = '',
155  $unused1 = '',
156  $unused2 = '',
157  $time = false
158  ) {
160  $title,
161  $label,
162  $query,
163  $unused1,
164  $unused2,
165  $time
166  );
167  }
168 
169  public function makeMediaLinkObj( $title, $html = '', $time = false ) {
171  $title,
172  $html,
173  $time
174  );
175  }
176 
177  public function makeMediaLinkFile( Title $title, $file, $html = '' ) {
179  $title,
180  $file,
181  $html
182  );
183  }
184 
185  public function specialLink( $name, $key = '' ) {
186  return Linker::specialLink( $name, $key );
187  }
188 
189  public function makeExternalLink(
190  $url,
191  $text,
192  $escape = true,
193  $linktype = '',
194  $attribs = [],
195  $title = null
196  ) {
198  $url,
199  $text,
200  $escape,
201  $linktype,
202  $attribs,
203  $title
204  );
205  }
206 
207  public function userLink( $userId, $userName, $altUserName = false, $attributes = [] ) {
208  return Linker::userLink(
209  $userId,
210  $userName,
211  $altUserName,
212  $attributes
213  );
214  }
215 
216  public function userToolLinks(
217  $userId,
218  $userText,
219  $redContribsWhenNoEdits = false,
220  $flags = 0,
221  $edits = null
222  ) {
223  return Linker::userToolLinks(
224  $userId,
225  $userText,
226  $redContribsWhenNoEdits,
227  $flags,
228  $edits
229  );
230  }
231 
232  public function userToolLinksRedContribs( $userId, $userText, $edits = null ) {
234  $userId,
235  $userText,
236  $edits
237  );
238  }
239 
240  public function userTalkLink( $userId, $userText ) {
241  return Linker::userTalkLink( $userId, $userText );
242  }
243 
244  public function blockLink( $userId, $userText ) {
245  return Linker::blockLink( $userId, $userText );
246  }
247 
248  public function emailLink( $userId, $userText ) {
249  return Linker::emailLink( $userId, $userText );
250  }
251 
252  public function revUserLink( RevisionRecord $revRecord, $isPublic = false ) {
253  return Linker::revUserLink( $revRecord, $isPublic );
254  }
255 
256  public function revUserTools( RevisionRecord $revRecord, $isPublic = false ) {
257  return Linker::revUserTools( $revRecord, $isPublic );
258  }
259 
260  public function formatComment(
261  $comment,
262  $title = null,
263  $local = false,
264  $wikiId = null
265  ) {
266  return Linker::formatComment(
267  $comment,
268  $title,
269  $local,
270  $wikiId
271  );
272  }
273 
274  public function formatLinksInComment(
275  $comment,
276  $title = null,
277  $local = false,
278  $wikiId = null
279  ) {
281  $comment,
282  $title,
283  $local,
284  $wikiId
285  );
286  }
287 
288  public function normalizeSubpageLink( $contextTitle, $target, &$text ) {
290  $contextTitle,
291  $target,
292  $text
293  );
294  }
295 
296  public function commentBlock(
297  $comment,
298  $title = null,
299  $local = false,
300  $wikiId = null
301  ) {
302  return Linker::commentBlock(
303  $comment,
304  $title,
305  $local,
306  $wikiId
307  );
308  }
309 
310  public function revComment( RevisionRecord $revRecord, $local = false, $isPublic = false ) {
311  return Linker::revComment( $revRecord, $local, $isPublic );
312  }
313 
314  public function formatRevisionSize( $size ) {
315  return Linker::formatRevisionSize( $size );
316  }
317 
318  public function tocIndent() {
319  return Linker::tocIndent();
320  }
321 
322  public function tocUnindent( $level ) {
323  return Linker::tocUnindent( $level );
324  }
325 
326  public function tocLine( $anchor, $tocline, $tocnumber, $level, $sectionIndex = false ) {
327  return Linker::tocLine(
328  $anchor,
329  $tocline,
330  $tocnumber,
331  $level,
332  $sectionIndex
333  );
334  }
335 
336  public function tocLineEnd() {
337  return Linker::tocLineEnd();
338  }
339 
340  public function tocList( $toc, Language $lang = null ) {
341  return Linker::tocList( $toc, $lang );
342  }
343 
344  public function generateTOC( $tree, Language $lang = null ) {
345  return Linker::generateTOC( $tree, $lang );
346  }
347 
348  public function makeHeadline(
349  $level,
350  $attribs,
351  $anchor,
352  $html,
353  $link,
354  $legacyAnchor = false
355  ) {
356  return Linker::makeHeadline(
357  $level,
358  $attribs,
359  $anchor,
360  $html,
361  $link,
362  $legacyAnchor
363  );
364  }
365 
366  public function splitTrail( $trail ) {
367  return Linker::splitTrail( $trail );
368  }
369 
370  public function generateRollback(
371  RevisionRecord $revRecord,
372  IContextSource $context = null,
373  $options = []
374  ) {
376  $revRecord,
377  $context,
378  $options
379  );
380  }
381 
382  public function getRollbackEditCount( RevisionRecord $revRecord, $verify ) {
383  return Linker::getRollbackEditCount( $revRecord, $verify );
384  }
385 
386  public function buildRollbackLink(
387  RevisionRecord $revRecord,
388  IContextSource $context = null,
389  $editCount = false
390  ) {
392  $revRecord,
393  $context,
394  $editCount
395  );
396  }
397 
398  public function formatHiddenCategories( $hiddencats ) {
399  return Linker::formatHiddenCategories( $hiddencats );
400  }
401 
402  public function titleAttrib( $name, $options = null, array $msgParams = [] ) {
403  return Linker::titleAttrib(
404  $name,
405  $options,
406  $msgParams
407  );
408  }
409 
410  public function accesskey( $name ) {
411  return Linker::accesskey( $name );
412  }
413 
414  public function getRevDeleteLink( User $user, RevisionRecord $revRecord, Title $title ) {
416  $user,
417  $revRecord,
418  $title
419  );
420  }
421 
422  public function revDeleteLink( $query = [], $restricted = false, $delete = true ) {
423  return Linker::revDeleteLink(
424  $query,
425  $restricted,
426  $delete
427  );
428  }
429 
430  public function revDeleteLinkDisabled( $delete = true ) {
431  return Linker::revDeleteLinkDisabled( $delete );
432  }
433 
434  public function tooltipAndAccesskeyAttribs( $name, array $msgParams = [] ) {
436  $name,
437  $msgParams
438  );
439  }
440 
441  public function tooltip( $name, $options = null ) {
442  return Linker::tooltip( $name, $options );
443  }
444 
445 }
446 
450 class_alias( DummyLinker::class, 'DummyLinker' );
Base class for language-specific code.
Definition: Language.php:63
buildRollbackLink(RevisionRecord $revRecord, IContextSource $context=null, $editCount=false)
revUserTools(RevisionRecord $revRecord, $isPublic=false)
formatComment( $comment, $title=null, $local=false, $wikiId=null)
makeHeadline( $level, $attribs, $anchor, $html, $link, $legacyAnchor=false)
makeSelfLinkObj( $nt, $html='', $query='', $trail='', $prefix='')
Definition: DummyLinker.php:49
tocList( $toc, Language $lang=null)
emailLink( $userId, $userText)
blockLink( $userId, $userText)
getInvalidTitleDescription(IContextSource $context, $namespace, $title)
Definition: DummyLinker.php:65
tooltipAndAccesskeyAttribs( $name, array $msgParams=[])
userTalkLink( $userId, $userText)
tooltip( $name, $options=null)
revComment(RevisionRecord $revRecord, $local=false, $isPublic=false)
userToolLinksRedContribs( $userId, $userText, $edits=null)
makeMediaLinkFile(Title $title, $file, $html='')
generateRollback(RevisionRecord $revRecord, IContextSource $context=null, $options=[])
makeThumbLinkObj(Title $title, $file, $label='', $alt='', $align='right', $params=[], $framed=false, $manualthumb="")
tocLine( $anchor, $tocline, $tocnumber, $level, $sectionIndex=false)
getRollbackEditCount(RevisionRecord $revRecord, $verify)
makeExternalImage( $url, $alt='')
Definition: DummyLinker.php:77
makeBrokenImageLinkObj( $title, $label='', $query='', $unused1='', $unused2='', $time=false)
formatLinksInComment( $comment, $title=null, $local=false, $wikiId=null)
makeExternalLink( $url, $text, $escape=true, $linktype='', $attribs=[], $title=null)
link( $target, $html=null, $customAttribs=[], $query=[], $options=[])
Definition: DummyLinker.php:17
userToolLinks( $userId, $userText, $redContribsWhenNoEdits=false, $flags=0, $edits=null)
makeImageLink(Parser $parser, Title $title, $file, $frameParams=[], $handlerParams=[], $time=false, $query="", $widthOption=null)
Definition: DummyLinker.php:81
commentBlock( $comment, $title=null, $local=false, $wikiId=null)
makeThumbLink2(Title $title, $file, $frameParams=[], $handlerParams=[], $time=false, $query="")
processResponsiveImages( $file, $thumb, $hp)
formatHiddenCategories( $hiddencats)
userLink( $userId, $userName, $altUserName=false, $attributes=[])
revDeleteLinkDisabled( $delete=true)
specialLink( $name, $key='')
generateTOC( $tree, Language $lang=null)
normalizeSubpageLink( $contextTitle, $target, &$text)
revUserLink(RevisionRecord $revRecord, $isPublic=false)
makeMediaLinkObj( $title, $html='', $time=false)
titleAttrib( $name, $options=null, array $msgParams=[])
revDeleteLink( $query=[], $restricted=false, $delete=true)
linkKnown( $target, $html=null, $customAttribs=[], $query=[], $options=[ 'known'])
Definition: DummyLinker.php:33
getRevDeleteLink(User $user, RevisionRecord $revRecord, Title $title)
static revComment(RevisionRecord $revRecord, $local=false, $isPublic=false, $useParentheses=true)
Wrap and format the given revision's comment block, if the current user is allowed to view it.
Definition: Linker.php:1704
static revDeleteLink( $query=[], $restricted=false, $delete=true)
Creates a (show/hide) link for deleting revisions/log entries.
Definition: Linker.php:2329
static link( $target, $html=null, $customAttribs=[], $query=[], $options=[])
This function returns an HTML link to the given target.
Definition: Linker.php:114
static tocLineEnd()
End a Table Of Contents line.
Definition: Linker.php:1790
static blockLink( $userId, $userText)
Definition: Linker.php:1366
static makeSelfLinkObj( $nt, $html='', $query='', $trail='', $prefix='', $hash='')
Make appropriate markup for a link to the current article.
Definition: Linker.php:196
static tooltipAndAccesskeyAttribs( $name, array $msgParams=[], $options=null, $localizer=null)
Returns the attributes for the tooltip and access key.
Definition: Linker.php:2373
static makeImageLink(Parser $parser, LinkTarget $title, $file, $frameParams=[], $handlerParams=[], $time=false, $query='', $widthOption=null)
Given parameters derived from [[Image:Foo|options...]], generate the HTML that that syntax inserts in...
Definition: Linker.php:330
static makeMediaLinkObj( $title, $html='', $time=false)
Create a direct link to a given uploaded file.
Definition: Linker.php:1028
static processResponsiveImages( $file, $thumb, $hp)
Process responsive images: add 1.5x and 2x subimages to the thumbnail, where applicable.
Definition: Linker.php:887
static userTalkLink( $userId, $userText)
Definition: Linker.php:1344
static commentBlock( $comment, $title=null, $local=false, $wikiId=null, $useParentheses=true)
Wrap a comment in standard punctuation and formatting if it's non-empty, otherwise return empty strin...
Definition: Linker.php:1681
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...
Definition: Linker.php:1543
static normalizeSubpageLink( $contextTitle, $target, &$text)
Definition: Linker.php:1584
static specialLink( $name, $key='')
Make a link to a special page given its name and, optionally, a message key from the link text.
Definition: Linker.php:1089
static userToolLinks( $userId, $userText, $redContribsWhenNoEdits=false, $flags=0, $edits=null, $useParentheses=true)
Generate standard user tool links (talk, contributions, block link, etc.)
Definition: Linker.php:1248
static emailLink( $userId, $userText)
Definition: Linker.php:1387
static formatHiddenCategories( $hiddencats)
Returns HTML for the "hidden categories on this page" list.
Definition: Linker.php:2148
static getInvalidTitleDescription(IContextSource $context, $namespace, $title)
Get a message saying that an invalid title was encountered.
Definition: Linker.php:229
static getRollbackEditCount(RevisionRecord $revRecord, $verify=true)
This function will return the number of revisions which a rollback would revert and will verify that ...
Definition: Linker.php:2011
static makeExternalLink( $url, $text, $escape=true, $linktype='', $attribs=[], $title=null)
Make an external link.
Definition: Linker.php:1136
static generateTOC(?TOCData $tocData, Language $lang=null, array $options=[])
Definition: Linker.php:1842
static linkKnown( $target, $html=null, $customAttribs=[], $query=[], $options=[ 'known'])
Identical to link(), except $options defaults to 'known'.
Definition: Linker.php:172
static getRevDeleteLink(Authority $performer, RevisionRecord $revRecord, LinkTarget $title)
Get a revision-deletion link, or disabled link, or nothing, depending on user permissions & the setti...
Definition: Linker.php:2277
static makeThumbLink2(LinkTarget $title, $file, $frameParams=[], $handlerParams=[], $time=false, $query='', array $classes=[], ?Parser $parser=null)
Definition: Linker.php:660
static tocList( $toc, Language $lang=null)
Wraps the TOC in a div with ARIA navigation role and provides the hide/collapse JavaScript.
Definition: Linker.php:1802
static makeHeadline( $level, $attribs, $anchor, $html, $link, $fallbackAnchor=false)
Create a headline for content.
Definition: Linker.php:1896
static makeExternalImage( $url, $alt='')
Return the code for images which were added via external links, via Parser::maybeMakeExternalImage().
Definition: Linker.php:272
static tooltip( $name, $options=null)
Returns raw bits of HTML, use titleAttrib()
Definition: Linker.php:2407
static makeBrokenImageLinkObj( $title, $label='', $query='', $unused1='', $unused2='', $time=false, array $handlerParams=[], bool $currentExists=false)
Make a "broken" link to an image.
Definition: Linker.php:924
static makeMediaLinkFile(LinkTarget $title, $file, $html='')
Create a direct link to a given uploaded file.
Definition: Linker.php:1047
static accesskey( $name, $localizer=null)
Given the id of an interface element, constructs the appropriate accesskey attribute from the system ...
Definition: Linker.php:2247
static titleAttrib( $name, $options=null, array $msgParams=[], $localizer=null)
Given the id of an interface element, constructs the appropriate title attribute from the system mess...
Definition: Linker.php:2193
static userToolLinksRedContribs( $userId, $userText, $edits=null, $useParentheses=true)
Alias for userToolLinks( $userId, $userText, true );.
Definition: Linker.php:1332
static splitTrail( $trail)
Split a link trail, return the "inside" portion and the remainder of the trail as a two-element array...
Definition: Linker.php:1917
static tocIndent()
Add another level to the Table of Contents.
Definition: Linker.php:1736
static revDeleteLinkDisabled( $delete=true)
Creates a dead (show/hide) link for deleting revisions/log entries.
Definition: Linker.php:2353
static formatRevisionSize( $size)
Definition: Linker.php:1721
static tocUnindent( $level)
Finish one or more sublevels on the Table of Contents.
Definition: Linker.php:1747
static formatLinksInComment( $comment, $title=null, $local=false, $wikiId=null)
Formats wiki links and media links in text; all other wiki formatting is ignored.
Definition: Linker.php:1570
static makeThumbLinkObj(LinkTarget $title, $file, $label='', $alt='', $align=null, $params=[], $framed=false, $manualthumb='')
Make HTML for a thumbnail including image, border and caption.
Definition: Linker.php:627
static userLink( $userId, $userName, $altUserName=false, $attributes=[])
Make user link (or user contributions for unregistered users)
Definition: Linker.php:1190
static revUserLink(RevisionRecord $revRecord, $isPublic=false)
Generate a user link if the current user is allowed to view it.
Definition: Linker.php:1413
static generateRollback(RevisionRecord $revRecord, IContextSource $context=null, $options=[])
Generate a rollback link for a given revision.
Definition: Linker.php:1956
static revUserTools(RevisionRecord $revRecord, $isPublic=false, $useParentheses=true)
Generate a user tool link cluster if the current user is allowed to view it.
Definition: Linker.php:1461
static tocLine( $linkAnchor, $tocline, $tocnumber, $level, $sectionIndex=false)
parameter level defines if we are on an indentation level
Definition: Linker.php:1762
static buildRollbackLink(RevisionRecord $revRecord, IContextSource $context=null, $editCount=false)
Build a raw rollback link, useful for collections of "tool" links.
Definition: Linker.php:2077
Page revision base class.
Represents a title within MediaWiki.
Definition: Title.php:76
internal since 1.36
Definition: User.php:98
PHP Parser - Processes wiki markup (which uses a more user-friendly syntax, such as "[[link]]" for ma...
Definition: Parser.php:115
Interface for objects which can provide a MediaWiki context on request.
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.
Definition: router.php:42