MediaWiki REL1_39
TitleParser Interface Reference

A title parser service for MediaWiki. More...

Inheritance diagram for TitleParser:

Public Member Functions

 makeTitleValueSafe ( $namespace, $text, $fragment='', $interwiki='')
 Given a namespace and title, return a TitleValue if valid, or null if invalid.
 
 parseTitle ( $text, $defaultNamespace=NS_MAIN)
 Parses the given text and constructs a TitleValue.
 

Detailed Description

A title parser service for MediaWiki.

This is designed to encapsulate knowledge about conventions for the title forms to be used in the database, in urls, in wikitext, etc.

See also
https://www.mediawiki.org/wiki/Requests_for_comment/TitleValue
Since
1.23

Definition at line 33 of file TitleParser.php.

Member Function Documentation

◆ makeTitleValueSafe()

TitleParser::makeTitleValueSafe (   $namespace,
  $text,
  $fragment = '',
  $interwiki = '' 
)

Given a namespace and title, return a TitleValue if valid, or null if invalid.

Parameters
int$namespace
string$text
string$fragment
string$interwiki
Returns
TitleValue|null

Implemented in MediaWikiTitleCodec.

◆ parseTitle()

TitleParser::parseTitle (   $text,
  $defaultNamespace = NS_MAIN 
)

Parses the given text and constructs a TitleValue.

Note
this only parses local page links, interwiki-prefixes etc. are not considered!
Parameters
string$textThe text to parse
int$defaultNamespaceNamespace to assume per default (usually NS_MAIN)
Exceptions
MalformedTitleExceptionIf the text is not a valid representation of a page title.
Returns
TitleValue

Implemented in MediaWikiTitleCodec.


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