Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Client\Hooks\ShortDescHandler Class Reference

Handles the {{SHORTDESC:...}} parser function. More...

Public Member Functions

 isValid ( $shortDesc)
 Validates a short description.
 
 sanitize ( $shortDesc)
 Sanitizes a short description by converting it into plaintext.
 
 doHandle (Parser $parser, $shortDesc, $controlArg)
 Parser function.
 

Static Public Member Functions

static handle (Parser $parser, $shortDesc, $controlArg='')
 Parser function callback.
 

Private Member Functions

 parseNoReplace ( $parser, $controlArg)
 

Static Private Member Functions

static factory ()
 

Detailed Description

Handles the {{SHORTDESC:...}} parser function.

Member Function Documentation

◆ doHandle()

Wikibase\Client\Hooks\ShortDescHandler::doHandle ( Parser $parser,
$shortDesc,
$controlArg )

Parser function.

Parameters
Parser$parser
string$shortDescShort description of the current page, as plain text.
string$controlArgAn extra argument to control behavior (such as 'noreplace').
Returns
void

◆ factory()

static Wikibase\Client\Hooks\ShortDescHandler::factory ( )
staticprivate
Returns
self

◆ handle()

static Wikibase\Client\Hooks\ShortDescHandler::handle ( Parser $parser,
$shortDesc,
$controlArg = '' )
static

Parser function callback.

Parameters
Parser$parser
string$shortDescShort description of the current page, as plain text.
string$controlArgAn extra argument to control behavior (such as 'noreplace').
Returns
string

◆ isValid()

Wikibase\Client\Hooks\ShortDescHandler::isValid ( $shortDesc)

Validates a short description.

Valid descriptions are not empty (contain something other than whitespace/punctuation).

Parameters
string$shortDescShort description of the current page, as plain text.
Returns
bool

◆ parseNoReplace()

Wikibase\Client\Hooks\ShortDescHandler::parseNoReplace ( $parser,
$controlArg )
private
Parameters
Parser$parser
string$controlArg
Returns
bool

◆ sanitize()

Wikibase\Client\Hooks\ShortDescHandler::sanitize ( $shortDesc)

Sanitizes a short description by converting it into plaintext.

Note that the sanitized description can still contain HTML (that was encoded as entities in the original) as there is no reason why someone shouldn't mention HTML tags in a description. That means the sanitized value is actually less safe for HTML inclusion than the original one (can contain <script> tags)! It is clients' responsibility to handle it safely.

Parameters
string$shortDescShort description of the current page, as HTML.
Returns
string Plaintext of description.

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