MediaWiki REL1_37
|
Represents a page (or page fragment) title within MediaWiki. More...
Public Member Functions | |
__construct ( $namespace, $title, $fragment='', $interwiki='') | |
Constructs a TitleValue. | |
__toString () | |
Returns a string representation of the title, for logging. | |
createFragmentTarget ( $fragment) | |
Creates a new TitleValue for a different fragment of the same page. | |
getDBkey () | |
Returns the title's DB key, as supplied to the constructor, without namespace prefix or fragment. | |
getFragment () | |
getInterwiki () | |
Returns the interwiki part. | |
getNamespace () | |
getText () | |
Returns the title in text form, without namespace prefix or fragment. | |
hasFragment () | |
inNamespace ( $ns) | |
isExternal () | |
Whether it has an interwiki part. | |
isSameLinkAs (LinkTarget $other) | |
Static Public Member Functions | |
static | assertValidSpec ( $namespace, $title, $fragment='', $interwiki='') |
Asserts that the given parameters could be used to construct a TitleValue object. | |
static | castPageToLinkTarget (?PageReference $page) |
Casts a PageReference to a LinkTarget. | |
static | newFromPage (PageReference $page) |
Constructs a TitleValue from a local PageReference. | |
static | tryNew ( $namespace, $title, $fragment='', $interwiki='') |
Constructs a TitleValue, or returns null if the parameters are not valid. | |
Public Attributes | |
string | $prefixedText = null |
Text form including namespace/interwiki, initialised on demand. | |
Protected Attributes | |
string | $dbkey |
string | $fragment |
string | $interwiki |
int | $namespace |
Represents a page (or page fragment) title within MediaWiki.
@newable
Definition at line 40 of file TitleValue.php.
TitleValue::__construct | ( | $namespace, | |
$title, | |||
$fragment = '' , |
|||
$interwiki = '' |
|||
) |
Constructs a TitleValue.
int | $namespace | The namespace ID. This is not validated. |
string | $title | The page title in either DBkey or text form. No normalization is applied beyond underscore/space conversion. |
string | $fragment | The fragment title. Use '' to represent the whole page. No validation or normalization is applied. |
string | $interwiki | The interwiki component. No validation or normalization is applied. |
InvalidArgumentException |
Definition at line 163 of file TitleValue.php.
References $title.
TitleValue::__toString | ( | ) |
Returns a string representation of the title, for logging.
This is purely informative and must not be used programmatically. Use the appropriate TitleFormatter to generate the correct string representation for a given use.
Implements MediaWiki\Linker\LinkTarget.
Definition at line 319 of file TitleValue.php.
|
static |
Asserts that the given parameters could be used to construct a TitleValue object.
Performs basic syntax and consistency checks. Does not perform full validation, use TitleParser::makeTitleValueSafe() for that.
int | $namespace | |
string | $title | |
string | $fragment | |
string | $interwiki |
InvalidArgumentException | if the combination of parameters is not valid for constructing a TitleValue. |
Definition at line 185 of file TitleValue.php.
|
static |
Casts a PageReference to a LinkTarget.
If $page is null, null is returned. If $page is also an instance of LinkTarget, $page is returned unchanged.
?PageReference | $page |
Definition at line 136 of file TitleValue.php.
TitleValue::createFragmentTarget | ( | $fragment | ) |
Creates a new TitleValue for a different fragment of the same page.
string | $fragment | The fragment name, or "" for the entire page. |
Implements MediaWiki\Linker\LinkTarget.
Definition at line 282 of file TitleValue.php.
TitleValue::getDBkey | ( | ) |
Returns the title's DB key, as supplied to the constructor, without namespace prefix or fragment.
Implements MediaWiki\Linker\LinkTarget.
Definition at line 254 of file TitleValue.php.
Referenced by newFromPage().
TitleValue::getFragment | ( | ) |
Implements MediaWiki\Linker\LinkTarget.
Definition at line 235 of file TitleValue.php.
TitleValue::getInterwiki | ( | ) |
Returns the interwiki part.
Implements MediaWiki\Linker\LinkTarget.
Definition at line 307 of file TitleValue.php.
TitleValue::getNamespace | ( | ) |
Implements MediaWiki\Linker\LinkTarget.
Definition at line 218 of file TitleValue.php.
Referenced by newFromPage().
TitleValue::getText | ( | ) |
Returns the title in text form, without namespace prefix or fragment.
This is computed from the DB key by replacing any underscores with spaces.
Implements MediaWiki\Linker\LinkTarget.
Definition at line 270 of file TitleValue.php.
TitleValue::hasFragment | ( | ) |
Implements MediaWiki\Linker\LinkTarget.
Definition at line 243 of file TitleValue.php.
TitleValue::inNamespace | ( | $ns | ) |
int | $ns |
Implements MediaWiki\Linker\LinkTarget.
Definition at line 227 of file TitleValue.php.
TitleValue::isExternal | ( | ) |
Whether it has an interwiki part.
Implements MediaWiki\Linker\LinkTarget.
Definition at line 297 of file TitleValue.php.
TitleValue::isSameLinkAs | ( | LinkTarget | $other | ) |
LinkTarget | $other |
Implements MediaWiki\Linker\LinkTarget.
Definition at line 338 of file TitleValue.php.
References MediaWiki\Linker\LinkTarget\getDBkey(), MediaWiki\Linker\LinkTarget\getFragment(), MediaWiki\Linker\LinkTarget\getInterwiki(), and MediaWiki\Linker\LinkTarget\getNamespace().
|
static |
Constructs a TitleValue from a local PageReference.
PageReference | $page |
Definition at line 119 of file TitleValue.php.
References getDBkey(), and getNamespace().
|
static |
Constructs a TitleValue, or returns null if the parameters are not valid.
int | $namespace | The namespace ID. This is not validated. |
string | $title | The page title in either DBkey or text form. No normalization is applied beyond underscore/space conversion. |
string | $fragment | The fragment title. Use '' to represent the whole page. No validation or normalization is applied. |
string | $interwiki | The interwiki component. No validation or normalization is applied. |
InvalidArgumentException |
Definition at line 94 of file TitleValue.php.
References $title.
|
protected |
Definition at line 52 of file TitleValue.php.
|
protected |
Definition at line 58 of file TitleValue.php.
|
protected |
Definition at line 64 of file TitleValue.php.
|
protected |
Definition at line 46 of file TitleValue.php.
string TitleValue::$prefixedText = null |
Text form including namespace/interwiki, initialised on demand.
Only public to share cache with TitleFormatter
Definition at line 74 of file TitleValue.php.