MediaWiki  1.27.1
Title Class Reference

Represents a title within MediaWiki. More...

Inheritance diagram for Title:
Collaboration diagram for Title:

Public Member Functions

 __construct ()
 
 __sleep ()
 
 __toString ()
 Return a string representation of this title. More...
 
 __wakeup ()
 
 areCascadeProtectionSourcesLoaded ($getPages=true)
 Determines whether cascading protection sources have already been loaded from the database. More...
 
 areRestrictionsCascading ()
 Returns cascading restrictions for the current article. More...
 
 areRestrictionsLoaded ()
 Accessor for mRestrictionsLoaded. More...
 
 canExist ()
 Is this in a namespace that allows actual pages? More...
 
 canTalk ()
 Could this title have a corresponding talk page? More...
 
 canUseNoindex ()
 Whether the magic words INDEX and NOINDEX function for this page. More...
 
 countAuthorsBetween ($old, $new, $limit, $options=[])
 Get the number of authors between the given revisions or revision IDs. More...
 
 countRevisionsBetween ($old, $new, $max=null)
 Get the number of revisions between the given revision. More...
 
 createFragmentTarget ($fragment)
 Creates a new Title for a different fragment of the same page. More...
 
 deleteTitleProtection ()
 Remove any title protection due to page existing. More...
 
 equals (Title $title)
 Compare with another title. More...
 
 estimateRevisionCount ()
 Get the approximate revision count of this page. More...
 
 exists ($flags=0)
 Check if page exists. More...
 
 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. More...
 
 flushRestrictions ()
 Flush the protection cache in this object and force reload from the database. More...
 
 getAllRestrictions ()
 Accessor/initialisation for mRestrictions. More...
 
 getArticleID ($flags=0)
 Get the article ID for this Title from the link cache, adding it if necessary. More...
 
 getAuthorsBetween ($old, $new, $limit, $options=[])
 Get the authors between the given revisions or revision IDs. More...
 
 getBacklinkCache ()
 Get a backlink cache object. More...
 
 getBaseText ()
 Get the base page name without a namespace, i.e. More...
 
 getBaseTitle ()
 Get the base page name title, i.e. More...
 
 getBrokenLinksFrom ()
 Get an array of Title objects referring to non-existent articles linked from this page. More...
 
 getCanonicalURL ($query= '', $query2=false)
 Get the URL for a canonical link, for use in things like IRC and e-mail notifications. More...
 
 getCascadeProtectionSources ($getPages=true)
 Cascading protection: Get the source of any cascading restrictions on this page. More...
 
 getCategorySortkey ($prefix= '')
 Returns the raw sort key to be used for categories, with the specified prefix. More...
 
 getCdnUrls ()
 Get a list of URLs to purge from the CDN cache when this page changes. More...
 
 getContentModel ($flags=0)
 Get the page's content model id, see the CONTENT_MODEL_XXX constants. More...
 
 getDBkey ()
 Get the main part with underscores. More...
 
 getDefaultMessageText ()
 Get the default message text or false if the message doesn't exist. More...
 
 getDefaultNamespace ()
 Get the default namespace index, for when there is no namespace. More...
 
 getEarliestRevTime ($flags=0)
 Get the oldest revision timestamp of this page. More...
 
 getEditNotices ($oldid=0)
 Get a list of rendered edit notices for this page. More...
 
 getEditURL ()
 Get the edit URL for this Title. More...
 
 getFirstRevision ($flags=0)
 Get the first revision of the page. More...
 
 getFragment ()
 Get the Title fragment (i.e. More...
 
 getFragmentForURL ()
 Get the fragment in URL form, including the "#" character if there is one. More...
 
 getFullText ()
 Get the prefixed title with spaces, plus any fragment (part beginning with '#') More...
 
 getFullURL ($query= '', $query2=false, $proto=PROTO_RELATIVE)
 Get a real URL referring to this title, with interwiki link and fragment. More...
 
 getInternalURL ($query= '', $query2=false)
 Get the URL form for an internal link. More...
 
 getInterwiki ()
 Get the interwiki prefix. More...
 
 getLatestRevID ($flags=0)
 What is the page_latest field for this page? More...
 
 getLength ($flags=0)
 What is the length of this page? Uses link cache, adding it if necessary. More...
 
 getLinksFrom ($options=[], $table= 'pagelinks', $prefix= 'pl')
 Get an array of Title objects linked from this Title Also stores the IDs in the link cache. More...
 
 getLinksTo ($options=[], $table= 'pagelinks', $prefix= 'pl')
 Get an array of Title objects linking to this Title Also stores the IDs in the link cache. More...
 
 getLinkURL ($query= '', $query2=false, $proto=PROTO_RELATIVE)
 Get a URL that's the simplest URL that will be valid to link, locally, to the current Title. More...
 
 getLocalURL ($query= '', $query2=false)
 Get a URL with no fragment or server name (relative URL) from a Title object. More...
 
 getNamespace ()
 Get the namespace index, i.e. More...
 
 getNamespaceKey ($prepend= 'nstab-')
 Generate strings used for xml 'id' names in monobook tabs. More...
 
 getNextRevisionID ($revId, $flags=0)
 Get the revision ID of the next revision. More...
 
 getNotificationTimestamp ($user=null)
 Get the timestamp when this page was updated since the user last saw it. More...
 
 getNsText ()
 Get the namespace text. More...
 
 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. More...
 
 getPageLanguage ()
 Get the language in which the content of this page is written in wikitext. More...
 
 getPageViewLanguage ()
 Get the language in which the content of this page is written when viewed by user. More...
 
 getParentCategories ()
 Get categories to which this Title belongs and return an array of categories' names. More...
 
 getParentCategoryTree ($children=[])
 Get a tree of parent categories. More...
 
 getPartialURL ()
 Get the URL-encoded form of the main part. More...
 
 getPrefixedDBkey ()
 Get the prefixed database key form. More...
 
 getPrefixedText ()
 Get the prefixed title with spaces. More...
 
 getPrefixedURL ()
 Get a URL-encoded title (not an actual URL) including interwiki. More...
 
 getPreviousRevisionID ($revId, $flags=0)
 Get the revision ID of the previous revision. More...
 
 getRedirectsHere ($ns=null)
 Get all extant redirects to this Title. More...
 
 getRestrictionExpiry ($action)
 Get the expiry time for the restriction against a given action. More...
 
 getRestrictions ($action)
 Accessor/initialisation for mRestrictions. More...
 
 getRestrictionTypes ()
 Returns restriction types for the current Title. More...
 
 getRootText ()
 Get the root page name text without a namespace, i.e. More...
 
 getRootTitle ()
 Get the root page name title, i.e. More...
 
 getSkinFromCssJsSubpage ()
 Trim down a .css or .js subpage title to get the corresponding skin name. More...
 
 getSquidURLs ()
 
 getSubjectNsText ()
 Get the namespace text of the subject (rather than talk) page. More...
 
 getSubjectPage ()
 Get a title object associated with the subject page of this talk page. More...
 
 getSubpage ($text)
 Get the title for a subpage of the current page. More...
 
 getSubpages ($limit=-1)
 Get all subpages of this page. More...
 
 getSubpageText ()
 Get the lowest-level subpage name, i.e. More...
 
 getSubpageUrlForm ()
 Get a URL-encoded form of the subpage text. More...
 
 getTalkNsText ()
 Get the namespace text of the talk page. More...
 
 getTalkPage ()
 Get a Title object associated with the talk page of this article. More...
 
 getTemplateLinksFrom ($options=[])
 Get an array of Title objects used on this Title as a template Also stores the IDs in the link cache. More...
 
 getTemplateLinksTo ($options=[])
 Get an array of Title objects using this Title as a template Also stores the IDs in the link cache. More...
 
 getText ()
 Get the text form (spaces not underscores) of the main part. More...
 
 getTitleProtection ()
 Is this title subject to title protection? Title protection is the one applied against creation of such title. More...
 
 getTitleValue ()
 Get a TitleValue object representing this Title. More...
 
 getTouched ($db=null)
 Get the last touched timestamp. More...
 
 getTransWikiID ()
 Returns the DB name of the distant wiki which owns the object. More...
 
 getUserCaseDBKey ()
 Get the DB key with the initial letter case as specified by the user. More...
 
 getUserPermissionsErrors ($action, $user, $rigor= 'secure', $ignoreErrors=[])
 Can $user perform $action on this page? More...
 
 hasContentModel ($id)
 Convenience method for checking a title's content model name. More...
 
 hasFragment ()
 Check if a Title fragment is set. More...
 
 hasSourceText ()
 Does this page have source text? More...
 
 hasSubjectNamespace ($ns)
 Returns true if the title has the same subject namespace as the namespace specified. More...
 
 hasSubpages ()
 Does this have subpages? (Warning, usually requires an extra DB query.) More...
 
 inNamespace ($ns)
 Returns true if the title is inside the specified namespace. More...
 
 inNamespaces ()
 Returns true if the title is inside one of the specified namespaces. More...
 
 invalidateCache ($purgeTime=null)
 Updates page_touched for this page; called from LinksUpdate.php. More...
 
 isAlwaysKnown ()
 Should links to this title be shown as potentially viewable (i.e. More...
 
 isBigDeletion ()
 Check whether the number of revisions of this page surpasses $wgDeleteRevisionsLimit. More...
 
 isCascadeProtected ()
 Cascading protection: Return true if cascading restrictions apply to this page, false if not. More...
 
 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? More...
 
 isConversionTable ()
 Is this a conversion table for the LanguageConverter? More...
 
 isCssJsSubpage ()
 Is this a .css or .js subpage of a user page? More...
 
 isCssOrJsPage ()
 Could this page contain custom CSS or JavaScript for the global UI. More...
 
 isCssSubpage ()
 Is this a .css subpage of a user page? More...
 
 isDeleted ()
 Is there a version of this page in the deletion archive? More...
 
 isDeletedQuick ()
 Is there a version of this page in the deletion archive? More...
 
 isExternal ()
 Is this Title interwiki? More...
 
 isJsSubpage ()
 Is this a .js subpage of a user page? More...
 
 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). More...
 
 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 ) More...
 
 isMainPage ()
 Is this the mainpage? More...
 
 isMovable ()
 Would anybody with sufficient privileges be able to move this page? Some pages just aren't movable. More...
 
 isNamespaceProtected (User $user)
 Determines if $user is unable to edit this page because it has been protected by $wgNamespaceProtection. More...
 
 isNewPage ()
 Check if this is a new page. More...
 
 isProtected ($action= '')
 Does the title correspond to a protected article? More...
 
 isRedirect ($flags=0)
 Is this an article that is a redirect page? Uses link cache, adding it if necessary. More...
 
 isSemiProtected ($action= 'edit')
 Is this page "semi-protected" - the only protection levels are listed in $wgSemiprotectedRestrictionLevels? More...
 
 isSingleRevRedirect ()
 Checks if this page is just a one-rev redirect. More...
 
 isSpecial ($name)
 Returns true if this title resolves to the named special page. More...
 
 isSpecialPage ()
 Returns true if this is a special page. More...
 
 isSubpage ()
 Is this a subpage? More...
 
 isSubpageOf (Title $title)
 Check if this title is a subpage of another title. More...
 
 isTalkPage ()
 Is this a talk page of some sort? More...
 
 isTrans ()
 Determine whether the object refers to a page within this project and is transcludable. More...
 
 isValidMoveOperation (&$nt, $auth=true, $reason= '')
 Check whether a given move operation would be valid. More...
 
 isValidMoveTarget ($nt)
 Checks if $this can be moved to a given Title. More...
 
 isValidRedirectTarget ()
 Check if this Title is a valid redirect target. More...
 
 isWatchable ()
 Can this title be added to a user's watchlist? More...
 
 isWikitextPage ()
 Does that page contain wikitext, or it is JS, CSS or whatever? More...
 
 loadFromRow ($row)
 Load Title object fields from a DB row. More...
 
 loadRestrictions ($oldFashionedRestrictions=null)
 Load restrictions from the page_restrictions table. More...
 
 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. More...
 
 moveNoAuth (&$nt)
 Move this page without authentication. More...
 
 moveSubpages ($nt, $auth=true, $reason= '', $createRedirect=true)
 Move this page's subpages to be subpages of $nt. More...
 
 moveTo (&$nt, $auth=true, $reason= '', $createRedirect=true)
 Move a title to a new location. More...
 
 pageCond ()
 Get an associative array for selecting this title from the "page" table. More...
 
 purgeSquid ()
 Purge all applicable CDN URLs. More...
 
 quickUserCan ($action, $user=null)
 Can $user perform $action on this page? This skips potentially expensive cascading permission checks as well as avoids expensive error formatting. More...
 
 resetArticleID ($newid)
 This clears some fields in this object, and clears any associated keys in the "bad links" section of the link cache. More...
 
 setFragment ($fragment)
 Set the fragment for this title. More...
 
 touchLinks ()
 Update page_touched timestamps and send CDN purge messages for pages linking to this title. More...
 
 userCan ($action, $user=null, $rigor= 'secure')
 Can $user perform $action on this page? More...
 
 wasLocalInterwiki ()
 Was this a local interwiki link? More...
 

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. More...
 
static clearCaches ()
 
static compare ($a, $b)
 Callback for usort() to do title sorts by (namespace, title) More...
 
static convertByteClassToUnicodeClass ($byteClass)
 Utility method for converting a character sequence from bytes to Unicode. More...
 
static escapeFragmentForURL ($fragment)
 Escape a text fragment, say from a link, for a URL. More...
 
static getFilteredRestrictionTypes ($exists=true)
 Get a filtered list of all restriction types supported by this wiki. More...
 
static getTitleInvalidRegex ()
 Returns a simple regex that will match on characters and sequences invalid in titles. More...
 
static legalChars ()
 Get a regex character class describing the legal characters in a link. More...
 
static makeName ($ns, $title, $fragment= '', $interwiki= '', $canonicalNamespace=false)
 Make a prefixed DB key from a DB key and a namespace index. More...
 
static & makeTitle ($ns, $title, $fragment= '', $interwiki= '')
 Create a new Title from a namespace index and a DB key. More...
 
static makeTitleSafe ($ns, $title, $fragment= '', $interwiki= '')
 Create a new Title from a namespace index and a DB key. More...
 
static nameOf ($id)
 Get the prefixed DB key associated with an ID. More...
 
static newFromDBkey ($key)
 Create a new Title from a prefixed DB key. More...
 
static newFromID ($id, $flags=0)
 Create a new Title from an article ID. More...
 
static newFromIDs ($ids)
 Make an array of titles from an array of IDs. More...
 
static newFromLinkTarget (LinkTarget $linkTarget)
 Create a new Title from a LinkTarget. More...
 
static newFromRow ($row)
 Make a Title object from a DB row. More...
 
static newFromText ($text, $defaultNamespace=NS_MAIN)
 Create a new Title from text, such as what one would find in a link. More...
 
static newFromTextThrow ($text, $defaultNamespace=NS_MAIN)
 Like Title::newFromText(), but throws MalformedTitleException when the title is invalid, rather than returning null. More...
 
static newFromTitleValue (TitleValue $titleValue)
 Create a new Title from a TitleValue. More...
 
static newFromURL ($url)
 THIS IS NOT THE FUNCTION YOU WANT. More...
 
