|
MediaWiki master
|
Represents a title within MediaWiki. More...
Inherits Stringable, MediaWiki\Linker\LinkTarget, and MediaWiki\Page\PageIdentity.

Public Member Functions | ||||
| __clone () | ||||
| __sleep () | ||||
| __toString () | ||||
| Return a string representation of this title. | ||||
| __wakeup () | ||||
| canExist () | ||||
| Can this title represent a page in the wiki's database? | ||||
| canHaveTalkPage () | ||||
| Can this title have a corresponding talk page? | ||||
| canUseNoindex () | ||||
| Whether the magic words INDEX and NOINDEX function for this page. | ||||
| createFragmentTarget (string $fragment) | ||||
| Creates a new Title for a different fragment of the same page. | ||||
| equals (object $other) | ||||
| Compares with another Title. | ||||
| exists ( $flags=0) | ||||
| Check if page exists. | ||||
| fixSpecialName () | ||||
| If the Title refers to a special page alias which is not the local default, resolve the alias, and localise the name as necessary. | ||||
| getArticleID ( $flags=0) | ||||
| Get the article ID for this Title from the link cache, adding it if necessary. | ||||
| getBaseText () | ||||
| Get the base page name without a namespace, i.e. | ||||
| getBaseTitle () | ||||
| Get the base page name title, i.e. | ||||
| getCanonicalURL ( $query='') | ||||
| Get the URL for a canonical link, for use in things like IRC and e-mail notifications. | ||||
| getCategorySortkey ( $prefix='') | ||||
| Returns the raw sort key to be used for categories, with the specified prefix. | ||||
| getContentModel ( $flags=0) | ||||
| Get the page's content model id, see the CONTENT_MODEL_XXX constants. | ||||
| getDBkey () | ||||
| Get the main part with underscores. | ||||
| getDefaultMessageText () | ||||
| Get the default (plain) message contents for a page that overrides an interface message key. | ||||
| getDefaultSystemMessage () | ||||
| Same as getDefaultMessageText, but returns a Message object. | ||||
| getDeletedEditsCount () | ||||
| Is there a version of this page in the deletion archive? | ||||
| getEditNotices ( $oldid=0) | ||||
| Get a list of rendered edit notices for this page. | ||||
| getEditURL () | ||||
| Get the edit URL for this Title. | ||||
| getFragment () | ||||
| Get the Title fragment (i.e. | ||||
| getFragmentForURL () | ||||
| Get the fragment in URL form, including the "#" character if there is one. | ||||
| getFullSubpageText () | ||||
| Get the entire subpage string of a title. | ||||
| getFullText () | ||||
| Get the prefixed title with spaces, plus any fragment (part beginning with '#'). | ||||
| getFullURL ( $query='', $query2=false, $proto=PROTO_RELATIVE) | ||||
| Get a real URL referring to this title, with interwiki link and fragment. | ||||
| getFullUrlForRedirect ( $query='', $proto=PROTO_CURRENT) | ||||
| Get a url appropriate for making redirects based on an untrusted url arg. | ||||
| getId ( $wikiId=self::LOCAL) | ||||
| Returns the page ID. | ||||
| getInternalURL ( $query='') | ||||
| Get the URL form for an internal link. | ||||
| getInterwiki () | ||||
| Get the interwiki prefix. | ||||
| getLatestRevID ( $flags=0) | ||||
| What is the page_latest field for this page? | ||||
| getLength ( $flags=0) | ||||
| What is the length of this page? | ||||
| getLinksFrom ( $options=[], $table='pagelinks', $prefix='pl') | ||||
| Get an array of Title objects linked from this Title Also stores the IDs in the link cache. | ||||
| getLinksTo ( $options=[], $table='pagelinks', $prefix='pl') | ||||
| Get an array of Title objects linking to this Title Also stores the IDs in the link cache. | ||||
| getLinkURL ( $query='', $query2=false, $proto=false) | ||||
| Get a URL that's the simplest URL that will be valid to link, locally, to the current Title. | ||||
| getLocalURL ( $query='') | ||||
| Get a URL with no fragment or server name (relative URL) from a Title object. | ||||
| getNamespace () | ||||
| Get the namespace index, i.e. | ||||
| getNamespaceKey ( $prepend='nstab-') | ||||
| Generate strings used for xml 'id' names in monobook tabs. | ||||
| getNsText () | ||||
| Get the namespace text. | ||||
| getPageLanguage () | ||||
| Get the language in which the content of this page is written in wikitext. | ||||
| getParentCategories () | ||||
| Get categories to which this Title belongs and return an array of categories' names. | ||||
| getParentCategoryTree ( $children=[]) | ||||
| Get a tree of parent categories. | ||||
| getPartialURL () | ||||
| Get the URL-encoded form of the main part. | ||||
| getPrefixedDBkey () | ||||
| Get the prefixed database key form. | ||||
| getPrefixedText () | ||||
| Get the prefixed title with spaces. | ||||
| getPrefixedURL (string $query='') | ||||
| Get a URL-encoded title (not an actual URL) including interwiki. | ||||
| getRedirectsHere ( $ns=null) | ||||
| Get all extant redirects to this Title. | ||||
| getRootText () | ||||
| Get the root page name text without a namespace, i.e. | ||||
| getRootTitle () | ||||
| Get the root page name title, i.e. | ||||
| getSkinFromConfigSubpage () | ||||
| Trim down a .css, .json, or .js subpage title to get the corresponding skin name. | ||||
| getSubjectNsText () | ||||
| Get the namespace text of the subject (rather than talk) page. | ||||
| getSubjectPage () | ||||
| Get a title object associated with the subject page of this talk page. | ||||
| getSubpage ( $text) | ||||
| Get the title for a subpage of the current page. | ||||
| getSubpages ( $limit=-1) | ||||
| Get all subpages of this page. | ||||
| getSubpageText () | ||||
| Get the lowest-level subpage name, i.e. | ||||
| getSubpageUrlForm () | ||||
| Get a URL-encoded form of the subpage text. | ||||
| getTalkNsText () | ||||
| Get the namespace text of the talk page. | ||||
| getTalkPage () | ||||
| Get a Title object associated with the talk page of this article. | ||||
| getTalkPageIfDefined () | ||||
| Get a Title object associated with the talk page of this article, if such a talk page can exist. | ||||
| getTemplateLinksFrom ( $options=[]) | ||||
| Get an array of Title objects used on this Title as a template Also stores the IDs in the link cache. | ||||
| getTemplateLinksTo ( $options=[]) | ||||
| Get an array of Title objects using this Title as a template Also stores the IDs in the link cache. | ||||
| getText () | ||||
| Get the text form (spaces not underscores) of the main part. | ||||
| getTitleValue () | ||||
| Get a TitleValue object representing this Title. | ||||
| getTouched (int $flags=IDBAccessObject::READ_NORMAL) | ||||
| Get the last touched timestamp. | ||||
| getTransWikiID () | ||||
| Returns the DB name of the distant wiki which owns the object. | ||||
| getWikiId () | ||||
| Returns false to indicate that this Title belongs to the local wiki. | ||||
| hasContentModel (string ... $id) | ||||
| Convenience method for checking a title's content model name. | ||||
| hasDeletedEdits () | ||||
| Is there a version of this page in the deletion archive? | ||||
| hasSourceText () | ||||
| Does this page have source text? | ||||
| hasSubjectNamespace ( $ns) | ||||
| Returns true if the title has the same subject namespace as the namespace specified. | ||||
| hasSubpages () | ||||
| Does this have subpages? | ||||
| inNamespace (int $ns) | ||||
| Returns true if the title is inside the specified namespace. | ||||
| inNamespaces (... $namespaces) | ||||
| Returns true if the title is inside one of the specified namespaces. | ||||
| invalidateCache ( $purgeTime=null) | ||||
| Updates page_touched for this page; called from LinksUpdate.php. | ||||
| isBigDeletion () | ||||
| Check whether the number of revisions of this page surpasses $wgDeleteRevisionsLimit. | ||||
| isContentPage () | ||||
| Is this Title in a namespace which contains content? | ||||
| isConversionTable () | ||||
| Is this a conversion table for the LanguageConverter? | ||||
| isDeleted () | ||||
| Is there a version of this page in the deletion archive? | ||||
| isDeletedQuick () | ||||
| Is there a version of this page in the deletion archive? | ||||
| isKnown () | ||||
| Does this title refer to a page that can (or might) be meaningfully viewed? | ||||
| isLocal () | ||||
| Determine whether the object refers to a page within this project (either this wiki or a wiki with a local interwiki, see https://www.mediawiki.org/wiki/Manual:Interwiki_table#iw_local ). | ||||
| isMainPage () | ||||
| Is this the mainpage? | ||||
| isMovable () | ||||
| Would anybody with sufficient privileges be able to move this page? | ||||
| isNewPage ( $flags=IDBAccessObject::READ_NORMAL) | ||||
| Check if this is a new page. | ||||
| isRawHtmlMessage () | ||||
| Is this a message which can contain raw HTML? | ||||
| isRedirect ( $flags=0) | ||||
| Is this an article that is a redirect page? | ||||
| isSamePageAs (PageReference $other) | ||||
Checks whether the given PageReference refers to the same page as this PageReference.Two PageReference instances are considered to refer to the same page if they belong to the same wiki, and have the same namespace and DB key.
| ||||
| isSingleRevRedirect () | ||||
| Locks the page row and check if this page is single revision redirect. | ||||
| isSiteConfigPage () | ||||
| Could this MediaWiki namespace page contain custom CSS, JSON, or JavaScript for the global UI. | ||||
| isSiteCssConfigPage () | ||||
| Is this a sitewide CSS "config" page? | ||||
| isSiteJsConfigPage () | ||||
| Is this a sitewide JS "config" page? | ||||
| isSiteJsonConfigPage () | ||||
| Is this a sitewide JSON "config" page? | ||||
| isSpecial ( $name) | ||||
| Returns true if this title resolves to the named special page. | ||||
| isSpecialPage () | ||||
| Returns true if this is a special page. | ||||
| isSubpage () | ||||
| Is this a subpage? | ||||
| isSubpageOf (Title $title) | ||||
| Check if this title is a subpage of another title. | ||||
| isTalkPage () | ||||
| Is this a talk page of some sort? | ||||
| isTrans () | ||||
| Determine whether the object refers to a page within this project and is transcludable. | ||||
| isUserConfigPage () | ||||
| Is this a "config" (.css, .json, or .js) subpage of a user page? | ||||
| isUserCssConfigPage () | ||||
| Is this a CSS "config" subpage of a user page? | ||||
| isUserJsConfigPage () | ||||
| Is this a JS "config" subpage of a user page? | ||||
| isUserJsonConfigPage () | ||||
| Is this a JSON "config" subpage of a user page? | ||||
| isValid () | ||||
| Returns true if the title is a valid link target, and that it has been properly normalized. | ||||
| isValidRedirectTarget () | ||||
| Check if this Title is a valid redirect target. | ||||
| isWikitextPage () | ||||
| Does that page contain wikitext, or it is JS, CSS or whatever? | ||||
| loadFromRow ( $row) | ||||
| Load Title object fields from a DB row. | ||||
| pageCond () | ||||
| Get an associative array for selecting this title from the "page" table. | ||||
| resetArticleID ( $id) | ||||
| Inject a page ID, reset DB-loaded fields, and clear the link cache for this title. | ||||
| setContentModel ( $model) | ||||
| Set a proposed content model for the page for permissions checking. | ||||
| setFragment ( $fragment) | ||||
| Set the fragment for this title. | ||||
| toPageIdentity () | ||||
| Returns the page represented by this Title as a ProperPageIdentity. | ||||
| toPageRecord ( $flags=0) | ||||
| Returns the page represented by this Title as a ProperPageRecord. | ||||
| toPageReference () | ||||
| Returns the page represented by this Title as a PageReferenceValue. | ||||
| touchLinks () | ||||
| Update page_touched timestamps and send CDN purge messages for pages linking to this title. | ||||
| wasLocalInterwiki () | ||||
| Was this a local interwiki link? | ||||
| Public Member Functions inherited from MediaWiki\Linker\LinkTarget | ||||
| hasFragment () | ||||
| Whether the link target has a fragment. | ||||
| isExternal () | ||||
| Whether this LinkTarget has an interwiki component. | ||||
| isSameLinkAs (ParsoidLinkTarget $other) | ||||
| Check whether the given LinkTarget refers to the same target as this LinkTarget. | ||||
| Public Member Functions inherited from MediaWiki\Page\PageIdentity | ||||
| exists () | ||||
| Checks if the page currently exists. | ||||
| Public Member Functions inherited from MediaWiki\DAO\WikiAwareEntity | ||||
| assertWiki ( $wikiId) | ||||
| Throws if $wikiId is different from the return value of getWikiId(). | ||||
Static Public Member Functions | |
| static | capitalize ( $text, $ns=NS_MAIN) |
| Capitalize a text string for a title if it belongs to a namespace that capitalizes. | |
| static | castFromLinkTarget (?ParsoidLinkTarget $linkTarget) |
| Same as newFromLinkTarget(), but if passed null, returns null. | |
| static | castFromPageIdentity (?PageIdentity $pageIdentity) |
| Same as newFromPageIdentity(), but if passed null, returns null. | |
| static | castFromPageReference (?PageReference $pageReference) |
| Same as newFromPageReference(), but if passed null, returns null. | |
| static | clearCaches () |
| static | compare ( $a, $b) |
| Callback for usort() to do title sorts by (namespace, title). | |
| static | convertByteClassToUnicodeClass ( $byteClass) |
| Utility method for converting a character sequence from bytes to Unicode. | |
| static | legalChars () |
| Get a regex character class describing the legal characters in a link. | |
| static | makeName ( $ns, $title, $fragment='', $interwiki='', $canonicalNamespace=false) |
| Make a prefixed DB key from a DB key and a namespace index. | |
| static | makeTitle ( $ns, $title, $fragment='', $interwiki='') |
| Create a new Title from a namespace index and a DB key. | |
| static | makeTitleSafe ( $ns, $title, $fragment='', $interwiki='') |
| Create a new Title from a namespace index and a DB key. | |
| static | newFromDBkey ( $key) |
| Create a new Title from a prefixed DB key. | |
| static | newFromID ( $id, $flags=0) |
| Create a new Title from an article ID. | |
| static | newFromLinkTarget (ParsoidLinkTarget $linkTarget, $forceClone='') |
| Returns a Title given a LinkTarget. | |
| static | newFromPageIdentity (PageIdentity $pageIdentity) |
| Return a Title for a given PageIdentity. | |
| static | newFromPageReference (PageReference $pageReference) |
| Return a Title for a given Reference. | |
| static | newFromRow ( $row) |
| Make a Title object from a DB row. | |
| static | newFromText ( $text, $defaultNamespace=NS_MAIN) |
| Create a new Title from text, such as what one would find in a link. | |
| static | newFromTextThrow ( $text, $defaultNamespace=NS_MAIN) |
| Like Title::newFromText(), but throws MalformedTitleException when the title is invalid, rather than returning null. | |
| static | newFromURL ( $url) |
| THIS IS NOT THE FUNCTION YOU WANT. | |
| static | newMainPage (?MessageLocalizer $localizer=null) |
| Create a new Title for the Main Page. | |
| static | purgeExpiredRestrictions () |
| Purge expired restrictions from the page_restrictions table. | |
Public Attributes | |
| const | NEW_CLONE = 'clone' |
| Flag for use with factory methods like newFromLinkTarget() that have a $forceClone parameter. | |
| Public Attributes inherited from MediaWiki\DAO\WikiAwareEntity | |
| const | LOCAL = false |
| Wiki ID value to use with instances that are defined relative to the local wiki. | |
Private member variables | |
Please use the accessor functions instead.
| |
| int | $mArticleID = -1 |
| Article ID, fetched from the link cache on demand. | |
| string null | $prefixedText = null |
| Text form including namespace/interwiki, initialised on demand. | |
| null bool | $mRedirect = null |
| Is the article at this title a redirect? | |
| int false | $mLatestID = false |
| ID of most recent revision. | |
| int | $mLength = -1 |
| The page length, 0 for special pages. | |
Represents a title within MediaWiki.
Optionally may contain an interwiki designation or namespace.
| MediaWiki\Title\Title::__toString | ( | ) |
Return a string representation of this title.
Implements MediaWiki\Linker\LinkTarget.
Definition at line 1828 of file Title.php.
References getPrefixedText(), and return.
| MediaWiki\Title\Title::__wakeup | ( | ) |
Definition at line 3569 of file Title.php.
References wfUrlencode().
| MediaWiki\Title\Title::canExist | ( | ) |
Can this title represent a page in the wiki's database?
Titles can exist as pages in the database if they are valid, and they are not Special pages, interwiki links, or fragment-only links.
Implements MediaWiki\Page\PageIdentity.
Definition at line 1197 of file Title.php.
References if.
Referenced by MediaWiki\JobQueue\Jobs\DoubleRedirectJob\fixRedirects(), getArticleID(), TitleCleanup\moveInconsistentPage(), and MediaWiki\JobQueue\Jobs\RefreshLinksJob\run().
| MediaWiki\Title\Title::canHaveTalkPage | ( | ) |
Can this title have a corresponding talk page?
False for relative section links (with getText() === ''), interwiki links (with getInterwiki() !== ''), and pages in NS_SPECIAL.
Definition at line 1183 of file Title.php.
References MediaWiki\MediaWikiServices\getInstance().
Referenced by getTalkPageIfDefined().
| MediaWiki\Title\Title::canUseNoindex | ( | ) |
Whether the magic words INDEX and NOINDEX function for this page.
Definition at line 3336 of file Title.php.
References MediaWiki\MediaWikiServices\getInstance(), and wfDeprecated().
|
static |
Capitalize a text string for a title if it belongs to a namespace that capitalizes.
| string | $text | Containing title to capitalize |
| int | $ns | Namespace index, defaults to NS_MAIN |
Definition at line 2648 of file Title.php.
References MediaWiki\MediaWikiServices\getInstance(), and NS_MAIN.
|
static |
|
static |
Same as newFromPageIdentity(), but if passed null, returns null.
| PageIdentity | null | $pageIdentity |
Definition at line 329 of file Title.php.
References castFromPageReference(), and return.
|
static |
Same as newFromPageReference(), but if passed null, returns null.
| PageReference | null | $pageReference |
Definition at line 362 of file Title.php.
References if.
Referenced by castFromPageIdentity().
|
static |
Definition at line 2626 of file Title.php.
References MediaWiki\MediaWikiServices\getInstance(), and MediaWiki\MediaWikiServices\hasInstance().
Referenced by BenchmarkCommentFormatter\execute().
|
static |
Callback for usort() to do title sorts by (namespace, title).
| LinkTarget | PageReference | $a | |
| LinkTarget | PageReference | $b |
Definition at line 852 of file Title.php.
Referenced by MediaWiki\FileRepo\RepoGroup\findBySha1(), and MediaWiki\FileRepo\RepoGroup\findBySha1s().
|
static |
Utility method for converting a character sequence from bytes to Unicode.
Primary usecase being converting $wgLegalTitleChars to a sequence usable in javascript, as PHP uses UTF-8 bytes where javascript uses Unicode code units.
| string | $byteClass |
| MediaWiki\Title\Title::createFragmentTarget | ( | string | $fragment | ) |
Creates a new Title for a different fragment of the same page.
| string | $fragment |
Implements MediaWiki\Linker\LinkTarget.
Definition at line 1750 of file Title.php.
References getText(), makeTitle(), and return.
| MediaWiki\Title\Title::equals | ( | object | $other | ) |
Compares with another Title.
A Title object is considered equal to another Title if it has the same text, the same interwiki prefix, and the same namespace.
| Title | object | $other |
Definition at line 3025 of file Title.php.
References getDBkey(), getInterwiki(), and getNamespace().
Referenced by getLocalURL(), inNamespace(), isMainPage(), MediaWiki\Block\Restriction\PageRestriction\matches(), and MediaWiki\Storage\DerivedPageDataUpdater\prepareContent().
| MediaWiki\Title\Title::exists | ( | $flags = 0 | ) |
Check if page exists.
For historical reasons, this function simply checks for the existence of the title in the page table, and will thus return false for interwiki links, special pages and the like. If you want to know if a title can be meaningfully viewed, you should probably call the isKnown() method instead.
| int | $flags | A bitfield of IDBAccessObject::READ_* constants |
Definition at line 3068 of file Title.php.
References getArticleID(), and MediaWiki\MediaWikiServices\getInstance().
Referenced by MediaWiki\SpecialPage\RedirectSpecialArticle\getRedirectQuery(), MediaWiki\Specials\SpecialUpload\getUploadForm(), hasSourceText(), isKnown(), makeTitleSafe(), TitleCleanup\moveInconsistentPage(), and toPageRecord().
| MediaWiki\Title\Title::fixSpecialName | ( | ) |
If the Title refers to a special page alias which is not the local default, resolve the alias, and localise the name as necessary.
Otherwise, return $this
Definition at line 1266 of file Title.php.
References MediaWiki\MediaWikiServices\getInstance(), isSpecialPage(), and NS_SPECIAL.
| MediaWiki\Title\Title::getArticleID | ( | $flags = 0 | ) |
Get the article ID for this Title from the link cache, adding it if necessary.
| int | $flags | A bitfield of IDBAccessObject::READ_* constants |
Definition at line 2519 of file Title.php.
References canExist().
Referenced by MediaWiki\Specials\SpecialPageLanguage\changePageLanguage(), exists(), MediaWiki\Search\SearchSuggestion\fromTitle(), MediaWiki\Content\ContentHandler\getAutoDeleteReason(), getId(), getLinksFrom(), getParentCategories(), isBigDeletion(), MediaWiki\Block\Restriction\PageRestriction\newFromTitle(), and toPageRecord().
| MediaWiki\Title\Title::getBaseText | ( | ) |
Get the base page name without a namespace, i.e.
the part before the subpage name
Definition at line 1959 of file Title.php.
References getText().
Referenced by getBaseTitle().
| MediaWiki\Title\Title::getBaseTitle | ( | ) |
Get the base page name title, i.e.
the part before the subpage name.
Definition at line 1986 of file Title.php.
References getBaseText(), and isValid().
| MediaWiki\Title\Title::getCanonicalURL | ( | $query = '' | ) |
Get the URL for a canonical link, for use in things like IRC and e-mail notifications.
Uses $wgCanonicalServer and the GetCanonicalURL hook.
NOTE: Unlike getInternalURL(), the canonical URL includes the fragment
| string | array | $query |
Definition at line 2320 of file Title.php.
References $url, getFragmentForURL(), MediaWiki\MediaWikiServices\getInstance(), getLocalURL(), PROTO_CANONICAL, and wfArrayToCgi().
| MediaWiki\Title\Title::getCategorySortkey | ( | $prefix = '' | ) |
Returns the raw sort key to be used for categories, with the specified prefix.
This will be fed to Collation::getSortKey() to get a binary sortkey that can be used for actual sorting.
| string | $prefix | The prefix to be used, specified using {{defaultsort:}} or like [[Category:Foo|prefix]]. Empty for no prefix. |
Definition at line 3353 of file Title.php.
References MediaWiki\MediaWikiServices\getInstance(), and getText().
| MediaWiki\Title\Title::getContentModel | ( | $flags = 0 | ) |
Get the page's content model id, see the CONTENT_MODEL_XXX constants.
| int | $flags | A bitfield of IDBAccessObject::READ_* constants |
Definition at line 1051 of file Title.php.
References MediaWiki\MediaWikiServices\getInstance().
Referenced by getPageLanguage(), hasContentModel(), and MediaWiki\LinkedData\PageDataRequestHandler\httpContentNegotiation().
| MediaWiki\Title\Title::getDBkey | ( | ) |
Get the main part with underscores.
Implements MediaWiki\Linker\LinkTarget.
Definition at line 1020 of file Title.php.
References return.
Referenced by MediaWiki\FileRepo\File\ArchivedFile\__construct(), MediaWiki\Watchlist\ActivityUpdateJob\__construct(), equals(), MediaWiki\JobQueue\Jobs\DoubleRedirectJob\getFinalDestination(), getSubpages(), isRawHtmlMessage(), isSamePageAs(), isValidRedirectTarget(), MediaWiki\Page\PageArchive\listPagesByPrefix(), MediaWiki\Page\PageArchive\listPagesBySearch(), TitleCleanup\moveInconsistentPage(), MediaWiki\FileRepo\File\ForeignAPIFile\newFromTitle(), MediaWiki\Page\WikiPage\onArticleCreate(), MediaWiki\Page\WikiPage\onArticleDelete(), toPageIdentity(), toPageRecord(), and toPageReference().
| MediaWiki\Title\Title::getDefaultMessageText | ( | ) |
Get the default (plain) message contents for a page that overrides an interface message key.
Definition at line 3126 of file Title.php.
References getDefaultSystemMessage(), and wfDeprecated().
| MediaWiki\Title\Title::getDefaultSystemMessage | ( | ) |
Same as getDefaultMessageText, but returns a Message object.
Definition at line 3141 of file Title.php.
References NS_MEDIAWIKI, and wfDeprecated().
Referenced by getDefaultMessageText().
| MediaWiki\Title\Title::getDeletedEditsCount | ( | ) |
Is there a version of this page in the deletion archive?
Definition at line 2455 of file Title.php.
References NS_FILE.
Referenced by isDeleted().
| MediaWiki\Title\Title::getEditNotices | ( | $oldid = 0 | ) |
Get a list of rendered edit notices for this page.
Array is keyed by the original message key, and values are rendered using parseAsBlock, so they will already be wrapped in paragraphs.
| int | $oldid | Revision ID that's being edited |
Definition at line 3464 of file Title.php.
References MediaWiki\MediaWikiServices\getInstance(), hasSubpages(), and wfMessage().
| MediaWiki\Title\Title::getEditURL | ( | ) |
Get the edit URL for this Title.
Definition at line 2339 of file Title.php.
References getLocalURL(), and MediaWiki\Linker\LinkTarget\isExternal().
| MediaWiki\Title\Title::getFragment | ( | ) |
Get the Title fragment (i.e.
\ the bit after the #) in text form
Use Title::hasFragment to check for a fragment
Implements MediaWiki\Linker\LinkTarget.
Definition at line 1701 of file Title.php.
References return.
| MediaWiki\Title\Title::getFragmentForURL | ( | ) |
Get the fragment in URL form, including the "#" character if there is one.
Definition at line 1710 of file Title.php.
References MediaWiki\Linker\LinkTarget\hasFragment(), and MediaWiki\Linker\LinkTarget\isExternal().
Referenced by getCanonicalURL(), getFullURL(), and getLinkURL().
| MediaWiki\Title\Title::getFullSubpageText | ( | ) |
Get the entire subpage string of a title.
Definition at line 2065 of file Title.php.
References getText().
| MediaWiki\Title\Title::getFullText | ( | ) |
Get the prefixed title with spaces, plus any fragment (part beginning with '#').
Definition at line 1838 of file Title.php.
References getPrefixedText(), and MediaWiki\Linker\LinkTarget\hasFragment().
Referenced by getParentCategories(), MediaWiki\Content\WikitextContentHandler\makeRedirectContent(), MediaWiki\Linker\LinkRenderer\makeRedirectHeader(), and MediaWiki\Content\WikitextContent\updateRedirect().
| MediaWiki\Title\Title::getFullURL | ( | $query = '', | |
| $query2 = false, | |||
| $proto = PROTO_RELATIVE ) |
Get a real URL referring to this title, with interwiki link and fragment.
| string | array | $query | |
| false | $query2 | deprecated since MW 1.19; ignored since MW 1.41 |
| string | int | null | $proto | Protocol type to use in URL |
Definition at line 2113 of file Title.php.
References $url, getFragmentForURL(), MediaWiki\MediaWikiServices\getInstance(), getLocalURL(), PROTO_RELATIVE, and wfArrayToCgi().
Referenced by MediaWiki\Feed\FeedUtils\getDiffLink(), getLinkURL(), MediaWiki\Content\CssContentHandler\makeRedirectContent(), and MediaWiki\Content\JavaScriptContentHandler\makeRedirectContent().
| MediaWiki\Title\Title::getFullUrlForRedirect | ( | $query = '', | |
| $proto = PROTO_CURRENT ) |
Get a url appropriate for making redirects based on an untrusted url arg.
This is basically the same as getFullUrl(), but in the case of non-local interwikis, we send the user to a landing page, to prevent possible phishing attacks and the like.
| array | string | $query | |
| string | $proto | Protocol type to use in URL |
Definition at line 2148 of file Title.php.
References getPrefixedDBkey(), MediaWiki\SpecialPage\SpecialPage\getTitleFor(), MediaWiki\Linker\LinkTarget\isExternal(), isLocal(), and PROTO_CURRENT.
| MediaWiki\Title\Title::getId | ( | $wikiId = self::LOCAL | ) |
Returns the page ID.
If this ID is 0, this means the page does not exist.
| string | false | $wikiId | The wiki ID expected by the caller. |
| PreconditionException | if this Title instance does not represent a proper page, that is, if it is a section link, interwiki link, link to a special page, or such. |
| PreconditionException | if $wikiId is not false. |
Implements MediaWiki\Page\PageIdentity.
Definition at line 3608 of file Title.php.
References MediaWiki\DAO\WikiAwareEntity\assertWiki(), and getArticleID().
Referenced by toPageIdentity().
| MediaWiki\Title\Title::getInternalURL | ( | $query = '' | ) |
Get the URL form for an internal link.
This uses $wgInternalServer to qualify the path, or $wgServer if $wgInternalServer is not set. If the server variable used is protocol-relative, the URL will be expanded to http://
| string | array | $query |
Definition at line 2295 of file Title.php.
References $url, $wgInternalServer, $wgServer, MediaWiki\MediaWikiServices\getInstance(), getLocalURL(), PROTO_HTTP, and wfArrayToCgi().
| MediaWiki\Title\Title::getInterwiki | ( | ) |
Get the interwiki prefix.
Use Title::isExternal to check if a interwiki is set
Implements MediaWiki\Linker\LinkTarget.
Definition at line 930 of file Title.php.
References return.
Referenced by equals(), MediaWiki\Content\WikitextContentHandler\makeRedirectContent(), and TitleCleanup\moveInconsistentPage().
| MediaWiki\Title\Title::getLatestRevID | ( | $flags = 0 | ) |
What is the page_latest field for this page?
| int | $flags | A bitfield of IDBAccessObject::READ_* constants |
Definition at line 2580 of file Title.php.
Referenced by toPageRecord().
| MediaWiki\Title\Title::getLength | ( | $flags = 0 | ) |
| MediaWiki\Title\Title::getLinksFrom | ( | $options = [], | |
| $table = 'pagelinks', | |||
| $prefix = 'pl' ) |
Get an array of Title objects linked from this Title Also stores the IDs in the link cache.
WARNING: do not use this function on arbitrary user-supplied titles! On heavily-used templates it will max out the memory.
| array | $options | Query option to Database::select() |
| string | $table | Table name |
| string | $prefix | Fields prefix |
Definition at line 2788 of file Title.php.
References getArticleID(), and MediaWiki\MediaWikiServices\getInstance().
Referenced by getTemplateLinksFrom().
| MediaWiki\Title\Title::getLinksTo | ( | $options = [], | |
| $table = 'pagelinks', | |||
| $prefix = 'pl' ) |
Get an array of Title objects linking to this Title Also stores the IDs in the link cache.
WARNING: do not use this function on arbitrary user-supplied titles! On heavily-used templates it will max out the memory.
| array | $options | May be FOR UPDATE |
| string | $table | Table name |
| string | $prefix | Fields prefix |
Definition at line 2714 of file Title.php.
References MediaWiki\MediaWikiServices\getInstance().
Referenced by getTemplateLinksTo().
| MediaWiki\Title\Title::getLinkURL | ( | $query = '', | |
| $query2 = false, | |||
| $proto = false ) |
Get a URL that's the simplest URL that will be valid to link, locally, to the current Title.
It includes the fragment, but does not include the server unless action=render is used (or the link is external). If there's a fragment but the prefixed text is empty, we just return a link to the fragment.
The result obviously should not be URL-escaped, but does need to be HTML-escaped if it's being output in HTML.
| string | array | $query | |
| string | string[] | false | $query2 | deprecated since MW 1.19; ignored since MW 1.41 |
| string | int | false | $proto | A PROTO_* constant on how the URL should be expanded, or false (default) for no expansion |
Definition at line 2271 of file Title.php.
References getFragmentForURL(), getFullURL(), getLocalURL(), getPrefixedText(), MediaWiki\Linker\LinkTarget\hasFragment(), and MediaWiki\Linker\LinkTarget\isExternal().
| MediaWiki\Title\Title::getLocalURL | ( | $query = '' | ) |
Get a URL with no fragment or server name (relative URL) from a Title object.
If this page is generated with action=render, however, $wgServer is prepended to make an absolute URL.
| string | array | $query | An optional query string, not used for interwiki links. Can be specified as an associative array as well, e.g., [ 'action' => 'edit' ] (keys and values will be URL-escaped). Some query patterns will trigger various shorturl path replacements. |
Definition at line 2176 of file Title.php.
References $url, $wgActionPaths, $wgArticlePath, $wgMainPageIsDomainRoot, $wgScript, $wgVariantArticlePath, equals(), MediaWiki\Request\PathRouter\getActionPaths(), MediaWiki\MediaWikiServices\getInstance(), getNsText(), getPageLanguage(), getPrefixedDBkey(), isMainPage(), wfAppendQuery(), wfArrayToCgi(), and wfUrlencode().
Referenced by MediaWiki\EditPage\EditPage\getActionURL(), getCanonicalURL(), getEditURL(), getFullURL(), getInternalURL(), getLinkURL(), and MediaWiki\Diff\TextSlotDiffRenderer\getTablePrefix().
| MediaWiki\Title\Title::getNamespace | ( | ) |
Get the namespace index, i.e.
one of the NS_xxxx constants.
Implements MediaWiki\Linker\LinkTarget.
Definition at line 1029 of file Title.php.
References return.
Referenced by MediaWiki\Watchlist\ActivityUpdateJob\__construct(), MediaWiki\Export\XmlDumpWriter\canonicalTitle(), MediaWiki\Parser\LinkHolderArray\doVariants(), equals(), MediaWiki\JobQueue\Jobs\DoubleRedirectJob\getFinalDestination(), getSubpages(), isSamePageAs(), MediaWiki\Page\PageArchive\listPagesByPrefix(), MediaWiki\Page\PageArchive\listPagesBySearch(), MediaWiki\Parser\LinkHolderArray\makeHolder(), MediaWiki\Content\WikitextContentHandler\makeRedirectContent(), MediaWiki\Block\Restriction\NamespaceRestriction\matches(), TitleCleanup\moveInconsistentPage(), MediaWiki\Page\WikiPage\onArticleCreate(), MediaWiki\Page\WikiPage\onArticleDelete(), toPageIdentity(), toPageRecord(), and toPageReference().
| MediaWiki\Title\Title::getNamespaceKey | ( | $prepend = 'nstab-' | ) |
Generate strings used for xml 'id' names in monobook tabs.
| string | $prepend | Defaults to 'nstab-' |
Definition at line 3254 of file Title.php.
References MediaWiki\MediaWikiServices\getInstance(), and getSubjectNsText().
| MediaWiki\Title\Title::getNsText | ( | ) |
Get the namespace text.
Definition at line 1125 of file Title.php.
References MediaWiki\MediaWikiServices\getInstance(), MediaWiki\Linker\LinkTarget\isExternal(), NS_MAIN, and wfDebug().
Referenced by getLocalURL(), getSubjectNsText(), and getTalkNsText().
| MediaWiki\Title\Title::getPageLanguage | ( | ) |
Get the language in which the content of this page is written in wikitext.
Defaults to content language, but in certain cases it can be e.g. $wgLang (such as special pages, which are in the user language).
Definition at line 3421 of file Title.php.
References $wgLanguageCode, getContentModel(), MediaWiki\MediaWikiServices\getInstance(), and isSpecialPage().
Referenced by getLocalURL().
| MediaWiki\Title\Title::getParentCategories | ( | ) |
Get categories to which this Title belongs and return an array of categories' names.
Definition at line 2900 of file Title.php.
References getArticleID(), getFullText(), MediaWiki\MediaWikiServices\getInstance(), and NS_CATEGORY.
Referenced by getParentCategoryTree().
| MediaWiki\Title\Title::getParentCategoryTree | ( | $children = [] | ) |
Get a tree of parent categories.
| array | $children | Array with the children in the keys, to check for circular refs |
Definition at line 2935 of file Title.php.
References getParentCategories().
| MediaWiki\Title\Title::getPartialURL | ( | ) |
| MediaWiki\Title\Title::getPrefixedDBkey | ( | ) |
Get the prefixed database key form.
Definition at line 1802 of file Title.php.
Referenced by MediaWiki\Parser\PPTemplateFrame_Hash\__construct(), getFullUrlForRedirect(), getLocalURL(), MediaWiki\Parser\PPFrame_Hash\loopCheck(), MediaWiki\Parser\LinkHolderArray\makeHolder(), and TitleCleanup\moveInconsistentPage().
| MediaWiki\Title\Title::getPrefixedText | ( | ) |
Get the prefixed title with spaces.
This is the form usually used for display
Definition at line 1814 of file Title.php.
Referenced by __toString(), MediaWiki\Export\XmlDumpWriter\canonicalTitle(), MediaWiki\Specials\SpecialPageLanguage\changePageLanguage(), MediaWiki\Search\SearchSuggestion\fromTitle(), getFullText(), getLinkURL(), getTitleValue(), and MediaWiki\Logging\RenameuserLogFormatter\myPageLink().
| MediaWiki\Title\Title::getPrefixedURL | ( | string | $query = '' | ) |
Get a URL-encoded title (not an actual URL) including interwiki.
| string | $query | An optional query string (since 1.47) |
Definition at line 2093 of file Title.php.
References wfAppendQuery(), and wfUrlencode().
| MediaWiki\Title\Title::getRedirectsHere | ( | $ns = null | ) |
Get all extant redirects to this Title.
| int | null | $ns | Single namespace to consider; null to consider all namespaces |
Definition at line 3283 of file Title.php.
References MediaWiki\Linker\LinkTarget\isExternal().
| MediaWiki\Title\Title::getRootText | ( | ) |
Get the root page name text without a namespace, i.e.
the leftmost part before any slashes
Definition at line 1898 of file Title.php.
References getText().
Referenced by getRootTitle().
| MediaWiki\Title\Title::getRootTitle | ( | ) |
Get the root page name title, i.e.
the leftmost part before any slashes
Definition at line 1925 of file Title.php.
References getRootText(), and isValid().
Referenced by isRawHtmlMessage().
| MediaWiki\Title\Title::getSkinFromConfigSubpage | ( | ) |
| MediaWiki\Title\Title::getSubjectNsText | ( | ) |
Get the namespace text of the subject (rather than talk) page.
Definition at line 1155 of file Title.php.
References MediaWiki\MediaWikiServices\getInstance(), and getNsText().
Referenced by getNamespaceKey().
| MediaWiki\Title\Title::getSubjectPage | ( | ) |
Get a title object associated with the subject page of this talk page.
Definition at line 1646 of file Title.php.
References MediaWiki\MediaWikiServices\getInstance().
| MediaWiki\Title\Title::getSubpage | ( | $text | ) |
| MediaWiki\Title\Title::getSubpages | ( | $limit = -1 | ) |
Get all subpages of this page.
| int | $limit | Maximum number of subpages to fetch; -1 for no limit |
Definition at line 2417 of file Title.php.
References getDBkey(), MediaWiki\MediaWikiServices\getInstance(), getNamespace(), and hasSubpages().
Referenced by hasSubpages().
| MediaWiki\Title\Title::getSubpageText | ( | ) |
Get the lowest-level subpage name, i.e.
the rightmost part after any slashes
Definition at line 2017 of file Title.php.
References getText().
Referenced by getSubpageUrlForm().
| MediaWiki\Title\Title::getSubpageUrlForm | ( | ) |
Get a URL-encoded form of the subpage text.
Definition at line 2081 of file Title.php.
References getSubpageText(), and wfUrlencode().
| MediaWiki\Title\Title::getTalkNsText | ( | ) |
Get the namespace text of the talk page.
Definition at line 1166 of file Title.php.
References MediaWiki\MediaWikiServices\getInstance(), and getNsText().
| MediaWiki\Title\Title::getTalkPage | ( | ) |
Get a Title object associated with the talk page of this article.
| MWException | if $target doesn't have talk pages, e.g. because it's in NS_SPECIAL or because it's a relative link, or an interwiki link. |
Definition at line 1601 of file Title.php.
References MediaWiki\MediaWikiServices\getInstance().
Referenced by getTalkPageIfDefined().
| MediaWiki\Title\Title::getTalkPageIfDefined | ( | ) |
Get a Title object associated with the talk page of this article, if such a talk page can exist.
Definition at line 1631 of file Title.php.
References canHaveTalkPage(), and getTalkPage().
| MediaWiki\Title\Title::getTemplateLinksFrom | ( | $options = [] | ) |
Get an array of Title objects used on this Title as a template Also stores the IDs in the link cache.
WARNING: do not use this function on arbitrary user-supplied titles! On heavily-used templates it will max out the memory.
| array | $options | May be FOR UPDATE |
Definition at line 2853 of file Title.php.
References getLinksFrom().
| MediaWiki\Title\Title::getTemplateLinksTo | ( | $options = [] | ) |
Get an array of Title objects using this Title as a template Also stores the IDs in the link cache.
WARNING: do not use this function on arbitrary user-supplied titles! On heavily-used templates it will max out the memory.
| array | $options | Query option to Database::select() |
Definition at line 2772 of file Title.php.
References getLinksTo().
| MediaWiki\Title\Title::getText | ( | ) |
Get the text form (spaces not underscores) of the main part.
Implements MediaWiki\Linker\LinkTarget.
Definition at line 1002 of file Title.php.
References return.
Referenced by MediaWiki\Export\XmlDumpWriter\canonicalTitle(), createFragmentTarget(), getBaseText(), MediaWiki\Gallery\TraditionalImageGallery\getCaptionHtml(), getCategorySortkey(), getFullSubpageText(), MediaWiki\Content\ContentHandler\getPageLanguage(), getRootText(), getSkinFromConfigSubpage(), getSubpage(), getSubpageText(), isConversionTable(), isSubpage(), MediaWiki\Page\PageArchive\listPagesBySearch(), MediaWiki\Page\WikiPage\onArticleDelete(), and MediaWiki\EditPage\EditPage\setHeaders().
| MediaWiki\Title\Title::getTitleValue | ( | ) |
Get a TitleValue object representing this Title.
Definition at line 979 of file Title.php.
References getPrefixedText(), and wfDebug().
| MediaWiki\Title\Title::getTouched | ( | int | $flags = IDBAccessObject::READ_NORMAL | ) |
Get the last touched timestamp.
| int | $flags | one of the READ_XXX constants. |
Definition at line 3243 of file Title.php.
Referenced by toPageRecord().
| MediaWiki\Title\Title::getTransWikiID | ( | ) |
Returns the DB name of the distant wiki which owns the object.
Definition at line 962 of file Title.php.
References MediaWiki\Linker\LinkTarget\isExternal().
| MediaWiki\Title\Title::getWikiId | ( | ) |
Returns false to indicate that this Title belongs to the local wiki.
Implements MediaWiki\Page\PageReference.
Definition at line 3588 of file Title.php.
Referenced by isSamePageAs(), toPageIdentity(), and toPageRecord().
| MediaWiki\Title\Title::hasContentModel | ( | string ... | $id | ) |
Convenience method for checking a title's content model name.
| string | ...$id Content model id, one ore more of the global CONTENT_MODEL_XXX constants |
Definition at line 1079 of file Title.php.
References getContentModel(), and return.
Referenced by isSiteCssConfigPage(), isSiteJsConfigPage(), isSiteJsonConfigPage(), isUserCssConfigPage(), isUserJsConfigPage(), isUserJsonConfigPage(), and isWikitextPage().
| MediaWiki\Title\Title::hasDeletedEdits | ( | ) |
Is there a version of this page in the deletion archive?
Definition at line 2492 of file Title.php.
References NS_FILE.
Referenced by isDeletedQuick().
| MediaWiki\Title\Title::hasSourceText | ( | ) |
Does this page have source text?
Definition at line 3096 of file Title.php.
References exists(), MediaWiki\MediaWikiServices\getInstance(), NS_MEDIAWIKI, wfDeprecated(), and wfMessage().
| MediaWiki\Title\Title::hasSubjectNamespace | ( | $ns | ) |
Returns true if the title has the same subject namespace as the namespace specified.
For example this method will take NS_USER and return true if namespace is either NS_USER or NS_USER_TALK since both of them have NS_USER as their subject namespace.
This is MUCH simpler than individually testing for equivalence against both NS_USER and NS_USER_TALK, and is also forward compatible.
| int | $ns |
Definition at line 1320 of file Title.php.
References MediaWiki\MediaWikiServices\getInstance().
| MediaWiki\Title\Title::hasSubpages | ( | ) |
Does this have subpages?
(Warning, usually requires an extra DB query.)
Definition at line 2389 of file Title.php.
References MediaWiki\Title\TitleArrayFromResult\count(), MediaWiki\MediaWikiServices\getInstance(), getSubpages(), and hasSubpages().
Referenced by getEditNotices(), getSubpages(), and hasSubpages().
| MediaWiki\Title\Title::inNamespace | ( | int | $ns | ) |
Returns true if the title is inside the specified namespace.
| int | $ns | The namespace |
Implements MediaWiki\Linker\LinkTarget.
Definition at line 1287 of file Title.php.
References equals(), and return.
Referenced by MediaWiki\Content\ContentHandler\getPageLanguage(), inNamespaces(), isRawHtmlMessage(), and MediaWiki\SpecialPage\ImageQueryPage\outputResults().
| MediaWiki\Title\Title::inNamespaces | ( | ... | ) |
Returns true if the title is inside one of the specified namespaces.
| int|int[] | ...$namespaces The namespaces to check for |
Definition at line 1299 of file Title.php.
References inNamespace().
| MediaWiki\Title\Title::invalidateCache | ( | $purgeTime = null | ) |
Updates page_touched for this page; called from LinksUpdate.php.
| string | null | $purgeTime | [optional] TS::MW timestamp |
Definition at line 3164 of file Title.php.
References Wikimedia\Rdbms\IReadableDatabase\expr(), MediaWiki\MediaWikiServices\getInstance(), Wikimedia\Rdbms\IDatabase\newUpdateQueryBuilder(), pageCond(), Wikimedia\Rdbms\Platform\ISQLPlatform\timestamp(), and wfRandom().
Referenced by MediaWiki\Specials\SpecialPageLanguage\changePageLanguage().
| MediaWiki\Title\Title::isBigDeletion | ( | ) |
Check whether the number of revisions of this page surpasses $wgDeleteRevisionsLimit.
Definition at line 2990 of file Title.php.
References $wgDeleteRevisionsLimit, and getArticleID().
| MediaWiki\Title\Title::isContentPage | ( | ) |
Is this Title in a namespace which contains content?
In other words, is this a content page, for the purposes of calculating statistics, etc?
Definition at line 1332 of file Title.php.
References MediaWiki\MediaWikiServices\getInstance().
| MediaWiki\Title\Title::isConversionTable | ( | ) |
Is this a conversion table for the LanguageConverter?
Definition at line 1387 of file Title.php.
References getText(), and NS_MEDIAWIKI.
| MediaWiki\Title\Title::isDeleted | ( | ) |
Is there a version of this page in the deletion archive?
Definition at line 2445 of file Title.php.
References getDeletedEditsCount().
| MediaWiki\Title\Title::isDeletedQuick | ( | ) |
Is there a version of this page in the deletion archive?
Definition at line 2482 of file Title.php.
References hasDeletedEdits().
| MediaWiki\Title\Title::isKnown | ( | ) |
Does this title refer to a page that can (or might) be meaningfully viewed?
In particular, this function may be used to determine if links to the title should be rendered as "bluelinks" (as opposed to "redlinks" to non-existent pages). Adding something else to this function will cause inconsistency since LinkHolderArray calls LinkAlwaysKnownLookup::isAlwaysKnown() and does its own page existence check.
Definition at line 3085 of file Title.php.
References exists(), and MediaWiki\MediaWikiServices\getInstance().
Referenced by MediaWiki\SpecialPage\WantedQueryPage\existenceCheck().
| MediaWiki\Title\Title::isLocal | ( | ) |
Determine whether the object refers to a page within this project (either this wiki or a wiki with a local interwiki, see https://www.mediawiki.org/wiki/Manual:Interwiki_table#iw_local ).
Definition at line 913 of file Title.php.
References MediaWiki\Linker\LinkTarget\isExternal().
Referenced by getFullUrlForRedirect().
| MediaWiki\Title\Title::isMainPage | ( | ) |
Is this the mainpage?
Definition at line 1365 of file Title.php.
References equals().
Referenced by getLocalURL().
| MediaWiki\Title\Title::isMovable | ( | ) |
Would anybody with sufficient privileges be able to move this page?
Some pages just aren't movable.
Definition at line 1343 of file Title.php.
References MediaWiki\MediaWikiServices\getInstance(), MediaWiki\Linker\LinkTarget\isExternal(), and isMovable().
Referenced by isMovable().
| MediaWiki\Title\Title::isNewPage | ( | $flags = IDBAccessObject::READ_NORMAL | ) |
Check if this is a new page.
| int | $flags | one of the READ_XXX constants. |
Definition at line 2979 of file Title.php.
Referenced by toPageRecord().
| MediaWiki\Title\Title::isRawHtmlMessage | ( | ) |
Is this a message which can contain raw HTML?
Definition at line 1570 of file Title.php.
References $wgRawHtmlMessages, getDBkey(), getRootTitle(), inNamespace(), and NS_MEDIAWIKI.
| MediaWiki\Title\Title::isRedirect | ( | $flags = 0 | ) |
Is this an article that is a redirect page?
Uses link cache, adding it if necessary.
This is intended to provide fast access to page_is_redirect for linking. In rare cases, there might not be a valid target in the redirect table even though this function returns true.
To find a redirect target, just call WikiPage::getRedirectTarget() and check if it returns null, there's no need to call this first.
| int | $flags | A bitfield of IDBAccessObject::READ_* constants |
Definition at line 2547 of file Title.php.
Referenced by MediaWiki\Linker\LinkRenderer\makeRedirectHeader(), and toPageRecord().
| MediaWiki\Title\Title::isSamePageAs | ( | PageReference | $other | ) |
Checks whether the given PageReference refers to the same page as this PageReference.Two PageReference instances are considered to refer to the same page if they belong to the same wiki, and have the same namespace and DB key.
| PageReference | $other |
Implements MediaWiki\Page\PageReference.
Definition at line 3039 of file Title.php.
References getDBkey(), getNamespace(), getWikiId(), and return.
Referenced by MediaWiki\Skin\SkinTemplate\tabAction().
| MediaWiki\Title\Title::isSingleRevRedirect | ( | ) |
Locks the page row and check if this page is single revision redirect.
This updates the cached fields of this instance via Title::loadFromRow()
Definition at line 2864 of file Title.php.
References MediaWiki\MediaWikiServices\getInstance(), loadFromRow(), and pageCond().
| MediaWiki\Title\Title::isSiteConfigPage | ( | ) |
Could this MediaWiki namespace page contain custom CSS, JSON, or JavaScript for the global UI.
This is generally true for pages in the MediaWiki namespace having CONTENT_MODEL_CSS, CONTENT_MODEL_JSON, CONTENT_MODEL_JAVASCRIPT or CONTENT_MODEL_VUE.
This method does not return true for per-user JS/JSON/CSS. Use isUserConfigPage() for that!
Note that this method should not return true for pages that contain and show "inactive" CSS, JSON, or JS.
Definition at line 1418 of file Title.php.
References isSiteCssConfigPage(), isSiteJsConfigPage(), and isSiteJsonConfigPage().
| MediaWiki\Title\Title::isSiteCssConfigPage | ( | ) |
Is this a sitewide CSS "config" page?
Definition at line 1511 of file Title.php.
References CONTENT_MODEL_CSS, hasContentModel(), and NS_MEDIAWIKI.
Referenced by isSiteConfigPage().
| MediaWiki\Title\Title::isSiteJsConfigPage | ( | ) |
Is this a sitewide JS "config" page?
Definition at line 1547 of file Title.php.
References CONTENT_MODEL_JAVASCRIPT, CONTENT_MODEL_VUE, hasContentModel(), and NS_MEDIAWIKI.
Referenced by isSiteConfigPage().
| MediaWiki\Title\Title::isSiteJsonConfigPage | ( | ) |
Is this a sitewide JSON "config" page?
Definition at line 1529 of file Title.php.
References CONTENT_MODEL_JSON, hasContentModel(), and NS_MEDIAWIKI.
Referenced by isSiteConfigPage().
| MediaWiki\Title\Title::isSpecial | ( | $name | ) |
Returns true if this title resolves to the named special page.
| string | $name | The special page name |
Definition at line 1248 of file Title.php.
References MediaWiki\MediaWikiServices\getInstance(), and isSpecialPage().
Referenced by isValidRedirectTarget().
| MediaWiki\Title\Title::isSpecialPage | ( | ) |
Returns true if this is a special page.
Definition at line 1238 of file Title.php.
References NS_SPECIAL.
Referenced by MediaWiki\Skin\SkinTemplate\buildPersonalUrls(), fixSpecialName(), getPageLanguage(), isSpecial(), and isValidRedirectTarget().
| MediaWiki\Title\Title::isSubpage | ( | ) |
Is this a subpage?
Definition at line 1375 of file Title.php.
References MediaWiki\MediaWikiServices\getInstance(), and getText().
Referenced by isUserCssConfigPage(), isUserJsConfigPage(), and isUserJsonConfigPage().
| MediaWiki\Title\Title::isSubpageOf | ( | Title | $title | ) |
| MediaWiki\Title\Title::isTalkPage | ( | ) |
Is this a talk page of some sort?
Definition at line 1585 of file Title.php.
References MediaWiki\MediaWikiServices\getInstance().
| MediaWiki\Title\Title::isTrans | ( | ) |
Determine whether the object refers to a page within this project and is transcludable.
Definition at line 949 of file Title.php.
References MediaWiki\Linker\LinkTarget\isExternal().
| MediaWiki\Title\Title::isUserConfigPage | ( | ) |
Is this a "config" (.css, .json, or .js) subpage of a user page?
Definition at line 1432 of file Title.php.
References isUserCssConfigPage(), isUserJsConfigPage(), and isUserJsonConfigPage().
| MediaWiki\Title\Title::isUserCssConfigPage | ( | ) |
Is this a CSS "config" subpage of a user page?
Definition at line 1467 of file Title.php.
References CONTENT_MODEL_CSS, hasContentModel(), isSubpage(), and NS_USER.
Referenced by isUserConfigPage().
| MediaWiki\Title\Title::isUserJsConfigPage | ( | ) |
Is this a JS "config" subpage of a user page?
Definition at line 1495 of file Title.php.
References CONTENT_MODEL_JAVASCRIPT, CONTENT_MODEL_VUE, hasContentModel(), isSubpage(), and NS_USER.
Referenced by isUserConfigPage().
| MediaWiki\Title\Title::isUserJsonConfigPage | ( | ) |
Is this a JSON "config" subpage of a user page?
Definition at line 1481 of file Title.php.
References CONTENT_MODEL_JSON, hasContentModel(), isSubpage(), and NS_USER.
Referenced by isUserConfigPage().
| MediaWiki\Title\Title::isValid | ( | ) |
Returns true if the title is a valid link target, and that it has been properly normalized.
This method checks that the title is syntactically valid, and that the namespace it refers to exists.
Titles constructed using newFromText() or makeTitleSafe() are always valid.
Definition at line 873 of file Title.php.
References MediaWiki\MediaWikiServices\getInstance().
Referenced by getBaseTitle(), getRootTitle(), and isValidRedirectTarget().
| MediaWiki\Title\Title::isValidRedirectTarget | ( | ) |
Check if this Title is a valid redirect target.
Definition at line 3313 of file Title.php.
References $wgInvalidRedirectTargets, getDBkey(), isSpecial(), isSpecialPage(), and isValid().
Referenced by MediaWiki\Export\XmlDumpWriter\openPage().
| MediaWiki\Title\Title::isWikitextPage | ( | ) |
Does that page contain wikitext, or it is JS, CSS or whatever?
Definition at line 1400 of file Title.php.
References CONTENT_MODEL_WIKITEXT, and hasContentModel().
|
static |
Get a regex character class describing the legal characters in a link.
Definition at line 701 of file Title.php.
References $wgLegalTitleChars.
Referenced by MediaWiki\Title\TitleParser\getTitleInvalidRegex(), and TitleCleanup\moveIllegalPage().
| MediaWiki\Title\Title::loadFromRow | ( | $row | ) |
Load Title object fields from a DB row.
If false is given, the title will be treated as non-existing.
| stdClass | false | $row | Database row |
Definition at line 556 of file Title.php.
Referenced by isSingleRevRedirect().
|
static |
Make a prefixed DB key from a DB key and a namespace index.
| int | $ns | Numerical representation of the namespace |
| string | $title | The DB key form the title |
| string | $fragment | The link fragment (after the "#") |
| string | $interwiki | The interwiki prefix |
| bool | $canonicalNamespace | If true, use the canonical name for $ns instead of the localized version. |
Definition at line 821 of file Title.php.
References MediaWiki\MediaWikiServices\getInstance(), and NS_SPECIAL.
Referenced by TitleCleanup\processRow().
|
static |
Create a new Title from a namespace index and a DB key.
It's assumed that $ns and $title are safe, for instance when they came directly from the database or a special page name, not from user input.
No validation is applied. For convenience, spaces are normalized to underscores, so that e.g. user_text fields can be used directly.
| int | $ns | The namespace of the article |
| string | $title | The unprefixed database key form |
| string | $fragment | The link fragment (after the "#") |
| string | $interwiki | The interwiki prefix |
Definition at line 609 of file Title.php.
References wfUrlencode().
Referenced by FindOrphanedFiles\checkFiles(), createFragmentTarget(), AttachLatest\execute(), CheckBadRedirects\execute(), DeleteDefaultMessages\execute(), DeleteEqualMessages\execute(), DumpLinks\execute(), FixDoubleRedirects\execute(), NukeNS\execute(), PurgeChangedPages\execute(), RebuildTextIndex\populateSearchIndex(), CleanupWatchlist\processRow(), CleanupCaps\processRowToLowercase(), CleanupCaps\processRowToUppercase(), and PurgeChangedFiles\purgeFromLogType().
|
static |
Create a new Title from a namespace index and a DB key.
The parameters will be checked for validity, which is a bit slower than makeTitle() but safer for user-provided data.
The Title object returned by this method is guaranteed to be valid. Call canExist() to check if the Title represents an editable page.
| int | $ns | The namespace of the article |
| string | $title | Database key form |
| string | $fragment | The link fragment (after the "#") |
| string | $interwiki | Interwiki prefix |
Definition at line 635 of file Title.php.
References exists(), and MediaWiki\MediaWikiServices\getInstance().
Referenced by FixMergeHistoryCorruption\execute(), ImportImages\execute(), ImportSiteScripts\execute(), MakeTestEdits\execute(), RebuildFileCache\execute(), RefreshLinks\execute(), TitleCleanup\moveInconsistentPage(), and CleanupImages\processRow().
|
static |
|
static |
Create a new Title from an article ID.
| int | $id | The page_id corresponding to the Title to create |
| int | $flags | Bitfield of IDBAccessObject::READ_* constants |
Definition at line 517 of file Title.php.
References MediaWiki\MediaWikiServices\getInstance().
Referenced by DeleteBatch\execute().
|
static |
Returns a Title given a LinkTarget.
If the given LinkTarget is already a Title instance, that instance is returned, unless $forceClone is "clone". If $forceClone is "clone" and the given LinkTarget is already a Title instance, that instance is copied using the clone operator.
| ParsoidLinkTarget | $linkTarget | Assumed to be safe. |
| string | $forceClone | set to NEW_CLONE to ensure a fresh instance is returned. |
|
static |
Return a Title for a given PageIdentity.
If $pageIdentity is a Title, that Title is returned unchanged.
| PageIdentity | $pageIdentity |
Definition at line 318 of file Title.php.
References newFromPageReference(), and return.
|
static |
Return a Title for a given Reference.
If $pageReference is a Title, that Title is returned unchanged.
| PageReference | $pageReference |
Definition at line 341 of file Title.php.
References if.
Referenced by newFromPageIdentity().
|
static |
Make a Title object from a DB row.
| stdClass | $row | Object database row (needs at least page_title,page_namespace) |
Definition at line 544 of file Title.php.
Referenced by CompareParserCache\execute(), and MediaWiki\Title\TitleArrayFromResult\setCurrent().
|
static |
Create a new Title from text, such as what one would find in a link.
Decodes any HTML entities in the text. Titles returned by this method are guaranteed to be valid. Call canExist() to check if the Title represents an editable page.
| string | int | null | $text | The link text; spaces, prefixes, and an initial ':' indicating the main namespace are accepted. |
| int | $defaultNamespace | The namespace to use if none is specified by a prefix. If you want to force a specific namespace even if $text might begin with a namespace prefix, use makeTitle() or makeTitleSafe(). |
Definition at line 388 of file Title.php.
References NS_MAIN.
Referenced by BackfillInterwikiRightsLog\execute(), BenchmarkCommentFormatter\execute(), BenchmarkParse\execute(), CompareLanguageConverterOutput\execute(), DeleteBatch\execute(), DumpIterator\execute(), EditCLI\execute(), FixDoubleRedirects\execute(), FormatInstallDoc\execute(), GetTextMaint\execute(), ImportTextFiles\execute(), MoveBatch\execute(), NukePage\execute(), PageExists\execute(), Protect\execute(), RollbackEdits\execute(), TestCompression\execute(), TitleCleanup\execute(), Undelete\execute(), UppercaseTitlesForUnicodeTransition\execute(), ViewCLI\execute(), CLIParser\getTitle(), TitleCleanup\moveIllegalPage(), BenchmarkTitleValue\parseTitle(), CleanupWatchlist\processRow(), TitleCleanup\processRow(), and CleanupCaps\processRowToUppercase().
|
static |
Like Title::newFromText(), but throws MalformedTitleException when the title is invalid, rather than returning null.
Titles returned by this method are guaranteed to be valid. Call canExist() to check if the Title represents an editable page.
| string | $text | Title text to check |
| int | $defaultNamespace |
| MalformedTitleException | If the title is invalid. |
Definition at line 423 of file Title.php.
References NS_MAIN.
|
static |
THIS IS NOT THE FUNCTION YOU WANT.
Use Title::newFromText().
Example of wrong and broken code: $title = Title::newFromURL( $request->getText( 'title' ) );
Example of right code: $title = Title::newFromText( $request->getText( 'title' ) );
Create a new Title from URL-encoded text. Ensures that the given title's length does not exceed the maximum.
| string | $url | The title, as might be taken from a URL |
Definition at line 485 of file Title.php.
References $url.
|
static |
Create a new Title for the Main Page.
This uses the 'mainpage' interface message, which could be specified in $wgForceUIMsgAsContentMsg. If that is the case, then calling this method will use the user language, which would involve initialising the session via RequestContext::getMain()->getLanguage(). For session-less endpoints, be sure to pass in a MessageLocalizer (such as your own RequestContext or ResourceLoader Context) to prevent an error.
| MessageLocalizer | null | $localizer | An optional context to use (since 1.34) |
Definition at line 671 of file Title.php.
References NS_MAIN, and wfMessage().
Referenced by MediaWiki\Title\TitleParser\splitTitleString().
| MediaWiki\Title\Title::pageCond | ( | ) |
Get an associative array for selecting this title from the "page" table.
Definition at line 2962 of file Title.php.
Referenced by invalidateCache(), and isSingleRevRedirect().
|
static |
Purge expired restrictions from the page_restrictions table.
This will purge no more than $wgUpdateRowsPerQuery page_restrictions rows
Definition at line 2353 of file Title.php.
References Wikimedia\Rdbms\IReadableDatabase\expr(), MediaWiki\MediaWikiServices\getInstance(), Wikimedia\Rdbms\IDatabase\newDeleteQueryBuilder(), Wikimedia\Rdbms\IReadableDatabase\newSelectQueryBuilder(), Wikimedia\Rdbms\Platform\ISQLPlatform\timestamp(), and MediaWiki\MainConfigNames\UpdateRowsPerQuery.
| MediaWiki\Title\Title::resetArticleID | ( | $id | ) |
Inject a page ID, reset DB-loaded fields, and clear the link cache for this title.
This can be called on page insertion to allow loading of the new page_id without having to create a new Title instance. Likewise with deletion.
This is also used during page moves, to reflect the change in the relationship between article ID and title text.
| int | bool | $id | Page ID, 0 for non-existent, or false for "unknown" (lazy-load) |
Definition at line 2605 of file Title.php.
References MediaWiki\MediaWikiServices\getInstance().
| MediaWiki\Title\Title::setContentModel | ( | $model | ) |
Set a proposed content model for the page for permissions checking.
This does not actually change the content model of a title in the DB. It only affects this particular Title instance. The content model is forced to remain this value until another setContentModel() call.
ContentHandler::canBeUsedOn() should be checked before calling this if there is any doubt regarding the applicability of the content model
| string | $model | CONTENT_MODEL_XXX constant |
| MediaWiki\Title\Title::setFragment | ( | $fragment | ) |
Set the fragment for this title.
Removes the first character from the specified fragment before setting, so it assumes you're passing it with an initial "#".
| string | $fragment | Text |
Definition at line 1735 of file Title.php.
Referenced by MediaWiki\Skin\Skin\doEditSectionLink().
| MediaWiki\Title\Title::toPageIdentity | ( | ) |
Returns the page represented by this Title as a ProperPageIdentity.
The ProperPageIdentity returned by this method is guaranteed to be immutable. If this Title does not represent a proper page, an exception is thrown.
It is preferred to use this method rather than using the Title as a PageIdentity directly.
| PreconditionException | if the page is not a proper page, that is, if it is a section link, interwiki link, link to a special page, or such. |
Definition at line 3645 of file Title.php.
References getDBkey(), getId(), getNamespace(), and getWikiId().
| MediaWiki\Title\Title::toPageRecord | ( | $flags = 0 | ) |
Returns the page represented by this Title as a ProperPageRecord.
The PageRecord returned by this method is guaranteed to be immutable, the page is guaranteed to exist.
| int | $flags | A bitfield of IDBAccessObject::READ_* constants |
| PreconditionException | if the page does not exist, or is not a proper page, that is, if it is a section link, interwiki link, link to a special page, or such. |
Definition at line 3672 of file Title.php.
References exists(), getArticleID(), getDBkey(), getLatestRevID(), getNamespace(), getTouched(), getWikiId(), isNewPage(), and isRedirect().
| MediaWiki\Title\Title::toPageReference | ( | ) |
Returns the page represented by this Title as a PageReferenceValue.
This is an object which implements PageReference but not PageIdentity.
Definition at line 3705 of file Title.php.
References getDBkey(), and getNamespace().
| MediaWiki\Title\Title::touchLinks | ( | ) |
Update page_touched timestamps and send CDN purge messages for pages linking to this title.
May be sent to the job queue depending on the number of links. Typically called on create and delete.
Definition at line 3214 of file Title.php.
References MediaWiki\MediaWikiServices\getInstance(), and NS_CATEGORY.
Referenced by MediaWiki\Page\WikiPage\onArticleCreate(), and MediaWiki\Page\WikiPage\onArticleDelete().
| MediaWiki\Title\Title::wasLocalInterwiki | ( | ) |
| int MediaWiki\Title\Title::$mArticleID = -1 |
|
protected |
|
protected |
| null bool MediaWiki\Title\Title::$mRedirect = null |
| string null MediaWiki\Title\Title::$prefixedText = null |
| const MediaWiki\Title\Title::NEW_CLONE = 'clone' |