MediaWiki
1.30.0
|
Some internal bits split of from Skin.php. More...
Static Public Member Functions | |
static | accesskey ( $name) |
Given the id of an interface element, constructs the appropriate accesskey attribute from the system messages. More... | |
static | blockLink ( $userId, $userText) |
static | buildRollbackLink ( $rev, IContextSource $context=null, $editCount=false) |
Build a raw rollback link, useful for collections of "tool" links. More... | |
static | commentBlock ( $comment, $title=null, $local=false, $wikiId=null) |
Wrap a comment in standard punctuation and formatting if it's non-empty, otherwise return empty string. More... | |
static | emailLink ( $userId, $userText) |
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 contributions list. More... | |
static | formatHiddenCategories ( $hiddencats) |
Returns HTML for the "hidden categories on this page" list. More... | |
static | formatLinksInComment ( $comment, $title=null, $local=false, $wikiId=null) |
Formats wiki links and media links in text; all other wiki formatting is ignored. More... | |
static | formatRevisionSize ( $size) |
static | formatSize ( $size) |
static | formatTemplates ( $templates, $preview=false, $section=false, $more=null) |
static | generateRollback ( $rev, IContextSource $context=null, $options=[ 'verify']) |
Generate a rollback link for a given revision. More... | |
static | generateTOC ( $tree, $lang=false) |
Generate a table of contents from a section tree. More... | |
static | getInvalidTitleDescription (IContextSource $context, $namespace, $title) |
Get a message saying that an invalid title was encountered. More... | |
static | getLinkColour (LinkTarget $t, $threshold) |
Return the CSS colour of a known link. More... | |
static | getRevDeleteLink (User $user, Revision $rev, Title $title) |
Get a revision-deletion link, or disabled link, or nothing, depending on user permissions & the settings on the revision. More... | |
static | getRollbackEditCount ( $rev, $verify) |
This function will return the number of revisions which a rollback would revert and, if $verify is set it will verify that a revision can be reverted (that the user isn't the only contributor and the revision we might rollback to isn't deleted). More... | |
static | link ( $target, $html=null, $customAttribs=[], $query=[], $options=[]) |
This function returns an HTML link to the given target. More... | |
static | linkKnown ( $target, $html=null, $customAttribs=[], $query=[], $options=[ 'known']) |
Identical to link(), except $options defaults to 'known'. More... | |
static | makeBrokenImageLinkObj ( $title, $label='', $query='', $unused1='', $unused2='', $time=false) |
Make a "broken" link to an image. More... | |
static | makeCommentLink (LinkTarget $linkTarget, $text, $wikiId=null, $options=[]) |
Generates a link to the given Title. More... | |
static | makeExternalImage ( $url, $alt='') |
Return the code for images which were added via external links, via Parser::maybeMakeExternalImage(). More... | |
static | makeExternalLink ( $url, $text, $escape=true, $linktype='', $attribs=[], $title=null) |
Make an external link. More... | |
static | makeHeadline ( $level, $attribs, $anchor, $html, $link, $fallbackAnchor=false) |
Create a headline for content. More... | |
static | makeImageLink (Parser $parser, Title $title, $file, $frameParams=[], $handlerParams=[], $time=false, $query="", $widthOption=null) |
Given parameters derived from [[Image:Foo|options...]], generate the HTML that that syntax inserts in the page. More... | |
static | makeMediaLinkFile (Title $title, $file, $html='') |
Create a direct link to a given uploaded file. More... | |
static | makeMediaLinkObj ( $title, $html='', $time=false) |
Create a direct link to a given uploaded file. More... | |
static | makeSelfLinkObj ( $nt, $html='', $query='', $trail='', $prefix='') |
Make appropriate markup for a link to the current article. More... | |
static | makeThumbLink2 (Title $title, $file, $frameParams=[], $handlerParams=[], $time=false, $query="") |
static | makeThumbLinkObj (Title $title, $file, $label='', $alt, $align='right', $params=[], $framed=false, $manualthumb="") |
Make HTML for a thumbnail including image, border and caption. More... | |
static | normaliseSpecialPage (LinkTarget $target) |
static | normalizeSubpageLink ( $contextTitle, $target, &$text) |
static | processResponsiveImages ( $file, $thumb, $hp) |
Process responsive images: add 1.5x and 2x subimages to the thumbnail, where applicable. More... | |
static | revComment (Revision $rev, $local=false, $isPublic=false) |
Wrap and format the given revision's comment block, if the current user is allowed to view it. More... | |
static | revDeleteLink ( $query=[], $restricted=false, $delete=true) |
Creates a (show/hide) link for deleting revisions/log entries. More... | |
static | revDeleteLinkDisabled ( $delete=true) |
Creates a dead (show/hide) link for deleting revisions/log entries. More... | |
static | revUserLink ( $rev, $isPublic=false) |
Generate a user link if the current user is allowed to view it. More... | |
static | revUserTools ( $rev, $isPublic=false) |
Generate a user tool link cluster if the current user is allowed to view it. More... | |
static | specialLink ( $name, $key='') |
Make a link to a special page given its name and, optionally, a message key from the link text. More... | |
static | splitTrail ( $trail) |
Split a link trail, return the "inside" portion and the remainder of the trail as a two-element array. More... | |
static | titleAttrib ( $name, $options=null, array $msgParams=[]) |
Given the id of an interface element, constructs the appropriate title attribute from the system messages. More... | |
static | tocIndent () |
Add another level to the Table of Contents. More... | |
static | tocLine ( $anchor, $tocline, $tocnumber, $level, $sectionIndex=false) |
parameter level defines if we are on an indentation level More... | |
static | tocLineEnd () |
End a Table Of Contents line. More... | |
static | tocList ( $toc, $lang=false) |
Wraps the TOC in a table and provides the hide/collapse javascript. More... | |
static | tocUnindent ( $level) |
Finish one or more sublevels on the Table of Contents. More... | |
static | tooltip ( $name, $options=null) |
Returns raw bits of HTML, use titleAttrib() More... | |
static | tooltipAndAccesskeyAttribs ( $name, array $msgParams=[]) |
Returns the attributes for the tooltip and access key. More... | |
static | userLink ( $userId, $userName, $altUserName=false) |
Make user link (or user contributions for unregistered users) More... | |
static | userTalkLink ( $userId, $userText) |
static | userToolLinks ( $userId, $userText, $redContribsWhenNoEdits=false, $flags=0, $edits=null) |
Generate standard user tool links (talk, contributions, block link, etc.) More... | |
static | userToolLinksRedContribs ( $userId, $userText, $edits=null) |
Alias for userToolLinks( $userId, $userText, true );. More... | |
Public Attributes | |
const | TOOL_LINKS_EMAIL = 2 |
const | TOOL_LINKS_NOBLOCK = 1 |
Flags for userToolLinks() More... | |
Static Public Attributes | |
static | $accesskeycache |
Static Protected Member Functions | |
static | getUploadUrl ( $destFile, $query='') |
Get the URL to upload a certain file. More... | |
Static Private Member Functions | |
static | fnamePart ( $url) |
Returns the filename part of an url. More... | |
static | formatAutocomments ( $comment, $title=null, $local=false, $wikiId=null) |
Converts autogenerated comments in edit summaries into section links. More... | |
static | getImageLinkMTOParams ( $frameParams, $query='', $parser=null) |
Get the link parameters for MediaTransformOutput::toHtml() from given frame parameters supplied by the Parser. More... | |
Some internal bits split of from Skin.php.
These functions are used for primarily page content: links, embedded images, table of contents. Links are also used in the skin.
Definition at line 34 of file Linker.php.
|
static |
Given the id of an interface element, constructs the appropriate accesskey attribute from the system messages.
(Note, this is usually the id but isn't always, because sometimes the accesskey needs to go on a different element than the id, for reverse-compatibility, etc.)
string | $name | Id of the element, minus prefixes. |
Definition at line 1994 of file Linker.php.
References $name, and wfMessage().
Referenced by DummyLinker\accesskey(), OOUIHTMLForm\getButtons(), EditPage\getEditButtons(), EditPage\getSummaryInputWidget(), HTMLFormField\getTooltipAndAccessKeyOOUI(), titleAttrib(), and tooltipAndAccesskeyAttribs().
|
static |
int | $userId | Userid |
string | $userText | User name in database. |
Definition at line 1008 of file Linker.php.
References SpecialPage\getTitleFor(), link(), and wfMessage().
Referenced by DummyLinker\blockLink(), and userToolLinks().
|
static |
Build a raw rollback link, useful for collections of "tool" links.
Revision | $rev | |
IContextSource | null | $context | Context to use or null for the main context. |
int | $editCount | Number of edits that would be reverted |
Definition at line 1790 of file Linker.php.
References $context, $html, $options, $query, $rev, $title, $wgMiserMode, $wgShowRollbackEditCount, as, RequestContext\getMain(), getRollbackEditCount(), MediaWiki\getTitle(), global, and link().
Referenced by DummyLinker\buildRollbackLink(), and generateRollback().
|
static |
Wrap a comment in standard punctuation and formatting if it's non-empty, otherwise return empty string.
string | $comment | |
Title | null | $title | Title object (to generate link to section in autocomment) or null |
bool | $local | Whether section links should refer to local page |
string | null | $wikiId | Id (as used by WikiMap) of the wiki to generate links to. For use with external changes. |
Definition at line 1445 of file Linker.php.
References $title, formatComment(), and wfMessage().
Referenced by DummyLinker\commentBlock(), RevDelFileItem\getComment(), LogFormatter\getComment(), SpecialUndelete\getFileComment(), RevDelLogItem\getHTML(), EditPage\getSummaryPreview(), ChangesList\insertComment(), revComment(), and LogFormatterTest\testLogComment().
|
static |
int | $userId | Userid |
string | $userText | User name in database. |
Definition at line 1022 of file Linker.php.
References SpecialPage\getTitleFor(), link(), and wfMessage().
Referenced by DummyLinker\emailLink(), and userToolLinks().
|
staticprivate |
Returns the filename part of an url.
Used as alternative text for external images.
string | $url |
Definition at line 251 of file Linker.php.
Referenced by makeExternalImage().
|
staticprivate |
Converts autogenerated comments in edit summaries into section links.
The pattern for autogen comments is / * foo * /, which makes for some nasty regex. We look for all comments, match any text before and after the comment, add a separator where needed and format the comment itself with CSS Called by Linker::formatComment.
string | $comment | Comment text |
Title | null | $title | An optional title object used to links to sections |
bool | $local | Whether section links should refer to local page |
string | null | $wikiId | Id of the wiki to link to (if not the local wiki), as used by WikiMap. |
Definition at line 1131 of file Linker.php.
References $auto, $link, $pre, $section, $title, $wgLang, global, makeCommentLink(), Title\makeTitleSafe(), Title\newFromText(), Hooks\run(), use, and wfMessage().
Referenced by formatComment().
|
static |
This function is called by all recent changes variants, by the page history, and by the user contributions list.
It is responsible for formatting edit summaries. It escapes any HTML in the summary, but adds some CSS to format auto-generated comments (from section editing) and formats [[wikilinks]].
Note: there's not always a title to pass to this function. Since you can't set a default parameter for a reference, I've turned it temporarily to a value pass. Should be adjusted further. –brion
string | $comment | |
Title | null | $title | Title object (to generate link to the section in autocomment) or null |
bool | $local | Whether section links should refer to local page |
string | null | $wikiId | Id (as used by WikiMap) of the wiki to generate links to. For use with external changes. |
Definition at line 1099 of file Linker.php.
References $title, formatAutocomments(), and formatLinksInComment().
Referenced by commentBlock(), ApiQueryDeletedrevs\execute(), ApiQueryFilearchive\execute(), ApiQueryWatchlist\extractOutputData(), ApiQueryRevisionsBase\extractRevisionInfo(), ApiQueryLogEvents\extractRowInfo(), ApiQueryContributions\extractRowInfo(), ApiQueryRecentChanges\extractRowInfo(), DummyLinker\formatComment(), FeedUtils\formatDiffRow(), ApiParse\formatSummary(), BlockListPager\formatValue(), ProtectedPagesPager\formatValue(), ImageListPager\formatValue(), ApiQueryImageInfo\getInfo(), ImageHistoryList\imageHistoryLine(), RollbackAction\onView(), ApiQueryProtectedTitles\run(), and ApiComparePages\setVals().
|
static |
Returns HTML for the "hidden categories on this page" list.
array | $hiddencats | Array of hidden categories from Article::getHiddenCategories or similar |
Definition at line 1900 of file Linker.php.
References as, captcha-old\count, link(), and wfMessage().
Referenced by DummyLinker\formatHiddenCategories(), InfoAction\pageInfo(), and EditPage\showEditForm().
|
static |
Formats wiki links and media links in text; all other wiki formatting is ignored.
string | $comment | Text to format links in. WARNING! Since the output of this function is html, $comment must be sanitized for use as html. You probably want to pass $comment through Sanitizer::escapeHtmlAllowEntities() before calling this function. |
Title | null | $title | An optional title object used to links to sections |
bool | $local | Whether section links should refer to local page |
string | null | $wikiId | Id of the wiki to link to (if not the local wiki), as used by WikiMap. |
Definition at line 1224 of file Linker.php.
References $title, $wgContLang, StringUtils\escapeRegexReplacement(), false, MWNamespace\getCanonicalName(), global, list, makeCommentLink(), makeMediaLinkObj(), Title\makeTitleSafe(), Title\newFromText(), normalizeSubpageLink(), NS_FILE, NS_MEDIA, splitTrail(), and use.
Referenced by formatComment(), and DummyLinker\formatLinksInComment().
|
static |
int | $size |
Definition at line 1493 of file Linker.php.
References wfMessage().
Referenced by SpecialMergeHistory\formatRevisionRow(), SpecialUndelete\formatRevisionRow(), DummyLinker\formatRevisionSize(), ContribsPager\formatRow(), ProtectedPagesPager\formatValue(), and HistoryPager\historyLine().
|
static |
Format a size in bytes for output, using an appropriate unit (B, KB, MB or GB) according to the magnitude in question
int | $size | Size to format |
Definition at line 1929 of file Linker.php.
References $wgLang, global, and wfDeprecated().
Referenced by DummyLinker\formatSize().
|
static |
Returns HTML for the "templates used on this page" list.
Make an HTML list of templates, and then add a "More..." link at the bottom. If $more is null, do not add a "More..." link. If $more is a Title, make a link to that title and use it. If $more is a string, directly paste it in as the link (escaping needs to be done manually). Finally, if $more is a Message, call toString().
Title[] | $templates | Array of templates |
bool | $preview | Whether this is for a preview |
bool | $section | Whether this is for a section edit |
Title | Message | string | null | $more | An escaped link for "More..." of the templates |
Definition at line 1869 of file Linker.php.
References $section, $type, RequestContext\getMain(), and wfDeprecated().
Referenced by DummyLinker\formatTemplates().
|
static |
Generate a rollback link for a given revision.
Currently it's the caller's responsibility to ensure that the revision is the top one. If it's not, of course, the user will get an error message.
If the calling page is called with the parameter &bot=1, all rollback links also get that parameter. It causes the edit itself and the rollback to be marked as "bot" edits. Bot edits are hidden by default from recent changes, so this allows sysops to combat a busy vandal without bothering other users.
If the option verify is set this function will return the link only in case the revision can be reverted. Please note that due to performance limitations it might be assumed that a user isn't the only contributor of a page while (s)he is, which will lead to useless rollback links. Furthermore this wont work if $wgShowRollbackEditCount is disabled, so this can only function as an additional check.
If the option noBrackets is set the rollback link wont be enclosed in "[]".
Revision | $rev | |
IContextSource | $context | Context to use or null for the main context. |
array | $options |
Definition at line 1691 of file Linker.php.
References $context, $options, $rev, buildRollbackLink(), RequestContext\getMain(), and getRollbackEditCount().
Referenced by ContribsPager\formatRow(), DummyLinker\generateRollback(), HistoryPager\historyLine(), ChangesList\insertRollback(), and DifferenceEngine\showDiffPage().
|
static |
Generate a table of contents from a section tree.
array | $tree | Return value of ParserOutput::getSections() |
string | Language | bool | $lang | Language for the toc title, defaults to user language |
Definition at line 1589 of file Linker.php.
References $lang, $section, as, tocIndent(), tocLine(), tocLineEnd(), tocList(), and tocUnindent().
Referenced by DummyLinker\generateTOC(), and ApiHelp\getHelp().
|
staticprivate |
Get the link parameters for MediaTransformOutput::toHtml() from given frame parameters supplied by the Parser.
array | $frameParams | The frame parameters |
string | $query | An optional query string to add to description page links |
Parser | null | $parser |
Definition at line 468 of file Linker.php.
References $name, $parser, $query, as, and Title\newFromLinkTarget().
Referenced by makeImageLink(), and makeThumbLink2().
|
static |
Get a message saying that an invalid title was encountered.
This should be called after a method like Title::makeTitleSafe() returned a value indicating that the title object is invalid.
IContextSource | $context | Context to use to get the messages |
int | $namespace | Namespace number |
string | $title | Text of the title, without the namespace part |
Definition at line 209 of file Linker.php.
References $context, $name, $title, $wgContLang, MWNamespace\exists(), global, and NS_MAIN.
Referenced by PageQueryPage\formatResult(), FewestrevisionsPage\formatResult(), MostlinkedCategoriesPage\formatResult(), MostcategoriesPage\formatResult(), MostinterwikisPage\formatResult(), MostlinkedTemplatesPage\formatResult(), MostlinkedPage\formatResult(), UnwatchedpagesPage\formatResult(), ShortPagesPage\formatResult(), SpecialProtectedtitles\formatRow(), ProtectedPagesPager\formatValue(), DummyLinker\getInvalidTitleDescription(), and SpecialUndelete\showList().
|
static |
Return the CSS colour of a known link.
LinkTarget | $t | |
int | $threshold | User defined threshold |
Definition at line 51 of file Linker.php.
References $linkRenderer, $services, $t, and wfDeprecated().
Referenced by DummyLinker\getLinkColour().
Get a revision-deletion link, or disabled link, or nothing, depending on user permissions & the settings on the revision.
Will use forward-compatible revision ID in the Special:RevDelete link if possible, otherwise the timestamp-based ID which may break after undeletion.
Definition at line 2030 of file Linker.php.
References $query, $rev, $title, $user, Revision\DELETED_RESTRICTED, revDeleteLink(), and revDeleteLinkDisabled().
Referenced by SpecialUndelete\diffHeader(), DeletedContribsPager\formatRevisionRow(), ContribsPager\formatRow(), DummyLinker\getRevDeleteLink(), DifferenceEngine\revisionDeleteLink(), Article\setOldSubtitle(), and SpecialUndelete\showRevision().
|
static |
This function will return the number of revisions which a rollback would revert and, if $verify is set it will verify that a revision can be reverted (that the user isn't the only contributor and the revision we might rollback to isn't deleted).
These checks can only function as an additional check as this function only checks against the last $wgShowRollbackEditCount edits.
Returns null if $wgShowRollbackEditCount is disabled or false if $verify is set and the user is the only contributor of the page.
Revision | $rev | |
bool | $verify | Try to verify that this revision can really be rolled back |
Definition at line 1730 of file Linker.php.
References $dbr, $res, $rev, $wgShowRollbackEditCount, as, DB_REPLICA, Revision\DELETED_TEXT, Revision\DELETED_USER, global, Revision\RAW, and wfGetDB().
Referenced by buildRollbackLink(), generateRollback(), and DummyLinker\getRollbackEditCount().
|
staticprotected |
Get the URL to upload a certain file.
Title | $destFile | Title object of the file to upload |
string | $query | Urlencoded query string to prepend |
Definition at line 740 of file Linker.php.
References $query, $wgUploadMissingFileUrl, $wgUploadNavigationUrl, SpecialPage\getTitleFor(), global, and wfAppendQuery().
Referenced by makeBrokenImageLinkObj(), and makeMediaLinkFile().
|
static |
This function returns an HTML link to the given target.
It serves a few purposes: 1) If $target is a Title, the correct URL to link to will be figured out automatically. 2) It automatically adds the usual classes for various types of link targets: "new" for red links, "stub" for short articles, etc. 3) It escapes all attribute values safely so there's no risk of XSS. 4) It provides a default tooltip if the target is a Title (the page name of the target). link() replaces the old functions in the makeLink() family.
LinkTarget | $target | Can currently only be a LinkTarget, but this may change to support Images, literal URLs, etc. |
string | $html | The HTML contents of the element, i.e., the link text. This is raw HTML and will not be escaped. If null, defaults to the prefixed text of the Title; or if the Title is just a fragment, the contents of the fragment. |
array | $customAttribs | A key => value array of extra HTML attributes, such as title and class. (href is ignored.) Classes will be merged with the default classes, while other attributes will replace default attributes. All passed attribute values will be HTML-escaped. A false attribute value means to suppress that attribute. |
array | $query | The query string to append to the URL you're linking to, in key => value array form. Query keys and values will be URL-encoded. |
string | array | $options | String or array of strings: 'known': Page is known to exist, so don't check if it does. 'broken': Page is known not to exist, so don't check if it does. 'noclasses': Don't add any classes automatically (includes "new", "stub", "mw-redirect", "extiw"). Only use the class attribute provided, if any, so you get a simple blue link with no funny i- cons. 'forcearticlepath': Use the article path always, even with a querystring. Has compatibility issues on some setups, so avoid wherever possible. 'http': Force a full URL with http:// as the scheme. 'https': Force a full URL with https:// as the scheme. 'stubThreshold' => (int): Stub threshold to use when determining link classes. |
Definition at line 107 of file Linker.php.
References $customAttribs, $html, $linkRenderer, $options, $query, $services, array(), wfCgiToArray(), wfDeprecated(), and wfWarn().
Referenced by blockLink(), buildRollbackLink(), Skin\doEditSectionLink(), Skin\drawCategoryBrowser(), emailLink(), SpecialRenameuser\execute(), formatHiddenCategories(), Skin\getCategoryLinks(), UserGroupMembership\getLink(), Article\getRedirectHeaderHtml(), LogPage\getTitleLink(), DummyLinker\link(), linkKnown(), makeBrokenImageLinkObj(), makeCommentLink(), makeImageLink(), LogFormatter\makePageLink(), RenameuserLogFormatter\myPageLink(), RenameuserHooks\onContributionsToolLinks(), revDeleteLink(), SpecialInterwiki\showList(), LogFormatterTest\testLogParamsTypeRaw(), LogFormatterTest\testLogParamsTypeTitleLink(), LogFormatterTest\testNormalLogParams(), userLink(), userTalkLink(), and userToolLinks().
|
static |
Identical to link(), except $options defaults to 'known'.
Title | $target | |
string | $html | |
array | $customAttribs | |
array | $query | |
string | array | $options |
Definition at line 164 of file Linker.php.
References $customAttribs, $html, $options, $query, and link().
Referenced by Article\confirmDelete(), Article\delete(), SpecialRenameuser\execute(), Skin\footerLink(), MergeLogFormatter\getActionLinks(), MoveLogFormatter\getActionLinks(), Skin\getCopyright(), Skin\getNewtalks(), DifferenceEngine\getRevisionHeader(), Skin\getUndeleteLink(), ImagePage\imageDupes(), ImageHistoryList\imageHistoryLine(), ImagePage\imageLinks(), DummyLinker\linkKnown(), Skin\mainPageLink(), IndexPager\makeLink(), SpecialInterwiki\makeTable(), DifferenceEngine\markPatrolledLink(), ImagePage\openShowImage(), Article\setOldSubtitle(), DifferenceEngine\showDiffPage(), SpecialInterwiki\showList(), Article\showPatrolFooter(), Article\showRedirectedFromHeader(), specialLink(), Skin\subPageSubtitle(), CologneBlueTemplate\sysLinks(), and TraditionalImageGallery\toHTML().
|
static |
Make a "broken" link to an image.
Title | $title | |
string | $label | Link label (plain text) |
string | $query | Query string |
string | $unused1 | Unused parameter kept for b/c |
string | $unused2 | Unused parameter kept for b/c |
bool | $time | A file of a certain timestamp was requested |
Definition at line 690 of file Linker.php.
References $query, $time, $title, $wgEnableUploads, $wgUploadMissingFileUrl, $wgUploadNavigationUrl, false, getUploadUrl(), global, link(), RepoGroup\singleton(), wfCgiToArray(), wfFindFile(), and wfWarn().
Referenced by DummyLinker\makeBrokenImageLinkObj(), makeImageLink(), and makeThumbLink2().
|
static |
Generates a link to the given Title.
LinkTarget | $linkTarget | |
string | $text | |
string | null | $wikiId | Id of the wiki to link to (if not the local wiki), as used by WikiMap. |
string | string[] | $options | See the $options parameter in Linker::link. |
Definition at line 1330 of file Linker.php.
References $link, $options, MWNamespace\getCanonicalName(), MediaWiki\Linker\LinkTarget\getDBkey(), WikiMap\getForeignURL(), MediaWiki\Linker\LinkTarget\getFragment(), MediaWiki\Linker\LinkTarget\getNamespace(), MediaWiki\Linker\LinkTarget\isExternal(), link(), and makeExternalLink().
Referenced by formatAutocomments(), formatLinksInComment(), and DummyLinker\makeCommentLink().
|
static |
Return the code for images which were added via external links, via Parser::maybeMakeExternalImage().
string | $url | |
string | $alt |
Definition at line 271 of file Linker.php.
References $success, Html\element(), fnamePart(), Hooks\run(), and wfDebug().
Referenced by DummyLinker\makeExternalImage().
|
static |
Make an external link.
string | $url | URL to link to |
string | $text | Text of link |
bool | $escape | Do we escape the link text? |
string | $linktype | Type of external link. Gets added to the classes |
array | $attribs | Array of extra attributes to |
Title | null | $title | Title object used for title specific link attributes |
Definition at line 843 of file Linker.php.
References $attribs, $link, $success, $title, $wgTitle, global, Html\rawElement(), Hooks\run(), and wfDebug().
Referenced by LinkSearchPage\formatResult(), AllMessagesTablePager\formatValue(), Skin\getCopyright(), SpecialVersion\getCreditsForExtension(), SpecialVersion\getExternalLibraries(), SpecialVersion\getParserFunctionHooks(), SpecialVersion\getParserTags(), ImagePage\imageDupes(), makeCommentLink(), DummyLinker\makeExternalLink(), WikiMap\makeForeignLink(), Article\showRedirectedFromHeader(), CologneBlueTemplate\sysLinks(), and ImagePage\uploadLinksBox().
|
static |
Create a headline for content.
int | $level | The level of the headline (1-6) |
string | $attribs | Any attributes for the headline, starting with a space and ending with '>' This must be at least '>' for no attribs |
string | $anchor | The anchor to give the headline (the bit after the #) |
string | $html | HTML for the text of the header |
string | $link | HTML to add for the section edit link |
string | bool | $fallbackAnchor | A second, optional anchor to give for backward compatibility (false to omit) |
Definition at line 1627 of file Linker.php.
References $fallback, $link, and $ret.
Referenced by DummyLinker\makeHeadline(), and ApiMain\modifyHelp().
|
static |
Given parameters derived from [[Image:Foo|options...]], generate the HTML that that syntax inserts in the page.
Parser | $parser | |
Title | $title | Title object of the file (not the currently viewed page) |
File | $file | File object, or false if it doesn't exist |
array | $frameParams | Associative array of parameters external to the media handler. Boolean parameters are indicated by presence or absence, the value is arbitrary and will often be false. thumbnail If present, downscale and frame manualthumb Image name to use as a thumbnail, instead of automatic scaling framed Shows image in original size in a frame frameless Downscale but don't frame upright If present, tweak default sizes for portrait orientation upright_factor Fudge factor for "upright" tweak (default 0.75) border If present, show a border around the image align Horizontal alignment (left, right, center, none) valign Vertical alignment (baseline, sub, super, top, text-top, middle, bottom, text-bottom) alt Alternate text for image (i.e. alt attribute). Plain text. class HTML for image classes. Plain text. caption HTML for image caption. link-url URL to link to link-title Title object to link to link-target Value for the target attribute, only with link-url no-link Boolean, suppress description link |
array | $handlerParams | Associative array of media handler parameters, to be passed to transform(). Typical keys are "width" and "page". |
string | bool | $time | Timestamp of the file, set as false for current |
string | $query | Query params for desc url |
int | null | $widthOption | Used by the parser to remember the user preference thumbnailsize |
Definition at line 324 of file Linker.php.
References $handlerParams, $params, $parser, $query, $res, $s, $time, $title, $wgSVGMaxSize, $wgThumbLimits, $wgThumbUpright, User\getDefaultOption(), getImageLinkMTOParams(), global, link(), makeBrokenImageLinkObj(), makeThumbLink2(), processResponsiveImages(), Hooks\run(), and wfDebug().
Referenced by DummyLinker\makeImageLink().
|
static |
Create a direct link to a given uploaded file.
This will make a broken link if $file is false.
Definition at line 783 of file Linker.php.
References $attribs, $html, $ret, $title, getUploadUrl(), Html\rawElement(), Hooks\run(), and wfDebug().
Referenced by DummyLinker\makeMediaLinkFile(), and makeMediaLinkObj().
|
static |
Create a direct link to a given uploaded file.
Title | $title | |
string | $html | Pre-sanitized HTML |
string | $time | MW timestamp of file creation time |
Definition at line 766 of file Linker.php.
References $html, $time, $title, makeMediaLinkFile(), and wfFindFile().
Referenced by formatLinksInComment(), MIMEsearchPage\formatResult(), and DummyLinker\makeMediaLinkObj().
|
static |
Make appropriate markup for a link to the current article.
This is since MediaWiki 1.29.0 rendered as an tag without an href and with a class showing the link text. The calling sequence is the same as for the other make*LinkObj static functions, but $query is not used.
Title | $nt | |
string | $html | [optional] |
string | $query | [optional] |
string | $trail | [optional] |
string | $prefix | [optional] |
Definition at line 186 of file Linker.php.
References $html, $ret, list, Hooks\run(), and splitTrail().
Referenced by DummyLinker\makeSelfLinkObj(), and LinkHolderArray\replaceInternal().
|
static |
Definition at line 533 of file Linker.php.
References $handlerParams, $params, $query, $s, $time, $title, getImageLinkMTOParams(), makeBrokenImageLinkObj(), Title\makeTitleSafe(), NS_FILE, processResponsiveImages(), Html\rawElement(), text, wfAppendQuery(), wfFindFile(), and wfMessage().
Referenced by makeImageLink(), DummyLinker\makeThumbLink2(), and makeThumbLinkObj().
|
static |
Make HTML for a thumbnail including image, border and caption.
Title | $title | |
File | bool | $file | File object or false if it doesn't exist |
string | $label | |
string | $alt | |
string | $align | |
array | $params | |
bool | $framed | |
string | $manualthumb |
Definition at line 507 of file Linker.php.
References $params, $title, and makeThumbLink2().
Referenced by DummyLinker\makeThumbLinkObj(), ImagePage\openShowImage(), and CreatePdfThumbnailsJob\run().
|
static |
LinkTarget | $target |
Definition at line 230 of file Linker.php.
References $name, $ret, MediaWiki\Linker\LinkTarget\getDBkey(), MediaWiki\Linker\LinkTarget\getFragment(), MediaWiki\Linker\LinkTarget\getNamespace(), SpecialPage\getTitleValueFor(), MediaWiki\Linker\LinkTarget\isExternal(), list, NS_SPECIAL, and SpecialPageFactory\resolveAlias().
Referenced by DummyLinker\normaliseSpecialPage(), and MediaWiki\Linker\LinkRenderer\normalizeTarget().
|
static |
Title | $contextTitle | |
string | $target | |
string | &$text |
Definition at line 1359 of file Linker.php.
References $ret, below, change, captcha-old\count, MWNamespace\hasSubpages(), is(), not, page, reasons, and value.
Referenced by formatLinksInComment(), and DummyLinker\normalizeSubpageLink().
|
static |
Process responsive images: add 1.5x and 2x subimages to the thumbnail, where applicable.
File | $file | |
MediaTransformOutput | $thumb | |
array | $hp | Image parameters |
Definition at line 655 of file Linker.php.
References $wgResponsiveImages, and global.
Referenced by makeImageLink(), makeThumbLink2(), ImagePage\openShowImage(), DummyLinker\processResponsiveImages(), and TraditionalImageGallery\toHTML().
Wrap and format the given revision's comment block, if the current user is allowed to view it.
Revision | $rev | |
bool | $local | Whether section links should refer to local page |
bool | $isPublic | Show only if all users can see it |
Definition at line 1470 of file Linker.php.
References $rev, commentBlock(), Revision\DELETED_COMMENT, Revision\FOR_THIS_USER, Revision\RAW, and wfMessage().
Referenced by SpecialUndelete\diffHeader(), DeletedContribsPager\formatRevisionRow(), SpecialMergeHistory\formatRevisionRow(), SpecialUndelete\formatRevisionRow(), SpecialNewpages\formatRow(), ContribsPager\formatRow(), ChangeTagsRevisionItem\getHTML(), RevDelRevisionItem\getHTML(), RevisionItem\getHTML(), HistoryPager\historyLine(), DummyLinker\revComment(), Article\setOldSubtitle(), and DifferenceEngine\showDiffPage().
Creates a (show/hide) link for deleting revisions/log entries.
array | $query | Query parameters to be passed to link() |
bool | $restricted | Set to true to use a "<strong>" instead of a "<span>" |
bool | $delete | Set to true to use (show/hide) rather than (show) |
Definition at line 2071 of file Linker.php.
References $html, $link, $query, SpecialPage\getTitleFor(), link(), Xml\tags(), and wfMessage().
Referenced by SpecialUndelete\formatFileRow(), getRevDeleteLink(), LogEventsList\getShowHideLinks(), HistoryPager\historyLine(), ImageHistoryList\imageHistoryLine(), and DummyLinker\revDeleteLink().
|
static |
Creates a dead (show/hide) link for deleting revisions/log entries.
bool | $delete | Set to true to use (show/hide) rather than (show) |
Definition at line 2093 of file Linker.php.
References $html, Xml\tags(), and wfMessage().
Referenced by SpecialUndelete\formatFileRow(), getRevDeleteLink(), LogEventsList\getShowHideLinks(), HistoryPager\historyLine(), ImageHistoryList\imageHistoryLine(), and DummyLinker\revDeleteLinkDisabled().
|
static |
Generate a user link if the current user is allowed to view it.
Revision | $rev | |
bool | $isPublic | Show only if all users can see it |
Definition at line 1038 of file Linker.php.
References $link, $rev, Revision\DELETED_USER, Revision\FOR_THIS_USER, userLink(), and wfMessage().
Referenced by ChangeTagsRevisionItem\getHTML(), RevDelRevisionItem\getHTML(), RevisionItem\getHTML(), and DummyLinker\revUserLink().
|
static |
Generate a user tool link cluster if the current user is allowed to view it.
Revision | $rev | |
bool | $isPublic | Show only if all users can see it |
Definition at line 1060 of file Linker.php.
References $link, $rev, Revision\DELETED_USER, Revision\FOR_THIS_USER, userLink(), userToolLinks(), and wfMessage().
Referenced by SpecialUndelete\diffHeader(), SpecialMergeHistory\formatRevisionRow(), SpecialUndelete\formatRevisionRow(), SpecialNewpages\formatRow(), HistoryPager\historyLine(), RollbackAction\onView(), InfoAction\pageInfo(), DummyLinker\revUserTools(), Article\setOldSubtitle(), DifferenceEngine\showDiffPage(), and SpecialUndelete\showRevision().
|
static |
Make a link to a special page given its name and, optionally, a message key from the link text.
Usage example: Linker::specialLink( 'Recentchanges' )
string | $name | |
string | $key |
Definition at line 824 of file Linker.php.
References $name, SpecialPage\getTitleFor(), linkKnown(), text, and wfMessage().
Referenced by DummyLinker\specialLink().
|
static |
Split a link trail, return the "inside" portion and the remainder of the trail as a two-element array.
string | $trail |
Definition at line 1650 of file Linker.php.
References $wgContLang, and global.
Referenced by formatLinksInComment(), LinkHolderArray\makeHolder(), makeSelfLinkObj(), and DummyLinker\splitTrail().
|
static |
Given the id of an interface element, constructs the appropriate title attribute from the system messages.
(Note, this is usually the id but isn't always, because sometimes the accesskey needs to go on a different element than the id, for reverse-compatibility, etc.)
string | $name | Id of the element, minus prefixes. |
string | null | $options | Null or the string 'withaccess' to add an access- key hint |
array | $msgParams | Parameters to pass to the message |
Definition at line 1951 of file Linker.php.
References $name, $options, accesskey(), and wfMessage().
Referenced by MonoBookTemplate\customBox(), OOUIHTMLForm\getButtons(), EditPage\getCheckboxes(), EditPage\getCheckboxesWidget(), EditPage\getEditButtons(), EditPage\getSummaryInputWidget(), HTMLFormField\getTooltipAndAccessKeyOOUI(), BaseTemplate\makeLink(), DifferenceEngine\showDiffPage(), EditPage\showEditForm(), DummyLinker\titleAttrib(), tooltip(), and tooltipAndAccesskeyAttribs().
|
static |
Add another level to the Table of Contents.
Definition at line 1509 of file Linker.php.
Referenced by generateTOC(), SpecialEditWatchlist\getNormalForm(), and DummyLinker\tocIndent().
|
static |
parameter level defines if we are on an indentation level
string | $anchor | |
string | $tocline | |
string | $tocnumber | |
string | $level | |
string | bool | $sectionIndex |
Definition at line 1535 of file Linker.php.
References Html\element(), Html\openElement(), and Html\rawElement().
Referenced by generateTOC(), SpecialEditWatchlist\getNormalForm(), and DummyLinker\tocLine().
|
static |
End a Table Of Contents line.
tocUnindent() will be used instead if we're ending a line below the new level.
Definition at line 1559 of file Linker.php.
Referenced by generateTOC(), SpecialEditWatchlist\getNormalForm(), and DummyLinker\tocLineEnd().
|
static |
Wraps the TOC in a table and provides the hide/collapse javascript.
string | $toc | Html of the Table Of Contents |
string | Language | bool | $lang | Language for the toc title, defaults to user language |
Definition at line 1571 of file Linker.php.
References $lang, $title, wfGetLangObj(), and wfMessage().
Referenced by generateTOC(), SpecialEditWatchlist\getNormalForm(), and DummyLinker\tocList().
|
static |
Finish one or more sublevels on the Table of Contents.
int | $level |
Definition at line 1520 of file Linker.php.
Referenced by generateTOC(), and DummyLinker\tocUnindent().
|
static |
Returns raw bits of HTML, use titleAttrib()
string | $name | |
array | null | $options |
Definition at line 2132 of file Linker.php.
References $name, $options, Xml\expandAttributes(), and titleAttrib().
Referenced by VectorTemplate\renderPortal(), and DummyLinker\tooltip().
|
static |
Returns the attributes for the tooltip and access key.
string | $name | |
array | $msgParams | Params for constructing the message |
Definition at line 2111 of file Linker.php.
References $attribs, $name, accesskey(), and titleAttrib().
Referenced by VectorTemplate\execute(), VFormHTMLForm\getButtons(), HTMLForm\getButtons(), HistoryPager\getStartBody(), EditPage\getSummaryInput(), HTMLFormField\getTooltipAndAccessKey(), BaseTemplate\makeLink(), BaseTemplate\makeSearchButton(), BaseTemplate\makeSearchInput(), UserrightsPage\showEditUserGroupsForm(), SpecialImport\showForm(), and DummyLinker\tooltipAndAccesskeyAttribs().
|
static |
Make user link (or user contributions for unregistered users)
int | $userId | User id in database. |
string | $userName | User name in database. |
string | $altUserName | Text to display instead of the user name (optional) |
Definition at line 893 of file Linker.php.
References SpecialPage\getTitleFor(), link(), Title\makeTitle(), NS_USER, and IP\prettifyIP().
Referenced by FileDuplicateSearchPage\formatResult(), ActiveUsersPager\formatRow(), UsersPager\formatRow(), ContribsPager\formatRow(), BlockListPager\formatValue(), ProtectedPagesPager\formatValue(), SpecialUndelete\getFileUser(), RCCacheEntryFactory\getUserLink(), RevDelFileItem\getUserTools(), ImageHistoryList\imageHistoryLine(), ChangesList\insertUserRelatedLinks(), LogFormatter\makeUserLink(), revUserLink(), revUserTools(), LogFormatterTest\testLogParamsTypeUserLink(), LogFormatterTest\testNormalLogParams(), and DummyLinker\userLink().
|
static |
Definition at line 993 of file Linker.php.
References link(), Title\makeTitle(), NS_USER_TALK, and wfMessage().
Referenced by ContribsPager\formatRow(), DummyLinker\userTalkLink(), and userToolLinks().
|
static |
Generate standard user tool links (talk, contributions, block link, etc.)
int | $userId | User identifier |
string | $userText | User name or IP address |
bool | $redContribsWhenNoEdits | Should the contributions link be red if the user has no edits? |
int | $flags | Customisation flags (e.g. Linker::TOOL_LINKS_NOBLOCK and Linker::TOOL_LINKS_EMAIL). |
int | $edits | User edit count (optional, for performance) |
Definition at line 926 of file Linker.php.
References $attribs, $flags, $user, $wgDisableAnonTalk, $wgLang, $wgUser, blockLink(), emailLink(), SpecialPage\getTitleFor(), global, link(), User\newFromId(), Hooks\run(), TOOL_LINKS_NOBLOCK, userTalkLink(), and wfMessage().
Referenced by FileDuplicateSearchPage\formatResult(), ActiveUsersPager\formatRow(), BlockListPager\formatValue(), ProtectedPagesPager\formatValue(), SpecialUndelete\getFileUser(), RevDelFileItem\getUserTools(), ImageHistoryList\imageHistoryLine(), ChangesList\insertUserRelatedLinks(), LogFormatter\makeUserLink(), RCCacheEntryFactory\newFromRecentChange(), revUserTools(), UserrightsPage\showEditUserGroupsForm(), DummyLinker\userToolLinks(), and userToolLinksRedContribs().
|
static |
Alias for userToolLinks( $userId, $userText, true );.
int | $userId | User identifier |
string | $userText | User name or IP address |
int | $edits | User edit count (optional, for performance) |
Definition at line 983 of file Linker.php.
References userToolLinks().
Referenced by UsersPager\formatRow(), LogFormatterTest\testNormalLogParams(), and DummyLinker\userToolLinksRedContribs().
|
static |
Definition at line 1981 of file Linker.php.
const Linker::TOOL_LINKS_EMAIL = 2 |
Definition at line 39 of file Linker.php.
Referenced by UserrightsPage\showEditUserGroupsForm().
const Linker::TOOL_LINKS_NOBLOCK = 1 |
Flags for userToolLinks()
Definition at line 38 of file Linker.php.
Referenced by BlockListPager\formatValue(), BlockLogFormatter\getMessageParameters(), and userToolLinks().