static newMainPage ()
 Create a new Title for the Main Page. More...
 
static purgeExpiredRestrictions ()
 Purge expired restrictions from the page_restrictions table. More...
 

Public Attributes

const CACHE_MAX = 1000
 Title::newFromText maintains a cache to avoid expensive re-normalization of commonly used titles. More...
 
const GAID_FOR_UPDATE = 1
 Used to be GAID_FOR_UPDATE define. More...
 

Protected Member Functions

 getUserPermissionsErrorsInternal ($action, $user, $rigor= 'secure', $short=false)
 Can $user perform $action on this page? This is an internal function, with multiple levels of checks depending on performance needs; see $rigor below. More...
 
 validateFileMoveOperation ($nt)
 Check if the requested move target is a valid file move target. More...
 

Static Protected Member Functions

static getSelectFields ()
 Returns a list of fields that are to be selected for initializing Title objects or LinkCache entries. More...
 

Private Member Functions

 checkActionPermissions ($action, $user, $errors, $rigor, $short)
 Check action permissions not already checked in checkQuickPermissions. More...
 
 checkCascadingSourcesRestrictions ($action, $user, $errors, $rigor, $short)
 Check restrictions on cascading pages. More...
 
 checkCSSandJSPermissions ($action, $user, $errors, $rigor, $short)
 Check CSS/JS sub-page permissions. More...
 
 checkPageRestrictions ($action, $user, $errors, $rigor, $short)
 Check against page_restrictions table requirements on this page. More...
 
 checkPermissionHooks ($action, $user, $errors, $rigor, $short)
 Check various permission hooks. More...
 
 checkQuickPermissions ($action, $user, $errors, $rigor, $short)
 Permissions checks that fail most often, and which are easiest to test. More...
 
 checkReadPermissions ($action, $user, $errors, $rigor, $short)
 Check that the user is allowed to read this page. More...
 
 checkSpecialsAndNSPermissions ($action, $user, $errors, $rigor, $short)
 Check permissions on special pages & namespaces. More...
 
 checkUserBlock ($action, $user, $errors, $rigor, $short)
 Check that the user isn't blocked from editing. More...
 
 getDbPageLanguageCode ()
 Returns the page language code saved in the database, if $wgPageLanguageUseDB is set to true in LocalSettings.php, otherwise returns false. More...
 
 loadRestrictionsFromResultWrapper ($res, $oldFashionedRestrictions=null)
 Loads a string into mRestrictions array. More...
 
 missingPermissionError ($action, $short)
 Get a description array when the user doesn't have the right to perform $action (i.e. More...
 
 prefix ($name)
 Prefix some arbitrary text with the namespace or interwiki prefix of this object. More...
 
 resultToError ($errors, $result)
 Add the resulting error code to the errors array. More...
 
 secureAndSplit ()
 Secure and split - main initialisation function for this object. More...
 

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. More...
 
static getMediaWikiTitleCodec ()
 B/C kludge: provide a TitleParser for use by Title. More...
 
static getTitleCache ()
 
static getTitleFormatter ()
 B/C kludge: provide a TitleParser for use by Title. More...
 

Static Private Attributes

static HashBagOStuff $titleCache = null
 

Private member variables

Please use the accessor functions instead.

Access:
private
string $mTextform = ''
 Text form (spaces not underscores) of the main part. More...
 
string $mUrlform = ''
 URL-encoded form of the main part. More...
 
string $mDbkeyform = ''
 Main part with underscores. More...
 
int $mNamespace = NS_MAIN
 Namespace index, i.e. More...
 
string $mInterwiki = ''
 Interwiki prefix. More...
 
