Linker Class Reference
[Skins]

Split off some of the internal bits from Skin.php. More...

Inherited by Skin.

List of all members.

Public Member Functions

 __construct ()
 postParseLinkColour ($s=null)
 getExternalLinkAttributes ($title, $unused=null, $class='')
 Get the appropriate HTML attributes to add to the "a" element of an ex- ternal link, as created by [wikisyntax].
 getInterwikiLinkAttributes ($title, $unused=null, $class='')
 Get the appropriate HTML attributes to add to the "a" element of an in- terwiki link.
 getInternalLinkAttributes ($title, $unused=null, $class='')
 Get the appropriate HTML attributes to add to the "a" element of an in- ternal link.
 getInternalLinkAttributesObj ($nt, $unused=null, $class= '', $title=false)
 Get the appropriate HTML attributes to add to the "a" element of an in- ternal link, given the Title object for the page we want to link to.
 getLinkColour ($t, $threshold)
 Return the CSS colour of a known link.
 link ($target, $text=null, $customAttribs=array(), $query=array(), $options=array())
 This function returns an HTML link to the given target.
 makeLink ($title, $text= '', $query= '', $trail= '')
 makeKnownLink ($title, $text= '', $query= '', $trail= '', $prefix= '', $aprops= '')
 makeBrokenLink ($title, $text= '', $query= '', $trail= '')
 makeStubLink ($title, $text= '', $query= '', $trail= '')
 makeLinkObj ($nt, $text= '', $query= '', $trail= '', $prefix= '')
 makeKnownLinkObj ($title, $text= '', $query= '', $trail= '', $prefix= '', $aprops= '', $style= '')
 makeBrokenLinkObj ($title, $text= '', $query= '', $trail= '', $prefix= '')
 makeStubLinkObj ($nt, $text= '', $query= '', $trail= '', $prefix= '')
 makeColouredLinkObj ($nt, $colour, $text= '', $query= '', $trail= '', $prefix= '')
 makeSizeLinkObj ($size, $nt, $text= '', $query= '', $trail= '', $prefix= '')
 Generate either a normal exists-style link or a stub link, depending on the given page size.
 makeSelfLinkObj ($nt, $text= '', $query= '', $trail= '', $prefix= '')
 Make appropriate markup for a link to the current article.
 normaliseSpecialPage (Title $title)
 fnamePart ($url)
 makeImage ($url, $alt= '')
 Obsolete alias.
 makeExternalImage ($url, $alt= '')
 makeImageLinkObj ($title, $label, $alt, $align= '', $handlerParams=array(), $framed=false, $thumb=false, $manualthumb= '', $valign= '', $time=false)
 Creates the HTML source for images.
 makeImageLink2 (Title $title, $file, $frameParams=array(), $handlerParams=array(), $time=false, $query="")
 Given parameters derived from [[Image:Foo|options.
 makeThumbLinkObj (Title $title, $file, $label= '', $alt, $align= 'right', $params=array(), $framed=false, $manualthumb="")
 Make HTML for a thumbnail including image, border and caption.
 makeThumbLink2 (Title $title, $file, $frameParams=array(), $handlerParams=array(), $time=false, $query="")
 makeBrokenImageLinkObj ($title, $text= '', $query= '', $trail= '', $prefix= '', $time=false)
 Make a "broken" link to an image.
 makeMediaLink ($name, $unused= '', $text= '', $time=false)
 makeMediaLinkObj ($title, $text= '', $time=false)
 Create a direct link to a given uploaded file.
 specialLink ($name, $key= '')
 makeExternalLink ($url, $text, $escape=true, $linktype= '', $attribs=array())
 Make an external link.
 userLink ($userId, $userText)
 Make user link (or user contributions for unregistered users).
 userToolLinks ($userId, $userText, $redContribsWhenNoEdits=false, $flags=0, $edits=null)
 Generate standard user tool links (talk, contributions, block link, etc.
 userToolLinksRedContribs ($userId, $userText, $edits=null)
 Alias for userToolLinks( $userId, $userText, true );.
 userTalkLink ($userId, $userText)
 blockLink ($userId, $userText)
 revUserLink ($rev, $isPublic=false)
 Generate a user link if the current user is allowed to view it.
 revUserTools ($rev, $isPublic=false)
 Generate a user tool link cluster if the current user is allowed to view it.
 formatComment ($comment, $title=NULL, $local=false)
 This function is called by all recent changes variants, by the page history, and by the user contributions list.
 formatLinksInComment ($comment)
 Formats wiki links and media links in text; all other wiki formatting is ignored.
 commentBlock ($comment, $title=NULL, $local=false)
 Wrap a comment in standard punctuation and formatting if it's non-empty, otherwise return empty string.
 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.
 formatRevisionSize ($size)
 tocIndent ()
 tocUnindent ($level)
 tocLine ($anchor, $tocline, $tocnumber, $level)
 parameter level defines if we are on an indentation level
 tocLineEnd ()
 tocList ($toc)
 editSectionLinkForOther ($title, $section)
 Used to generate section edit links that point to "other" pages (sections that are really part of included pages).
 editSectionLink (Title $nt, $section, $hint= '')
 doEditSectionLink (Title $nt, $section, $tooltip=null)
 Create a section edit link.
 makeHeadline ($level, $attribs, $anchor, $text, $link, $legacyAnchor=false)
 Create a headline for content.
 generateRollback ($rev)
 Generate a rollback link for a given revision.
 buildRollbackLink ($rev)
 Build a raw rollback link, useful for collections of "tool" links.
 formatTemplates ($templates, $preview=false, $section=false)
 Returns HTML for the "templates used on this page" list.
 formatHiddenCategories ($hiddencats)
 Returns HTML for the "hidden categories on this page" list.
 formatSize ($size)
 Format a size in bytes for output, using an appropriate unit (B, KB, MB or GB) according to the magnitude in question.
 tooltipAndAccesskey ($name)
 tooltip ($name, $options=null)
 titleAttrib ($name, $options=null)
 Given the id of an interface element, constructs the appropriate title attribute from the system messages.
 accesskey ($name)
 Given the id of an interface element, constructs the appropriate accesskey attribute from the system messages.
 revDeleteLink ($query=array(), $restricted=false)
 Creates a (show/hide) link for deleting revisions/log entries.

Static Public Member Functions

static splitTrail ($trail)
 Split a link trail, return the "inside" portion and the remainder of the trail as a two-element array.

Public Attributes

const TOOL_LINKS_NOBLOCK = 1
 Flags for userToolLinks().

Protected Member Functions

 formatLinksInCommentCallback ($match)

Private Member Functions

 getLinkAttributesInternal ($title, $class, $classDefault=false)
 Common code for getLinkAttributesX functions.
 linkUrl ($target, $query, $options)
 linkAttribs ($target, $attribs, $options)
 linkText ($target)
 formatAutocomments ($comment, $title=null, $local=false)
 The pattern for autogen comments is / * foo * /, which makes for some nasty regex.
 formatAutocommentsCallback ($match)


Detailed Description

Split off some of the internal bits from Skin.php.

These functions are used for primarily page content: links, embedded images, table of contents. Links are also used in the skin. For the moment, Skin is a descendent class of Linker. In the future, it should probably be further split so that every other bit of the wiki doesn't have to go loading up Skin to get at it.

Definition at line 11 of file Linker.php.


Constructor & Destructor Documentation

Linker::__construct (  ) 

Definition at line 18 of file Linker.php.

Referenced by Skin::Skin().


Member Function Documentation

Linker::accesskey ( name  ) 

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.)

Parameters:
string $name Id of the element, minus prefixes.
Returns:
string Contents of the accesskey attribute (which you must HTML- escape), or false for no accesskey attribute

Definition at line 1796 of file Linker.php.

Linker::blockLink ( userId,
userText 
)

Parameters:
$userId Integer: userid
$userText String: user name in database.
Returns:
string HTML fragment with block link
Access:
private

Definition at line 1135 of file Linker.php.

References SpecialPage::getTitleFor(), link(), and wfMsgHtml().

Referenced by userToolLinks().

Linker::buildRollbackLink ( rev  ) 

Build a raw rollback link, useful for collections of "tool" links.

Parameters:
Revision $rev
Returns:
string

Definition at line 1601 of file Linker.php.

References $wgRequest, $wgUser, Title::getPrefixedText(), link(), wfMsg(), and wfMsgHtml().

Referenced by generateRollback().

Linker::commentBlock ( comment,
title = NULL,
local = false 
)

Wrap a comment in standard punctuation and formatting if it's non-empty, otherwise return empty string.

Parameters:
string $comment
mixed $title Title object (to generate link to section in autocomment) or null
bool $local Whether section links should refer to local page
Returns:
string

Definition at line 1356 of file Linker.php.

References formatComment().

Referenced by revComment().

Linker::doEditSectionLink ( Title nt,
section,
tooltip = null 
)

Create a section edit link.

This supersedes editSectionLink() and editSectionLinkForOther().

Parameters:
$nt Title The title being linked to (may not be the same as $wgTitle, if the section is included from a template)
$section string The designation of the section being pointed to, to be included in the link, like "&section=$section"
$tooltip string The tooltip to use for the link: will be escaped and wrapped in the 'editsectionhint' message
Returns:
string HTML to use for edit link

Definition at line 1489 of file Linker.php.

References $result, $section, link(), wfMsg(), wfMsgHtml(), and wfRunHooks().

Referenced by editSectionLink(), and editSectionLinkForOther().

Linker::editSectionLink ( Title nt,
section,
hint = '' 
)

Parameters:
$nt Title object.
$section Integer: section number.
$hint Link String: title, or default if omitted or empty

Definition at line 1467 of file Linker.php.

References $section, doEditSectionLink(), and wfDeprecated().

Linker::editSectionLinkForOther ( title,
section 
)

Used to generate section edit links that point to "other" pages (sections that are really part of included pages).

Parameters:
$title Title string.
$section Integer: section number.

Definition at line 1456 of file Linker.php.

References $section, doEditSectionLink(), Title::newFromText(), and wfDeprecated().

Linker::fnamePart ( url  ) 

Todo:
document

Definition at line 597 of file Linker.php.

References $url.

Referenced by makeExternalImage().

Linker::formatAutocomments ( comment,
title = null,
local = false 
) [private]

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.

Parameters:
string $comment Comment text
object $title An optional title object used to links to sections
Returns:
string $comment formatted comment
Todo:
Document the $local parameter.

Definition at line 1230 of file Linker.php.

Linker::formatAutocommentsCallback ( match  )  [private]

Linker::formatComment ( comment,
title = NULL,
local = false 
)

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 comments. It escapes any HTML in the comment, but adds some CSS to format auto-generated comments (from section editing) and formats [[wikilinks]].

Author:
Erik Moeller <moeller@scireview.de>
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

Parameters:
string $comment
mixed $title Title object (to generate link to the section in autocomment) or null
bool $local Whether section links should refer to local page

Definition at line 1201 of file Linker.php.

References Sanitizer::escapeHtmlAllowEntities(), formatLinksInComment(), wfProfileIn(), and wfProfileOut().

Referenced by commentBlock().

Linker::formatHiddenCategories ( hiddencats  ) 

Returns HTML for the "hidden categories on this page" list.

Parameters:
array $hiddencats Array of hidden categories from Article::getHiddenCategories or similar
Returns:
string HTML output

Definition at line 1681 of file Linker.php.

References $wgLang, link(), wfMsgExt(), and wfProfileIn().

Linker::formatLinksInComment ( comment  ) 

Formats wiki links and media links in text; all other wiki formatting is ignored.

doesn't handle sub-links as in image thumb texts like the main parser

Parameters:
string $comment Text to format links in
Returns:
string

Definition at line 1298 of file Linker.php.

Referenced by formatComment().

Linker::formatLinksInCommentCallback ( match  )  [protected]

Linker::formatRevisionSize ( size  ) 

Definition at line 1392 of file Linker.php.

References $size, $wgLang, and wfMsgExt().

Linker::formatSize ( size  ) 

Format a size in bytes for output, using an appropriate unit (B, KB, MB or GB) according to the magnitude in question.

Parameters:
$size Size to format
Returns:
string

Definition at line 1708 of file Linker.php.

Linker::formatTemplates ( templates,
preview = false,
section = false 
)

Returns HTML for the "templates used on this page" list.

Parameters:
array $templates Array of templates from Article::getUsedTemplate or similar
bool $preview Whether this is for a preview
bool $section Whether this is for a section edit
Returns:
string HTML output

Definition at line 1628 of file Linker.php.

References $batch, $section, link(), makeLinkObj(), wfMsg(), wfMsgExt(), wfProfileIn(), and wfProfileOut().

Linker::generateRollback ( rev  ) 

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.

Parameters:
Revision $rev

Definition at line 1589 of file Linker.php.

References buildRollbackLink().

Linker::getExternalLinkAttributes ( title,
unused = null,
class = '' 
)

Get the appropriate HTML attributes to add to the "a" element of an ex- ternal link, as created by [wikisyntax].

Parameters:
string $title The (unescaped) title text for the link
string $unused Unused
string $class The contents of the class attribute; if an empty string is passed, which is the default value, defaults to 'external'.

Definition at line 37 of file Linker.php.

References $title, and getLinkAttributesInternal().

Referenced by makeExternalLink().

Linker::getInternalLinkAttributes ( title,
unused = null,
class = '' 
)

Get the appropriate HTML attributes to add to the "a" element of an in- ternal link.

Parameters:
string $title The title text for the link, URL-encoded (???) but not HTML-escaped
string $unused Unused
string $class The contents of the class attribute, default none

Definition at line 72 of file Linker.php.

References $title, and getLinkAttributesInternal().

Linker::getInternalLinkAttributesObj ( nt,
unused = null,
class = '',
title = false 
)

Get the appropriate HTML attributes to add to the "a" element of an in- ternal link, given the Title object for the page we want to link to.

Parameters:
Title $nt The Title object
string $unused Unused
string $class The contents of the class attribute, default none
mixed $title Optional (unescaped) string to use in the title attribute; if false, default to the name of the page we're linking to

Definition at line 88 of file Linker.php.

References $title, and getLinkAttributesInternal().

Referenced by makeBrokenImageLinkObj(), and makeColouredLinkObj().

Linker::getInterwikiLinkAttributes ( title,
unused = null,
class = '' 
)

Get the appropriate HTML attributes to add to the "a" element of an in- terwiki link.

Parameters:
string $title The title text for the link, URL-encoded (???) but not HTML-escaped
string $unused Unused
string $class The contents of the class attribute; if an empty string is passed, which is the default value, defaults to 'external'.

Definition at line 51 of file Linker.php.

References $title, $wgContLang, and getLinkAttributesInternal().

Linker::getLinkAttributesInternal ( title,
class,
classDefault = false 
) [private]

Common code for getLinkAttributesX functions.

Definition at line 98 of file Linker.php.

References $title.

Referenced by getExternalLinkAttributes(), getInternalLinkAttributes(), getInternalLinkAttributesObj(), and getInterwikiLinkAttributes().

Linker::getLinkColour ( t,
threshold 
)

Return the CSS colour of a known link.

Parameters:
Title $t
integer $threshold user defined threshold
Returns:
string CSS class

Definition at line 122 of file Linker.php.

References $t, and MWNamespace::isContent().

Linker::link ( target,
text = null,
customAttribs = array(),
query = array(),
options = array() 
)

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.

Parameters:
$target Title Can currently only be a Title, but this may change to support Images, literal URLs, etc.
$text string 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.
$customAttribs array A key => value array of extra HTML attri- butes, 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.
$query array 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.
$options mixed 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.
Returns:
string HTML attribute

Definition at line 173 of file Linker.php.

References $options, $text, Xml::closeElement(), linkAttribs(), linkText(), linkUrl(), normaliseSpecialPage(), Xml::openElement(), wfAppendQuery(), wfProfileIn(), wfProfileOut(), and wfRunHooks().

Referenced by blockLink(), buildRollbackLink(), doEditSectionLink(), formatAutocommentsCallback(), formatHiddenCategories(), formatTemplates(), makeBrokenLinkObj(), makeImageLink2(), makeKnownLinkObj(), makeLinkObj(), SkinNostalgia::topLinks(), userLink(), userTalkLink(), and userToolLinks().

Linker::linkAttribs ( target,
attribs,
options 
) [private]

Definition at line 252 of file Linker.php.

References $classes, $defaults, $key, $options, $wgUser, Sanitizer::mergeAttributes(), wfMsg(), wfProfileIn(), and wfProfileOut().

Referenced by link().

Linker::linkText ( target  )  [private]

Definition at line 308 of file Linker.php.

Referenced by link(), makeBrokenLinkObj(), makeKnownLinkObj(), and makeLinkObj().

Linker::linkUrl ( target,
query,
options 
) [private]

Definition at line 230 of file Linker.php.

References $options, wfProfileIn(), and wfProfileOut().

Referenced by link().

Linker::makeBrokenImageLinkObj ( title,
text = '',
query = '',
trail = '',
prefix = '',
time = false 
)

Make a "broken" link to an image.

Parameters:
Title $title Image title
string $text Link label
string $query Query string
string $trail Link trail
string $prefix Link prefix
bool $time, a file of a certain timestamp was requested
Returns:
string

Definition at line 933 of file Linker.php.

References $prefix, $text, $wgEnableUploads, getInternalLinkAttributesObj(), Title::getPrefixedText(), SpecialPage::getTitleFor(), makeKnownLinkObj(), RepoGroup::singleton(), splitTrail(), wfFindFile(), wfProfileIn(), and wfProfileOut().

Referenced by makeImageLink2(), and makeThumbLink2().

Linker::makeBrokenLink ( title,
text = '',
query = '',
trail = '' 
)

Deprecated:
Use link()
This function is a shortcut to makeBrokenLinkObj(Title::newFromText($title),...). Do not call it if you already have a title object handy. See makeBrokenLinkObj for further documentation.

Parameters:
string $title The text of the title
string $text Link text
string $query Optional query part
string $trail Optional trail. Alphabetic characters at the start of this string will be included in the link text. Other characters will be appended after the end of the link.

Definition at line 385 of file Linker.php.

References $text, $title, makeBrokenLinkObj(), Title::newFromText(), and wfDebug().

Linker::makeBrokenLinkObj ( title,
text = '',
query = '',
trail = '',
prefix = '' 
)

Deprecated:
Use link()
Make a red link to the edit page of a given title.

Parameters:
$nt Title object of the target page
$text String: Link text
$query String: Optional query part
$trail String: Optional trail. Alphabetic characters at the start of this string will be included in the link text. Other characters will be appended after the end of the link.

Definition at line 499 of file Linker.php.

References $text, $title, link(), linkText(), normaliseSpecialPage(), splitTrail(), wfCgiToArray(), wfProfileIn(), and wfProfileOut().

Referenced by makeBrokenLink().

Linker::makeColouredLinkObj ( nt,
colour,
text = '',
query = '',
trail = '',
prefix = '' 
)

Deprecated:
Use link()
Make a coloured link.

Parameters:
$nt Title object of the target page
$colour Integer: colour of the link
$text String: link text
$query String: optional query part
$trail String: optional trail. Alphabetic characters at the start of this string will be included in the link text. Other characters will be appended after the end of the link.

Definition at line 545 of file Linker.php.

References $prefix, $text, getInternalLinkAttributesObj(), and makeKnownLinkObj().

Referenced by makeSizeLinkObj(), and makeStubLinkObj().

Linker::makeExternalImage ( url,
alt = '' 
)

Todo:
document

Definition at line 614 of file Linker.php.

References $success, $url, Xml::element(), fnamePart(), wfDebug(), and wfRunHooks().

Referenced by makeImage().

Linker::makeExternalLink ( url,
text,
escape = true,
linktype = '',
attribs = array() 
)

Make an external link.

Parameters:
String $url URL to link to
String $text text of link
boolean $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
! ! This is a really crappy implementation. $linktype and 'external' are mashed into the class attrib for the link (which is made into a string). Then, if we've got additional params in $attribs, we add to it. People using this might want to change the classes (or other default link attributes), but passing $attribsText is just messy. Would make a lot more sense to make put the classes into $attribs, let the hook play with them, *then* expand it all at once.

Definition at line 1029 of file Linker.php.

References $success, $text, $url, Xml::expandAttributes(), getExternalLinkAttributes(), wfDebug(), and wfRunHooks().

Linker::makeHeadline ( level,
attribs,
anchor,
text,
link,
legacyAnchor = false 
)

Create a headline for content.

Parameters:
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 $text The text of the header
string $link HTML to add for the section edit link
mixed $legacyAnchor A second, optional anchor to give for backward compatibility (false to omit)
Returns:
string HTML headline

Definition at line 1541 of file Linker.php.

Linker::makeImage ( url,
alt = '' 
)

Obsolete alias.

Definition at line 608 of file Linker.php.

References $url, makeExternalImage(), and wfDeprecated().

Linker::makeImageLink2 ( Title title,
file,
frameParams = array(),
handlerParams = array(),
time = false,
query = "" 
)

Given parameters derived from [[Image:Foo|options.

..]], generate the HTML that that syntax inserts in the page.

Parameters:
Title $title Title object
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. caption HTML for image caption. link-url URL to link to link-title Title object to link to 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 $time, timestamp of the file, set as false for current
string $query, query params for desc url
Returns:
string HTML for an image, with links, wrappers, etc.

Definition at line 701 of file Linker.php.

References $file, $page, $prefix, $res, $s, $wgContLang, $wgThumbLimits, $wgThumbUpright, $wgUser, User::getDefaultOption(), Title::getPrefixedDBkey(), link(), makeBrokenImageLinkObj(), wfDebug(), and wfRunHooks().

Referenced by makeImageLinkObj().

Linker::makeImageLinkObj ( title,
label,
alt,
align = '',
handlerParams = array(),
framed = false,
thumb = false,
manualthumb = '',
valign = '',
time = false 
)

Creates the HTML source for images.

Deprecated:
use makeImageLink2
Parameters:
object $title
string $label label text
string $alt alt text
string $align horizontal alignment: none, left, center, right)
array $handlerParams Parameters to be passed to the media handler
boolean $framed shows image in original size in a frame
boolean $thumb shows image as thumbnail in a frame
string $manualthumb image name for the manual thumbnail
string $valign vertical alignment: baseline, sub, super, top, text-top, middle, bottom, text-bottom
string $time, timestamp of the file, set as false for current
Returns:
string

Definition at line 646 of file Linker.php.

References $file, $title, makeImageLink2(), and wfFindFile().

Linker::makeKnownLink ( title,
text = '',
query = '',
trail = '',
prefix = '',
aprops = '' 
)

Deprecated:
Use link()
This function is a shortcut to makeKnownLinkObj(Title::newFromText($title),...). Do not call it if you already have a title object handy. See makeKnownLinkObj for further documentation.

Parameters:
$title String: the text of the title
$text String: link text
$query String: optional query part
$trail String: optional trail. Alphabetic characters at the start of this string will be included in the link text. Other characters will be appended after the end of the link.

Definition at line 362 of file Linker.php.

References $prefix, $text, $title, makeKnownLinkObj(), Title::newFromText(), and wfDebug().

Referenced by SkinStandard::quickBar(), SkinCologneBlue::quickBar(), specialLink(), and SkinCologneBlue::sysLinks().

Linker::makeKnownLinkObj ( title,
text = '',
query = '',
trail = '',
prefix = '',
aprops = '',
style = '' 
)

Deprecated:
Use link()
Make a link for a title which definitely exists. This is faster than makeLinkObj because it doesn't have to do a database query. It's also valid for interwiki titles and special pages.

Parameters:
$nt Title object of target page
$text String: text to replace the title
$query String: link target
$trail String: text after link
$prefix String: text before link text
$aprops String: extra attributes to the a-element
$style String: style to apply - if empty, use getInternalLinkAttributesObj instead
Returns:
the a-element

Definition at line 467 of file Linker.php.

References $text, $title, Sanitizer::decodeTagAttributes(), link(), linkText(), Sanitizer::mergeAttributes(), splitTrail(), wfCgiToArray(), wfProfileIn(), and wfProfileOut().

Referenced by SkinCologneBlue::doAfterContent(), makeBrokenImageLinkObj(), makeColouredLinkObj(), makeKnownLink(), SkinMonoBookCBT::newtalk(), SkinTemplate::outputPage(), SkinStandard::quickBar(), and SkinCologneBlue::quickBar().

Linker::makeLink ( title,
text = '',
query = '',
trail = '' 
)

Deprecated:
Use link()
This function is a shortcut to makeLinkObj(Title::newFromText($title),...). Do not call it if you already have a title object handy. See makeLinkObj for further documentation.

Parameters:
$title String: the text of the title
$text String: link text
$query String: optional query part
$trail String: optional trail. Alphabetic characters at the start of this string will be included in the link text. Other characters will be appended after the end of the link.

Definition at line 335 of file Linker.php.

References $result, $text, $title, makeLinkObj(), Title::newFromText(), wfDebug(), wfProfileIn(), and wfProfileOut().

Referenced by formatLinksInCommentCallback(), and SkinStandard::quickBar().

Linker::makeLinkObj ( nt,
text = '',
query = '',
trail = '',
prefix = '' 
)

Deprecated:
Use link()
Make a link for a title which may or may not be in the database. If you need to call this lots of times, pre-fill the link cache with a LinkBatch, otherwise each call to this will result in a DB query.

Parameters:
$nt Title: the title object to make the link from, e.g. from Title::newFromText.
$text String: link text
$query String: optional query part
$trail String: optional trail. Alphabetic characters at the start of this string will be included in the link text. Other characters will be appended after the end of the link.
$prefix String: optional prefix. As trail, only before instead of after.

Definition at line 435 of file Linker.php.

References $text, $wgUser, link(), linkText(), splitTrail(), wfCgiToArray(), wfProfileIn(), and wfProfileOut().

Referenced by formatTemplates(), and makeLink().

Linker::makeMediaLink ( name,
unused = '',
text = '',
time = false 
)

Linker::makeMediaLinkObj ( title,
text = '',
time = false 
)

Create a direct link to a given uploaded file.

Parameters:
$title Title object.
$text String: pre-sanitized HTML
$time string: time image was created
Returns:
string HTML
Todo:
Handle invalid or missing images better.

Definition at line 980 of file Linker.php.

References $text, $u, $url, Title::getDBkey(), Title::getText(), SpecialPage::getTitleFor(), and wfFindFile().

Referenced by makeMediaLink().

Linker::makeSelfLinkObj ( nt,
text = '',
query = '',
trail = '',
prefix = '' 
)

Make appropriate markup for a link to the current article.

This is currently rendered as the bold link text. The calling sequence is the same as the other make*LinkObj functions, despite $query not being used.

Definition at line 576 of file Linker.php.

References $text, and splitTrail().

Linker::makeSizeLinkObj ( size,
nt,
text = '',
query = '',
trail = '',
prefix = '' 
)

Generate either a normal exists-style link or a stub link, depending on the given page size.

Parameters:
$size Integer
$nt Title object.
$text String
$query String
$trail String
$prefix String
Returns:
string HTML of link

Definition at line 564 of file Linker.php.

References $prefix, $size, $text, $wgUser, and makeColouredLinkObj().

Linker::makeStubLink ( title,
text = '',
query = '',
trail = '' 
)

Deprecated:
Use link()
This function is a shortcut to makeStubLinkObj(Title::newFromText($title),...). Do not call it if you already have a title object handy. See makeStubLinkObj for further documentation.

Parameters:
$title String: the text of the title
$text String: link text
$query String: optional query part
$trail String: optional trail. Alphabetic characters at the start of this string will be included in the link text. Other characters will be appended after the end of the link.

Definition at line 408 of file Linker.php.

References $text, $title, makeStubLinkObj(), Title::newFromText(), wfDebug(), and wfDeprecated().

Linker::makeStubLinkObj ( nt,
text = '',
query = '',
trail = '',
prefix = '' 
)

Deprecated:
Use link()
Make a brown link to a short article.

Parameters:
$nt Title object of the target page
$text String: link text
$query String: optional query part
$trail String: optional trail. Alphabetic characters at the start of this string will be included in the link text. Other characters will be appended after the end of the link.

Definition at line 527 of file Linker.php.

References $prefix, $text, makeColouredLinkObj(), and wfDeprecated().

Referenced by makeStubLink().

Linker::makeThumbLink2 ( Title title,
file,
frameParams = array(),
handlerParams = array(),
time = false,
query = "" 
)

Linker::makeThumbLinkObj ( Title title,
file,
label = '',
alt,
align = 'right',
params = array(),
framed = false,
manualthumb = "" 
)

Make HTML for a thumbnail including image, border and caption.

Parameters:
Title $title
File $file File object or false if it doesn't exist

Definition at line 819 of file Linker.php.

References $file, and makeThumbLink2().

Linker::normaliseSpecialPage ( Title title  ) 

Linker::postParseLinkColour ( s = null  ) 

Deprecated:

Definition at line 23 of file Linker.php.

References wfDeprecated().

Linker::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.

Parameters:
Revision $rev
bool $local Whether section links should refer to local page
$isPublic,show only if all users can see it
Returns:
string HTML

Definition at line 1377 of file Linker.php.

References commentBlock(), Revision::DELETED_COMMENT, Revision::FOR_THIS_USER, Revision::getComment(), Revision::getTitle(), Revision::isDeleted(), Revision::userCan(), and wfMsgHtml().

Linker::revDeleteLink ( query = array(),
restricted = false 
)

Creates a (show/hide) link for deleting revisions/log entries.

Parameters:
array $query Query parameters to be passed to link()
bool $restricted Set to true to use a instead of a
Returns:
string HTML link to Special:Revisiondelete, wrapped in a span to allow for customization of appearance with CSS

Definition at line 1822 of file Linker.php.

Linker::revUserLink ( rev,
isPublic = false 
)

Generate a user link if the current user is allowed to view it.

Parameters:
$rev Revision object.
$isPublic,bool,show only if all users can see it
Returns:
string HTML

Definition at line 1147 of file Linker.php.

References Revision::DELETED_USER, Revision::FOR_THIS_USER, userLink(), and wfMsgHtml().

Linker::revUserTools ( rev,
isPublic = false 
)

Generate a user tool link cluster if the current user is allowed to view it.

Parameters:
$rev Revision object.
$isPublic,bool,show only if all users can see it
Returns:
string HTML

Definition at line 1168 of file Linker.php.

References Revision::DELETED_USER, Revision::FOR_THIS_USER, userLink(), userToolLinks(), and wfMsgHtml().

Linker::specialLink ( name,
key = '' 
)

static Linker::splitTrail ( trail  )  [static]

Split a link trail, return the "inside" portion and the remainder of the trail as a two-element array.

Definition at line 1559 of file Linker.php.

References $wgContLang.

Referenced by makeBrokenImageLinkObj(), makeBrokenLinkObj(), LinkHolderArray::makeHolder(), Parser::makeKnownLinkHolder(), makeKnownLinkObj(), makeLinkObj(), makeSelfLinkObj(), and Parser::replaceExternalLinks().

Linker::titleAttrib ( name,
options = null 
)

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.)

