Semantic MediaWiki and related extensions
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
SMWWikiPageValue Class Reference
Inheritance diagram for SMWWikiPageValue:
Inheritance graph
[legend]
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 ()
 
 getText ()
 
 getPrefixedText ()
 
 getPreferredCaption ()
 
 getDisplayTitle ()
 
- Public Member Functions inherited from SMWDataValue
 __construct ( $typeid)
 
 getTypeID ()
 
 setUserValue ( $value, $caption=false)
 
 setDataItem (SMWDataItem $dataItem)
 
 setDataValueServiceFactory (DataValueServiceFactory $dataValueServiceFactory)
 
 setProperty (DIProperty $property)
 
 getProperty ()
 
 setContextPage (SMWDIWikiPage $contextPage=null)
 
 getContextPage ()
 
 setCaption ( $caption)
 
 getCaption ()
 
 getPreferredCaption ()
 
 setOutputFormat ( $formatString)
 
 getOutputFormat ()
 
 addError ( $error)
 
 addErrorMsg ( $error, $type=Message::TEXT)
 
 getErrorText ()
 
 getErrors ()
 
 getErrorsByType ( $type=null)
 
 getRestrictionError ()
 
 clearErrors ()
 
 getQueryDescription ( $value)
 
 getDataItem ()
 
 __toString ()
 
 getShortWikiText ( $linker=null)
 
 getShortHTMLText ( $linker=null)
 
 getLongWikiText ( $linker=null)
 
 getLongHTMLText ( $linker=null)
 
 getWikiValue ()
 
 getShortText ( $outputFormat, $linker=null)
 
 getLongText ( $outputFormat, $linker=null)
 
 getInfolinkText ( $outputFormat, $linker=null)
 
 getInfolinks ()
 
 getHash ()
 
 isNumeric ()
 
 isValid ()
 
 canUse ()
 
 isRestricted ()
 
 addCallable ( $key, callable $callable)
 
 getCallable ( $key)
 
 clearCallable ( $key)
 
 copyOptions (Options $options=null)
 
 setOption ( $key, $value)
 
 getOption ( $key, $default=false)
 
 hasFeature ( $feature)
 
 isEnabledFeature ( $feature)
 
 checkConstraints ()
 

Public Attributes

const NO_TEXT_TRANSFORMATION = 'no.text.transformation'
 
const NO_IMAGE = 'no.image'
 
const SHORT_FORM = 'form/short'
 
const PREFIXED_FORM = 'form/prefixed'
 
- 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'
 
const OPT_DISABLE_SERVICELINKS = 'disable.servicelinks'
 
const OPT_COMPACT_INFOLINKS = 'compact.infolinks'
 

Protected Member Functions

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

Protected Attributes

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

Additional Inherited Members

- Static Public Member Functions inherited from SMWDataValue
static prepareValue (&$value, &$comparator)
 

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 included the namespace and long displays used the pipe trick, leading to a paradoxical confusion of "long" and "short".

Author
Nikolas Iwan
Markus Krötzsch

Member Function Documentation

◆ getDisplayTitle()

SMWWikiPageValue::getDisplayTitle ( )
Since
2.4
Returns
string

◆ getLongCaptionText()

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

◆ getLongHTMLText()

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

◆ getLongWikiText()

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

◆ getPreferredCaption()

SMWWikiPageValue::getPreferredCaption ( )

DataValue::getPreferredCaption

Since
2.4
Returns
string

◆ getPrefixedText()

SMWWikiPageValue::getPrefixedText ( )

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

Returns
string

◆ getServiceLinkParams()

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

◆ getShortCaptionText()

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

◆ getShortHTMLText()

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

◆ getShortWikiText()

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

◆ getText()

SMWWikiPageValue::getText ( )

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

Returns
string

◆ getWikiLinkTarget()

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

◆ getWikiValue()

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

◆ loadDataItem()

SMWWikiPageValue::loadDataItem ( SMWDataItem  $dataItem)
protected
See also
SMWDataValue::loadDataItem()
Parameters
$dataitemSMWDataItem
Returns
boolean

◆ parseUserValue()

SMWWikiPageValue::parseUserValue (   $value)
protected

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

◆ setLinkAttributes()

SMWWikiPageValue::setLinkAttributes ( array  $linkAttributes)
Since
2.4
Parameters
array$linkAttributes

◆ setQueryParameters()

SMWWikiPageValue::setQueryParameters ( array  $queryParameters)
Since
2.5
Parameters
array$queryParameters

Member Data Documentation

◆ NO_IMAGE

const SMWWikiPageValue::NO_IMAGE = 'no.image'

Whether images should be displayed as media or simple link.

◆ NO_TEXT_TRANSFORMATION

const SMWWikiPageValue::NO_TEXT_TRANSFORMATION = 'no.text.transformation'

Whether text transformation should be suppressed or not.

◆ PREFIXED_FORM

const SMWWikiPageValue::PREFIXED_FORM = 'form/prefixed'

Whether to use the prefixed form or not.

◆ SHORT_FORM

const SMWWikiPageValue::SHORT_FORM = 'form/short'

Whether to use the short form or not.


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

About | General disclaimer | Privacy policy