MediaWiki
1.28.0
|
A codec for MediaWiki page titles. More...
Public Member Functions | |
__construct (Language $language, GenderCache $genderCache, $localInterwikis=[]) | |
formatTitle ($namespace, $text, $fragment= '', $interwiki= '') | |
getFullText (LinkTarget $title) | |
getNamespaceName ($namespace, $text) | |
getPrefixedDBkey (LinkTarget $target) | |
getPrefixedText (LinkTarget $title) | |
getText (LinkTarget $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... | |
Static Public Member Functions | |
static | getTitleInvalidRegex () |
Returns a simple regex that will match on characters and sequences invalid in titles. More... | |
Protected Attributes | |
GenderCache | $genderCache |
Language | $language |
string[] | $localInterwikis |
A codec for MediaWiki page titles.
Definition at line 37 of file MediaWikiTitleCodec.php.
MediaWikiTitleCodec::__construct | ( | Language | $language, |
GenderCache | $genderCache, | ||
$localInterwikis = [] |
|||
) |
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 58 of file MediaWikiTitleCodec.php.
References $genderCache, $language, and array().
MediaWikiTitleCodec::formatTitle | ( | $namespace, | |
$text, | |||
$fragment = '' , |
|||
$interwiki = '' |
|||
) |
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). |
string | $interwiki | The interwiki name (may be empty). |
InvalidArgumentException | If the namespace is invalid |
Implements TitleFormatter.
Definition at line 106 of file MediaWikiTitleCodec.php.
References $e, and getNamespaceName().
Referenced by getFullText(), getPrefixedText(), and getText().
MediaWikiTitleCodec::getFullText | ( | LinkTarget | $title | ) |
LinkTarget | $title |
Implements TitleFormatter.
Definition at line 228 of file MediaWikiTitleCodec.php.
References formatTitle(), MediaWiki\Linker\LinkTarget\getFragment(), MediaWiki\Linker\LinkTarget\getInterwiki(), MediaWiki\Linker\LinkTarget\getNamespace(), and MediaWiki\Linker\LinkTarget\getText().
MediaWikiTitleCodec::getNamespaceName | ( | $namespace, | |
$text | |||
) |
int | $namespace | |
string | $text |
InvalidArgumentException | If the namespace is invalid |
Implements TitleFormatter.
Definition at line 75 of file MediaWikiTitleCodec.php.
References $name, and MWNamespace\hasGenderDistinction().
Referenced by formatTitle(), and getPrefixedDBkey().
MediaWikiTitleCodec::getPrefixedDBkey | ( | LinkTarget | $target | ) |
LinkTarget | $target |
Implements TitleFormatter.
Definition at line 196 of file MediaWikiTitleCodec.php.
References $e, MediaWiki\Linker\LinkTarget\getInterwiki(), MediaWiki\Linker\LinkTarget\getNamespace(), getNamespaceName(), MediaWiki\Linker\LinkTarget\getText(), and MediaWiki\Linker\LinkTarget\isExternal().
MediaWikiTitleCodec::getPrefixedText | ( | LinkTarget | $title | ) |
LinkTarget | $title |
Implements TitleFormatter.
Definition at line 181 of file MediaWikiTitleCodec.php.
References formatTitle(), MediaWiki\Linker\LinkTarget\getInterwiki(), MediaWiki\Linker\LinkTarget\getNamespace(), and MediaWiki\Linker\LinkTarget\getText().
MediaWikiTitleCodec::getText | ( | LinkTarget | $title | ) |
LinkTarget | $title |
Implements TitleFormatter.
Definition at line 170 of file MediaWikiTitleCodec.php.
References formatTitle(), and MediaWiki\Linker\LinkTarget\getText().
|
static |
Returns a simple regex that will match on characters and sequences invalid in titles.
Note that this doesn't pick up many things that could be wrong with titles, but that replacing this regex with something valid will make many titles valid. Previously Title::getTitleInvalidRegex()
Definition at line 465 of file MediaWikiTitleCodec.php.
References is(), Title\legalChars(), not, the, and URL.
Referenced by Title\getTitleInvalidRegex(), and Language\isValidCode().
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 144 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 257 of file MediaWikiTitleCodec.php.
References $matches, as, Title\capitalize(), Interwiki\isValidInterwiki(), Title\newMainPage(), NS_MAIN, NS_SPECIAL, NS_TALK, NS_USER, NS_USER_TALK, Message\numParam(), processing, IP\sanitizeIP(), the, and UTF8_REPLACEMENT.
Referenced by parseTitle().
|
protected |
Definition at line 46 of file MediaWikiTitleCodec.php.
Referenced by __construct().
|
protected |
Definition at line 41 of file MediaWikiTitleCodec.php.
Referenced by __construct().
|
protected |
Definition at line 51 of file MediaWikiTitleCodec.php.