Semantic MediaWiki and related extensions
|
Public Member Functions | |
__construct ( $internal, $caption, $target, $style=false, array $params=[]) | |
isRestricted ( $isRestricted) | |
setCompactLink ( $isCompactLink=true) | |
setParameter ( $value, $key=false) | |
getParameter ( $key) | |
setCaption ( $caption) | |
setStyle ( $style) | |
setLinkAttributes (array $linkAttributes) | |
getText ( $outputformat, $linker=null) | |
getHTML ( $linker=null) | |
getWikiText ( $linker=null) | |
getURL () | |
getLocalURL () | |
Static Public Member Functions | |
static | newInternalLink ( $caption, $target, $style=false, array $params=[]) |
static | newExternalLink ( $caption, $url, $style=false, array $params=[]) |
static | newPropertySearchLink ( $caption, $propertyName, $propertyValue, $style='smwsearch') |
static | newInversePropertySearchLink ( $caption, $subject, $propertyname, $style=false) |
static | newBrowsingLink ( $caption, $titleText, $style='smwbrowse') |
static | encodeParameters (array $params, $forTitle=true) |
static | decodeParameters ( $titleParam='', $allParams=false) |
static | encodeCompactLink ( $value, $compound=false) |
static | decodeCompactLink ( $value) |
Public Attributes | |
const | LINK_UPPER_LENGTH_RESTRICTION = 2000 |
Protected Member Functions | |
getLinker (&$linker=null) | |
Protected Attributes | |
$mTarget | |
$mCaption | |
$mStyle | |
$mInternal | |
$mParams | |
This class mainly is a container to store URLs for the factbox in a clean way. The class provides methods for creating source code for realising them in wiki or html contexts.
GNU GPL v2+
SMWInfolink::__construct | ( | $internal, | |
$caption, | |||
$target, | |||
$style = false , |
|||
array | $params = [] |
||
) |
Create a new link to some internal page or to some external URL.
boolean | $internal | Indicates whether $target is a page name (true) or URL (false). |
string | $caption | The label for the link. |
string | $target | The actual link target. |
mixed | $style | CSS class of a span to embedd the link into, or false if no extra style is required. |
array | $params | Array of parameters, format $name => $value, if any. |
|
static |
string | $value |
|
static |
Obtain an array of parameters from the parameters given to some HTTP service. In particular, this function performs all necessary decoding as may be needed, e.g., to recover the proper parameter strings after encoding for use in wiki title names as done by SMWInfolink::encodeParameters().
If $allparams is set to true, it is assumed that further data should be obtained from the global $wgRequest, and all given parameters are read.
$titleparam is the string extracted by MediaWiki from special page calls of the form Special:Something/titleparam Note: it is assumed that the given $titleparam is already urldecoded, as is normal when getting such parameters from MediaWiki. SMW-escaped parameters largely prevent double decoding effects (i.e. there are no new "%" after one pass of urldecoding)
The function SMWInfolink::encodeParameters() can be used to create a suitable encoding. It is strongly recommended to not create any code that depends on the concrete way of how parameters are encoded within this function, and to always use the respective encoding/decoding methods instead.
string | $titleParam | |
boolean | $allParams |
|
static |
string | $value |
|
static |
Encode an array of parameters, formatted as $name => $value, to a parameter string that can be used for linking. If $forTitle is true (default), then the parameters are encoded for use in a MediaWiki page title (useful for making internal links to parameterised special pages), otherwise the parameters are encoded HTTP GET style. The parameter name "x" is used to collect parameters that do not have any string keys in GET, and hence "x" should never be used as a parameter name.
The function SMWInfolink::decodeParameters() can be used to undo this encoding. It is strongly recommended to not create any code that depends on the concrete way of how parameters are encoded within this function, and to always use the respective encoding/decoding methods instead.
array | $params | |
boolean | $forTitle |
: SMW's parameter separator, must not occur within params
SMWInfolink::getHTML | ( | $linker = null | ) |
Return hyperlink for this infolink in HTML format.
|
protected |
Return a Linker object, using the parameter $linker if not null, and creatng a new one otherwise. $linker is usually a user skin object, while the fallback linker object is not customised to user settings.
SMWInfolink::getLocalURL | ( | ) |
SMWInfolink::getParameter | ( | $key | ) |
Get the value of some named parameter, or null if no parameter of that name exists.
SMWInfolink::getText | ( | $outputformat, | |
$linker = null |
|||
) |
Returns a suitable text string for displaying this link in HTML or wiki, depending on whether $outputformat is SMW_OUTPUT_WIKI or SMW_OUTPUT_HTML.
The parameter $linker controls linking of values such as titles and should be some Linker object (for HTML output). Some default linker will be created if needed and not provided.
SMWInfolink::getURL | ( | ) |
Return a fully qualified URL that points to the link target (whether internal or not). This function might be used when the URL is needed outside normal links, e.g. in the HTML header or in some metadata file. For making normal links, getText() should be used.
SMWInfolink::getWikiText | ( | $linker = null | ) |
Return hyperlink for this infolink in wiki format.
SMWInfolink::isRestricted | ( | $isRestricted | ) |
boolean | $isRestricted |
|
static |
Static function to construct links to the browsing special.
string | $caption | The label for the link. |
string | $titleText | |
mixed | $style | CSS class of a span to embedd the link into, or false if no extra style is required. |
|
static |
Create a new link to an external location $url.
string | $caption | The label for the link. |
string | $url | The actual link target. |
mixed | $style | CSS class of a span to embedd the link into, or false if no extra style is required. |
array | $params | Array of parameters, format $name => $value, if any. |
|
static |
Create a new link to an internal page $target. All parameters are mere strings as used by wiki users.
string | $caption | The label for the link. |
string | $target | The actual link target. |
mixed | $style | CSS class of a span to embedd the link into, or false if no extra style is required. |
array | $params | Array of parameters, format $name => $value, if any. |
|
static |
Static function to construct links to inverse property searches.
string | $caption | The label for the link. |
string | $subject | |
string | $propertyName | |
mixed | $style | CSS class of a span to embed the link into, or false if no extra style is required. |
|
static |
Static function to construct links to property searches.
string | $caption | The label for the link. |
string | $propertyName | |
string | $propertyValue | |
mixed | $style | CSS class of a span to embedd the link into, or false if no extra style is required. |
SMWInfolink::setCaption | ( | $caption | ) |
Change the link text.
SMWInfolink::setCompactLink | ( | $isCompactLink = true | ) |
boolean | $isCompactLink |
SMWInfolink::setLinkAttributes | ( | array | $linkAttributes | ) |
Modify link attributes
array | $linkAttributes |
SMWInfolink::setParameter | ( | $value, | |
$key = false |
|||
) |
Set (or add) parameter values for an existing link.
mixed | $value | |
mixed | $key |
SMWInfolink::setStyle | ( | $style | ) |
Change the link's CSS class.