Semantic MediaWiki and related extensions
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SMWWikiPageValue Class Reference
Collaboration diagram for SMWWikiPageValue:
Collaboration graph
[legend]

Public Member Functions

 __construct ($typeid)
 
 setLinkAttributes (array $linkAttributes)
 
 setQueryParameters (array $queryParameters)
 
 getShortWikiText ($linked=null)
 
 getShortHTMLText ($linker=null)
 
 getLongWikiText ($linked=null)
 
 getLongHTMLText ($linker=null)
 
 getWikiValue ()
 
 getHash ()
 
 getTitle ()
 
 getArticleID ()
 
 getNamespace ()
 
 getDBkey ()
 
 getText ()
 
 getPrefixedText ()
 
 getInterwiki ()
 
 getPreferredCaption ()
 
 getSortKey ()
 
 getDisplayTitle ()
 
- Public Member Functions inherited from SMWDataValue
 __construct ($typeid)
 
 setUserValue ($value, $caption=false)
 
 setDataItem (SMWDataItem $dataItem)
 
 setDataValueServiceFactory ($dataValueServiceFactory)
 
 setProperty (SMWDIProperty $property)
 
 getProperty ()
 
 setContextPage (SMWDIWikiPage $contextPage=null)
 
 getContextPage ()
 
 setOptions (Options $options=null)
 
 setOption ($key, $value)
 
 getOption ($key)
 
 isEnabledFeature ($feature)
 
 setCaption ($caption)
 
 getCaption ()
 
 getPreferredCaption ()
 
 setOutputFormat ($formatString)
 
 getOutputFormat ()
 
 addError ($error)
 
 addErrorMsg ($parameters, $type=null)
 
 clearErrors ()
 
 getQueryDescription ($value)
 
 getDataItem ()
 
 __toString ()
 
 getShortWikiText ($linked=null)
 
 getShortHTMLText ($linker=null)
 
 getLongWikiText ($linked=null)
 
 getLongHTMLText ($linker=null)
 
 getShortText ($outputformat, $linker=null)
 
 getLongText ($outputformat, $linker=null)
 
 getInfolinkText ($outputformat, $linker=null)
 
 getWikiValue ()
 
 getTypeID ()
 
 getInfolinks ()
 
 getHash ()
 
 isNumeric ()
 
 isValid ()
 
 canUse ()
 
 getExtraneousFunctionFor ($name, array $parameters=array())
 
 getErrorText ()
 
 getErrors ()
 

Static Public Member Functions

static makePage ($dbkey, $namespace, $ignoredParameter= '', $interwiki= '')
 
static makePageFromTitle (Title $title)
 
- Static Public Member Functions inherited from SMWDataValue
static prepareValue (&$value, &$comparator)
 

Protected Member Functions

 parseUserValue ($value)
 
 loadDataItem (SMWDataItem $dataItem)
 
 getServiceLinkParams ()
 
 getShortCaptionText ()
 
 getLongCaptionText ()
 
 getWikiLinkTarget ()
 
- Protected Member Functions inherited from SMWDataValue
 parseUserValue ($value)
 
 loadDataItem (SMWDataItem $dataItem)
 
 getServiceLinkParams ()
 
 checkAllowedValues ()
 
 getOptions ()
 

Protected Attributes

 $m_fragment = ''
 
 $m_prefixedtext = ''
 
 $m_id = -1
 
 $m_title = null
 
 $m_fixNamespace = NS_MAIN
 
 $linkAttributes = array()
 
 $queryParameters = array()
 
- Protected Attributes inherited from SMWDataValue
 $m_dataitem
 
 $m_property = null
 
 $m_contextPage = null
 
 $m_caption
 
 $m_typeid
 
 $m_outformat = false
 
 $dataValueServiceFactory
 

Additional Inherited Members

- Public Attributes inherited from SMWDataValue
const OPT_USER_LANGUAGE = 'user.language'
 
const OPT_CONTENT_LANGUAGE = 'content.language'
 
const OPT_QUERY_CONTEXT = 'query.context'
 
const OPT_QUERY_COMP_CONTEXT = 'query.comparator.context'
 
const OPT_DISABLE_INFOLINKS = 'disable.infolinks'
 

Detailed Description

This datavalue implements special processing suitable for defining wikipages as values of properties.

The class can support general wiki pages, or pages of a fixed namespace, Whether a namespace is fixed is decided based on the type ID when the object is constructed.

The short display simulates the behavior of the MediaWiki "pipe trick" but always includes fragments. This can be overwritten by setting a caption, which is also done by default when generating a value from user input. The long display always includes all relevant information. Only if a fixed namespace is used for the datatype, the namespace prefix is omitted. This behavior has changed in SMW 1.7: up to this time, short displays have always inlcuded the namespace and long displays used the pipe trick, leading to a paradoxical confusion of "long" and "short".

Author
Nikolas Iwan
Markus Krötzsch

Constructor & Destructor Documentation

SMWWikiPageValue::__construct (   $typeid)

Member Function Documentation

SMWWikiPageValue::getArticleID ( )

Get MediaWiki's ID for this value or 0 if not available.

Returns
integer
SMWWikiPageValue::getDBkey ( )

Get DBKey for this value. Subclasses that allow for values that do not correspond to wiki pages may choose a DB key that is not a legal title DB key but rather another suitable internal ID. Thus it is not suitable to use this method in places where only MediaWiki Title keys are allowed.

Returns
string
SMWWikiPageValue::getDisplayTitle ( )
Since
2.4
Returns
string
SMWWikiPageValue::getHash ( )
SMWWikiPageValue::getInterwiki ( )

Get interwiki prefix or empty string.

