SMWInfolink Class Reference
[Semantic MediaWiki]

This class mainly is a container to store URLs for the factbox in a clean way. More...

List of all members.

Public Member Functions

 __construct ($internal, $caption, $target, $style=false, array $params=array())
 Create a new link to some internal page or to some external URL.
 setParameter ($value, $key=false)
 Set (or add) parameter values for an existing link.
 getParameter ($key)
 Get the value of some named parameter, or null if no parameter of that name exists.
 setCaption ($caption)
 Change the link text.
 setStyle ($style)
 Change the link's CSS class.
 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.
 getHTML ($linker=null)
 Return hyperlink for this infolink in HTML format.
 getWikiText ($linker=null)
 Return hyperlink for this infolink in wiki format.
 getURL ()
 Return a fully qualified URL that points to the link target (whether internal or not).

Static Public Member Functions

static newInternalLink ($caption, $target, $style=false, array $params=array())
 Create a new link to an internal page $target.
static newExternalLink ($caption, $url, $style=false, array $params=array())
 Create a new link to an external location $url.
static newPropertySearchLink ($caption, $propertyName, $propertyValue, $style= 'smwsearch')
 Static function to construct links to property searches.
static newInversePropertySearchLink ($caption, $subject, $propertyname, $style=false)
 Static function to construct links to inverse property searches.
static newBrowsingLink ($caption, $titleText, $style= 'smwbrowse')
 Static function to construct links to the browsing special.
static encodeParameters (array $params, $forTitle=true)
 Encode an array of parameters, formatted as $name => $value, to a parameter string that can be used for linking.
static decodeParameters ($titleParam= '', $allParams=false)
 Obtain an array of parameters from the parameters given to some HTTP service.

Protected Member Functions

 getLinker (&$linker=null)
 Return a Linker object, using the parameter $linker if not null, and creatng a new one otherwise.

Protected Attributes

 $mTarget
 $mCaption
 $mStyle
 $mInternal
 $mParams


Detailed Description

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.

Definition at line 19 of file SMW_Infolink.php.


Constructor & Destructor Documentation

SMWInfolink::__construct ( internal,
caption,
target,
style = false,
array $  params = array() 
)

Create a new link to some internal page or to some external URL.

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

Definition at line 66 of file SMW_Infolink.php.


Member Function Documentation

static SMWInfolink::newInternalLink ( caption,
target,
style = false,
array $  params = array() 
) [static]

Create a new link to an internal page $target.

All parameters are mere strings as used by wiki users.

Parameters:
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.
Returns:
SMWInfolink

Definition at line 85 of file SMW_Infolink.php.

Referenced by SMWFactbox::getFactboxText(), SMWQueryResult::getQueryLink(), and SMWConcept::render().

static SMWInfolink::newExternalLink ( caption,
url,
style = false,
array $  params = array() 
) [static]

Create a new link to an external location $url.

Parameters:
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.
Returns:
SMWInfolink

Definition at line 99 of file SMW_Infolink.php.

Referenced by SMWDataValue::addServiceLinks().

static SMWInfolink::newPropertySearchLink ( caption,
propertyName,
propertyValue,
style = 'smwsearch' 
) [static]

Static function to construct links to property searches.

Parameters:
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.
Returns:
SMWInfolink

Definition at line 113 of file SMW_Infolink.php.

Referenced by SMWDataValue::getInfolinks().

static SMWInfolink::newInversePropertySearchLink ( caption,
subject,
propertyname,
style = false 
) [static]

Static function to construct links to inverse property searches.

Parameters:
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.
Returns:
SMWInfolink

Definition at line 134 of file SMW_Infolink.php.

Referenced by SMWSpecialBrowse::displayValue(), and SMWPropertyPage::subjectObjectList().

static SMWInfolink::newBrowsingLink ( caption,
titleText,
style = 'smwbrowse' 
) [static]

Static function to construct links to the browsing special.

Parameters:
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.
Returns:
SMWInfolink

Definition at line 153 of file SMW_Infolink.php.

Referenced by SMWSearchByProperty::displayResults(), SMWSpecialBrowse::displayValue(), SMWPageProperty::execute(), SMWFactbox::getFactboxText(), SMWHooks::showBrowseLink(), and SMWPropertyPage::subjectObjectList().

SMWInfolink::setParameter ( value,
key = false 
)

Set (or add) parameter values for an existing link.

Parameters:
mixed $value
mixed $key

Definition at line 170 of file SMW_Infolink.php.

SMWInfolink::getParameter ( key  ) 

Get the value of some named parameter, or null if no parameter of that name exists.

Definition at line 182 of file SMW_Infolink.php.

SMWInfolink::setCaption ( caption  ) 

Change the link text.

Definition at line 193 of file SMW_Infolink.php.

SMWInfolink::setStyle ( style  ) 

Change the link's CSS class.

Definition at line 200 of file SMW_Infolink.php.

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.

Definition at line 212 of file SMW_Infolink.php.

References encodeParameters(), getLinker(), getURL(), and SMWOutputs::requireResource().

Referenced by getHTML(), and getWikiText().

SMWInfolink::getHTML ( linker = null  ) 

Return hyperlink for this infolink in HTML format.

Returns:
string

Definition at line 276 of file SMW_Infolink.php.

References getText().

SMWInfolink::getWikiText ( linker = null  ) 

Return hyperlink for this infolink in wiki format.

Returns:
string

Definition at line 285 of file SMW_Infolink.php.

References getText().

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.

Returns:
string

Definition at line 296 of file SMW_Infolink.php.

References encodeParameters(), and SMWExporter::expandURI().

Referenced by getText().

SMWInfolink::getLinker ( &$  linker = null  )  [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.

Returns:
Linker

Definition at line 328 of file SMW_Infolink.php.

Referenced by getText().

static SMWInfolink::encodeParameters ( array $  params,
forTitle = true 
) [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.

Parameters:
array $params
boolean $forTitle

: SMW's parameter separator, must not occur within params

Definition at line 352 of file SMW_Infolink.php.

Referenced by getText(), and getURL().

static SMWInfolink::decodeParameters ( titleParam = '',
allParams = false 
) [static]

Obtain an array of parameters from the parameters given to some HTTP service.

In particular, this function perfoms all necessary decoding as may be needed, e.g., to recover the proper paramter 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.

Parameters:
string $titleParam
boolean $allParams

Definition at line 440 of file SMW_Infolink.php.

Referenced by SMWSearchByProperty::execute(), SMWSpecialBrowse::execute(), SMWSpecialTypes::execute(), SMWQueryUIHelper::extractParameters(), and SMWAskPage::extractQueryParameters().


Member Data Documentation

SMWInfolink::$mTarget [protected]

Definition at line 26 of file SMW_Infolink.php.

SMWInfolink::$mCaption [protected]

Definition at line 33 of file SMW_Infolink.php.

SMWInfolink::$mStyle [protected]

Definition at line 41 of file SMW_Infolink.php.

SMWInfolink::$mInternal [protected]

Definition at line 48 of file SMW_Infolink.php.

SMWInfolink::$mParams [protected]

Definition at line 55 of file SMW_Infolink.php.


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

Generated on Sun Mar 18 07:15:43 2012 for Semantic MediaWiki by  doxygen 1.5.6