string $mFragment = ''
 Title fragment (i.e. More...
 
int $mArticleID = -1
 Article ID, fetched from the link cache on demand. More...
 
bool string $mContentModel = false
 ID of the page's content model, i.e. More...
 
array $mRestrictions = []
 Array of groups allowed to edit this article. More...
 
bool $mCascadeRestriction
 Cascade restrictions on this page to included templates and images? More...
 
 $mCascadingRestrictions
 Caching the results of getCascadeProtectionSources. More...
 
array $mCascadeSources
 Where are the cascading restrictions coming from on this page? More...
 
bool $mRestrictionsLoaded = false
 Boolean for initialisation on demand. More...
 
mixed $mTitleProtection
 Cached value for getTitleProtection (create protection) More...
 
int $mDefaultNamespace = NS_MAIN
 Namespace index when there is no namespace. More...
 
null $mRedirect = null
 Is the article at this title a redirect? More...
 
string $mUserCaseDBKey
 Database key with the initial letter in the case specified by the user. More...
 
bool int $mLatestID = false
 ID of most recent revision. More...
 
string bool $mOldRestrictions = false
 Text form (spaces not underscores) of the main part. More...
 
array $mRestrictionsExpiry = []
 When do the restrictions on this page expire? More...
 
bool $mHasCascadingRestrictions
 Are cascading restrictions in effect on this page? More...
 
string $mPrefixedText = null
 Text form including namespace/interwiki, initialised on demand. More...
 
int $mLength = -1
 The page length, 0 for special pages. More...
 
bool $mLocalInterwiki = false
 Was this Title created from a string with a local interwiki prefix? More...
 
int $mEstimateRevisions
 Estimated number of revisions; null of not loaded. More...
 
array $mNotificationTimestamp = []
 Associative array of user ID -> timestamp/false. More...
 
bool $mHasSubpages
 Whether a page has any subpages. More...
 
bool $mPageLanguage = false
 The (string) language code of the page's language and content code. More...
 
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. More...
 
TitleValue $mTitleValue = null
 A corresponding TitleValue object. More...
 
bool $mIsBigDeletion = null
 Would deleting this page be a big deletion? More...
 

Detailed Description

Represents a title within MediaWiki.

Optionally may contain an interwiki designation or namespace.

Note
This class can fetch various kinds of data from the database; however, it does so inefficiently.
Consider using a TitleValue object instead. TitleValue is more lightweight and does not rely on global state or the database.

Definition at line 34 of file Title.php.

Constructor & Destructor Documentation

Title::__construct ( )

Definition at line 210 of file Title.php.

Member Function Documentation

Title::__sleep ( )
Returns
array

Definition at line 4784 of file Title.php.

Title::__toString ( )

Return a string representation of this title.

Returns
string Representation of this title

Definition at line 1463 of file Title.php.

References getPrefixedText().

Title::__wakeup ( )

Definition at line 4796 of file Title.php.

References wfUrlencode().

Title::areCascadeProtectionSourcesLoaded (   $getPages = true)

Determines whether cascading protection sources have already been loaded from the database.

Parameters
bool$getPagesTrue to check if the pages are loaded, or false to check if the status is loaded.
Returns
bool Whether or not the specified information has been loaded
Since
1.23

Definition at line 2703 of file Title.php.

Title::areRestrictionsCascading ( )

Returns cascading restrictions for the current article.

Returns
bool

Definition at line 2861 of file Title.php.

References $mCascadeRestriction, and loadRestrictions().

Title::areRestrictionsLoaded ( )

Accessor for mRestrictionsLoaded.

Returns
bool Whether or not the page's restrictions have already been loaded from the database
Since
1.23

Definition at line 2806 of file Title.php.

References $mRestrictionsLoaded.

Title::canExist ( )

Is this in a namespace that allows actual pages?

Returns
bool

Definition at line 1027 of file Title.php.

References NS_MAIN.

Referenced by RequestContext\canUseWikiPage().

Title::canTalk ( )

Could this title have a corresponding talk page?

Returns
bool

Definition at line 1018 of file Title.php.

References MWNamespace\canTalk().

Title::canUseNoindex ( )

Whether the magic words INDEX and NOINDEX function for this page.

Returns
bool

Definition at line 4562 of file Title.php.

References $wgContentNamespaces, and global.

static Title::capitalize (   $text,
  $ns = NS_MAIN 
)
static

Capitalize a text string for a title if it belongs to a namespace that capitalizes.

Parameters
string$textContaining title to capitalize
int$nsNamespace index, defaults to NS_MAIN
Returns
string Containing capitalized title

Definition at line 3307 of file Title.php.

References $wgContLang, global, and MWNamespace\isCapitalized().

Referenced by CategoryPager\__construct(), UploadBase\checkWarnings(), WithoutInterwikiPage\execute(), and MediaWikiTitleCodec\splitTitleString().

Title::checkActionPermissions (   $action,
  $user,
  $errors,
  $rigor,
  $short 
)
private

Check action permissions not already checked in checkQuickPermissions.

Parameters
string$actionThe action to check
User$userUser to check
array$errorsList of current errors
string$rigorSame format as Title::getUserPermissionsErrors()
bool$shortShort circuit on first error
Returns
array List of errors

Definition at line 2225 of file Title.php.

References $user, $wgLang, checkCascadingSourcesRestrictions(), checkPageRestrictions(), getNsText(), getTitleProtection(), getUserPermissionsErrorsInternal(), global, isBigDeletion(), MWNamespace\isMovable(), isMovable(), userCan(), and User\whoIs().

Title::checkCascadingSourcesRestrictions (   $action,
  $user,
  $errors,
  $rigor,
  $short 
)
private

Check restrictions on cascading pages.

Parameters
string$actionThe action to check
User$userUser to check
array$errorsList of current errors
string$rigorSame format as Title::getUserPermissionsErrors()
bool$shortShort circuit on first error
Returns
array List of errors

Definition at line 2178 of file Title.php.

References $page, $user, as, getCascadeProtectionSources(), isCssJsSubpage(), and list.

Referenced by checkActionPermissions().

Title::checkCSSandJSPermissions (   $action,
  $user,
  $errors,
  $rigor,
  $short 
)
private

Check CSS/JS sub-page permissions.

Parameters
string$actionThe action to check
User$userUser to check
array$errorsList of current errors
string$rigorSame format as Title::getUserPermissionsErrors()
bool$shortShort circuit on first error
Returns
array List of errors

Definition at line 2108 of file Title.php.

References $user, isCssSubpage(), and isJsSubpage().

Title::checkPageRestrictions (   $action,
  $user,
  $errors,
  $rigor,
  $short 
)
private

Check against page_restrictions table requirements on this page.

The user must possess all required rights for this action.

Parameters
string$actionThe action to check
User$userUser to check
array$errorsList of current errors
string$rigorSame format as Title::getUserPermissionsErrors()
bool$shortShort circuit on first error
Returns
array List of errors

Definition at line 2144 of file Title.php.

References $user, as, and getRestrictions().

Referenced by checkActionPermissions().

Title::checkPermissionHooks (   $action,
  $user,
  $errors,
  $rigor,
  $short 
)
private

Check various permission hooks.

Parameters
string$actionThe action to check
User$userUser to check
array$errorsList of current errors
string$rigorSame format as Title::getUserPermissionsErrors()
bool$shortShort circuit on first error
Returns
array List of errors

Definition at line 2046 of file Title.php.

References $user, resultToError(), and Hooks\run().

Title::checkQuickPermissions (   $action,
  $user,
  $errors,
  $rigor,
  $short 
)
private

Permissions checks that fail most often, and which are easiest to test.

Parameters
string$actionThe action to check
User$userUser to check
array$errorsList of current errors
string$rigorSame format as Title::getUserPermissionsErrors()
bool$shortShort circuit on first error
Returns
array List of errors

Definition at line 1945 of file Title.php.

References $user, User\groupHasPermission(), isSubpage(), isTalkPage(), missingPermissionError(), NS_CATEGORY, NS_FILE, NS_USER, and Hooks\run().

Title::checkReadPermissions (   $action,
  $user,
  $errors,
  $rigor,
  $short 
)
private

Check that the user is allowed to read this page.

Parameters
string$actionThe action to check
User$userUser to check
array$errorsList of current errors
string$rigorSame format as Title::getUserPermissionsErrors()
bool$shortShort circuit on first error
Returns
array List of errors

Definition at line 2333 of file Title.php.

References $name, $user, as, getDBkey(), getNamespace(), getPrefixedDBkey(), getPrefixedText(), SpecialPage\getTitleFor(), global, User\isEveryoneAllowed(), isSpecial(), isSpecialPage(), list, missingPermissionError(), NS_MAIN, SpecialPageFactory\resolveAlias(), and Hooks\run().

Title::checkSpecialsAndNSPermissions (   $action,
  $user,
  $errors,
  $rigor,
  $short 
)
private

Check permissions on special pages & namespaces.

Parameters
string$actionThe action to check
User$userUser to check
array$errorsList of current errors
string$rigorSame format as Title::getUserPermissionsErrors()
bool$shortShort circuit on first error
Returns
array List of errors

Definition at line 2079 of file Title.php.

References $user, getNsText(), isNamespaceProtected(), NS_MAIN, NS_MEDIAWIKI, NS_SPECIAL, and wfMessage().

Title::checkUserBlock (   $action,
  $user,
  $errors,
  $rigor,
  $short 
)
private

Check that the user isn't blocked from editing.

Parameters
string$actionThe action to check
User$userUser to check
array$errorsList of current errors
string$rigorSame format as Title::getUserPermissionsErrors()
bool$shortShort circuit on first error
Returns
array List of errors

Definition at line 2291 of file Title.php.

References $user, false, RequestContext\getMain(), and global.

static Title::clearCaches ( )
static
static Title::compare (   $a,
  $b 
)
static

Callback for usort() to do title sorts by (namespace, title)

Parameters
Title$a
Title$b
Returns
int Result of string comparison, or namespace comparison

Definition at line 780 of file Title.php.

Referenced by ApiQueryInfo\execute(), and Article\view().

static Title::convertByteClassToUnicodeClass (   $byteClass)
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.

Parameters
string$byteClass
Returns
string

Definition at line 634 of file Title.php.

References $out.

Referenced by ResourceLoaderStartUpModule\getConfigSettings(), and TitleTest\testConvertByteClassToUnicodeClass().

Title::countAuthorsBetween (   $old,
  $new,
  $limit,
  $options = [] 
)

Get the number of authors between the given revisions or revision IDs.

Used for diffs and other things that really need it.

Parameters
int | Revision$oldOld revision or rev ID (first before range by default)
int | Revision$newNew revision or rev ID (first after range by default)
int$limitMaximum number of authors
string | array$options(Optional): Single option, or an array of options: 'include_old' Include $old in the range; $new is excluded. 'include_new' Include $new in the range; $old is excluded. 'include_both' Include both $old and $new in the range. Unknown option values are ignored.
Returns
int Number of revision authors in the range; zero if not both revisions exist

Definition at line 4191 of file Title.php.

References $limit, $options, and getAuthorsBetween().

Title::countRevisionsBetween (   $old,
  $new,
  $max = null 
)

Get the number of revisions between the given revision.

Used for diffs and other things that really need it.

Parameters
int | Revision$oldOld revision or rev ID (first before range)
int | Revision$newNew revision or rev ID (first after range)
int | null$maxLimit of Revisions to count, will be incremented to detect truncations
Returns
int Number of revisions between these revisions.

Definition at line 4074 of file Title.php.

References $dbr, DB_SLAVE, getArticleID(), Revision\newFromTitle(), and wfGetDB().

Title::createFragmentTarget (   $fragment)

Creates a new Title for a different fragment of the same page.

Since
1.27
Parameters
string$fragment
Returns
Title

Implements MediaWiki\Linker\LinkTarget.

Definition at line 1402 of file Title.php.

References getInterwiki(), getNamespace(), and getText().

Referenced by TitleTest\testCreateFragmentTitle().

Title::deleteTitleProtection ( )

Remove any title protection due to page existing.

Definition at line 2593 of file Title.php.

References DB_MASTER, getDBkey(), getNamespace(), and wfGetDB().

Referenced by WikiPage\onArticleCreate().

Title::equals ( Title  $title)

Compare with another title.

Parameters
Title$title
Returns
bool

Definition at line 4202 of file Title.php.

References getDBkey(), getInterwiki(), and getNamespace().

Referenced by isMainPage(), WikiPage\prepareContentForEdit(), NamespaceImportTitleFactoryTest\testBasic(), and NaiveImportTitleFactoryTest\testBasic().

static Title::escapeFragmentForURL (   $fragment)
static

Escape a text fragment, say from a link, for a URL.

Parameters
string$fragmentContaining a URL or link fragment (after the "#")
Returns
string Escaped string

Definition at line 764 of file Title.php.

References Sanitizer\escapeId().

Referenced by getFragmentForURL().

Title::estimateRevisionCount ( )

Get the approximate revision count of this page.

Returns
int

Definition at line 4051 of file Title.php.

References $dbr, $mEstimateRevisions, DB_SLAVE, exists(), getArticleID(), 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.

Parameters
int$flagsAn optional bit field; may be Title::GAID_FOR_UPDATE to check from master/for update
Returns
bool

Definition at line 4232 of file Title.php.

References $flags, getArticleID(), and Hooks\run().

Referenced by estimateRevisionCount(), getRestrictionTypes(), getTitleProtection(), SpecialUpload\getUploadForm(), hasSourceText(), isKnown(), and loadRestrictions().

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

Returns
Title

Definition at line 1071 of file Title.php.

References SpecialPageFactory\getLocalNameFor(), isSpecialPage(), list, makeTitle(), NS_SPECIAL, and SpecialPageFactory\resolveAlias().

static Title::fixUrlQueryArgs (   $query,
  $query2 = false 
)
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();

Since
1.19 (r105919)
Parameters
array | string$query
bool$query2
Returns
string

Definition at line 1628 of file Title.php.

References $query, wfArrayToCgi(), and wfDeprecated().

Title::flushRestrictions ( )

Flush the protection cache in this object and force reload from the database.

This is used when updating protection from WikiPage::doUpdateRestrictions().

Definition at line 3006 of file Title.php.

Title::getAllRestrictions ( )

Accessor/initialisation for mRestrictions.

Returns
array Keys are actions, values are arrays as returned by Title::getRestrictions()
Since
1.23

Definition at line 2835 of file Title.php.

References $mRestrictions, and loadRestrictions().

Title::getAuthorsBetween (   $old,
  $new,
  $limit,
  $options = [] 
)

Get the authors between the given revisions or revision IDs.

Used for diffs and other things that really need it.

Since
1.23
Parameters
int | Revision$oldOld revision or rev ID (first before range by default)
int | Revision$newNew revision or rev ID (first after range by default)
int$limitMaximum number of authors
string | array$options(Optional): Single option, or an array of options: 'include_old' Include $old in the range; $new is excluded. 'include_new' Include $new in the range; $old is excluded. 'include_both' Include both $old and $new in the range. Unknown option values are ignored.
Returns
array|null Names of revision authors in the range; null if not both revisions exist

Definition at line 4117 of file Title.php.

References $dbr, $limit, $options, $res, array(), as, DB_SLAVE, getArticleID(), Revision\newFromTitle(), Revision\RAW, and wfGetDB().

Referenced by countAuthorsBetween().

Title::getBacklinkCache ( )

Get a backlink cache object.

Returns
BacklinkCache

Definition at line 4553 of file Title.php.

References BacklinkCache\get().

Referenced by LinksUpdate\queueRecursiveJobsForTable().

Title::getBaseText ( )

Get the base page name without a namespace, i.e.

the part before the subpage name

Example:
Title::newFromText('User:Foo/Bar/Baz')->getBaseText();
# returns: 'Foo/Bar'
Returns
string Base name

Definition at line 1528 of file Title.php.

References getText(), and MWNamespace\hasSubpages().

Referenced by getBaseTitle().

Title::getBaseTitle ( )

Get the base page name title, i.e.

the part before the subpage name

Example:
Title::newFromText('User:Foo/Bar/Baz')->getBaseTitle();
# returns: Title{User:Foo/Bar}
Returns
Title Base title
Since
1.20

Definition at line 1553 of file Title.php.

References getBaseText(), getNamespace(), and makeTitle().

Title::getBrokenLinksFrom ( )

Get an array of Title objects referring to non-existent articles linked from this page.

Todo:
check if needed (used only in SpecialBrokenRedirects.php, and should use redirect table in this case).
Returns
Title[] Array of Title the Title objects

Definition at line 3498 of file Title.php.

References $dbr, $res, as, DB_SLAVE, getArticleID(), makeTitle(), 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

See also
self::getLocalURL for the arguments.
Returns
string The URL
Since
1.18

Definition at line 1842 of file Title.php.

References $query, getFragmentForURL(), getLocalURL(), PROTO_CANONICAL, Hooks\run(), and wfExpandUrl().

Title::getCascadeProtectionSources (   $getPages = true)

Cascading protection: Get the source of any cascading restrictions on this page.

Parameters
bool$getPagesWhether or not to retrieve the actual pages that the restrictions have come from and the actual restrictions themselves.
Returns
array Two elements: First is an array of Title objects of the pages from which cascading restrictions have come, false for none, or true if such restrictions exist but $getPages was not set. Second is an array like that returned by Title::getAllRestrictions(), or an empty array if $getPages is false.

Definition at line 2720 of file Title.php.

References $dbr, $mCascadeSources, $mCascadingRestrictions, $mHasCascadingRestrictions, $res, $tables, as, DB_SLAVE, getDBkey(), getNamespace(), makeTitle(), NS_FILE, wfGetDB(), and wfTimestampNow().

Referenced by checkCascadingSourcesRestrictions(), and isCascadeProtected().

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.

Parameters
string$prefixThe prefix to be used, specified using {{defaultsort:}} or like [[Category:Foo|prefix]]. Empty for no prefix.
Returns
string

Definition at line 4583 of file Title.php.

References getText(), and Hooks\run().

Referenced by CategoryViewer\doCategoryQuery().

Title::getCdnUrls ( )

Get a list of URLs to purge from the CDN cache when this page changes.

Returns
string[] Array of String the URLs

Definition at line 3534 of file Title.php.

References $urls, as, getInternalURL(), getPageLanguage(), isCssSubpage(), isJsSubpage(), and Hooks\run().

Referenced by getSquidURLs(), CdnCacheUpdate\newSimplePurge(), MediaWiki\performAction(), and purgeSquid().

Title::getContentModel (   $flags = 0)

Get the page's content model id, see the CONTENT_MODEL_XXX constants.

Parameters
int$flagsA bit field; may be Title::GAID_FOR_UPDATE to select for update
Returns
string Content model id

Definition at line 944 of file Title.php.

References $flags, $mContentModel, article, getArticleID(), ContentHandler\getDefaultModelFor(), in, and LinkCache\singleton().

Referenced by ContentHandler\getForTitle(), hasContentModel(), loadFromRow(), and makeTitle().

Title::getDbPageLanguageCode ( )
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.

Returns
string|null|bool

Definition at line 4609 of file Title.php.

References $mDbPageLanguage, global, and LinkCache\singleton().

Referenced by getPageLanguage(), and getPageViewLanguage().

Title::getDefaultMessageText ( )

Get the default message text or false if the message doesn't exist.

Returns
string|bool

Definition at line 4342 of file Title.php.

References $lang, $name, $wgContLang, getNamespace(), global, list, NS_MEDIAWIKI, MessageCache\singleton(), and wfMessage().

Title::getDefaultNamespace ( )

Get the default namespace index, for when there is no namespace.

Returns
int Default namespace index

Definition at line 1342 of file Title.php.

References $mDefaultNamespace.

Referenced by secureAndSplit().

Title::getEarliestRevTime (   $flags = 0)

Get the oldest revision timestamp of this page.

Parameters
int$flagsTitle::GAID_FOR_UPDATE
Returns
string MW timestamp

Definition at line 4002 of file Title.php.

References $flags, $rev, and getFirstRevision().

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.

Since
1.21
Parameters
int$oldidRevision ID that's being edited
Returns
array

Definition at line 4713 of file Title.php.

References $html, Sanitizer\escapeClass(), getDBkey(), getNamespace(), MWNamespace\hasSubpages(), Html\rawElement(), Hooks\run(), and wfMessage().

Title::getEditURL ( )

Get the edit URL for this Title.

Returns
string The URL, or a null string if this is an interwiki link

Definition at line 1854 of file Title.php.

References $s, getLocalURL(), and isExternal().

static Title::getFilteredRestrictionTypes (   $exists = true)
static

Get a filtered list of all restriction types supported by this wiki.

Parameters
bool$existsTrue 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
Returns
array

Definition at line 2504 of file Title.php.

References global.

Referenced by ApiQueryAllPages\getAllowedParams(), and SpecialProtectedpages\getTypeMenu().

Title::getFirstRevision (   $flags = 0)

Get the first revision of the page.

Parameters
int$flagsTitle::GAID_FOR_UPDATE
Returns
Revision|null If page doesn't exist

Definition at line 3980 of file Title.php.

References $flags, DB_MASTER, DB_SLAVE, getArticleID(), Revision\selectFields(), and wfGetDB().

Referenced by getEarliestRevTime().

Title::getFragment ( )

Get the Title fragment (i.e.

\ the bit after the #) in text form

Use Title::hasFragment to check for a fragment

Returns
string Title fragment

Implements MediaWiki\Linker\LinkTarget.

Definition at line 1353 of file Title.php.

References $mFragment.

Referenced by getFragmentForURL(), getFullText(), getTitleValue(), WikiPage\insertRedirectEntry(), Linker\makeCommentLink(), and WatchedItemUnitTest\testResetNotificationTimestamp().

Title::getFragmentForURL ( )

Get the fragment in URL form, including the "#" character if there is one.

Returns
string Fragment in URL form

Definition at line 1371 of file Title.php.

References escapeFragmentForURL(), getFragment(), and hasFragment().

Referenced by getCanonicalURL(), getFullURL(), and getLinkURL().

Title::getFullText ( )

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

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

Definition at line 1473 of file Title.php.

References getFragment(), getPrefixedText(), and hasFragment().

Referenced by getParentCategories(), 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.

See also
self::getLocalURL for the arguments.
wfExpandUrl
Parameters
array | string$query
bool$query2
string$protoProtocol type to use in URL
Returns
string The URL

Definition at line 1666 of file Title.php.

References $query, getFragmentForURL(), getLocalURL(), Hooks\run(), and wfExpandUrl().

Referenced by SpecialPageFactory\executePath(), FeedUtils\getDiffLink(), getLinkURL(), CssContentHandler\makeRedirectContent(), JavaScriptContentHandler\makeRedirectContent(), and MediaWiki\tryNormaliseRedirect().

Title::getInternalURL (   $query = '',
  $query2 = false 
)

Get the URL form for an internal link.

  • Used in various CDN-related code, in case we have a different internal hostname for the server from the exposed one.

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://

See also
self::getLocalURL for the arguments.
Returns
string The URL

Definition at line 1822 of file Title.php.

References $query, $wgInternalServer, $wgServer, getLocalURL(), global, PROTO_HTTP, Hooks\run(), and wfExpandUrl().

Referenced by getCdnUrls().

Title::getInterwiki ( )

Get the interwiki prefix.

Use Title::isExternal to check if a interwiki is set

Returns
string Interwiki prefix

Implements MediaWiki\Linker\LinkTarget.

Definition at line 821 of file Title.php.

References $mInterwiki.

Referenced by createFragmentTarget(), equals(), getRedirectsHere(), getTitleValue(), WikiPage\insertRedirectEntry(), isSubpageOf(), WikitextContentHandler\makeRedirectContent(), and TitleTest\testCreateFragmentTitle().

Title::getLatestRevID (   $flags = 0)

What is the page_latest field for this page?

Parameters
int$flagsA bit field; may be Title::GAID_FOR_UPDATE to select for update
Returns
int Int or 0 if the page doesn't exist

Definition at line 3238 of file Title.php.

References $flags, $mLatestID, article, GAID_FOR_UPDATE, getArticleID(), in, and LinkCache\singleton().

Title::getLength (   $flags = 0)

What is the length of this page? Uses link cache, adding it if necessary.

Parameters
int$flagsA bit field; may be Title::GAID_FOR_UPDATE to select for update
Returns
int

Definition at line 3210 of file Title.php.

References $flags, $mLength, article, getArticleID(), in, and LinkCache\singleton().

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.

Parameters
array$optionsQuery option to Database::select()
string$tableTable name
string$prefixFields prefix
Returns
array Array of Title objects linking here

Definition at line 3433 of file Title.php.

References $options, $res, as, DB_SLAVE, getArticleID(), makeTitle(), newFromRow(), WikiPage\selectFields(), LinkCache\singleton(), and wfGetDB().

Referenced by getTemplateLinksFrom().

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.

Parameters
array$optionsMay be FOR UPDATE
string$tableTable name
string$prefixFields prefix
Returns
Title[] Array of Title objects linking here

Definition at line 3375 of file Title.php.

References $options, $res, as, DB_MASTER, DB_SLAVE, getDBkey(), getNamespace(), makeTitle(), LinkCache\singleton(), and wfGetDB().

Referenced by getTemplateLinksTo().

Title::getLinkURL (   $query = '',
  $query2 = false,
  $proto = PROTO_RELATIVE 
)

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.

Parameters
array$query
bool$query2
string$protoProtocol to use; setting this will cause a full URL to be used
See also
self::getLocalURL for the arguments.
Returns
string The URL

Definition at line 1799 of file Title.php.

References $query, $ret, getFragmentForURL(), getFullURL(), getLocalURL(), getPrefixedText(), hasFragment(), isExternal(), and PROTO_RELATIVE.

Referenced by Parser\renderImageGallery().

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.

See also
self::getFullURL to always get an absolute URL.
self::getLinkURL to always get a URL that's the simplest URL that will be valid to link, locally, to the current Title.
self::newFromText to produce a Title object.
Parameters
string | array$queryAn optional query string, not used for interwiki links. Can be specified as an associative array as well, e.g., array( 'action' => 'edit' ) (keys and values will be URL-escaped). Some query patterns will trigger various shorturl path replacements.
array$query2An 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.
Returns
string String of the URL.

Definition at line 1707 of file Title.php.

References $matches, $query, $wgActionPaths, $wgArticlePath, $wgContLang, $wgRequest, $wgScript, $wgServer, $wgVariantArticlePath, Interwiki\fetch(), getDBkey(), getNsText(), getPageLanguage(), getPrefixedDBkey(), global, Hooks\run(), wfAppendQuery(), and wfUrlencode().

Referenced by EditPage\getActionURL(), getCanonicalURL(), getEditURL(), getFullURL(), getInternalURL(), getLinkURL(), Linker\makeThumbLink2(), and Language\numLink().

static Title::getMediaWikiTitleCodec ( )
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.

Returns
MediaWikiTitleCodec

Definition at line 168 of file Title.php.

References $wgContLang, $wgLocalInterwikis, global, and GenderCache\singleton().

Title::getNamespace ( )

Get the namespace index, i.e.

one of the NS_xxxx constants.

Returns
int Namespace index

Implements MediaWiki\Linker\LinkTarget.

Definition at line 934 of file Title.php.

References $mNamespace.

Referenced by SubpageImportTitleFactory\__construct(), EmailNotification\actuallyNotifyOnPageChange(), CategoryViewer\addFragmentToTitle(), ParserOutput\addLink(), LinkCache\addLinkObj(), XmlDumpWriter\canonicalTitle(), EmailNotification\canSendUserTalkEmail(), checkReadPermissions(), LocalRepo\checkRedirect(), createFragmentTarget(), deleteTitleProtection(), CategoryViewer\doCategoryQuery(), equals(), WikiPage\factory(), DoubleRedirectJob\fixRedirects(), getArticleID(), getBaseTitle(), getCascadeProtectionSources(), getDefaultMessageText(), ContentHandler\getDefaultModelFor(), getEditNotices(), DoubleRedirectJob\getFinalDestination(), getLinksTo(), getNamespaceKey(), ContentHandler\getPageLanguage(), ContentHandler\getPageViewLanguage(), getRedirectsHere(), getRestrictionTypes(), BenchmarkParse\getRevIdForTime(), getRootTitle(), getSubjectPage(), getSubpage(), getSubpages(), getTalkPage(), getTitleProtection(), getTitleValue(), hasSubjectNamespace(), inNamespace(), WikiPage\insertRedirectEntry(), isContentPage(), isConversionTable(), isDeleted(), isDeletedQuick(), isMovable(), isSingleRevRedirect(), isSpecialPage(), isSubpageOf(), isTalkPage(), isWatchable(), LogPager\limitTitle(), PageArchive\listPagesByPrefix(), WikitextContentHandler\makeRedirectContent(), moveSubpages(), RecentChange\newForCategorization(), EmailNotification\notifyOnPageChange(), WikiPage\onArticleDelete(), ApiPageSet\setGeneratorData(), MovePageForm\showForm(), SpecialWhatLinksHere\showIndirectLinks(), TitleTest\testCreateFragmentTitle(), WatchedItemUnitTest\testResetNotificationTimestamp(), touchLinks(), and LanguageConverter\updateConversionTable().

Title::getNamespaceKey (   $prepend = 'nstab-')

Generate strings used for xml 'id' names in monobook tabs.

Parameters
string$prependDefaults to 'nstab-'
Returns
string XML 'id' name

Definition at line 4462 of file Title.php.

References $wgContLang, MWNamespace\exists(), MWNamespace\getCanonicalName(), getNamespace(), MWNamespace\getSubject(), getSubjectNsText(), and global.

Title::getNextRevisionID (   $revId,
  $flags = 0 
)

Get the revision ID of the next revision.

Parameters
int$revIdRevision ID. Get the revision that was after this one.
int$flagsTitle::GAID_FOR_UPDATE
Returns
int|bool Next revision ID, or false if none exists

Definition at line 3956 of file Title.php.

References $flags, $revId, DB_MASTER, DB_SLAVE, getArticleID(), and wfGetDB().

Referenced by WatchedItemStore\getNotificationTimestamp().

Title::getNotificationTimestamp (   $user = null)

Get the timestamp when this page was updated since the user last saw it.

Parameters
User$user
Returns
string|null

Definition at line 4425 of file Title.php.

References $user, $wgUser, WatchedItemStore\getDefaultInstance(), and global.

Title::getNsText ( )

Get the namespace text.

Returns
string Namespace text

Definition at line 973 of file Title.php.

References MWNamespace\exists(), MWNamespace\getCanonicalName(), isExternal(), and wfDebug().

Referenced by checkActionPermissions(), checkSpecialsAndNSPermissions(), getLocalURL(), and prefix().

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.

Since
1.25
Exceptions
MWException
Returns
Title

Definition at line 1326 of file Title.php.

References getSubjectPage(), getTalkPage(), isSpecialPage(), and isTalkPage().

Referenced by WikiPage\onArticleCreate(), and WikiPage\onArticleDelete().

Title::getPageLanguage ( )

Get the language in which the content of this page is written in wikitext.

Defaults to $wgContLang, but in certain cases it can be e.g. $wgLang (such as special pages, which are in the user language).

Since
1.18
Returns
Language

Definition at line 4631 of file Title.php.

References $wgLang, $wgLanguageCode, getDbPageLanguageCode(), ContentHandler\getForTitle(), global, isSpecialPage(), and wfGetLangObj().

Referenced by WikitextContent\fillParserOutput(), SpecialExpandTemplates\generateHtml(), getCdnUrls(), and getLocalURL().

Title::getPageViewLanguage ( )

Get the language in which the content of this page is written when viewed by user.

Defaults to $wgContLang, but in certain cases it can be e.g. $wgLang (such as special pages, which are in the user language).

Since
1.20
Returns
Language

Definition at line 4669 of file Title.php.

References $wgLang, Language\factory(), getDbPageLanguageCode(), ContentHandler\getForTitle(), global, isSpecialPage(), and wfGetLangObj().

Referenced by SpecialExpandTemplates\showHtmlPreview().

Title::getParentCategories ( )

Get categories to which this Title belongs and return an array of categories' names.

Returns
array Array of parents in the form: $parent => $currentarticle

Definition at line 3853 of file Title.php.

References $dbr, $res, $wgContLang, as, DB_SLAVE, getArticleID(), getFullText(), global, NS_CATEGORY, and wfGetDB().

Referenced by getParentCategoryTree().

Title::getParentCategoryTree (   $children = [])

Get a tree of parent categories.

Parameters
array$childrenArray with the children in the keys, to check for circular refs
Returns
array Tree of parent categories

Definition at line 3888 of file Title.php.

References as, getParentCategories(), and newFromText().

Title::getPartialURL ( )

Get the URL-encoded form of the main part.

Returns
string Main part of the title, URL-encoded

Definition at line 902 of file Title.php.

References $mUrlform.

Title::getPrefixedURL ( )

Get a URL-encoded title (not an actual URL) including interwiki.

Returns
string The URL-encoded form

Definition at line 1609 of file Title.php.

References $s, prefix(), and wfUrlencode().

Referenced by DumpLinks\execute().

Title::getPreviousRevisionID (   $revId,
  $flags = 0 
)

Get the revision ID of the previous revision.

Parameters
int$revIdRevision ID. Get the revision that was before this one.
int$flagsTitle::GAID_FOR_UPDATE
Returns
int|bool Old revision ID, or false if none exists

Definition at line 3931 of file Title.php.

References $flags, $revId, DB_MASTER, DB_SLAVE, getArticleID(), and wfGetDB().

Title::getRedirectsHere (   $ns = null)

Get all extant redirects to this Title.

Parameters
int | null$nsSingle namespace to consider; null to consider all namespaces
Returns
Title[] Array of Title redirects to this title

Definition at line 4493 of file Title.php.

References $dbr, $res, as, DB_SLAVE, getDBkey(), getInterwiki(), getNamespace(), isExternal(), and wfGetDB().

Title::getRestrictionExpiry (   $action)

Get the expiry time for the restriction against a given action.

Parameters
string$action
Returns
string|bool 14-char timestamp, or 'infinity' if the page is protected forever or not protected at all, or false if the action is not recognised.

Definition at line 2849 of file Title.php.

References loadRestrictions().

Title::getRestrictions (   $action)

Accessor/initialisation for mRestrictions.

Parameters
string$actionAction that permission needs to be checked for
Returns
array Restriction levels needed to take the action. All levels are required. Note that restriction levels are normally user rights, but 'sysop' and 'autoconfirmed' are also allowed for backwards compatibility. These should be mapped to 'editprotected' and 'editsemiprotected' respectively.

Definition at line 2819 of file Title.php.

References loadRestrictions().

Referenced by checkPageRestrictions(), isProtected(), and isSemiProtected().

Title::getRestrictionTypes ( )

Returns restriction types for the current Title.

Returns
array Applicable restriction types

Definition at line 2522 of file Title.php.

References exists(), getNamespace(), getPrefixedText(), isSpecialPage(), NS_FILE, Hooks\run(), and wfDebug().

Referenced by isProtected(), and loadRestrictionsFromRows().

Title::getRootText ( )

Get the root page name text without a namespace, i.e.

the leftmost part before any slashes

Example:
Title::newFromText('User:Foo/Bar/Baz')->getRootText();
# returns: 'Foo'
Returns
string Root name
Since
1.20

Definition at line 1493 of file Title.php.

References getText(), and MWNamespace\hasSubpages().

Referenced by getRootTitle().

Title::getRootTitle ( )

Get the root page name title, i.e.

the leftmost part before any slashes

Example:
Title::newFromText('User:Foo/Bar/Baz')->getRootTitle();
# returns: Title{User:Foo}
Returns
Title Root title
Since
1.20

Definition at line 1513 of file Title.php.

References getNamespace(), getRootText(), and makeTitle().

static Title::getSelectFields ( )
staticprotected

Returns a list of fields that are to be selected for initializing Title objects or LinkCache entries.

Uses $wgContentHandlerUseDB to determine whether to include page_content_model.

Returns
array

Definition at line 391 of file Title.php.

References global.

Title::getSkinFromCssJsSubpage ( )

Trim down a .css or .js subpage title to get the corresponding skin name.

Returns
string Containing skin name from .css or .js subpage title

Definition at line 1255 of file Title.php.

References in, names, and or.

Title::getSquidURLs ( )
Deprecated:
since 1.27 use getCdnUrls()

Definition at line 3562 of file Title.php.

References getCdnUrls().

Title::getSubjectNsText ( )

Get the namespace text of the subject (rather than talk) page.

Returns
string Namespace text

Definition at line 998 of file Title.php.

References $wgContLang, MWNamespace\getSubject(), and global.

Referenced by getNamespaceKey().

Title::getSubjectPage ( )

Get a title object associated with the subject page of this talk page.

Returns
Title The object for the subject page

Definition at line 1309 of file Title.php.

References getDBkey(), getNamespace(), MWNamespace\getSubject(), and makeTitle().

Referenced by getOtherPage().

Title::getSubpage (   $text)

Get the title for a subpage of the current page.

Example:
Title::newFromText('User:Foo/Bar/Baz')->getSubpage("Asdf");
# returns: Title{User:Foo/Bar/Baz/Asdf}
Parameters
string$textThe subpage name to add to the title
Returns
Title Subpage title
Since
1.20

Definition at line 1589 of file Title.php.

References getNamespace(), getText(), and makeTitleSafe().

Title::getSubpages (   $limit = -1)

Get all subpages of this page.

Parameters
int$limitMaximum number of subpages to fetch; -1 for no limit
Returns
TitleArray|array TitleArray, or empty array if this page's namespace doesn't allow subpages

Definition at line 3070 of file Title.php.

References $dbr, $limit, $options, DB_SLAVE, getDBkey(), getNamespace(), MWNamespace\hasSubpages(), TitleArray\newFromResult(), and wfGetDB().

Referenced by hasSubpages(), and moveSubpages().

Title::getSubpageText ( )

Get the lowest-level subpage name, i.e.

the rightmost part after any slashes

Example:
Title::newFromText('User:Foo/Bar/Baz')->getSubpageText();
# returns: "Baz"
Returns
string Subpage name

Definition at line 1568 of file Title.php.

References $mTextform, and MWNamespace\hasSubpages().

Referenced by getSubpageUrlForm().

Title::getSubpageUrlForm ( )

Get a URL-encoded form of the subpage text.

Returns
string URL-encoded subpage name

Definition at line 1598 of file Title.php.

References getSubpageText(), and wfUrlencode().

Title::getTalkNsText ( )

Get the namespace text of the talk page.

Returns
string Namespace text

Definition at line 1008 of file Title.php.

References $wgContLang, MWNamespace\getTalk(), and global.

Title::getTalkPage ( )

Get a Title object associated with the talk page of this article.

Returns
Title The object for the talk page

Definition at line 1299 of file Title.php.

References getDBkey(), getNamespace(), MWNamespace\getTalk(), and makeTitle().

Referenced by getOtherPage().

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.

Parameters
array$optionsMay be FOR UPDATE
Returns
Title[] Array of Title the Title objects used here

Definition at line 3486 of file Title.php.

References $options, and getLinksFrom().

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.

Parameters
array$optionsQuery option to Database::select()
Returns
Title[] Array of Title the Title objects linking here

Definition at line 3417 of file Title.php.

References $options, and getLinksTo().

static Title::getTitleCache ( )
staticprivate
Returns
HashBagOStuff

Definition at line 377 of file Title.php.

static Title::getTitleFormatter ( )
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.

Returns
TitleFormatter

Definition at line 204 of file Title.php.

static Title::getTitleInvalidRegex ( )
static

Returns a simple regex that will match on characters and sequences invalid in titles.

Note that this doesn't pick up many things that could be wrong with titles, but that replacing this regex with something valid will make many titles valid.

Deprecated:
since 1.25, use MediaWikiTitleCodec::getTitleInvalidRegex() instead
Returns
string Regex string

Definition at line 620 of file Title.php.

References MediaWikiTitleCodec\getTitleInvalidRegex(), and wfDeprecated().

Title::getTitleProtection ( )

Is this title subject to title protection? Title protection is the one applied against creation of such title.

Returns
array|bool An associative array representing any existent title protection, or false if there's none.

Definition at line 2549 of file Title.php.

References $dbr, $mTitleProtection, $res, DB_SLAVE, exists(), getDBkey(), getNamespace(), and wfGetDB().

Referenced by checkActionPermissions(), and loadRestrictions().

Title::getTitleValue ( )

Get a TitleValue object representing this Title.

Note
Not all valid Titles have a corresponding valid TitleValue (e.g. TitleValues cannot represent page-local links that have a fragment but no title text).
Returns
TitleValue|null

Definition at line 870 of file Title.php.

References $mTitleValue, getDBkey(), getFragment(), getInterwiki(), getNamespace(), getPrefixedText(), and wfDebug().

Title::getTouched (   $db = null)

Get the last touched timestamp.

Parameters
IDatabase$dbOptional db
Returns
string Last-touched timestamp

Definition at line 4411 of file Title.php.

References DB_SLAVE, pageCond(), and wfGetDB().

Title::getTransWikiID ( )

Returns the DB name of the distant wiki which owns the object.

Returns
string The DB name

Definition at line 853 of file Title.php.

References Interwiki\fetch(), and isExternal().

Title::getUserCaseDBKey ( )

Get the DB key with the initial letter case as specified by the user.

Returns
string DB key

Definition at line 920 of file Title.php.

References $mDbkeyform, and $mUserCaseDBKey.

Referenced by FileRepo\getNameFromTitle().

Title::getUserPermissionsErrors (   $action,
  $user,
  $rigor = 'secure',
  $ignoreErrors = [] 
)

Can $user perform $action on this page?

Todo:
FIXME: This does not check throttles (User::pingLimiter()).
Parameters
string$actionAction that permission needs to be checked for
User$userUser to check
string$rigorOne of (quick,full,secure)
  • quick : does cheap permission checks from slaves (usable for GUI creation)
  • full : does cheap and expensive checks possibly from a slave
  • secure : does cheap and expensive checks, using the master as needed
array$ignoreErrorsArray of Strings Set this to a list of message keys whose corresponding errors may be ignored.
Returns
array Array of arrays of the arguments to wfMessage to explain permissions problems.

Definition at line 1914 of file Title.php.

References $user, as, and getUserPermissionsErrorsInternal().

Title::getUserPermissionsErrorsInternal (   $action,
  $user,
  $rigor = 'secure',
  $short = false 
)
protected

Can $user perform $action on this page? This is an internal function, with multiple levels of checks depending on performance needs; see $rigor below.

It does not check wfReadOnly().

Parameters
string$actionAction that permission needs to be checked for
User$userUser to check
string$rigorOne of (quick,full,secure)
  • quick : does cheap permission checks from slaves (usable for GUI creation)
  • full : does cheap and expensive checks possibly from a slave
  • secure : does cheap and expensive checks, using the master as needed
bool$shortSet this to true to stop after the first permission error.
Returns
array Array of arrays of the arguments to wfMessage to explain permissions problems.

Definition at line 2443 of file Title.php.

References $user.

Referenced by checkActionPermissions(), getUserPermissionsErrors(), and userCan().

Title::hasContentModel (   $id)

Convenience method for checking a title's content model name.

Parameters
string$idThe content model ID (use the CONTENT_MODEL_XXX constants).
Returns
bool True if $this->getContentModel() == $id

Definition at line 964 of file Title.php.

References getContentModel().

Referenced by isCssJsSubpage(), isCssOrJsPage(), isCssSubpage(), isJsSubpage(), and isWikitextPage().

Title::hasFragment ( )

Check if a Title fragment is set.

Returns
bool
Since
1.23

Implements MediaWiki\Linker\LinkTarget.

Definition at line 1363 of file Title.php.

Referenced by getFragmentForURL(), getFullText(), and getLinkURL().

Title::hasSourceText ( )

Does this page have source text?

Returns
bool

Definition at line 4316 of file Title.php.

References $name, $wgContLang, exists(), global, list, NS_MEDIAWIKI, MessageCache\singleton(), and wfMessage().

Referenced by isAlwaysKnown().

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.

Since
1.19
Parameters
int$ns
Returns
bool

Definition at line 1133 of file Title.php.

References getNamespace(), and MWNamespace\subjectEquals().

Title::hasSubpages ( )

Does this have subpages? (Warning, usually requires an extra DB query.)

Returns
bool

Definition at line 3042 of file Title.php.

References $mHasSubpages, getSubpages(), and MWNamespace\hasSubpages().

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.

Parameters
int$nsThe namespace
Returns
bool
Since
1.19

Implements MediaWiki\Linker\LinkTarget.

Definition at line 1094 of file Title.php.

References MWNamespace\equals(), and getNamespace().

Referenced by inNamespaces().

Title::inNamespaces ( )

Returns true if the title is inside one of the specified namespaces.

Parameters
int$namespaces,...The namespaces to check for
Returns
bool
Since
1.19

Definition at line 1105 of file Title.php.

References $namespaces, as, and inNamespace().

Title::invalidateCache (   $purgeTime = null)

Updates page_touched for this page; called from LinksUpdate.php.

Parameters
string$purgeTime[optional] TS_MW timestamp
Returns
bool True if the update succeeded

Definition at line 4367 of file Title.php.

References DB_MASTER, pageCond(), use, 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.)

Returns
bool

Definition at line 4254 of file Title.php.

References SpecialPageFactory\exists(), getDBkey(), hasSourceText(), isExternal(), NS_FILE, NS_MAIN, NS_MEDIA, NS_MEDIAWIKI, NS_SPECIAL, Hooks\run(), and wfFindFile().

Referenced by isKnown().

Title::isBigDeletion ( )

Check whether the number of revisions of this page surpasses $wgDeleteRevisionsLimit.

Returns
bool

Definition at line 4022 of file Title.php.

References $dbr, $mIsBigDeletion, DB_SLAVE, getArticleID(), global, and wfGetDB().

Referenced by checkActionPermissions().

Title::isCascadeProtected ( )

Cascading protection: Return true if cascading restrictions apply to this page, false if not.

Returns
bool If the page is subject to cascading restrictions.

Definition at line 2689 of file Title.php.

References getCascadeProtectionSources(), and list.

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?

Returns
bool

Definition at line 1144 of file Title.php.

References getNamespace(), and MWNamespace\isContent().

Title::isConversionTable ( )

Is this a conversion table for the LanguageConverter?

Returns
bool

Definition at line 1195 of file Title.php.

References getNamespace(), getText(), and NS_MEDIAWIKI.

Title::isCssJsSubpage ( )

Is this a .css or .js subpage of a user page?

Returns
bool
Todo:
FIXME: Rename to isUserConfigPage()

Definition at line 1244 of file Title.php.

References CONTENT_MODEL_CSS, CONTENT_MODEL_JAVASCRIPT, hasContentModel(), isSubpage(), and NS_USER.

Referenced by checkCascadingSourcesRestrictions().

Title::isCssOrJsPage ( )

Could this page contain custom CSS or JavaScript for the global UI.

This is generally true for pages in the MediaWiki namespace having CONTENT_MODEL_CSS or CONTENT_MODEL_JAVASCRIPT.

This method does not return true for per-user JS/CSS. Use isCssJsSubpage() for that!

Note that this method should not return true for pages that contain and show "inactive" CSS or JS.

Returns
bool
Todo:
FIXME: Rename to isSiteConfigPage() and remove deprecated hook

Definition at line 1225 of file Title.php.

References CONTENT_MODEL_CSS, CONTENT_MODEL_JAVASCRIPT, hasContentModel(), NS_MEDIAWIKI, and Hooks\run().

Title::isCssSubpage ( )

Is this a .css subpage of a user page?

Returns
bool

Definition at line 1270 of file Title.php.

References CONTENT_MODEL_CSS, hasContentModel(), isSubpage(), and NS_USER.

Referenced by checkCSSandJSPermissions(), and getCdnUrls().

Title::isDeleted ( )

Is there a version of this page in the deletion archive?

Returns
int The number of archived revisions

Definition at line 3098 of file Title.php.

References $dbr, DB_SLAVE, getDBkey(), getNamespace(), NS_FILE, and wfGetDB().

Title::isDeletedQuick ( )

Is there a version of this page in the deletion archive?

Returns
bool

Definition at line 3123 of file Title.php.

References $dbr, DB_SLAVE, getDBkey(), getNamespace(), NS_FILE, and wfGetDB().

Title::isJsSubpage ( )

Is this a .js subpage of a user page?

Returns
bool

Definition at line 1280 of file Title.php.

References CONTENT_MODEL_JAVASCRIPT, hasContentModel(), isSubpage(), and NS_USER.

Referenced by checkCSSandJSPermissions(), and getCdnUrls().

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.

Returns
bool

Definition at line 4307 of file Title.php.

References exists(), and isAlwaysKnown().

Referenced by WantedQueryPage\existenceCheck().

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 )