Returns
string
SMWWikiPageValue::getLongCaptionText ( )
protected

Get a long caption used to label this value. In particular, this includes namespace and interwiki prefixes, while fragments are only included if they do not start with an underscore (used for generated fragment names that are not helpful for users and that might change easily).

Since
1.7
Returns
string
SMWWikiPageValue::getLongHTMLText (   $linker = null)

Display the "long" value in HTML. This behaves largely like getLongWikiText() but does not embed images.

Parameters
$linkermixed if a Linker is given, the result will be linked
Returns
string
SMWWikiPageValue::getLongWikiText (   $linked = null)

Display the "long" value on a wiki page. This behaves largely like getShortWikiText() but does not use the caption. Instead, it always takes the long display form (wiki value).

Parameters
$linkedmixed if true the result will be linked
Returns
string
SMWWikiPageValue::getNamespace ( )

Get namespace constant for this value.

Returns
integer
SMWWikiPageValue::getPreferredCaption ( )

DataValue::getPreferredCaption

Since
2.4
Returns
string
SMWWikiPageValue::getPrefixedText ( )

Get the prefixed text for this value, including a localized namespace prefix.

Returns
string
SMWWikiPageValue::getServiceLinkParams ( )
protected

Create links to mapping services based on a wiki-editable message. The parameters available to the message are: $1: urlencoded article name (no namespace)

Returns
array
SMWWikiPageValue::getShortCaptionText ( )
protected

Get a short caption used to label this value. In particular, this omits namespace and interwiki prefixes (similar to the MediaWiki "pipe trick"). Fragments are included unless they start with an underscore (used for generated fragment names that are not helpful for users and that might change easily).

Since
1.7
Returns
string
SMWWikiPageValue::getShortHTMLText (   $linker = null)

Display the value as in getShortWikiText() but create HTML. The only difference is that images are not embedded.

Parameters
Linker$linkermixed the Linker object to use or null if no linking is desired
Returns
string
SMWWikiPageValue::getShortWikiText (   $linked = null)

Display the value on a wiki page. This is used to display the value in the place where it was annotated on a wiki page. The desired behavior is that the display in this case looks as if no property annotation had been given, i.e. an annotation [[property::page|foo]] should display like [[page|foo]] in MediaWiki. But this should lead to a link, not to a category assignment. This means that:

(1) If Image: is used (instead of Media:) then let MediaWiki embed the image.

(2) If Category: is used, treat it as a page and link to it (do not categorize the page)

(3) Preserve everything given after "|" for display (caption, image parameters, ...)

(4) Use the (default) caption for display. When the value comes from user input, this includes the full value that one would also see in MediaWiki.

Parameters
$linkedmixed generate links if not null or false
Returns
string
SMWWikiPageValue::getSortKey ( )

Find the sortkey for this object.

Deprecated:
Use SMWStore::getWikiPageSortKey(). Will vanish before SMW 1.7
Returns
string sortkey
SMWWikiPageValue::getText ( )

Get text label for this value, just like Title::getText().

Returns
string
SMWWikiPageValue::getTitle ( )

Return according Title object or null if no valid value was set. null can be returned even if this object returns true for isValid(), since the latter function does not check whether MediaWiki can really make a Title out of the given data. However, isValid() will return false after this function failed in trying to create a title.

Returns
Title
SMWWikiPageValue::getWikiLinkTarget ( )
protected

Compute a text that can be used in wiki text to link to this datavalue. Processing includes some escaping and adding the fragment.

Since
1.7
Returns
string
SMWWikiPageValue::getWikiValue ( )

Return a string that could be used in an in-page property assignment for setting this value. This does not include initial ":" for escaping things like Category: links since the property value does not include such escapes either. Fragment information is included. Namespaces are omitted if a fixed namespace is used, since they are not needed in this case when making a property assignment.

Returns
string
SMWWikiPageValue::loadDataItem ( SMWDataItem  $dataItem)
protected
See also
SMWDataValue::loadDataItem()
Parameters
$dataitemSMWDataItem
Returns
boolean
static SMWWikiPageValue::makePage (   $dbkey,
  $namespace,
  $ignoredParameter = '',
  $interwiki = '' 
)
static

Static function for creating a new wikipage object from data as it is typically stored internally. In particular, the title string is supposed to be in DB key form.

Note
The resulting wikipage object might be invalid if the provided title is not allowed. An object is returned in any case.
Deprecated:
This method will vanish before SMW 1.7. If you really need this, simply copy its code.
Returns
SMWWikiPageValue
static SMWWikiPageValue::makePageFromTitle ( Title  $title)
static

Static function for creating a new wikipage object from a MediaWiki Title object.

Deprecated:
This method will vanish before SMW 1.7. If you really need this, simply copy its code.
Returns
SMWWikiPageValue
SMWWikiPageValue::parseUserValue (   $value)
protected

TODO: Escape the text so users can see punctuation problems (bug 11666).

SMWWikiPageValue::setLinkAttributes ( array  $linkAttributes)
Since
2.4
Parameters
array$linkAttributes
SMWWikiPageValue::setQueryParameters ( array  $queryParameters)
Since
2.5
Parameters
array$queryParameters

Member Data Documentation

SMWWikiPageValue::$linkAttributes = array()
protected
SMWWikiPageValue::$m_fixNamespace = NS_MAIN
protected
SMWWikiPageValue::$m_fragment = ''
protected
SMWWikiPageValue::$m_id = -1
protected
SMWWikiPageValue::$m_prefixedtext = ''
protected
SMWWikiPageValue::$m_title = null
protected
SMWWikiPageValue::$queryParameters = array()
protected

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