Parameters:
string $name Id of the element, minus prefixes.
mixed $options null or the string 'withaccess' to add an access- key hint
Returns:
string Contents of the title attribute (which you must HTML- escape), or false for no title attribute

Definition at line 1759 of file Linker.php.

Linker::tocIndent (  ) 

Todo:
document

Definition at line 1405 of file Linker.php.

Linker::tocLine ( anchor,
tocline,
tocnumber,
level 
)

parameter level defines if we are on an indentation level

Definition at line 1417 of file Linker.php.

Linker::tocLineEnd (  ) 

Todo:
document

Definition at line 1425 of file Linker.php.

Linker::tocList ( toc  ) 

Todo:
document

Definition at line 1430 of file Linker.php.

References $wgJsMimeType, Xml::escapeJsString(), wfMsg(), and wfMsgHtml().

Linker::tocUnindent ( level  ) 

Todo:
document

Definition at line 1410 of file Linker.php.

Linker::tooltip ( name,
options = null 
)

Deprecated:
Returns raw bits of HTML, use titleAttrib()

Definition at line 1734 of file Linker.php.

Linker::tooltipAndAccesskey ( name  ) 

Deprecated:
Returns raw bits of HTML, use titleAttrib() and accesskey()

Definition at line 1716 of file Linker.php.