Returns
bool True if this is an in-project interwiki link or a wikilink, false otherwise

Definition at line 795 of file Title.php.

References Interwiki\fetch(), and isExternal().

Title::isMainPage ( )

Is this the mainpage?

Note
Title::newFromText seems to be sufficiently optimized by the title cache that we don't need to over-optimize by doing direct comparisons and accidentally creating new bugs where $title->equals( Title::newFromText() ) ends up reporting something differently than $title->isMainPage();
Since
1.18
Returns
bool

Definition at line 1175 of file Title.php.

References equals(), and newMainPage().

Title::isMovable ( )

Would anybody with sufficient privileges be able to move this page? Some pages just aren't movable.

Returns
bool

Definition at line 1154 of file Title.php.

References getNamespace(), isExternal(), MWNamespace\isMovable(), and Hooks\run().

Referenced by checkActionPermissions().

Title::isNamespaceProtected ( User  $user)

Determines if $user is unable to edit this page because it has been protected by $wgNamespaceProtection.

Parameters
User$userUser object to check permissions
Returns
bool

Definition at line 2671 of file Title.php.

References $wgNamespaceProtection, array(), as, global, and User\isAllowed().

Referenced by checkSpecialsAndNSPermissions().

Title::isNewPage ( )

Check if this is a new page.

