MediaWiki master
|
A title formatter service for MediaWiki. More...
Public Member Functions | |
__construct (Language $language, GenderCache $genderCache, NamespaceInfo $nsInfo) | |
formatTitle ( $namespace, $text, $fragment='', $interwiki='') | |
Returns the title formatted for display. | |
getFullText ( $title) | |
Returns the title formatted for display, with namespace and fragment. | |
getNamespaceName ( $namespace, $text) | |
Returns the name of the namespace for the given title. | |
getPrefixedDBkey ( $target) | |
Return the title in prefixed database key form, with interwiki and namespace. | |
getPrefixedText ( $title) | |
Returns the title formatted for display, including the namespace name. | |
getText ( $title) | |
Returns the title text formatted for display, without namespace or fragment. | |
Protected Attributes | |
GenderCache | $genderCache |
Language | $language |
NamespaceInfo | $nsInfo |
A title formatter 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.
Definition at line 46 of file TitleFormatter.php.
MediaWiki\Title\TitleFormatter::__construct | ( | Language | $language, |
GenderCache | $genderCache, | ||
NamespaceInfo | $nsInfo ) |
Language | $language | The language object to use for localizing namespace names, capitalization, etc. |
GenderCache | $genderCache | The gender cache for generating gendered namespace names |
NamespaceInfo | $nsInfo |
Definition at line 57 of file TitleFormatter.php.
References MediaWiki\Title\TitleFormatter\$genderCache, MediaWiki\Title\TitleFormatter\$language, and MediaWiki\Title\TitleFormatter\$nsInfo.
MediaWiki\Title\TitleFormatter::formatTitle | ( | $namespace, | |
$text, | |||
$fragment = '', | |||
$interwiki = '' ) |
Returns the title formatted for display.
By default, this includes the namespace but not the fragment.
int | false | $namespace | The namespace ID (or false, if the namespace should be ignored) |
string | $text | The page title. Should be valid. Only minimal normalization is applied. Underscores will be replaced. |
string | $fragment | The fragment name (may be empty). |
string | $interwiki | The interwiki prefix (may be empty). |
InvalidArgumentException | If the namespace is invalid |
Definition at line 82 of file TitleFormatter.php.
References MediaWiki\Title\TitleFormatter\getNamespaceName(), and NS_SPECIAL.
Referenced by MediaWiki\Title\TitleFormatter\getFullText(), MediaWiki\Title\TitleFormatter\getPrefixedDBkey(), and MediaWiki\Title\TitleFormatter\getPrefixedText().
MediaWiki\Title\TitleFormatter::getFullText | ( | $title | ) |
Returns the title formatted for display, with namespace and fragment.
LinkTarget | PageReference | $title | The title to format |
Definition at line 191 of file TitleFormatter.php.
References MediaWiki\Title\TitleFormatter\formatTitle().
MediaWiki\Title\TitleFormatter::getNamespaceName | ( | $namespace, | |
$text ) |
Returns the name of the namespace for the given title.
int | $namespace | |
string | $text |
InvalidArgumentException | If the namespace is invalid |
Definition at line 221 of file TitleFormatter.php.
Referenced by MediaWiki\Title\TitleFormatter\formatTitle().
MediaWiki\Title\TitleFormatter::getPrefixedDBkey | ( | $target | ) |
Return the title in prefixed database key form, with interwiki and namespace.
LinkTarget | PageReference | $target |
Definition at line 165 of file TitleFormatter.php.
References MediaWiki\Title\TitleFormatter\formatTitle().
MediaWiki\Title\TitleFormatter::getPrefixedText | ( | $title | ) |
Returns the title formatted for display, including the namespace name.
LinkTarget | PageReference | $title | The title to format |
Definition at line 134 of file TitleFormatter.php.
References MediaWiki\Title\TitleFormatter\formatTitle().
MediaWiki\Title\TitleFormatter::getText | ( | $title | ) |
Returns the title text formatted for display, without namespace or fragment.
LinkTarget | PageReference | $title | The title to format |
Definition at line 116 of file TitleFormatter.php.
|
protected |
Definition at line 48 of file TitleFormatter.php.
Referenced by MediaWiki\Title\TitleFormatter\__construct().
|
protected |
Definition at line 47 of file TitleFormatter.php.
Referenced by MediaWiki\Title\TitleFormatter\__construct().
|
protected |
Definition at line 49 of file TitleFormatter.php.
Referenced by MediaWiki\Title\TitleFormatter\__construct().