Linker::userLink ( userId,
userText 
)

Make user link (or user contributions for unregistered users).

Parameters:
$userId Integer: user id in database.
$userText String: user name in database
Returns:
string HTML fragment
Access:
private

Definition at line 1054 of file Linker.php.

References $page, SpecialPage::getTitleFor(), link(), and Title::makeTitle().

Referenced by revUserLink(), and revUserTools().

Linker::userTalkLink ( userId,
userText 
)

Parameters:
$userId Integer: user id in database.
$userText String: user name in database.
Returns:
string HTML fragment with user talk link
Access:
private

Definition at line 1123 of file Linker.php.

References link(), Title::makeTitle(), and wfMsgHtml().

Referenced by userToolLinks().

Linker::userToolLinks ( userId,
userText,
redContribsWhenNoEdits = false,
flags = 0,
edits = null 
)

Generate standard user tool links (talk, contributions, block link, etc.

)

Parameters:
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. self::TOOL_LINKS_NOBLOCK)
int $edits, user edit count (optional, for performance)
Returns:
string

Definition at line 1073 of file Linker.php.

References $count, $flags, $wgDisableAnonTalk, $wgLang, $wgSysopUserBans, $wgUser, blockLink(), User::edits(), SpecialPage::getTitleFor(), link(), userTalkLink(), and wfMsgHtml().

Referenced by revUserTools(), and userToolLinksRedContribs().

Linker::userToolLinksRedContribs ( userId,
userText,
edits = null 
)

Alias for userToolLinks( $userId, $userText, true );.

Parameters:
int $userId User identifier
string $userText User name or IP address
int $edits, user edit count (optional, for performance)

Definition at line 1112 of file Linker.php.

References userToolLinks().


Member Data Documentation

Flags for userToolLinks().

Definition at line 16 of file Linker.php.

Referenced by IPUnblockForm::formatRow(), and LogPage::getTitleLink().


The documentation for this class was generated from the following file:

Generated on Sat Sep 5 02:08:41 2009 for MediaWiki by  doxygen 1.5.9