Returns
bool

Definition at line 4012 of file Title.php.

References $dbr, DB_SLAVE, pageCond(), and wfGetDB().

Title::isProtected (   $action = '')

Does the title correspond to a protected article?

Parameters
string$actionThe action the page is protected from, by default checks all actions.
Returns
bool

Definition at line 2639 of file Title.php.

References $type, as, getRestrictions(), getRestrictionTypes(), global, and isSpecialPage().

Title::isRedirect (   $flags = 0)

Is this an article that is a redirect page? Uses link cache, adding it if necessary.

Parameters
int$flagsA bit field; may be Title::GAID_FOR_UPDATE to select for update
Returns
bool

Definition at line 3175 of file Title.php.

References $flags, $mRedirect, article, getArticleID(), in, and LinkCache\singleton().

Referenced by CategoryViewer\addSubcategoryObject(), and OutputPage\buildBacklinkSubtitle().

Title::isSemiProtected (   $action = 'edit')

Is this page "semi-protected" - the only protection levels are listed in $wgSemiprotectedRestrictionLevels?

Parameters
string$actionAction to check (default: edit)
Returns
bool

Definition at line 2611 of file Title.php.

References $key, as, getRestrictions(), and global.

Title::isSingleRevRedirect ( )

Checks if this page is just a one-rev redirect.

Adds lock, so don't use just for light purposes.

Returns
bool

Definition at line 3754 of file Title.php.

References DB_MASTER, getDBkey(), getNamespace(), global, pageCond(), and wfGetDB().

Title::isSpecial (   $name)

Returns true if this title resolves to the named special page.

Parameters
string$nameThe special page name
Returns
bool

Definition at line 1055 of file Title.php.

References $name, getDBkey(), isSpecialPage(), list, and SpecialPageFactory\resolveAlias().

Referenced by checkReadPermissions(), and isValidRedirectTarget().

Title::isSubpage ( )

Is this a subpage?

Returns
bool

Definition at line 1184 of file Title.php.

References getText(), and MWNamespace\hasSubpages().

Referenced by checkQuickPermissions(), isCssJsSubpage(), isCssSubpage(), and isJsSubpage().

Title::isSubpageOf ( Title  $title)

Check if this title is a subpage of another title.

Parameters
Title$title
Returns
bool

Definition at line 4215 of file Title.php.

References getDBkey(), getInterwiki(), and getNamespace().

Title::isTalkPage ( )

Is this a talk page of some sort?

Returns
bool

Definition at line 1290 of file Title.php.

References getNamespace(), and MWNamespace\isTalk().

Referenced by checkQuickPermissions(), and getOtherPage().

Title::isTrans ( )

Determine whether the object refers to a page within this project and is transcludable.

Returns
bool True if this is transcludable

Definition at line 840 of file Title.php.

References Interwiki\fetch(), and isExternal().

Title::isValidMoveOperation ( $nt,
  $auth = true,
  $reason = '' 
)

Check whether a given move operation would be valid.

Returns true if ok, or a getUserPermissionsErrors()-like array otherwise

Deprecated:
since 1.25, use MovePage's methods instead
Parameters
Title$ntThe new title
bool$authWhether to check user permissions (uses $wgUser)
string$reasonIs the log summary of the move, used for spam checking
Returns
array|bool True on success, getUserPermissionsErrors()-like array on failure

Definition at line 3598 of file Title.php.

References $wgUser, global, and wfMergeErrorArrays().

Referenced by moveTo(), and MovePageForm\showForm().

Title::isValidMoveTarget (   $nt)

Checks if $this can be moved to a given Title.

  • Selects for update, so don't call it unless you mean business
Deprecated:
since 1.25, use MovePage's methods instead
Parameters
Title$ntThe new title to check
Returns
bool

Definition at line 3805 of file Title.php.

References $content, $rev, getPrefixedDBkey(), Revision\newFromTitle(), NS_FILE, IDBAccessObject\READ_LATEST, wfDebug(), and wfLocalFile().

Title::isValidRedirectTarget ( )

Check if this Title is a valid redirect target.

Returns
bool

Definition at line 4529 of file Title.php.

References as, global, isSpecial(), and isSpecialPage().

Referenced by AbstractContent\getRedirectChain(), and XmlDumpWriter\openPage().

Title::isWatchable ( )

Can this title be added to a user's watchlist?

Returns
bool

Definition at line 1036 of file Title.php.

References getNamespace(), isExternal(), and MWNamespace\isWatchable().

Referenced by ApiWatch\watchTitle().

Title::isWikitextPage ( )

Does that page contain wikitext, or it is JS, CSS or whatever?

Returns
bool

Definition at line 1207 of file Title.php.

References CONTENT_MODEL_WIKITEXT, and hasContentModel().

static Title::legalChars ( )
static

Get a regex character class describing the legal characters in a link.

Returns
string The list of characters, not delimited

Definition at line 606 of file Title.php.

References $wgLegalTitleChars, and global.

Referenced by ApiQuerySiteinfo\appendGeneralInfo(), ImageCleanup\buildSafeTitle(), ResourceLoaderStartUpModule\getConfigSettings(), Languages\getMessagesWithDubiousLinks(), MediaWikiTitleCodec\getTitleInvalidRegex(), Parser\pstPass2(), Parser\replaceInternalLinks2(), and TitleTest\testLegalChars().

Title::loadFromRow (   $row)

Load Title object fields from a DB row.

If false is given, the title will be treated as non-existing.

Parameters
stdClass | bool$rowDatabase row

Definition at line 477 of file Title.php.

References getContentModel(), in, and string.

Title::loadRestrictions (   $oldFashionedRestrictions = null)

Load restrictions from the page_restrictions table.

Parameters
string$oldFashionedRestrictionsComma-separated list of page restrictions from page table (pre 1.10)

Definition at line 2968 of file Title.php.

References $dbr, $res, DB_SLAVE, exists(), getArticleID(), getTitleProtection(), loadRestrictionsFromResultWrapper(), wfGetDB(), and wfTimestampNow().

Referenced by areRestrictionsCascading(), getAllRestrictions(), getRestrictionExpiry(), and getRestrictions().

Title::loadRestrictionsFromResultWrapper (   $res,
  $oldFashionedRestrictions = null 
)
private

Loads a string into mRestrictions array.

Parameters
ResultWrapper$resResource restrictions as an SQL result.
string$oldFashionedRestrictionsComma-separated list of page restrictions from page table (pre 1.10)

Definition at line 2876 of file Title.php.

References $res, as, and loadRestrictionsFromRows().

Referenced by loadRestrictions().

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.

Parameters
array$rowsArray of db result objects
string$oldFashionedRestrictionsComma-separated list of page restrictions from page table (pre 1.10)

Definition at line 2895 of file Title.php.

References $dbr, $type, as, DB_SLAVE, getArticleID(), getRestrictionTypes(), wfGetDB(), and wfTimestampNow().

Referenced by loadRestrictionsFromResultWrapper().

