MediaWiki REL1_37
|
Represents a title within MediaWiki. More...
Public Member Functions | |
__clone () | |
__sleep () | |
__toString () | |
Return a string representation of this title. | |
__wakeup () | |
areCascadeProtectionSourcesLoaded () | |
Determines whether cascading protection sources have already been loaded from the database. | |
areRestrictionsCascading () | |
Returns cascading restrictions for the current article. | |
areRestrictionsLoaded () | |
Accessor for mRestrictionsLoaded. | |
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 ( $fragment) | |
Creates a new Title for a different fragment of the same page. | |
deleteTitleProtection () | |
Remove any title protection due to page existing. | |
equals (object $other) | |
Compares with another Title. | |
estimateRevisionCount () | |
Get the approximate revision count of this page. | |
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. | |
flushRestrictions () | |
Flush the protection cache in this object and force reload from the database. | |
getAllRestrictions () | |
Accessor/initialisation for mRestrictions. | |
getArticleID ( $flags=0) | |
Get the article ID for this Title from the link cache, adding it if necessary. | |
getBacklinkCache () | |
Get a backlink cache object. | |
getBaseText () | |
Get the base page name without a namespace, i.e. | |
getBaseTitle () | |
Get the base page name title, i.e. | |
getBrokenLinksFrom () | |
Get an array of Title objects referring to non-existent articles linked from this page. | |
getCanonicalURL ( $query='', $query2=false) | |
Get the URL for a canonical link, for use in things like IRC and e-mail notifications. | |
getCascadeProtectionSources ( $getPages=true) | |
Cascading protection: Get the source of any cascading restrictions on this page. | |
getCategorySortkey ( $prefix='') | |
Returns the raw sort key to be used for categories, with the specified prefix. | |
getCdnUrls () | |
Get a list of URLs to purge from the CDN cache when this page changes. | |
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 an page that overrides an interface message key. | |
getDefaultNamespace () | |
Get the default namespace index, for when there is no namespace. | |
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. | |
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='', $query2=false) | |
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? Uses link cache, adding it if necessary. | |
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='', $query2=false) | |
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. | |
getNotificationTimestamp (User $user) | |
Get the timestamp when this page was updated since the user last saw it. | |
getNsText () | |
Get the namespace text. | |
getOtherPage () | |
Get the other title for this page, if this is a subject page get the talk page, if it is a subject page get the talk page. | |
getPageLanguage () | |
Get the language in which the content of this page is written in wikitext. | |
getPageViewLanguage () | |
Get the language in which the content of this page is written when viewed by user. | |
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 () | |
Get a URL-encoded title (not an actual URL) including interwiki. | |
getRedirectsHere ( $ns=null) | |
Get all extant redirects to this Title. | |
getRestrictionExpiry ( $action) | |
Get the expiry time for the restriction against a given action. | |
getRestrictions ( $action) | |
Accessor/initialisation for mRestrictions. | |
getRestrictionTypes () | |
Returns restriction types for the current 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. | |
getTitleProtection () | |
Is this title subject to title protection? Title protection is the one applied against creation of such title. | |
getTitleValue () | |
Get a TitleValue object representing this Title. | |
getTouched ( $db=null) | |
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 ( $id) | |
Convenience method for checking a title's content model name. | |
hasDeletedEdits () | |
Is there a version of this page in the deletion archive? | |
hasFragment () | |
Check if a Title fragment is set. | |
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? (Warning, usually requires an extra DB query.) | |
inNamespace ( $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. | |
isAlwaysKnown () | |
Should links to this title be shown as potentially viewable (i.e. | |
isBigDeletion () | |
Check whether the number of revisions of this page surpasses $wgDeleteRevisionsLimit. | |
isCascadeProtected () | |
Cascading protection: Return true if cascading restrictions apply to this page, false if not. | |
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? | |
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? | |
isExternal () | |
Is this Title interwiki? | |
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). | |
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? Some pages just aren't movable. | |
isNamespaceProtected (User $user) | |
Determines if $user is unable to edit this page because it has been protected by $wgNamespaceProtection. | |
isNewPage () | |
Check if this is a new page. | |
isProtected ( $action='') | |
Does the title correspond to a protected article? | |
isRawHtmlMessage () | |
Is this a message which can contain raw HTML? | |
isRedirect ( $flags=0) | |
Is this an article that is a redirect page? Uses link cache, adding it if necessary. | |
isSameLinkAs (LinkTarget $other) | |
isSamePageAs (PageReference $other) | |
isSemiProtected ( $action='edit') | |
Is this page "semi-protected" - the only protection levels are listed in $wgSemiprotectedRestrictionLevels? | |
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) sub-page of a user page? | |
isUserCssConfigPage () | |
Is this a CSS "config" sub-page of a user page? | |
isUserJsConfigPage () | |
Is this a JS "config" sub-page of a user page? | |
isUserJsonConfigPage () | |
Is this a JSON "config" sub-page 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. | |
isWatchable () | |
Can this title be added to a user's watchlist? | |
isWikitextPage () | |
Does that page contain wikitext, or it is JS, CSS or whatever? | |
loadFromRow ( $row) | |
Load Title object fields from a DB row. | |
loadRestrictions ( $oldFashionedRestrictions=null, $flags=0) | |
Load restrictions from the page_restrictions table. | |
loadRestrictionsFromRows ( $rows, $oldFashionedRestrictions=null) | |
Compiles list of active page restrictions from both page table (pre 1.10) and page_restrictions table for this existing page. | |
pageCond () | |
Get an associative array for selecting this title from the "page" table. | |
purgeSquid () | |
Purge all applicable CDN URLs. | |
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. | |
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\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 ( $linkTarget) |
Same as newFromLinkTarget, but if passed null, returns null. | |
static | castFromPageIdentity (?PageIdentity $pageIdentity) |
Return a Title for a given PageIdentity. | |
static | castFromPageReference (?PageReference $pageReference) |
Return a Title for a given Reference. | |
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 | getFilteredRestrictionTypes ( $exists=true) |
Get a filtered list of all restriction types supported by this wiki. | |
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 | newFromIDs ( $ids) |
Make an array of titles from an array of IDs. | |
static | newFromLinkTarget (LinkTarget $linkTarget, $forceClone='') |
Returns a Title given a LinkTarget. | |
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 | newFromTitleValue (TitleValue $titleValue, $forceClone='') |
Returns a Title given a TitleValue. | |
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 | GAID_FOR_UPDATE = 512 |
Used to be GAID_FOR_UPDATE define(). | |
const | NEW_CLONE = 'clone' |
Flag for use with factory methods like newFromLinkTarget() that have a $forceClone parameter. | |
Public Attributes inherited from IDBAccessObject | |
const | READ_NONE = -1 |
Constants for object loading bitfield flags (higher => higher QoS) | |
Static Protected Member Functions | |
static | getSelectFields () |
Returns a list of fields that are to be selected for initializing Title objects or LinkCache entries. | |
Private Member Functions | |
__construct () | |
assertProperPage () | |
Code that requires this Title to be a "proper page" in the sense defined by PageIdentity should call this method. | |
findSubpageDivider ( $text, $dir) | |
Finds the first or last subpage divider (slash) in the string. | |
getDbPageLanguageCode () | |
Returns the page language code saved in the database, if $wgPageLanguageUseDB is set to true in LocalSettings.php, otherwise returns false. | |
getLanguageConverter ( $language) | |
Shorthand for getting a Language Converter for specific language. | |
getPageLanguageConverter () | |
Shorthand for getting a Language Converter for page's language. | |
hasSubpagesEnabled () | |
Whether this Title's namespace has subpages enabled. | |
lazyFillContentModel ( $model) | |
If the content model field is not frozen then update it with a retrieved value. | |
loadFieldFromDB ( $field, $flags) | |
prefix ( $name) | |
Prefix some arbitrary text with the namespace or interwiki prefix of this object. | |
secureAndSplit ( $text, $defaultNamespace=null) | |
Secure and split - main initialisation function for this object. | |
uncache () | |
Removes this instance from the internal title cache, so it can be modified in-place without polluting the cache (see T281337). | |
warnIfPageCannotExist (Title $title, $method) | |
Static Private Member Functions | |
static | fixUrlQueryArgs ( $query, $query2=false) |
Helper to fix up the get{Canonical,Full,Link,Local,Internal}URL args get{Canonical,Full,Link,Local,Internal}URL methods accepted an optional second argument named variant. | |
static | getInterwikiLookup () |
B/C kludge: provide an InterwikiLookup for use by Title. | |
static | getTitleCache () |
static | getTitleFormatter () |
B/C kludge: provide a TitleParser for use by Title. | |
static | normalizeFragment ( $fragment) |
Normalizes fragment part of the title. | |
Private Attributes | |
const | CACHE_MAX = 1000 |
Title::newFromText maintains a cache to avoid expensive re-normalization of commonly used titles. | |
Static Private Attributes | |
static MapCacheLRU null | $titleCache = null |
Private member variables | |
Please use the accessor functions instead.
| |
bool | $mLocalInterwiki = false |
Was this Title created from a string with a local interwiki prefix? | |
bool string | $mContentModel = false |
ID of the page's content model, i.e. | |
bool | $mForcedContentModel = false |
If a content model was forced via setContentModel() this will be true to avoid having other code paths reset it. | |
int | $mEstimateRevisions |
Estimated number of revisions; null of not loaded. | |
bool | $mHasSubpages |
Whether a page has any subpages. | |
array null | $mPageLanguage |
The (string) language code of the page's language and content code. | |
string bool null | $mDbPageLanguage = false |
The page language code from the database, null if not saved in the database or false if not loaded, yet. | |
TitleValue null | $mTitleValue = null |
Was this Title created from a string with a local interwiki prefix? | |
bool null | $mIsBigDeletion = null |
Would deleting this page be a big deletion? | |
bool null | $mIsValid = null |
Is the title known to be valid? | |
string null | $mInstanceCacheKey = null |
The key of this instance in the internal Title instance cache. | |
string | $mTextform = '' |
string | $mUrlform = '' |
string | $mDbkeyform = '' |
int | $mNamespace = NS_MAIN |
string | $mInterwiki = '' |
string | $mFragment = '' |
int | $mArticleID = -1 |
Article ID, fetched from the link cache on demand. | |
string null | $prefixedText = null |
Text form including namespace/interwiki, initialised on demand. | |
int | $mDefaultNamespace = NS_MAIN |
Namespace index when there is no namespace. | |
null bool | $mRedirect = null |
Is the article at this title a redirect? | |
bool int | $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.
Title::__toString | ( | ) |
Return a string representation of this title.
Implements MediaWiki\Linker\LinkTarget.
Title::__wakeup | ( | ) |
Definition at line 4200 of file Title.php.
References wfUrlencode().
Title::areCascadeProtectionSourcesLoaded | ( | ) |
Determines whether cascading protection sources have already been loaded from the database.
Title::areRestrictionsCascading | ( | ) |
Returns cascading restrictions for the current article.
Title::areRestrictionsLoaded | ( | ) |
Accessor for mRestrictionsLoaded.
|
private |
Code that requires this Title to be a "proper page" in the sense defined by PageIdentity should call this method.
For the purpose of the Title class, a proper page is one that can exist in the page table. That is, a Title represents a proper page if canExist() returns true.
PreconditionException |
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 1236 of file Title.php.
Referenced by RequestContext\canUseWikiPage(), and UppercaseTitlesForUnicodeTransition\mungeTitle().
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.
Title::canUseNoindex | ( | ) |
Whether the magic words INDEX and NOINDEX function for this page.
Definition at line 3938 of file Title.php.
References $wgExemptFromUserRobotsControl.
|
static |
|
static |
|
static |
|
static |
|
static |
|
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 |
Title::createFragmentTarget | ( | $fragment | ) |
Creates a new Title for a different fragment of the same page.
string | $fragment |
Implements MediaWiki\Linker\LinkTarget.
Definition at line 1854 of file Title.php.
Referenced by SpecialWhatLinksHere\listItem().
Title::deleteTitleProtection | ( | ) |
Remove any title protection due to page existing.
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.
@phpcs:disable MediaWiki.Commenting.FunctionComment.ObjectTypeHintParam
object | $other |
Definition at line 3499 of file Title.php.
Referenced by MediaWiki\Block\Restriction\PageRestriction\matches(), MediaWiki\Storage\DerivedPageDataUpdater\prepareContent(), and MediaWiki\Revision\RenderedRevision\setRevisionInternal().
Title::estimateRevisionCount | ( | ) |
Get the approximate revision count of this page.
Definition at line 3471 of file Title.php.
References $dbr, DB_REPLICA, and wfGetDB().
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 | Either a bitfield of class READ_* constants or GAID_FOR_UPDATE |
Definition at line 3572 of file Title.php.
Referenced by RedirectSpecialArticle\getRedirectQuery(), SpecialUpload\getUploadForm(), and UppercaseTitlesForUnicodeTransition\mungeTitle().
|
private |
Finds the first or last subpage divider (slash) in the string.
Any leading sequence of slashes is ignored, since it does not divide two parts of the string. Considering leading slashes dividers would result in empty root title or base title (T229443).
Note that trailing slashes are considered dividers, and empty subpage names are allowed.
string | $text | |
int | $dir | -1 for the last or +1 for the first divider. |
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 1321 of file Title.php.
References NS_SPECIAL.
|
staticprivate |
Helper to fix up the get{Canonical,Full,Link,Local,Internal}URL args get{Canonical,Full,Link,Local,Internal}URL methods accepted an optional second argument named variant.
This was deprecated in favor of passing an array of option with a "variant" key Once $query2 is removed for good, this helper can be dropped and the wfArrayToCgi moved to getLocalURL();
array | string | $query | |
string | string[] | bool | $query2 |
Definition at line 2173 of file Title.php.
References wfArrayToCgi(), and wfDeprecatedMsg().
Title::flushRestrictions | ( | ) |
Flush the protection cache in this object and force reload from the database.
This is used when updating protection from WikiPage::doUpdateRestrictions().
Title::getAllRestrictions | ( | ) |
Accessor/initialisation for mRestrictions.
Title::getArticleID | ( | $flags = 0 | ) |
Get the article ID for this Title from the link cache, adding it if necessary.
int | $flags | Either a bitfield of class READ_* constants or GAID_FOR_UPDATE |
Definition at line 2902 of file Title.php.
Referenced by MediaWiki\Preferences\MultiTitleFilter\filterFromForm(), NamespaceDupes\mergePage(), and MediaWiki\Block\Restriction\PageRestriction\newFromTitle().
Title::getBacklinkCache | ( | ) |
Get a backlink cache object.
Title::getBaseText | ( | ) |
Get the base page name without a namespace, i.e.
the part before the subpage name
Title::getBaseTitle | ( | ) |
Get the base page name title, i.e.
the part before the subpage name.
Definition at line 2082 of file Title.php.
References $title.
Title::getBrokenLinksFrom | ( | ) |
Get an array of Title objects referring to non-existent articles linked from this page.
Definition at line 3260 of file Title.php.
References $dbr, $res, DB_REPLICA, and wfGetDB().
Title::getCanonicalURL | ( | $query = '' , |
|
$query2 = false |
|||
) |
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 | |
string | bool | $query2 | Deprecated |
Definition at line 2433 of file Title.php.
References PROTO_CANONICAL, and wfExpandUrl().
Title::getCascadeProtectionSources | ( | $getPages = true | ) |
Cascading protection: Get the source of any cascading restrictions on this page.
bool | $getPages | Whether or not to retrieve the actual pages that the restrictions have come from and the actual restrictions themselves. |
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. |
Title::getCdnUrls | ( | ) |
Get a list of URLs to purge from the CDN cache when this page changes.
Title::getContentModel | ( | $flags = 0 | ) |
Get the page's content model id, see the CONTENT_MODEL_XXX constants.
int | $flags | Either a bitfield of class READ_* constants or GAID_FOR_UPDATE |
Definition at line 1090 of file Title.php.
Referenced by MediaWiki\EditPage\TextConflictHelper\__construct(), SpecialChangeContentModel\getOptionsForTitle(), and SpecialWhatLinksHere\wlhLink().
Title::getDBkey | ( | ) |
Get the main part with underscores.
Implements MediaWiki\Linker\LinkTarget.
Definition at line 1069 of file Title.php.
Referenced by ArchivedFile\__construct(), DoubleRedirectJob\fixRedirects(), DoubleRedirectJob\getFinalDestination(), UploadBase\getTitle(), WikiPage\insertRedirectEntry(), ForeignAPIFile\newFromTitle(), RefreshLinks\refreshCategory(), UppercaseTitlesForUnicodeTransition\shouldDelete(), and SpecialWhatLinksHere\showIndirectLinks().
|
private |
Returns the page language code saved in the database, if $wgPageLanguageUseDB is set to true in LocalSettings.php, otherwise returns false.
If there is no language saved in the db, it will return NULL.
Definition at line 3983 of file Title.php.
References $wgPageLanguageUseDB.
Title::getDefaultMessageText | ( | ) |
Get the default (plain) message contents for an page that overrides an interface message key.
Primary use cases:
Definition at line 3716 of file Title.php.
References $lang, NS_MEDIAWIKI, and wfMessage().
Title::getDefaultNamespace | ( | ) |
Get the default namespace index, for when there is no namespace.
Definition at line 1786 of file Title.php.
References wfDeprecated().
Title::getDeletedEditsCount | ( | ) |
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 4094 of file Title.php.
References wfMessage().
Title::getEditURL | ( | ) |
|
static |
Get a filtered list of all restriction types supported by this wiki.
bool | $exists | True to get all restriction types that apply to titles that do exist, False for all restriction types that apply to titles that do not exist |
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 1798 of file Title.php.
Referenced by WikiPage\insertRedirectEntry().
Title::getFragmentForURL | ( | ) |
Title::getFullText | ( | ) |
Get the prefixed title with spaces, plus any fragment (part beginning with '#')
Definition at line 1945 of file Title.php.
Referenced by WikitextContentHandler\makeRedirectContent(), and WikitextContent\updateRedirect().
Title::getFullURL | ( | $query = '' , |
|
$query2 = false , |
|||
$proto = PROTO_RELATIVE |
|||
) |
Get a real URL referring to this title, with interwiki link and fragment.
string | array | $query | |
string | string[] | bool | $query2 | |
string | int | null | $proto | Protocol type to use in URL |
Definition at line 2211 of file Title.php.
References wfExpandUrl().
Referenced by CssContentHandler\makeRedirectContent(), and JavaScriptContentHandler\makeRedirectContent().
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 external 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 2244 of file Title.php.
References SpecialPage\getTitleFor().
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.
Title::getInternalURL | ( | $query = '' , |
|
$query2 = false |
|||
) |
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 | |
string | bool | $query2 | Deprecated |
Definition at line 2411 of file Title.php.
References $wgInternalServer, $wgServer, PROTO_HTTP, and wfExpandUrl().
Title::getInterwiki | ( | ) |
Get the interwiki prefix.
Use Title::isExternal to check if a interwiki is set
Implements MediaWiki\Linker\LinkTarget.
Definition at line 979 of file Title.php.
Referenced by WikiPage\insertRedirectEntry(), and WikitextContentHandler\makeRedirectContent().
|
staticprivate |
B/C kludge: provide an InterwikiLookup for use by Title.
Ideally, Title would have no methods that need this. Avoid usage of this singleton by using TitleValue and the associated services when possible.
|
private |
Shorthand for getting a Language Converter for specific language.
Definition at line 208 of file Title.php.
References getLanguageConverter().
Referenced by getLanguageConverter().
Title::getLatestRevID | ( | $flags = 0 | ) |
What is the page_latest field for this page?
int | $flags | Either a bitfield of class READ_* constants or GAID_FOR_UPDATE |
Definition at line 2993 of file Title.php.
Referenced by RefreshLinksJob\getCurrentRevisionIfUnchanged().
Title::getLength | ( | $flags = 0 | ) |
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 3194 of file Title.php.
References $res, DB_REPLICA, and wfGetDB().
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 3136 of file Title.php.
References $res, DB_PRIMARY, DB_REPLICA, and wfGetDB().
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 | |
bool | $query2 | |
string | int | bool | $proto | A PROTO_* constant on how the URL should be expanded, or false (default) for no expansion |
Title::getLocalURL | ( | $query = '' , |
|
$query2 = false |
|||
) |
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. |
string | string[] | bool | $query2 | An optional secondary query array. This one MUST be an array. If a string is passed it will be interpreted as a deprecated variant argument and urlencoded into a variant= argument. This second query argument will be added to the $query The second parameter is deprecated since 1.19. Pass it as a key,value pair in the first parameter array instead. |
Definition at line 2278 of file Title.php.
References $matches, $wgActionPaths, $wgArticlePath, $wgMainPageIsDomainRoot, $wgRequest, $wgScript, $wgServer, $wgVariantArticlePath, wfAppendQuery(), and wfUrlencode().
Referenced by SkinTemplate\buildContentNavigationUrls().
Title::getNamespace | ( | ) |
Get the namespace index, i.e.
one of the NS_xxxx constants.
Implements MediaWiki\Linker\LinkTarget.
Definition at line 1078 of file Title.php.
Referenced by SubpageImportTitleFactory\__construct(), LinkHolderArray\doVariants(), DoubleRedirectJob\fixRedirects(), DoubleRedirectJob\getFinalDestination(), WikiPage\insertRedirectEntry(), LinkHolderArray\makeHolder(), WikitextContentHandler\makeRedirectContent(), MediaWiki\Block\Restriction\NamespaceRestriction\matches(), UppercaseTitlesForUnicodeTransition\mungeTitle(), ImageQueryPage\outputResults(), UppercaseTitlesForUnicodeTransition\shouldDelete(), MovePageForm\showForm(), and SpecialWhatLinksHere\showIndirectLinks().
Title::getNamespaceKey | ( | $prepend = 'nstab-' | ) |
Title::getNotificationTimestamp | ( | User | $user | ) |
Get the timestamp when this page was updated since the user last saw it.
User | $user |
Title::getNsText | ( | ) |
Title::getOtherPage | ( | ) |
Get the other title for this page, if this is a subject page get the talk page, if it is a subject page get the talk page.
MWException | If the page doesn't have an other page |
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 4005 of file Title.php.
References $wgLang, $wgLanguageCode, and wfGetLangObj().
|
private |
Shorthand for getting a Language Converter for page's language.
Title::getPageViewLanguage | ( | ) |
Get the language in which the content of this page is written when viewed by user.
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 4046 of file Title.php.
References $wgLang, and wfGetLangObj().
Title::getParentCategories | ( | ) |
Get categories to which this Title belongs and return an array of categories' names.
Definition at line 3355 of file Title.php.
References $dbr, $res, DB_REPLICA, NS_CATEGORY, and wfGetDB().
Title::getParentCategoryTree | ( | $children = [] | ) |
Title::getPartialURL | ( | ) |
Title::getPrefixedDBkey | ( | ) |
Get the prefixed database key form.
Definition at line 1909 of file Title.php.
References $s.
Referenced by PPTemplateFrame_Hash\__construct(), PPFrame_Hash\loopCheck(), and LinkHolderArray\makeHolder().
Title::getPrefixedText | ( | ) |
Get the prefixed title with spaces.
This is the form usually used for display
Definition at line 1921 of file Title.php.
References $s.
Referenced by ApiPageSet\loadRedirectTargets(), CleanupCaps\movePage(), UppercaseTitlesForUnicodeTransition\mungeTitle(), SpecialChangeContentModel\setParameter(), MovePageForm\showForm(), SpecialWhatLinksHere\whatlinkshereForm(), and SpecialWhatLinksHere\wlhLink().
Title::getPrefixedURL | ( | ) |
Get a URL-encoded title (not an actual URL) including interwiki.
Definition at line 2154 of file Title.php.
References $s, and wfUrlencode().
Title::getRedirectsHere | ( | $ns = null | ) |
Title::getRestrictionExpiry | ( | $action | ) |
Get the expiry time for the restriction against a given action.
string | $action |
Title::getRestrictions | ( | $action | ) |
Accessor/initialisation for mRestrictions.
string | $action | Action that permission needs to be checked for |
Title::getRestrictionTypes | ( | ) |
Returns restriction types for the current Title.
Title::getRootText | ( | ) |
Get the root page name text without a namespace, i.e.
the leftmost part before any slashes
Title::getRootTitle | ( | ) |
Get the root page name title, i.e.
the leftmost part before any slashes
Definition at line 2032 of file Title.php.
References $title.
|
staticprotected |
Returns a list of fields that are to be selected for initializing Title objects or LinkCache entries.
Title::getSkinFromConfigSubpage | ( | ) |
Title::getSubjectNsText | ( | ) |
Title::getSubjectPage | ( | ) |
Get a title object associated with the subject page of this talk page.
Definition at line 1703 of file Title.php.
References $title.
Title::getSubpage | ( | $text | ) |
Get the title for a subpage of the current page.
string | $text | The subpage name to add to the 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 2802 of file Title.php.
References TitleArray\newFromResult().
Title::getSubpageText | ( | ) |
Get the lowest-level subpage name, i.e.
the rightmost part after any slashes
Title::getSubpageUrlForm | ( | ) |
Get a URL-encoded form of the subpage text.
Definition at line 2143 of file Title.php.
References wfUrlencode().
Title::getTalkNsText | ( | ) |
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 1658 of file Title.php.
References $title.
Referenced by MovePageForm\showForm().
Title::getTalkPageIfDefined | ( | ) |
Title::getTemplateLinksFrom | ( | $options = [] | ) |
Title::getTemplateLinksTo | ( | $options = [] | ) |
Title::getText | ( | ) |
Get the text form (spaces not underscores) of the main part.
Implements MediaWiki\Linker\LinkTarget.
Definition at line 1051 of file Title.php.
Referenced by TraditionalImageGallery\getCaptionHtml(), UppercaseTitlesForUnicodeTransition\mungeTitle(), and MovePageForm\showForm().
|
staticprivate |
|
staticprivate |
B/C kludge: provide a TitleParser for use by Title.
Ideally, Title would have no methods that need this. Avoid usage of this singleton by using TitleValue and the associated services when possible.
Title::getTitleProtection | ( | ) |
Is this title subject to title protection? Title protection is the one applied against creation of such title.
Title::getTitleValue | ( | ) |
Get a TitleValue object representing this Title.
Definition at line 1028 of file Title.php.
References wfDebug().
Title::getTouched | ( | $db = null | ) |
Get the last touched timestamp.
IDatabase | null | $db |
Definition at line 3803 of file Title.php.
References DB_REPLICA, and wfGetDB().
Title::getTransWikiID | ( | ) |
Title::getWikiId | ( | ) |
Returns false to indicate that this Title belongs to the local wiki.
Implements MediaWiki\Page\PageReference.
Title::hasContentModel | ( | $id | ) |
Title::hasDeletedEdits | ( | ) |
Title::hasFragment | ( | ) |
Check if a Title fragment is set.
Implements MediaWiki\Linker\LinkTarget.
Definition at line 1808 of file Title.php.
Referenced by CoreParserFunctions\displaytitle().
Title::hasSourceText | ( | ) |
Does this page have source text?
Definition at line 3657 of file Title.php.
References NS_MEDIAWIKI, and wfMessage().
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 |
Title::hasSubpages | ( | ) |
|
private |
Title::inNamespace | ( | $ns | ) |
Returns true if the title is inside the specified namespace.
Please make use of this instead of comparing to getNamespace() This function is much more resistant to changes we may make to namespaces than code that makes direct comparisons.
int | $ns | The namespace |
Implements MediaWiki\Linker\LinkTarget.
Title::inNamespaces | ( | $namespaces | ) |
Title::invalidateCache | ( | $purgeTime = null | ) |
Updates page_touched for this page; called from LinksUpdate.php.
string | null | $purgeTime | [optional] TS_MW timestamp |
Definition at line 3739 of file Title.php.
References Wikimedia\Rdbms\IDatabase\addQuotes(), DB_PRIMARY, Wikimedia\Rdbms\IDatabase\getDomainID(), Wikimedia\Rdbms\IDatabase\timestamp(), Wikimedia\Rdbms\IDatabase\update(), wfGetDB(), and wfReadOnly().
Title::isAlwaysKnown | ( | ) |
Should links to this title be shown as potentially viewable (i.e.
as "bluelinks"), even if there's no record by this title in the page table?
This function is semi-deprecated for public use, as well as somewhat misleadingly named. You probably just want to call isKnown(), which calls this function internally.
(ISSUE: Most of these checks are cheap, but the file existence check can potentially be quite expensive. Including it here fixes a lot of existing code, but we might want to add an optional parameter to skip it and any other expensive checks.)
Definition at line 3594 of file Title.php.
References NS_FILE, NS_MAIN, NS_MEDIA, NS_MEDIAWIKI, and NS_SPECIAL.
Title::isBigDeletion | ( | ) |
Check whether the number of revisions of this page surpasses $wgDeleteRevisionsLimit.
Definition at line 3442 of file Title.php.
References $dbr, $wgDeleteRevisionsLimit, DB_REPLICA, and wfGetDB().
Title::isCascadeProtected | ( | ) |
Cascading protection: Return true if cascading restrictions apply to this page, false if not.
Title::isContentPage | ( | ) |
Title::isConversionTable | ( | ) |
Is this a conversion table for the LanguageConverter?
Definition at line 1452 of file Title.php.
References NS_MEDIAWIKI.
Title::isDeleted | ( | ) |
Is there a version of this page in the deletion archive?
Title::isDeletedQuick | ( | ) |
Is there a version of this page in the deletion archive?
Title::isExternal | ( | ) |
Is this Title interwiki?
Implements MediaWiki\Linker\LinkTarget.
Definition at line 968 of file Title.php.
Referenced by DoubleRedirectJob\getFinalDestination(), and LinkHolderArray\makeHolder().
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 isAlwaysKnown() and does its own page existence check.
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 )
Title::isMainPage | ( | ) |
Is this the mainpage?
Title::isMovable | ( | ) |
Title::isNamespaceProtected | ( | User | $user | ) |
Determines if $user is unable to edit this page because it has been protected by $wgNamespaceProtection.
Definition at line 2544 of file Title.php.
References $wgNamespaceProtection, and wfDeprecated().
Title::isNewPage | ( | ) |
Check if this is a new page.
Definition at line 3431 of file Title.php.
References $dbr, DB_REPLICA, and wfGetDB().
Title::isProtected | ( | $action = '' | ) |
Does the title correspond to a protected article?
string | $action | The action the page is protected from, by default checks all actions. |
Title::isRawHtmlMessage | ( | ) |
Is this a message which can contain raw HTML?
Definition at line 1627 of file Title.php.
References $wgRawHtmlMessages, and NS_MEDIAWIKI.
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 | Either a bitfield of class READ_* constants or GAID_FOR_UPDATE |
Title::isSameLinkAs | ( | LinkTarget | $other | ) |
LinkTarget | $other |
Implements MediaWiki\Linker\LinkTarget.
Definition at line 3519 of file Title.php.
References MediaWiki\Linker\LinkTarget\getDBkey(), MediaWiki\Linker\LinkTarget\getFragment(), MediaWiki\Linker\LinkTarget\getInterwiki(), and MediaWiki\Linker\LinkTarget\getNamespace().
Title::isSamePageAs | ( | PageReference | $other | ) |
PageReference | $other |
Implements MediaWiki\Page\PageReference.
Title::isSemiProtected | ( | $action = 'edit' | ) |
Is this page "semi-protected" - the only protection levels are listed in $wgSemiprotectedRestrictionLevels?
string | $action | Action to check (default: edit) |
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 3317 of file Title.php.
References DB_PRIMARY, and wfGetDB().
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, or CONTENT_MODEL_JAVASCRIPT.
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.
Title::isSiteCssConfigPage | ( | ) |
Is this a sitewide CSS "config" page?
Definition at line 1573 of file Title.php.
References CONTENT_MODEL_CSS, and NS_MEDIAWIKI.
Title::isSiteJsConfigPage | ( | ) |
Is this a sitewide JS "config" page?
Definition at line 1609 of file Title.php.
References CONTENT_MODEL_JAVASCRIPT, and NS_MEDIAWIKI.
Title::isSiteJsonConfigPage | ( | ) |
Is this a sitewide JSON "config" page?
Definition at line 1591 of file Title.php.
References CONTENT_MODEL_JSON, and NS_MEDIAWIKI.
Title::isSpecial | ( | $name | ) |
Title::isSpecialPage | ( | ) |
Returns true if this is a special page.
Definition at line 1293 of file Title.php.
References NS_SPECIAL.
Referenced by SkinTemplate\buildPersonalUrls().
Title::isSubpageOf | ( | Title | $title | ) |
Title::isTalkPage | ( | ) |
Title::isTrans | ( | ) |
Title::isUserConfigPage | ( | ) |
Title::isUserCssConfigPage | ( | ) |
Is this a CSS "config" sub-page of a user page?
Definition at line 1531 of file Title.php.
References CONTENT_MODEL_CSS, and NS_USER.
Title::isUserJsConfigPage | ( | ) |
Is this a JS "config" sub-page of a user page?
Definition at line 1559 of file Title.php.
References CONTENT_MODEL_JAVASCRIPT, and NS_USER.
Title::isUserJsonConfigPage | ( | ) |
Is this a JSON "config" sub-page of a user page?
Definition at line 1545 of file Title.php.
References CONTENT_MODEL_JSON, and NS_USER.
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.
Title::isValidRedirectTarget | ( | ) |
Check if this Title is a valid redirect target.
Definition at line 3896 of file Title.php.
References $wgInvalidRedirectTargets.
Referenced by AbstractContent\getRedirectChain(), WikitextContent\getRedirectTargetAndText(), WikiPage\insertRedirectEntry(), and XmlDumpWriter\openPage().
Title::isWatchable | ( | ) |
Can this title be added to a user's watchlist?
False for relative section links (with getText() === ''), interwiki links (with getInterwiki() !== ''), and pages in NS_SPECIAL.
Definition at line 1282 of file Title.php.
References $watchlistManager, and wfDeprecated().
Referenced by SpecialEditWatchlist\extractTitles().
Title::isWikitextPage | ( | ) |
Does that page contain wikitext, or it is JS, CSS or whatever?
Definition at line 1464 of file Title.php.
References CONTENT_MODEL_WIKITEXT.
|
private |
|
static |
Get a regex character class describing the legal characters in a link.
Definition at line 746 of file Title.php.
References $wgLegalTitleChars.
|
private |
Title::loadFromRow | ( | $row | ) |
Title::loadRestrictions | ( | $oldFashionedRestrictions = null , |
|
$flags = 0 |
|||
) |
Load restrictions from the page_restrictions table.
string | null | $oldFashionedRestrictions | Comma-separated set of permission keys indicating who can move or edit the page from the page table, (pre 1.10) rows. Edit and move sections are separated by a colon Example: "edit=autoconfirmed,sysop:move=sysop" |
int | $flags | A bit field. If self::READ_LATEST is set, skip replicas and read from the primary DB. |
Title::loadRestrictionsFromRows | ( | $rows, | |
$oldFashionedRestrictions = null |
|||
) |
Compiles list of active page restrictions from both page table (pre 1.10) and page_restrictions table for this existing page.
Public for usage by LiquidThreads.
stdClass[] | $rows | Array of db result objects |
string | null | $oldFashionedRestrictions | Comma-separated set of permission keys indicating who can move or edit the page from the page table, (pre 1.10) rows. Edit and move sections are separated by a colon Example: "edit=autoconfirmed,sysop:move=sysop" |
|
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 866 of file Title.php.
References $title.
|
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 651 of file Title.php.
References $t, $title, and wfUrlencode().
|
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 |
|
static |
|
static |
|
static |
|
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.
LinkTarget | $linkTarget | Assumed to be safe. |
string | $forceClone | set to NEW_CLONE to ensure a fresh instance is returned. |
Definition at line 295 of file Title.php.
References MediaWiki\Linker\LinkTarget\getFragment(), MediaWiki\Linker\LinkTarget\getInterwiki(), MediaWiki\Linker\LinkTarget\getNamespace(), and MediaWiki\Linker\LinkTarget\getText().
|
static |
|
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(). |
InvalidArgumentException |
|
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. |
|
static |
Returns a Title given a TitleValue.
If the given TitleValue is already a Title instance, that instance is returned, unless $forceClone is "clone". If $forceClone is "clone" and the given TitleValue is already a Title instance, that instance is copied using the clone operator.
TitleValue | $titleValue | Assumed to be safe. |
string | $forceClone | set to NEW_CLONE to ensure a fresh instance is returned. |
|
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 480 of file Title.php.
References $t.
|
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 ResourceloaderContext) to prevent an error.
MessageLocalizer | null | $localizer | An optional context to use (since 1.34) |
Definition at line 713 of file Title.php.
References $title, and wfMessage().
|
staticprivate |
Title::pageCond | ( | ) |
|
private |
Prefix some arbitrary text with the namespace or interwiki prefix of this object.
string | $name | The text |
Definition at line 1883 of file Title.php.
References NS_SPECIAL.
|
static |
Purge expired restrictions from the page_restrictions table.
This will purge no more than $wgUpdateRowsPerQuery page_restrictions rows
Definition at line 2733 of file Title.php.
References Wikimedia\Rdbms\IDatabase\addQuotes(), DB_PRIMARY, Wikimedia\Rdbms\IDatabase\delete(), Wikimedia\Rdbms\IDatabase\selectFieldValues(), Wikimedia\Rdbms\IDatabase\timestamp(), wfGetDB(), and wfReadOnly().
Title::purgeSquid | ( | ) |
Purge all applicable CDN URLs.
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-existant, or false for "unknown" (lazy-load) |
|
private |
Secure and split - main initialisation function for this object.
Assumes that $text is urldecoded and uses underscores, but not otherwise munged. This function removes illegal characters, splits off the interwiki and namespace prefixes, sets the other forms, and canonicalizes everything.
If this method returns normally, the Title is valid.
string | $text | |
int | null | $defaultNamespace |
MalformedTitleException | On malformed titles |
Definition at line 3088 of file Title.php.
References wfUrlencode().
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 |
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 |
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. |
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 | Either a bitfield of class READ_* constants or GAID_FOR_UPDATE |
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. |
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 3779 of file Title.php.
References HTMLCacheUpdateJob\newForBacklinks(), and NS_CATEGORY.
|
private |
|
private |
Title | $title | |
string | $method |
Definition at line 1729 of file Title.php.
References $title, and wfLogWarning().
Title::wasLocalInterwiki | ( | ) |
int Title::$mArticleID = -1 |
|
private |
string Title::$mDbkeyform = '' |
|
private |
int Title::$mDefaultNamespace = NS_MAIN |
|
private |
|
private |
string Title::$mFragment = '' |
|
private |
|
private |
string Title::$mInterwiki = '' |
|
private |
|
private |
|
protected |
|
protected |
|
private |
int Title::$mNamespace = NS_MAIN |
|
private |
null bool Title::$mRedirect = null |
string Title::$mTextform = '' |
|
private |
string Title::$mUrlform = '' |
string null Title::$prefixedText = null |
Text form including namespace/interwiki, initialised on demand.
Only public to share cache with TitleFormatter
|
staticprivate |
|
private |
const Title::GAID_FOR_UPDATE = 512 |
Used to be GAID_FOR_UPDATE define().
Used with getArticleID() and friends to use the primary DB and inject it into link cache.
const Title::NEW_CLONE = 'clone' |