MediaWiki
1.23.2
|
A codec for MediaWiki page titles. More...
Public Member Functions | |
__construct (Language $language, GenderCache $genderCache, $localInterwikis=array()) | |
formatTitle ( $namespace, $text, $fragment='') | |
getFullText (TitleValue $title) | |
getNamespaceName ( $namespace, $text) | |
getPrefixedText (TitleValue $title) | |
getText (TitleValue $title) | |
parseTitle ( $text, $defaultNamespace) | |
Parses the given text and constructs a TitleValue. More... | |
splitTitleString ( $text, $defaultNamespace=NS_MAIN) | |
Normalizes and splits a title string. More... | |
Protected Attributes | |
GenderCache | $genderCache |
Language | $language |
string[] | $localInterwikis |
A codec for MediaWiki page titles.
Definition at line 35 of file MediaWikiTitleCodec.php.
MediaWikiTitleCodec::__construct | ( | Language | $language, |
GenderCache | $genderCache, | ||
$localInterwikis = array() |
|||
) |
Language | $language | the language object to use for localizing namespace names. |
GenderCache | $genderCache | the gender cache for generating gendered namespace names |
string[] | string | $localInterwikis |
Definition at line 54 of file MediaWikiTitleCodec.php.
References $genderCache, $language, $localInterwikis, and array().
MediaWikiTitleCodec::formatTitle | ( | $namespace, | |
$text, | |||
$fragment = '' |
|||
) |
int | bool | $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). |
InvalidArgumentException | if the namespace is invalid |
Implements TitleFormatter.
Definition at line 98 of file MediaWikiTitleCodec.php.
References getNamespaceName().
Referenced by getFullText(), getPrefixedText(), and getText().
MediaWikiTitleCodec::getFullText | ( | TitleValue | $title | ) |
TitleValue | $title |
Implements TitleFormatter.
Definition at line 174 of file MediaWikiTitleCodec.php.
References $title, formatTitle(), and TitleValue\getNamespace().
MediaWikiTitleCodec::getNamespaceName | ( | $namespace, | |
$text | |||
) |
int | $namespace | |
string | $text |
InvalidArgumentException | if the namespace is invalid |
Implements TitleFormatter.
Definition at line 69 of file MediaWikiTitleCodec.php.
References $name, and MWNamespace\hasGenderDistinction().
Referenced by formatTitle().
MediaWikiTitleCodec::getPrefixedText | ( | TitleValue | $title | ) |
TitleValue | $title |
Implements TitleFormatter.
Definition at line 163 of file MediaWikiTitleCodec.php.
References $title, formatTitle(), and TitleValue\getNamespace().
MediaWikiTitleCodec::getText | ( | TitleValue | $title | ) |
TitleValue | $title |
Implements TitleFormatter.
Definition at line 152 of file MediaWikiTitleCodec.php.
References formatTitle(), and TitleValue\getText().
MediaWikiTitleCodec::parseTitle | ( | $text, | |
$defaultNamespace | |||
) |
Parses the given text and constructs a TitleValue.
Normalization is applied according to the rules appropriate for the form specified by $form.
string | $text | the text to parse |
int | $defaultNamespace | namespace to assume per default (usually NS_MAIN) |
MalformedTitleException |
Implements TitleParser.
Definition at line 126 of file MediaWikiTitleCodec.php.
References splitTitleString().
MediaWikiTitleCodec::splitTitleString | ( | $text, | |
$defaultNamespace = NS_MAIN |
|||
) |
Normalizes and splits a title string.
This function removes illegal characters, splits off the interwiki and namespace prefixes, sets the other forms, and canonicalizes everything.
string | $text | |
int | $defaultNamespace |
MalformedTitleException | If $text is not a valid title string. |
Definition at line 198 of file MediaWikiTitleCodec.php.
References array(), as, Title\capitalize(), Title\getTitleInvalidRegex(), Interwiki\isValidInterwiki(), NS_MAIN, NS_SPECIAL, NS_TALK, NS_USER, NS_USER_TALK, processing, IP\sanitizeIP(), and UTF8_REPLACEMENT.
Referenced by parseTitle().
|
protected |
Definition at line 43 of file MediaWikiTitleCodec.php.
Referenced by __construct().
|
protected |
Definition at line 39 of file MediaWikiTitleCodec.php.
Referenced by __construct().
|
protected |
Definition at line 47 of file MediaWikiTitleCodec.php.
Referenced by __construct().