static Title::makeName (   $ns,
  $title,
  $fragment = '',
  $interwiki = '',
  $canonicalNamespace = false 
)
static

Make a prefixed DB key from a DB key and a namespace index.

Parameters
int$nsNumerical representation of the namespace
string$titleThe DB key form the title
string$fragmentThe link fragment (after the "#")
string$interwikiThe interwiki prefix
bool$canonicalNamespaceIf true, use the canonical name for $ns instead of the localized version.
Returns
string The prefixed form of the title

Definition at line 738 of file Title.php.

References $name, $title, $wgContLang, MWNamespace\getCanonicalName(), and global.

Referenced by MovePageForm\doSubmit(), makeTitleSafe(), and TitleCleanup\processRow().

static& Title::makeTitle (   $ns,
  $title,
  $fragment = '',
  $interwiki = '' 
)
static

Create a new Title from a namespace index and a DB key.

It's assumed that $ns and $title are valid, for instance when they came directly from the database or a special page name. For convenience, spaces are converted to underscores so that eg user_text fields can be used directly.

Parameters
int$nsThe namespace of the article
string$titleThe unprefixed database key form
string$fragmentThe link fragment (after the "#")
string$interwikiThe interwiki prefix
Returns
Title The new object

Definition at line 524 of file Title.php.

References $t, $title, getContentModel(), in, and wfUrlencode().

Referenced by FakeDimensionFile\__construct(), JobSpecification\__construct(), NewParserTest\addDBDataOnce(), CategoryViewer\addFragmentToTitle(), LinkBatch\addResultToCache(), ChangesFeed\buildItems(), FindOrphanedFiles\checkFiles(), LocalRepo\checkRedirect(), Orphans\checkSeparation(), CompressOld\compressWithConcat(), ApiPageSetTest\createPageSetWithRedirect(), SpecialRedirect\dispatchUser(), JobQueueDB\doPop(), CdnCacheUpdate\doUpdate(), LinkHolderArray\doVariants(), CheckBadRedirects\execute(), ApiQueryDeletedrevs\execute(), ApiQueryFilearchive\execute(), DeleteDefaultMessages\execute(), AttachLatest\execute(), FixDoubleRedirects\execute(), DumpLinks\execute(), PurgeChangedPages\execute(), NukeNS\execute(), DeleteEqualMessages\execute(), ApiQueryLogEvents\extractRowInfo(), ApiQueryWatchlist\extractRowInfo(), ApiQueryContributions\extractRowInfo(), ApiQueryRecentChanges\extractRowInfo(), ApiFeedContributions\feedItem(), SpecialNewpages\feedItem(), QueryPage\feedResult(), SpecialRecentChanges\filterByCategories(), ForeignAPIRepo\findBySha1(), DoubleRedirectJob\fixRedirects(), fixSpecialName(), WikiFilePage\followRedirect(), FeedUtils\formatDiff(), ApiParse\formatLinks(), UncategorizedCategoriesPage\formatResult(), UnusedCategoriesPage\formatResult(), AncientPagesPage\formatResult(), UnusedtemplatesPage\formatResult(), WantedCategoriesPage\formatResult(), ListDuplicatedFilesPage\formatResult(), BrokenRedirectsPage\formatResult(), ListredirectsPage\formatResult(), DoubleRedirectsPage\formatResult(), MIMEsearchPage\formatResult(), DeletedContribsPager\formatRevisionRow(), NewFilesPager\formatRow(), SpecialNewpages\formatRow(), AllMessagesTablePager\formatValue(), ImageListPager\formatValue(), SearchSuggestion\fromText(), ParserTest\fuzzTest(), GenerateSitemap\generateLimit(), LinksUpdate\getAddedLinks(), getBaseTitle(), getBrokenLinksFrom(), User\getCanonicalName(), getCascadeProtectionSources(), ApiUpload\getChunkResult(), ApiErrorFormatter\getDummyTitle(), DoubleRedirectJob\getFinalDestination(), WikiPage\getHiddenCategories(), ChangeTagsLogItem\getHTML(), RevDelLogItem\getHTML(), JobQueueRedis\getJobFromFields(), JobQueueRedis\getJobFromUidInternal(), JobQueueDB\getJobIterator(), SpecialExport\getLinks(), getLinksFrom(), getLinksTo(), ApiDocumentationTest\getMain(), MessageCache\getMsgFromNamespace(), SearchNearMatcher\getNearMatchInternal(), ActionTest\getPage(), NewUsersLogFormatter\getPreloadTitles(), ApiQueryInfo\getProtectionInfo(), SpecialRandomInCategory\getRandomTitle(), SpecialMypage\getRedirect(), SpecialMytalk\getRedirect(), File\getRedirectedTitle(), WikiFilePage\getRedirectTarget(), ListredirectsPage\getRedirectTarget(), WikiPage\getRedirectTarget(), ApiPageSet\getRedirectTargets(), LinksUpdate\getRemovedLinks(), RollbackEdits\getRollbackTitles(), getRootTitle(), getSubjectPage(), getTalkPage(), DatabaseLogEntry\getTarget(), RCDatabaseLogEntry\getTarget(), Parser\getTemplateDom(), EditPage\getTemplates(), RecentChange\getTitle(), Message\getTitle(), SpecialPage\getTitleFor(), SpecialPageTest\getTitleForWithWarningProvider(), ResourceLoaderWikiModule\getTitleInfo(), User\getTokenUrl(), UserRightsProxy\getUserPage(), User\getUserPage(), FixDefaultJsonContentPages\handleRow(), ImagePage\imageLinks(), ApiPageSet\initFromQueryResult(), ApiPageSet\initFromRevIDs(), GenerateSitemap\main(), MediaWiki\main(), NamespaceConflictChecker\mergePage(), Revision\newFromArchiveRow(), JobSpecification\newFromArray(), EnqueueJob\newFromJobsByWiki(), ForeignDBFile\newFromRow(), OldLocalFile\newFromRow(), LocalFile\newFromRow(), ArchivedFile\newFromRow(), Article\newFromTitle(), Revision\newNullRevision(), SqlSearchResultSet\next(), CategoryMembershipChangeJob\notifyUpdatesForRevision(), XmlDumpWriter\openPage(), MessageCache\parse(), MediaWiki\parseTitle(), ApiUpload\performUpload(), PopulateContentModel\populateRevisionOrArchive(), RebuildTextIndex\populateSearchIndex(), SpecialBlock\processForm(), WatchlistCleanup\processRow(), CapsCleanup\processRow(), SpecialUnblock\processUnblock(), TitleTest\provideCreateFragmentTitle(), WikitextContentHandlerTest\provideMakeRedirectContent(), GlobalWithDBTest\provideWfIsBadImageList(), PurgeChangedFiles\purgeFromLogType(), PurgeList\purgeNamespace(), LinkHolderArray\replaceInternal(), ApiQueryDeletedRevisions\run(), ApiQueryAllDeletedRevisions\run(), ApiQueryLangBacklinks\run(), ApiQueryIWBacklinks\run(), ApiQueryImages\run(), ApiQueryProtectedTitles\run(), ApiQueryWatchlistRaw\run(), ApiQueryExtLinksUsage\run(), ApiQueryCategories\run(), ApiQueryAllCategories\run(), ApiQueryPagesWithProp\run(), ApiQueryQueryPage\run(), ApiQueryCategoryMembers\run(), ApiQueryAllPages\run(), ApiQueryLinks\run(), ApiQueryAllImages\run(), ApiQueryBacklinksprop\run(), DoubleRedirectJob\run(), ApiQueryAllLinks\run(), ApiQueryRecentChanges\run(), ApiQueryBacklinks\runFirstQuery(), ApiQueryRandom\runQuery(), ApiOpenSearch\search(), SearchSuggestion\setText(), TitlePermissionTest\setTitle(), SpecialMIMESearchTest\setUp(), ArticleTest\setUp(), TitlePermissionTest\setUp(), ParserTest\setupDatabase(), SpecialAllPages\showChunk(), SpecialWhatLinksHere\showIndirectLinks(), SpecialPrefixindex\showPrefixChunk(), SpecialUpload\showUploadWarning(), TitlePermissionTest\testCascadingSourcesRestrictions(), TitleTest\testExists(), NewParserTest\testFuzzTests(), SpecialPageTest\testGetTitleFor(), WikiCategoryPageTest\testHiddenCategory_PropertyIsSet(), WikiCategoryPageTest\testHiddenCategory_PropertyNotSet(), SpecialPageTest\testInvalidGetTitleFor(), TitleTest\testIsAlwaysKnownOnInterwiki(), RefreshLinksPartitionTest\testRefreshLinks(), SpecialSearchTest\testRewriteQueryWithSuggestion(), LinksUpdateTest\testUpdate_pagelinks(), CoreParserFunctions\urlFunction(), Linker\userLink(), Linker\userTalkLink(), ImagePage\view(), XmlDumpWriter\writeLogItem(), and XmlDumpWriter\writeRevision().

static Title::makeTitleSafe (   $ns,
  $title,
  $fragment = '',
  $interwiki = '' 
)
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.

Parameters
int$nsThe namespace of the article
string$titleDatabase key form
string$fragmentThe link fragment (after the "#")
string$interwikiInterwiki prefix
Returns
Title|null The new object, or null on an error

Definition at line 548 of file Title.php.

References $t, $title, MWNamespace\exists(), and makeName().

Referenced by AllMessagesTablePager\__construct(), UsersPager\__construct(), ImageListPager\__construct(), ActiveUsersPager\__construct(), OutputPage\addCategoryLinks(), ParserOutput\addTrackingCategory(), ImageCleanup\buildSafeTitle(), ChangeTags\canCreateTag(), NaiveImportTitleFactory\createTitleFromForeignTitle(), NamespaceImportTitleFactory\createTitleFromForeignTitle(), DifferenceEngine\deletedLink(), SpecialRedirect\dispatchFile(), MovePageForm\doSubmit(), LinkHolderArray\doVariants(), SpecialContributions\execute(), SpecialLog\execute(), SpecialExport\execute(), MakeTestEdits\execute(), ApiFeedContributions\execute(), ImportSiteScripts\execute(), RebuildFileCache\execute(), MovePageForm\execute(), ApiQueryInfo\execute(), SpecialNewpages\form(), Linker\formatAutocomments(), Linker\formatLinksInComment(), PageQueryPage\formatResult(), FewestrevisionsPage\formatResult(), WantedQueryPage\formatResult(), MostlinkedCategoriesPage\formatResult(), UnwatchedpagesPage\formatResult(), MostcategoriesPage\formatResult(), ShortPagesPage\formatResult(), MostinterwikisPage\formatResult(), MostlinkedTemplatesPage\formatResult(), MostlinkedPage\formatResult(), SpecialProtectedtitles\formatRow(), ProtectedPagesPager\formatValue(), ImageListPager\formatValue(), Preferences\generateSkinOptions(), NamespaceConflictChecker\getAlternateTitle(), CategoryPager\getBody(), LinksUpdate\getCategoryInsertions(), NamespaceConflictChecker\getDestinationTitle(), ImagePageTest\getImagePage(), ImagePage404Test\getImagePage(), SpecialAllPages\getNamespaceKeyAndText(), SpecialEditWatchlist\getNormalForm(), WantedFilesPage\getPageHeader(), NewPagesPager\getQueryInfo(), RandomPage\getRandomTitle(), SpecialPage\getSafeTitleFor(), MergeHistoryPager\getStartBody(), LogPager\getStartBody(), getSubpage(), SpecialBlock\getTargetUserTitle(), Category\getTitle(), UploadBase\getTitle(), SpecialUpload\getUploadForm(), SpecialUpload\getWatchCheck(), SpecialEditWatchlist\getWatchlist(), User\idFromName(), LogPager\limitPerformer(), ArchivedFile\loadFromRow(), Skin\makeNSUrl(), Linker\makeThumbLink2(), TitleCleanup\moveInconsistentPage(), moveSubpages(), Category\newFromName(), File\normalizeTitle(), SpecialRandomInCategory\onSubmit(), ImageQueryPage\outputResults(), CoreParserFunctions\pagesincategory(), LanguageConverter\parseCachedTable(), SpecialTrackingCategories\prepareTrackingCategoriesData(), ImageCleanup\processRow(), RefreshLinksJob\run(), CategoryFinder\seed(), RevisionDeleteUser\setUsernameBitfields(), SpecialUndelete\showHistory(), SpecialBookSources\showList(), SpecialUndelete\showList(), SpecialAllPages\showToplevel(), SpecialUpload\showViewDeletedLinks(), Preferences\skinPreferences(), CoreParserFunctions\special(), PrefixSearch\specialSearch(), ExtraParserTest\testTrackingCategory(), LinksUpdateTest\testUpdate_iwlinks(), ApiQueryBase\titlePartToKey(), ApiFileRevert\validateParameters(), ApiBase\validateUser(), and wfStreamThumb().

Title::missingPermissionError (   $action,
  $short 
)
private

Get a description array when the user doesn't have the right to perform $action (i.e.

when User::isAllowed() returns false)

Parameters
string$actionThe action to check
bool$shortShort circuit on first error
Returns
array List of errors

Definition at line 2408 of file Title.php.

References $wgLang, User\getGroupsWithPermission(), and global.

Referenced by checkQuickPermissions(), and checkReadPermissions().

Title::moveNoAuth ( $nt)

Move this page without authentication.

Deprecated:
since 1.25 use MovePage class instead
Parameters
Title$ntThe new page Title
Returns
array|bool True on success, getUserPermissionsErrors()-like array on failure

Definition at line 3583 of file Title.php.

References moveTo(), and wfDeprecated().

Title::moveSubpages (   $nt,
  $auth = true,
  $reason = '',
  $createRedirect = true 
)

Move this page's subpages to be subpages of $nt.

Parameters
Title$ntMove target
bool$authWhether $wgUser's permissions should be checked
string$reasonThe reason for the move
bool$createRedirectWhether to create redirects from the old subpages to the new ones Ignored if the user doesn't have the 'suppressredirect' right
Returns
array Array with old page titles as keys, and strings (new page titles) or arrays (errors) as values, or an error array with numeric indices if no pages were moved

Definition at line 3687 of file Title.php.

References $count, $retval, $success, as, StringUtils\escapeRegexReplacement(), getArticleID(), MWNamespace\getCanonicalName(), getDBkey(), getNamespace(), getSubpages(), global, MWNamespace\hasSubpages(), makeTitleSafe(), and userCan().

Title::moveTo ( $nt,
  $auth = true,
  $reason = '',
  $createRedirect = true 
)

Move a title to a new location.

Deprecated:
since 1.25, use the MovePage class instead
Parameters
Title$ntThe new title
bool$authIndicates whether $wgUser's permissions should be checked
string$reasonThe reason for the move
bool$createRedirectWhether to create a redirect from the old title to the new title. Ignored if the user doesn't have the suppressredirect right.
Returns
array|bool True on success, getUserPermissionsErrors()-like array on failure

Definition at line 3653 of file Title.php.

References $status, $wgUser, global, and isValidMoveOperation().

Referenced by moveNoAuth().

static Title::nameOf (   $id)
static

Get the prefixed DB key associated with an ID.

Parameters
int$idThe page_id of the article
Returns
Title|null An object representing the article, or null if no such article was found

Definition at line 584 of file Title.php.

