Parsoid
A bidirectional parser between wikitext and HTML5
Loading...
Searching...
No Matches
Wikimedia\Parsoid\Utils\Title Class Reference
+ Inheritance diagram for Wikimedia\Parsoid\Utils\Title:
+ Collaboration diagram for Wikimedia\Parsoid\Utils\Title:

Public Member Functions

 getInterwiki ()
 The interwiki component of this LinkTarget.
 
 getKey ()
 Get the DBkey, prefixed with interwiki prefix if any.
 
 getDBkey ()
 Get the main part of the link target, in canonical database form.
 
 getPrefixedDBKey ()
 Get the prefixed DBkey.
 
 getPrefixedText ()
 Get the prefixed text.
 
 getFullText ()
 Get the prefixed title with spaces, plus any fragment (part beginning with '#')
 
 getFullDBKey ()
 Get the prefixed title with underscores, plus any fragment (part beginning with '#')
 
 getNamespace ()
 Get the namespace ID.
 
 getNamespaceName ()
 Get the human-readable name for the namespace (with spaces, not underscores).
 
 getFragment ()
 Get the link fragment in text form (i.e.
 
 equals (Title $title)
 Compare with another title.
 
 isSpecialPage ()
 Returns true if this is a special page.
 
 createFragmentTarget (string $fragment)
 Create a new LinkTarget with a different fragment on the same page.
 
- Public Member Functions inherited from Wikimedia\Parsoid\Core\LinkTarget
 inNamespace (int $ns)
 Convenience function to check if the target is in a given namespace.
 
 hasFragment ()
 Whether the link target has a fragment.
 
 getText ()
 Get the main part of the link target, in text form.
 
 isExternal ()
 Whether this LinkTarget has an interwiki component.
 
 isSameLinkAs (LinkTarget $other)
 Check whether the given LinkTarget refers to the same target as this LinkTarget.
 
 __toString ()
 Return an informative human-readable representation of the link target, for use in logging and debugging.
 

Static Public Member Functions

static newFromText (string $title, SiteConfig $siteConfig, ?int $defaultNs=null)
 
static fixSpecialName (SiteConfig $siteConfig, string $title)
 Use the default special page alias.
 
static newFromLinkTarget (LinkTarget $linkTarget, SiteConfig $siteConfig)
 Convert LinkTarget from core (or other implementation) into a Parsoid Title.
 

Member Function Documentation

◆ createFragmentTarget()

Wikimedia\Parsoid\Utils\Title::createFragmentTarget ( string $fragment)

Create a new LinkTarget with a different fragment on the same page.

It is expected that the same type of object will be returned, but the only requirement is that it is a LinkTarget.

Parameters
string$fragmentThe fragment override, or "" to remove it.
Returns
self

Implements Wikimedia\Parsoid\Core\LinkTarget.

◆ equals()

Wikimedia\Parsoid\Utils\Title::equals ( Title $title)

Compare with another title.

Parameters
Title$title
Returns
bool

◆ fixSpecialName()

static Wikimedia\Parsoid\Utils\Title::fixSpecialName ( SiteConfig $siteConfig,
string $title )
static

Use the default special page alias.

Parameters
SiteConfig$siteConfig
string$title
Returns
string

◆ getDBkey()

Wikimedia\Parsoid\Utils\Title::getDBkey ( )

Get the main part of the link target, in canonical database form.

The main part is the link target without namespace prefix or hash fragment. The database form means that spaces become underscores, this is also used for URLs.

Returns
string

Implements Wikimedia\Parsoid\Core\LinkTarget.

◆ getFragment()

Wikimedia\Parsoid\Utils\Title::getFragment ( )

Get the link fragment in text form (i.e.

the bit after the hash #).

Returns
string link fragment

Implements Wikimedia\Parsoid\Core\LinkTarget.

◆ getFullDBKey()

Wikimedia\Parsoid\Utils\Title::getFullDBKey ( )

Get the prefixed title with underscores, plus any fragment (part beginning with '#')

Returns
string The prefixed title, with underscores, and the fragment, including '#'
Note
This method is Parsoid-only and doesn't exist in mediawiki-core's Title class.

◆ getFullText()

Wikimedia\Parsoid\Utils\Title::getFullText ( )

Get the prefixed title with spaces, plus any fragment (part beginning with '#')

Returns
string The prefixed title, with spaces and the fragment, including '#'

◆ getInterwiki()

Wikimedia\Parsoid\Utils\Title::getInterwiki ( )

The interwiki component of this LinkTarget.

This is the empty string if there is no interwiki component.

Returns
string

Implements Wikimedia\Parsoid\Core\LinkTarget.

◆ getKey()

Wikimedia\Parsoid\Utils\Title::getKey ( )

Get the DBkey, prefixed with interwiki prefix if any.

This is Parsoid's convention, which differs from core; use ::getDBkey() for a method compatible with core's convention.

Returns
string
See also
::getDBkey()
Deprecated

◆ getNamespace()

Wikimedia\Parsoid\Utils\Title::getNamespace ( )

Get the namespace ID.

Returns
int

Implements Wikimedia\Parsoid\Core\LinkTarget.

◆ getNamespaceName()

Wikimedia\Parsoid\Utils\Title::getNamespaceName ( )

Get the human-readable name for the namespace (with spaces, not underscores).

Returns
string

◆ getPrefixedDBKey()

Wikimedia\Parsoid\Utils\Title::getPrefixedDBKey ( )

Get the prefixed DBkey.

Returns
string

◆ getPrefixedText()

Wikimedia\Parsoid\Utils\Title::getPrefixedText ( )

Get the prefixed text.

Returns
string

◆ isSpecialPage()

Wikimedia\Parsoid\Utils\Title::isSpecialPage ( )

Returns true if this is a special page.

Returns
bool

◆ newFromLinkTarget()

static Wikimedia\Parsoid\Utils\Title::newFromLinkTarget ( LinkTarget $linkTarget,
SiteConfig $siteConfig )
static

Convert LinkTarget from core (or other implementation) into a Parsoid Title.

Parameters
LinkTarget$linkTarget
Returns
self

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