References $dbr, $s, DB_SLAVE, and wfGetDB().

static Title::newFromDBkey (   $key)
static

Create a new Title from a prefixed DB key.

Parameters
string$keyThe database key, which has underscores instead of spaces, possibly including namespace and interwiki prefixes
Returns
Title|null Title, or null on an error

Definition at line 221 of file Title.php.

References $key, and $t.

Referenced by LinkCache\addLink(), and TitleTest\testWgWhitelistReadRegexp().

static Title::newFromID (   $id,
  $flags = 0 
)
static
static Title::newFromIDs (   $ids)
static

Make an array of titles from an array of IDs.

Parameters
int[]$ids Array of IDs
Returns
Title[] Array of Titles

Definition at line 439 of file Title.php.

References $dbr, $res, $titles, as, DB_SLAVE, newFromRow(), and wfGetDB().

static Title::newFromLinkTarget ( LinkTarget  $linkTarget)
static
static Title::newFromText (   $text,
  $defaultNamespace = NS_MAIN 
)
static

Create a new Title from text, such as what one would find in a link.

De- codes any HTML entities in the text.

Parameters
string | int | null$textThe link text; spaces, prefixes, and an initial ':' indicating the main namespace are accepted.
int$defaultNamespaceThe 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().
Exceptions
InvalidArgumentException
Returns
Title|null Title or null on an error.

Definition at line 277 of file Title.php.

References newFromTextThrow().

Referenced by PreferencesTest\__construct(), DoubleRedirectJob\__construct(), ImageListPager\__construct(), SearchUpdate\__construct(), Installer\__construct(), LinkHolderArray\__wakeup(), ParserTest\addArticle(), MediaWikiTestCase\addCoreDBData(), BackupDumperPageTest\addDBData(), TextPassDumperDatabaseTest\addDBData(), FetchTextTest\addDBData(), SpecialMyLanguageTest\addDBDataOnce(), ApiQueryBasicTest\addDBDataOnce(), BackupDumperLoggerTest\addLogEntry(), Skin\addToSidebarPlain(), ApiFormatXml\addXslt(), ApiQuerySiteinfo\appendRightsInfo(), EditPageTest\assertEdit(), CoreParserFunctions\basepagename(), CoreParserFunctions\basepagenamee(), NamespaceImportTitleFactoryTest\basicProvider(), NaiveImportTitleFactoryTest\basicProvider(), SubpageImportTitleFactoryTest\basicProvider(), Parser\braceSubstitution(), SkinTemplate\buildPersonalUrls(), ImageListPager\buildQueryConds(), CoreParserFunctions\cascadingsources(), SpecialComparePages\checkExistingTitle(), LocalRepo\checkRedirect(), Skin\checkTitle(), ApiFeedWatchlist\createFeedItem(), RevisionStorageTest\createPage(), TestPageProps\createPage(), SubpageImportTitleFactory\createTitleFromForeignTitle(), PrefixSearch\defaultSearchBackend(), UploadFromUrlTest\deleteFile(), ApiTestCaseUpload\deleteFileByFileName(), ApiTestCaseUpload\deleteFileByTitle(), CoreParserFunctions\displaytitle(), SpecialExport\doExport(), SpecialRecentChangesLinked\doMainQuery(), PurgeList\doPurge(), GenderCache\doTitlesArray(), Skin\drawCategoryBrowser(), ApiTestCase\editPage(), ApiUndelete\execute(), ApiMergeHistory\execute(), ApiMove\execute(), PageExists\execute(), ApiRevisionDelete\execute(), Undelete\execute(), ApiWatch\execute(), SpecialLog\execute(), ApiExpandTemplates\execute(), ApiQueryAllMessages\execute(), ApiQueryLangLinks\execute(), ApiQueryIWLinks\execute(), MaintenanceFormatInstallDoc\execute(), SpecialListGroupRights\execute(), GetTextMaint\execute(), NukePage\execute(), Protect\execute(), ApiQueryLogEvents\execute(), SpecialWhatLinksHere\execute(), FixDoubleRedirects\execute(), ApiParse\execute(), EditCLI\execute(), DumpIterator\execute(), ImportTextFiles\execute(), RollbackEdits\execute(), DeleteBatch\execute(), SpecialExpandTemplates\execute(), MoveBatch\execute(), BenchmarkParse\execute(), SpecialEditTags\execute(), MovePageForm\execute(), FileDuplicateSearchPage\execute(), SpecialRevisionDelete\execute(), SpecialEditWatchlist\extractTitles(), SubpageImportTitleFactoryTest\failureProvider(), SpecialMyLanguage\findTitle(), LanguageConverter\findVariantLink(), ApiHelp\fixHelpLinks(), Skin\footerLink(), foreach(), Linker\formatAutocomments(), ApiParse\formatIWLinks(), ApiParse\formatLangLinks(), Linker\formatLinksInComment(), LogFormatter\formatParameterValue(), LogFormatter\formatParameterValueForApi(), MIMEsearchPage\formatResult(), CoreParserFunctions\fullpagename(), CoreParserFunctions\fullpagenamee(), CoreParserFunctions\gender(), MoveLogFormatter\getActionLinks(), User\getCanonicalName(), EnhancedChangesListTest\getCategorizationChange(), Skin\getCategoryLinks(), ResourceLoaderStartUpModule\getConfigSettings(), ResourceLoaderWikiModule\getContent(), RCCacheEntryFactoryTest\getContext(), Skin\getCopyright(), ApiFeedRecentChanges\getFeedObject(), User\getGroupPage(), SpecialStatistics\getGroupStats(), OutputPage\getHeadLinksArray(), ApiPageSet\getInterwikiTitlesAsResult(), SkinTemplate\getLanguages(), IRCColourfulRCFeedFormatter\getLine(), SpecialExport\getLinks(), MergeLogFormatter\getMessageParameters(), MoveLogFormatter\getMessageParameters(), ProtectLogFormatter\getMessageParameters(), SearchNearMatcher\getNearMatchInternal(), WantedFilesPage\getPageHeader(), getParentCategoryTree(), EditPage\getPreloadedContent(), MergeLogFormatter\getPreloadTitles(), ProtectLogFormatter\getPreloadTitles(), MoveLogFormatter\getPreloadTitles(), NewFilesPager\getQueryInfo(), ApiRollback\getRbTitle(), CssContent\getRedirectTarget(), JavaScriptContent\getRedirectTarget(), WikitextContent\getRedirectTargetAndText(), SpecialChangeCredentials\getReturnUrl(), SpecialRecentChangesLinked\getTargetTitle(), TestRecentChangesHelper\getTestContext(), ParserOutput\getText(), DifferenceEngineTest\getTitle(), CLIParser\getTitle(), UploadBase\getTitle(), ResourceLoaderWikiModule\getTitleInfo(), ApiBase\getTitleOrPageId(), SpecialSearch\goResult(), ParserMethodsTest\helperParserFunc(), ApiPageSet\initFromRevIDs(), SideBarTest\initMessagesHref(), MediaWikiTestCase\insertPage(), User\isValidUserName(), LogPager\limitTitle(), PageArchive\listPagesByPrefix(), LoginSignupSpecialPage\load(), SpecialUndelete\loadRequest(), SpecialMergeHistory\loadRequestParams(), ChangeTags\logTagManagementAction(), MediaWiki\main(), SkinTemplate\makeArticleUrlDetails(), Skin\makeI18nUrl(), Parser\makeImage(), Skin\makeKnownUrlDetails(), MessageCacheTest\makePage(), SkinTemplate\makeTalkUrlDetails(), PPFuzzTester\makeTitle(), LinksUpdateTest\makeTitleAndParserOutput(), Skin\makeUrl(), Skin\makeUrlDetails(), TitleCleanup\moveIllegalPage(), CoreParserFunctions\mwnamespace(), CoreParserFunctions\namespacee(), CoreParserFunctions\namespacenumber(), CategoryMembershipChangeTest\newChange(), ForeignAPIFile\newFromTitle(), JobQueueMemoryTest\newJobSpecification(), newMainPage(), WikiPageTest\newPage(), RevisionTest\newTestRevision(), SearchEngine\normalizeNamespaces(), MediaWikiSite\normalizePageName(), SpecialRandomInCategory\onSubmit(), SpecialPageLanguage\onSubmit(), SpecialChangeContentModel\onSubmit(), SpecialChangeEmail\onSuccess(), WikiExporter\pageByName(), CoreParserFunctions\pageid(), CoreParserFunctions\pagename(), CoreParserFunctions\pagenamee(), CoreParserFunctions\pagesize(), ApiQueryBase\prefixedTitlePartToKey(), SpecialPage\prefixSearchString(), FileDuplicateSearchPage\prefixSearchSubpages(), SearchEngine\processCompletionResults(), WikiImporter\processLogItem(), TitleCleanup\processRow(), WatchlistCleanup\processRow(), CoreParserFunctions\protectionexpiry(), CoreParserFunctions\protectionlevel(), LogFormatterTest\provideApiParamFormatting(), ApiFormatXmlTest\provideGeneralEncoding(), WatchedItemStoreUnitTest\provideLinkTargetPairs(), WatchedItemUnitTest\provideUserTitleTimestamp(), SearchExactMatchRescorer\redirectTargetsToRedirect(), Parser\renderImageGallery(), Parser\replaceInternalLinks2(), SearchExactMatchRescorer\rescore(), OutputPage\returnToMain(), CoreParserFunctions\revisionday(), CoreParserFunctions\revisionday2(), CoreParserFunctions\revisionid(), CoreParserFunctions\revisionmonth(), CoreParserFunctions\revisionmonth1(), ApiComparePages\revisionOrTitleOrId(), CoreParserFunctions\revisiontimestamp(), CoreParserFunctions\revisionuser(), CoreParserFunctions\revisionyear(), SpecialComparePages\revOrTitle(), CoreParserFunctions\rootpagename(), CoreParserFunctions\rootpagenamee(), ApiQueryDeletedRevisions\run(), ApiQueryImages\run(), ApiQueryCategories\run(), ApiQueryLinks\run(), ParserTest\runTest(), PrefixSearch\search(), SpecialChangeContentModel\setParameter(), WikiImporter\setTargetRootPage(), Parser\setTitle(), TextContentTest\setUp(), RecentChangeTest\setUp(), ApiRevisionDeleteTest\setUp(), ParserPreloadTest\setUp(), ApiOptionsTest\setUp(), LogFormatterTest\setUp(), MagicVariableTest\setUp(), ApiFormatXmlTest\setUpBeforeClass(), EditPage\showCustomIntro(), SpecialSearch\showInterwikiHit(), OutputPage\showPermissionsErrorPage(), SpecialSearch\showResults(), LoginHelper\showReturnToPage(), SpecialEditWatchlist\showTitles(), CoreParserFunctions\subjectpagename(), CoreParserFunctions\subjectpagenamee(), CoreParserFunctions\subjectspace(), CoreParserFunctions\subjectspacee(), WebInstallerName\submit(), CoreParserFunctions\subpagename(), CoreParserFunctions\subpagenamee(), Skin\subPageSubtitle(), CoreParserFunctions\talkpagename(), CoreParserFunctions\talkpagenamee(), CoreParserFunctions\talkspace(), CoreParserFunctions\talkspacee(), WatchedItemUnitTest\testAddWatch(), WatchedItemStoreUnitTest\testAddWatch_anonymousUser(), WatchedItemStoreUnitTest\testAddWatch_nonAnonymousUser(), EditPageTest\testAutoMerge(), TagHookTest\testBadFunctionTagHooks(), TagHookTest\testBadTagHooks(), WatchedItemUnitTest\testBatchAddWatch(), SpecialPreferencesTest\testBug41337(), ParserMethodsTest\testCallParserFunction(), CategoryMembershipChangeTest\testChangeAddedNoRev(), CategoryMembershipChangeTest\testChangeAddedWithRev(), CategoryMembershipChangeTest\testChangeRemovedNoRev(), CategoryMembershipChangeTest\testChangeRemovedWithRev(), EditPageTest\testCheckDirectEditingDisallowed_forNonTextContent(), MergeHistoryTest\testCheckPermissions(), ExtraParserTest\testCleanSig(), ExtraParserTest\testCleanSigDisabled(), TitleMethodsTest\testClearCaches(), RevisionTest\testConstructWithContent(), ApiQueryRevisionsTest\testContentComesWithContentModelAndFormat(), TestSample\testCreateBasicListOfTitles(), TextContentTest\testDeletionUpdates(), WikiPageTest\testDoDeleteArticle(), WikiPageTest\testDoEdit(), WatchedItemIntegrationTest\testDuplicateAllAssociatedEntries(), WatchedItemStoreIntegrationTest\testDuplicateAllAssociatedEntries(), WatchedItemStoreUnitTest\testDuplicateAllAssociatedEntries_nothingToDuplicate(), WatchedItemUnitTest\testDuplicateEntries(), WatchedItemStoreUnitTest\testDuplicateEntry_nothingToDuplicate(), WatchedItemStoreUnitTest\testDuplicateEntry_somethingToDuplicate(), ApiEditPageTest\testEdit_redirect(), ApiEditPageTest\testEdit_redirectText(), ApiEditPageTest\testEditAppend(), ApiEditPageTest\testEditConflict(), ApiEditPageTest\testEditConflict_bug41990(), ApiEditPageTest\testEditConflict_newSection(), UserTest\testEditCount(), ApiEditPageTest\testEditNewSection(), ApiEditPageTest\testEditSection(), TitleMethodsTest\testEquals(), TitleTest\testFixSpecialNameRetainsParameter(), LinkerTest\testFormatComment(), LinkerTest\testFormatLinksInComment(), TagHookTest\testFunctionTagHooks(), ContentHandlerTest\testGetAutosummary(), TitleTest\testGetBaseText(), RevisionTest\testGetContentClone(), TitleMethodsTest\testGetContentModel(), ContentHandlerTest\testGetDefaultModelFor(), ContentHandlerTest\testGetForTitle(), TitleTest\testGetFragment(), HTMLFormTest\testGetHTML_empty(), HTMLFormTest\testGetHTML_noPrepare(), MergeHistoryTest\testGetMergedRevisionCount(), WatchedItemIntegrationTest\testGetNotificationTimestamp_falseOnNotAllowed(), WatchedItemIntegrationTest\testGetNotificationTimestamp_falseOnNotWatched(), TitleMethodsTest\testGetOtherPage(), ContentHandlerTest\testGetPageLanguage(), TitleTest\testGetPageViewLanguage(), TextContentTest\testGetParserOutput(), ExtraParserTest\testGetPreloadText(), ApiWatchTest\testGetRollbackToken(), TitleTest\testGetRootText(), WikitextContentTest\testGetSecondaryDataUpdates(), ParserMethodsTest\testGetSections(), TitleTest\testGetSubpageText(), TitleTest\testGetTitleValue(), TitleMethodsTest\testHasContentModel(), TitleMethodsTest\testHasSubjectNamespace(), RecentChangeTest\testHiddenCategoryChange(), ImportLinkCacheIntegrationTest\testImportForImportSource(), TitleMethodsTest\testInNamespace(), TitleMethodsTest\testInNamespaces(), ApiResultTest\testInstanceDataMethods(), TitleTest\testIsAlwaysKnown(), WikiPageTest\testIsCountable(), TitleMethodsTest\testIsCssJsSubpage(), TitleMethodsTest\testIsCssOrJsPage(), TitleMethodsTest\testIsCssSubpage(), TitleMethodsTest\testIsJsSubpage(), MergeHistoryTest\testIsValidMerge(), MergeHistoryTest\testIsValidMergeRevisionLimit(), MovePageTest\testIsValidMove(), TitleTest\testIsValidMoveOperation(), WatchedItemUnitTest\testIsWatched(), WatchedItemIntegrationTest\testIsWatched_falseOnNotAllowed(), TitleMethodsTest\testIsWikitextPage(), ExtraParserTest\testLongNumericLinesDontKillTheParser(), ContentHandlerTest\testMakeContent(), JavaScriptContentHandlerTest\testMakeRedirectContent(), CssContentHandlerTest\testMakeRedirectContent(), WikitextContentHandlerTest\testMakeRedirectContent(), LinksUpdateTest\testOnAddingAndRemovingCategory_recentChangesRowIsAdded(), LinksUpdateTest\testOnAddingAndRemovingCategoryToTemplates_embeddingPagesAreIgnored(), ExportTest\testPageByTitle(), ExtraParserTest\testParse(), NewParserTest\testParserTest(), ApiQueryAllPagesTest\testPrefixNormalizationSearchBug(), ExtraParserTest\testPreprocess(), ParserMethodsTest\testPreSaveTransform(), ExtraParserTest\testPreSaveTransform(), ApiPurgeTest\testPurgeMainPage(), ParserMethodsTest\testRecursiveParse(), ImportLinkCacheIntegrationTest\testReImportForImportSource(), WatchedItemUnitTest\testRemoveWatch(), WatchedItemIntegrationTest\testRemoveWatch_falseOnNotAllowed(), WatchedItemStoreUnitTest\testResetNotificationTimestamp_anonymousUser(), WatchedItemStoreUnitTest\testResetNotificationTimestamp_item(), WatchedItemStoreUnitTest\testResetNotificationTimestamp_noItem(), WatchedItemStoreUnitTest\testResetNotificationTimestamp_noItemForced(), SpecialSearchTest\testSearchTermIsNotExpanded(), TitleTest\testSecureAndSplitValid(), MessageTest\testSerialization(), ApiResultTest\testStaticDataMethods(), ApiEditPageTest\testSupportsDirectApiEditing_withContentHandlerOverride(), TagHookTest\testTagHooks(), TemplateCategoriesTest\testTemplateCategories(), ArticleTablesTest\testTemplatelinksUsesContentLanguage(), MovePageTest\testTitleMoveCompleteIntegrationTest(), TestSample\testTitleObjectFromObject(), TestSample\testTitleObjectStringConversion(), ApiQueryTest\testTitlesAreRejectedIfInvalid(), ApiQueryTest\testTitlesGetNormalized(), ExtraParserTest\testTrackingCategory(), MediaWikiTest\testTryNormaliseRedirect(), ImportTest\testUnknownXMLTags(), LinksUpdateTest\testUpdate_langlinks(), LinksUpdateTest\testUpdate_pagelinks(), LinksUpdateTest\testUpdate_templatelinks(), WatchedItemIntegrationTest\testUpdateAndResetNotificationTimestamp(), WatchedItemStoreIntegrationTest\testUpdateAndResetNotificationTimestamp(), JavaScriptContentTest\testUpdateRedirect(), RevisionStorageTest\testUserWasLastToEdit(), WatchedItemIntegrationTest\testWatchAndUnWatchItem(), WatchedItemStoreIntegrationTest\testWatchAndUnWatchItem(), RequestContextTest\testWikiPageTitle(), SpecialEditWatchlist\unwatchTitles(), and CoreParserFunctions\urlFunction().

static Title::newFromTextThrow (   $text,
  $defaultNamespace = NS_MAIN 
)
static

Like Title::newFromText(), but throws MalformedTitleException when the title is invalid, rather than returning null.

The exception subclasses encode detailed information about why the title is invalid.

See also
Title::newFromText
Since
1.25
Parameters
string$textTitle text to check
int$defaultNamespace
Exceptions
MalformedTitleExceptionIf the title is invalid
Returns
Title

Definition at line 307 of file Title.php.

References $t, Sanitizer\decodeCharReferencesAndNormalize(), BagOStuff\get(), NS_MAIN, and HashBagOStuff\set().

Referenced by newFromText(), MediaWiki\parseTitle(), ApiPageSet\processTitlesArray(), TitleTest\testSecureAndSplitInvalid(), HTMLTitleTextField\validate(), and SpecialChangeContentModel\validateTitle().

static Title::newFromTitleValue ( TitleValue  $titleValue)
static

Create a new Title from a TitleValue.

Parameters
TitleValue$titleValueAssumed to be safe.
Returns
Title

Definition at line 240 of file Title.php.

Referenced by TitleTest\testNewFromTitleValue().

static Title::newFromURL (   $url)
static

THIS IS NOT THE FUNCTION YOU WANT.

Use Title::newFromText().

Example of wrong and broken code: $title = Title::newFromURL( $wgRequest->getVal( 'title' ) );

Example of right code: $title = Title::newFromText( $wgRequest->getVal( 'title' ) );

Create a new Title from URL-encoded text. Ensures that the given title's length does not exceed the maximum.

Parameters
string$urlThe title, as might be taken from a URL
Returns
Title|null The new object, or null on an error

Definition at line 354 of file Title.php.

References $t.

Referenced by MediaWiki\parseTitle(), and CoreParserFunctions\urlFunction().

Title::pageCond ( )

Get an associative array for selecting this title from the "page" table.

Returns
array Array suitable for the $where parameter of DB::select()

Definition at line 3915 of file Title.php.

References $mArticleID, $mDbkeyform, and $mNamespace.

Referenced by getTouched(), invalidateCache(), isNewPage(), and isSingleRevRedirect().

Title::prefix (   $name)
private

Prefix some arbitrary text with the namespace or interwiki prefix of this object.

Parameters
string$nameThe text
Returns
string The prefixed text

Definition at line 1419 of file Title.php.

References $name, getNsText(), and isExternal().

Referenced by getPrefixedDBkey(), getPrefixedText(), and getPrefixedURL().

static Title::purgeExpiredRestrictions ( )
static

Purge expired restrictions from the page_restrictions table.

Definition at line 3014 of file Title.php.

References $fname, IDatabase\addQuotes(), DeferredUpdates\addUpdate(), DB_MASTER, IDatabase\delete(), IDatabase\timestamp(), wfGetDB(), and wfReadOnly().

Referenced by WikiPage\doUpdateRestrictions().

Title::purgeSquid ( )

Purge all applicable CDN URLs.

Definition at line 3569 of file Title.php.

References DeferredUpdates\addUpdate(), getCdnUrls(), and DeferredUpdates\PRESEND.

Referenced by WikiPage\onArticleCreate(), WikiPage\onArticleDelete(), and WikiPage\onArticleEdit().

Title::quickUserCan (   $action,
  $user = null 
)

Can $user perform $action on this page? This skips potentially expensive cascading permission checks as well as avoids expensive error formatting.

Suitable for use for nonessential UI controls in common cases, but not for functional access control.

May provide false positives, but should never provide a false negative.

Parameters
string$actionAction that permission needs to be checked for
User$userUser to check (since 1.19); $wgUser will be used if not provided.
Returns
bool

Definition at line 1877 of file Title.php.

References $user, and userCan().

Referenced by MovePageForm\showForm().

Title::resetArticleID (   $newid)

This clears some fields in this object, and clears any associated keys in the "bad links" section of the link cache.

Parameters
int$newidThe new Article ID

Definition at line 3270 of file Title.php.

References LinkCache\singleton().

Title::resultToError (   $errors,
  $result 
)
private

Add the resulting error code to the errors array.

Parameters
array$errorsList of current errors
array$resultResult of errors
Returns
array List of errors

Definition at line 2015 of file Title.php.

Referenced by checkPermissionHooks().

Title::secureAndSplit ( )
private

Secure and split - main initialisation function for this object.

Assumes that mDbkeyform has been set, and 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.

Exceptions
MalformedTitleExceptionOn invalid titles
Returns
bool True on success

Definition at line 3329 of file Title.php.

References $mDbkeyform, $mDefaultNamespace, getDefaultNamespace(), isExternal(), NS_MAIN, NS_SPECIAL, setFragment(), and wfUrlencode().

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 "#".

Deprecated for public use, use Title::makeTitle() with fragment parameter, or Title::createFragmentTarget(). Still in active use privately.

Parameters
string$fragmentText

Definition at line 1391 of file Title.php.

Referenced by secureAndSplit().

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 4398 of file Title.php.

References DeferredUpdates\addUpdate(), getNamespace(), and NS_CATEGORY.

Referenced by WikiPage\onArticleCreate(), and WikiPage\onArticleDelete().

Title::userCan (   $action,
  $user = null,
  $rigor = 'secure' 
)

Can $user perform $action on this page?

Parameters
string$actionAction that permission needs to be checked for
User$userUser to check (since 1.19); $wgUser will be used if not provided.
string$rigorSame format as Title::getUserPermissionsErrors()
Returns
bool

Definition at line 1890 of file Title.php.

References $user, $wgUser, getUserPermissionsErrorsInternal(), and global.

Referenced by checkActionPermissions(), ApiParse\checkReadPermissions(), moveSubpages(), and quickUserCan().

Title::validateFileMoveOperation (   $nt)
protected

Check if the requested move target is a valid file move target.

Todo:
move this to MovePage
Parameters
Title$ntTarget title
Returns
array List of errors

Definition at line 3625 of file Title.php.

References $wgUser, global, IDBAccessObject\READ_LATEST, wfFindFile(), and wfLocalFile().

Title::wasLocalInterwiki ( )

Was this a local interwiki link?

Returns
bool

Definition at line 830 of file Title.php.

References $mLocalInterwiki.

Member Data Documentation

int Title::$mArticleID = -1

Article ID, fetched from the link cache on demand.

Definition at line 83 of file Title.php.

Referenced by getArticleID(), and pageCond().

bool Title::$mCascadeRestriction

Cascade restrictions on this page to included templates and images?

Definition at line 104 of file Title.php.

Referenced by areRestrictionsCascading().

array Title::$mCascadeSources

Where are the cascading restrictions coming from on this page?

Definition at line 116 of file Title.php.

Referenced by getCascadeProtectionSources().

Title::$mCascadingRestrictions

Caching the results of getCascadeProtectionSources.

Definition at line 107 of file Title.php.

Referenced by getCascadeProtectionSources().

bool string Title::$mContentModel = false

ID of the page's content model, i.e.

one of the CONTENT_MODEL_XXX constants

Definition at line 92 of file Title.php.

Referenced by getContentModel().

string Title::$mDbkeyform = ''

Main part with underscores.

Definition at line 65 of file Title.php.

Referenced by getDBkey(), getUserCaseDBKey(), pageCond(), and secureAndSplit().

string bool null Title::$mDbPageLanguage = false
private

The page language code from the database, null if not saved in the database or false if not loaded, yet.

Definition at line 151 of file Title.php.

Referenced by getDbPageLanguageCode().

int Title::$mDefaultNamespace = NS_MAIN

Namespace index when there is no namespace.

Don't change the following default, NS_MAIN is hardcoded in several places. See bug 696. Zero except in {{transclusion}} tags.

Definition at line 132 of file Title.php.

Referenced by getDefaultNamespace(), and secureAndSplit().

int Title::$mEstimateRevisions
private

Estimated number of revisions; null of not loaded.

Definition at line 95 of file Title.php.

Referenced by estimateRevisionCount().

string Title::$mFragment = ''

Title fragment (i.e.

the bit after the #)

Definition at line 80 of file Title.php.

Referenced by getFragment().

bool Title::$mHasCascadingRestrictions
protected

Are cascading restrictions in effect on this page?

Definition at line 113 of file Title.php.

Referenced by getCascadeProtectionSources().

bool Title::$mHasSubpages
private

Whether a page has any subpages.

Definition at line 144 of file Title.php.

Referenced by hasSubpages().

string Title::$mInterwiki = ''

Interwiki prefix.

Definition at line 74 of file Title.php.

Referenced by getInterwiki().

bool Title::$mIsBigDeletion = null
private

Would deleting this page be a big deletion?

Definition at line 157 of file Title.php.

Referenced by isBigDeletion().

bool int Title::$mLatestID = false
protected

ID of most recent revision.

Definition at line 86 of file Title.php.

Referenced by getLatestRevID().

int Title::$mLength = -1
protected

The page length, 0 for special pages.

Definition at line 135 of file Title.php.

Referenced by getLength().

bool Title::$mLocalInterwiki = false
private

Was this Title created from a string with a local interwiki prefix?

Definition at line 77 of file Title.php.

Referenced by wasLocalInterwiki().

int Title::$mNamespace = NS_MAIN

Namespace index, i.e.

one of the NS_xxxx constants

Definition at line 71 of file Title.php.

Referenced by getNamespace(), and pageCond().

array Title::$mNotificationTimestamp = []
private

Associative array of user ID -> timestamp/false.

Definition at line 141 of file Title.php.

string bool Title::$mOldRestrictions = false
protected

Text form (spaces not underscores) of the main part.

Definition at line 101 of file Title.php.

bool Title::$mPageLanguage = false
private

The (string) language code of the page's language and content code.

Definition at line 147 of file Title.php.

string Title::$mPrefixedText = null
protected

Text form including namespace/interwiki, initialised on demand.

Definition at line 122 of file Title.php.

Referenced by getPrefixedText().

null Title::$mRedirect = null

Is the article at this title a redirect?

Definition at line 138 of file Title.php.

Referenced by isRedirect().

array Title::$mRestrictions = []

Array of groups allowed to edit this article.

Definition at line 98 of file Title.php.

Referenced by getAllRestrictions().

array Title::$mRestrictionsExpiry = []
protected

When do the restrictions on this page expire?

Definition at line 110 of file Title.php.

bool Title::$mRestrictionsLoaded = false

Boolean for initialisation on demand.

Definition at line 119 of file Title.php.

Referenced by areRestrictionsLoaded().

string Title::$mTextform = ''

Text form (spaces not underscores) of the main part.

Definition at line 59 of file Title.php.

Referenced by getSubpageText(), and getText().

mixed Title::$mTitleProtection

Cached value for getTitleProtection (create protection)

Definition at line 125 of file Title.php.

Referenced by getTitleProtection().

TitleValue Title::$mTitleValue = null
private

A corresponding TitleValue object.

Definition at line 154 of file Title.php.

Referenced by getTitleValue().

string Title::$mUrlform = ''

URL-encoded form of the main part.

Definition at line 62 of file Title.php.

Referenced by getPartialURL().

string Title::$mUserCaseDBKey
protected

Database key with the initial letter in the case specified by the user.

Definition at line 68 of file Title.php.

Referenced by getUserCaseDBKey().

HashBagOStuff Title::$titleCache = null
staticprivate

Definition at line 36 of file Title.php.

const Title::CACHE_MAX = 1000

Title::newFromText maintains a cache to avoid expensive re-normalization of commonly used titles.

On a batch operation this can become a memory leak if not bounded. After hitting this many titles reset the cache.

Definition at line 43 of file Title.php.


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