MediaWiki  1.23.8
Title Class Reference

Represents a title within MediaWiki. More...

Inheritance diagram for Title:

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

Static Private Attributes

static $titleCache = null
 

Private member variables

Please use the accessor functions instead.

Access:\n private
 $mTextform = ''
 Cascade restrictions on this page to included templates and images? More...
 
 $mUrlform = ''
 Cascade restrictions on this page to included templates and images? More...
 
 $mDbkeyform = ''
 Cascade restrictions on this page to included templates and images? More...
 
 $mUserCaseDBKey
 Cascade restrictions on this page to included templates and images? More...
 
 $mNamespace = NS_MAIN
 Cascade restrictions on this page to included templates and images? More...
 
 $mInterwiki = ''
 Cascade restrictions on this page to included templates and images? More...
 
 $mFragment = ''
 Cascade restrictions on this page to included templates and images? More...
 
 $mArticleID = -1
 Cascade restrictions on this page to included templates and images? More...
 
 $mLatestID = false
 Cascade restrictions on this page to included templates and images? More...
 
 $mContentModel = false
 Cascade restrictions on this page to included templates and images? More...
 
 $mRestrictions = array()
 Cascade restrictions on this page to included templates and images? More...
 
 $mOldRestrictions = false
 Cascade restrictions on this page to included templates and images? More...
 
 $mCascadeRestriction
 Cascade restrictions on this page to included templates and images? More...
 
 $mCascadingRestrictions
 Cascade restrictions on this page to included templates and images? More...
 
 $mRestrictionsExpiry = array()
 When do the restrictions on this page expire? More...
 
 $mHasCascadingRestrictions
 Are cascading restrictions in effect on this page? More...
 
 $mCascadeSources
 Where are the cascading restrictions coming from on this page? More...
 
 $mRestrictionsLoaded = false
 Boolean for initialisation on demand. More...
 
 $mPrefixedText = null
 Text form including namespace/interwiki, initialised on demand. More...
 
 $mTitleProtection
 Cached value for getTitleProtection (create protection) More...
 
 $mDefaultNamespace = NS_MAIN
 Cascade restrictions on this page to included templates and images? More...
 
 $mWatched = null
 Cascade restrictions on this page to included templates and images? More...
 
 $mLength = -1
 Cascade restrictions on this page to included templates and images? More...
 
 $mRedirect = null
 Cascade restrictions on this page to included templates and images? More...
 
 $mNotificationTimestamp = array()
 Cascade restrictions on this page to included templates and images? More...
 
 $mHasSubpage
 Cascade restrictions on this page to included templates and images? More...
 
 $mEstimateRevisions
 Cascade restrictions on this page to included templates and images? More...
 
 $mPageLanguage = false
 Cascade restrictions on this page to included templates and images? More...
 
 $mTitleValue = null
 Cascade restrictions on this page to included templates and images? More...
 
static getTitleParser ()
 B/C kludge: provide a TitleParser for use by Title. More...
 
static getTitleFormatter ()
 B/C kludge: provide a TitleParser for use by Title. More...
 
static getTitleCache ()
 
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...
 
 __construct ()
 Constructor. More...
 
 loadFromRow ( $row)
 Load Title object fields from a DB row. More...
 
 isLocal ()
 Determine whether the object refers to a page within this project. More...
 
 isExternal ()
 Is this Title interwiki? More...
 
 getInterwiki ()
 Get the interwiki prefix. More...
 
 isTrans ()
 Determine whether the object refers to a page within this project and is transcludable. More...
 
 getTransWikiID ()
 Returns the DB name of the distant wiki which owns the object. More...
 
 getTitleValue ()
 Get a TitleValue object representing this Title. More...
 
 getText ()
 Get the text form (spaces not underscores) of the main part. More...
 
 getPartialURL ()
 Get the URL-encoded form of the main part. More...
 
 getDBkey ()
 Get the main part with underscores. More...
 
 getUserCaseDBKey ()
 Get the DB key with the initial letter case as specified by the user. More...
 
 getNamespace ()
 Get the namespace index, i.e. More...
 
 getContentModel ()
 Get the page's content model id, see the CONTENT_MODEL_XXX constants. More...
 
 hasContentModel ( $id)
 Convenience method for checking a title's content model name. More...
 
 getNsText ()
 Get the namespace text. More...
 
 getSubjectNsText ()
 Get the namespace text of the subject (rather than talk) page. More...
 
 getTalkNsText ()
 Get the namespace text of the talk page. More...
 
 canTalk ()
 Could this title have a corresponding talk page? More...
 
 canExist ()
 Is this in a namespace that allows actual pages? More...
 
 isWatchable ()
 Can this title be added to a user's watchlist? More...
 
 isSpecialPage ()
 Returns true if this is a special page. More...
 
 isSpecial ( $name)
 Returns true if this title resolves to the named special page. 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...
 
 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...
 
 hasSubjectNamespace ( $ns)
 Returns true if the title has the same subject namespace as the namespace specified. 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...
 
 isMovable ()
 Would anybody with sufficient privileges be able to move this page? Some pages just aren't movable. More...
 
 isMainPage ()
 Is this the mainpage? More...
 
 isSubpage ()
 Is this a subpage? More...
 
 isConversionTable ()
 Is this a conversion table for the LanguageConverter? More...
 
 isWikitextPage ()
 Does that page contain wikitext, or it is JS, CSS or whatever? More...
 
 isCssOrJsPage ()
 Could this page contain custom CSS or JavaScript for the global UI. More...
 
 isCssJsSubpage ()
 Is this a .css or .js subpage of a user page? More...
 
 getSkinFromCssJsSubpage ()
 Trim down a .css or .js subpage title to get the corresponding skin name. More...
 
 isCssSubpage ()
 Is this a .css subpage of a user page? More...
 
 isJsSubpage ()
 Is this a .js subpage of a user page? More...
 
 isTalkPage ()
 Is this a talk page of some sort? More...
 
 getTalkPage ()
 Get a Title object associated with the talk page of this article. More...
 
 getSubjectPage ()
 Get a title object associated with the subject page of this talk page. More...
 
 getDefaultNamespace ()
 Get the default namespace index, for when there is no namespace. More...
 
 getIndexTitle ()
 Get title for search index. More...
 
 getFragment ()
 Get the Title fragment (i.e. the bit after the #) in text form. More...
 
 hasFragment ()
 Check if a Title fragment is set. More...
 
 getFragmentForURL ()
 Get the fragment in URL form, including the "#" character if there is one. More...
 
 setFragment ( $fragment)
 Set the fragment for this title. More...
 
 getPrefixedDBkey ()
 Get the prefixed database key form. More...
 
 getPrefixedText ()
 Get the prefixed title with spaces. More...
 
 __toString ()
 Return a string representation of this title. More...
 
 getFullText ()
 Get the prefixed title with spaces, plus any fragment (part beginning with '#') More...
 
 getRootText ()
 Get the root page name text without a namespace, i.e. More...
 
 getRootTitle ()
 Get the root page name title, i.e. More...
 
 getBaseText ()
 Get the base page name without a namespace, i.e. More...
 
 getBaseTitle ()
 Get the base page name title, i.e. More...
 
 getSubpageText ()
 Get the lowest-level subpage name, i.e. More...
 
 getSubpage ( $text)
 Get the title for a subpage of the current page. More...
 
 getEscapedText ()
 Get the HTML-escaped displayable text form. More...
 
 getSubpageUrlForm ()
 Get a URL-encoded form of the subpage text. More...
 
 getPrefixedURL ()
 Get a URL-encoded title (not an actual URL) including interwiki. More...
 
 getFullURL ( $query='', $query2=false, $proto=PROTO_RELATIVE)
 Get a real URL referring to this title, with interwiki link and fragment. More...
 
 getLocalURL ( $query='', $query2=false)
 Get a URL with no fragment or server name (relative URL) from a Title object. 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...
 
 escapeLocalURL ( $query='', $query2=false)
 Get an HTML-escaped version of the URL form, suitable for using in a link, without a server name or fragment. More...
 
 escapeFullURL ( $query='', $query2=false)
 Get an HTML-escaped version of the URL form, suitable for using in a link, including the server name and fragment. More...
 
 getInternalURL ( $query='', $query2=false)
 Get the URL form for an internal link. More...
 
 getCanonicalURL ( $query='', $query2=false)
 Get the URL for a canonical link, for use in things like IRC and e-mail notifications. More...
 
 escapeCanonicalURL ( $query='', $query2=false)
 HTML-escaped version of getCanonicalURL() More...
 
 getEditURL ()
 Get the edit URL for this Title. More...
 
 userIsWatching ()
 Is $wgUser watching this page? More...
 
 userCanRead ()
 Can $wgUser read this page? 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...
 
 userCan ( $action, $user=null, $doExpensiveQueries=true)
 Can $user perform $action on this page? More...
 
 getUserPermissionsErrors ( $action, $user, $doExpensiveQueries=true, $ignoreErrors=array())
 Can $user perform $action on this page? More...
 
 getRestrictionTypes ()
 Returns restriction types for the current Title. More...
 
 updateTitleProtection ( $create_perm, $reason, $expiry)
 Update the title protection status. More...
 
 deleteTitleProtection ()
 Remove any title protection due to page existing. More...
 
 isSemiProtected ( $action='edit')
 Is this page "semi-protected" - the only protection levels are listed in $wgSemiprotectedRestrictionLevels? More...
 
 isProtected ( $action='')
 Does the title correspond to a protected article? More...
 
 isNamespaceProtected (User $user)
 Determines if $user is unable to edit this page because it has been protected by $wgNamespaceProtection. More...
 
 isCascadeProtected ()
 Cascading protection: Return true if cascading restrictions apply to this page, false if not. More...
 
 areCascadeProtectionSourcesLoaded ( $getPages=true)
 Determines whether cascading protection sources have already been loaded from the database. More...
 
 getCascadeProtectionSources ( $getPages=true)
 Cascading protection: Get the source of any cascading restrictions on this page. More...
 
 areRestrictionsLoaded ()
 Accessor for mRestrictionsLoaded. More...
 
 getRestrictions ( $action)
 Accessor/initialisation for mRestrictions. More...
 
 getAllRestrictions ()
 Accessor/initialisation for mRestrictions. More...
 
 getRestrictionExpiry ( $action)
 Get the expiry time for the restriction against a given action. More...
 
 areRestrictionsCascading ()
 Returns cascading restrictions for the current article. 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...
 
 loadRestrictions ( $oldFashionedRestrictions=null)
 Load restrictions from the page_restrictions table. More...
 
 flushRestrictions ()
 Flush the protection cache in this object and force reload from the database. More...
 
 hasSubpages ()
 Does this have subpages? (Warning, usually requires an extra DB query.) More...
 
 getSubpages ( $limit=-1)
 Get all subpages of this 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...
 
 getArticleID ( $flags=0)
 Get the article ID for this Title from the link cache, adding it if necessary. More...
 
 isRedirect ( $flags=0)
 Is this an article that is a redirect page? Uses link cache, adding it if necessary. More...
 
 getLength ( $flags=0)
 What is the length of this page? Uses link cache, adding it if necessary. More...
 
 getLatestRevID ( $flags=0)
 What is the page_latest field for this page? 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...
 
 getLinksTo ( $options=array(), $table='pagelinks', $prefix='pl')
 Get an array of Title objects linking to this Title Also stores the IDs in the link cache. More...
 
 getTemplateLinksTo ( $options=array())
 Get an array of Title objects using this Title as a template Also stores the IDs in the link cache. More...
 
 getLinksFrom ( $options=array(), $table='pagelinks', $prefix='pl')
 Get an array of Title objects linked from this Title Also stores the IDs in the link cache. More...
 
 getTemplateLinksFrom ( $options=array())
 Get an array of Title objects used on this Title as a template Also stores the IDs in the link cache. More...
 
 getBrokenLinksFrom ()
 Get an array of Title objects referring to non-existent articles linked from this page. More...
 
 getSquidURLs ()
 Get a list of URLs to purge from the Squid cache when this page changes. More...
 
 purgeSquid ()
 Purge all applicable Squid URLs. More...
 
 moveNoAuth (&$nt)
 Move this page without authentication. More...
 
 isValidMoveOperation (&$nt, $auth=true, $reason='')
 Check whether a given move operation would be valid. More...
 
 moveTo (&$nt, $auth=true, $reason='', $createRedirect=true)
 Move a title to a new location. More...
 
 moveSubpages ( $nt, $auth=true, $reason='', $createRedirect=true)
 Move this page's subpages to be subpages of $nt. More...
 
 isSingleRevRedirect ()
 Checks if this page is just a one-rev redirect. More...
 
 isValidMoveTarget ( $nt)
 Checks if $this can be moved to a given Title. More...
 
 getParentCategories ()
 Get categories to which this Title belongs and return an array of categories' names. More...
 
 getParentCategoryTree ( $children=array())
 Get a tree of parent categories. More...
 
 pageCond ()
 Get an associative array for selecting this title from the "page" table. More...
 
 getPreviousRevisionID ( $revId, $flags=0)
 Get the revision ID of the previous revision. More...
 
 getNextRevisionID ( $revId, $flags=0)
 Get the revision ID of the next revision. More...
 
 getFirstRevision ( $flags=0)
 Get the first revision of the page. More...
 
 getEarliestRevTime ( $flags=0)
 Get the oldest revision timestamp of this page. More...
 
 isNewPage ()
 Check if this is a new page. More...
 
 isBigDeletion ()
 Check whether the number of revisions of this page surpasses $wgDeleteRevisionsLimit. More...
 
 estimateRevisionCount ()
 Get the approximate revision count of this page. More...
 
 countRevisionsBetween ( $old, $new, $max=null)
 Get the number of revisions between the given revision. More...
 
 getAuthorsBetween ( $old, $new, $limit, $options=array())
 Get the authors between the given revisions or revision IDs. More...
 
 countAuthorsBetween ( $old, $new, $limit, $options=array())
 Get the number of authors between the given revisions or revision IDs. More...
 
 equals (Title $title)
 Compare with another title. More...
 
 isSubpageOf (Title $title)
 Check if this title is a subpage of another title. More...
 
 exists ()
 Check if page exists. More...
 
 isAlwaysKnown ()
 Should links to this title be shown as potentially viewable (i.e. 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...
 
 hasSourceText ()
 Does this page have source text? More...
 
 getDefaultMessageText ()
 Get the default message text or false if the message doesn't exist. More...
 
 invalidateCache ()
 Updates page_touched for this page; called from LinksUpdate.php. More...
 
 touchLinks ()
 Update page_touched timestamps and send squid purge messages for pages linking to this title. More...
 
 getTouched ( $db=null)
 Get the last touched timestamp. More...
 
 getNotificationTimestamp ( $user=null)
 Get the timestamp when this page was updated since the user last saw it. More...
 
 getNamespaceKey ( $prepend='nstab-')
 Generate strings used for xml 'id' names in monobook tabs. More...
 
 getRedirectsHere ( $ns=null)
 Get all extant redirects to this Title. More...
 
 isValidRedirectTarget ()
 Check if this Title is a valid redirect target. More...
 
 getBacklinkCache ()
 Get a backlink cache object. More...
 
 canUseNoindex ()
 Whether the magic words INDEX and NOINDEX function for this page. More...
 
 getCategorySortkey ( $prefix='')
 Returns the raw sort key to be used for categories, with the specified prefix. 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...
 
 getEditNotices ( $oldid=0)
 Get a list of rendered edit notices for this page. More...
 
static newFromDBkey ( $key)
 Create a new Title from a prefixed DB key. More...
 
static newFromTitleValue (TitleValue $titleValue)
 Create a new Title from a TitleValue. More...
 
static newFromText ( $text, $defaultNamespace=NS_MAIN)
 Create a new Title from text, such as what one would find in a link. More...
 
static newFromURL ( $url)
 THIS IS NOT THE FUNCTION YOU WANT. 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 newFromRow ( $row)
 Make a Title object from a DB row. 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 newMainPage ()
 Create a new Title for the Main Page. More...
 
static newFromRedirect ( $text)
 Extract a redirect destination from a string and return the Title, or null if the text doesn't contain a valid redirect This will only return the very next target, useful for the redirect table and other checks that don't need full recursion. More...
 
static newFromRedirectRecurse ( $text)
 Extract a redirect destination from a string and return the Title, or null if the text doesn't contain a valid redirect This will recurse down $wgMaxRedirects times or until a non-redirect target is hit in order to provide (hopefully) the Title of the final destination instead of another redirect. More...
 
static newFromRedirectArray ( $text)
 Extract a redirect destination from a string and return an array of Titles, or null if the text doesn't contain a valid redirect The last element in the array is the final destination after all redirects have been resolved (up to $wgMaxRedirects times) More...
 
static nameOf ( $id)
 Get the prefixed DB key associated with an ID. More...
 
static legalChars ()
 Get a regex character class describing the legal characters in a link. More...
 
static getTitleInvalidRegex ()
 Returns a simple regex that will match on characters and sequences invalid in titles. More...
 
static convertByteClassToUnicodeClass ( $byteClass)
 Utility method for converting a character sequence from bytes to Unicode. More...
 
static indexTitle ( $ns, $title)
 Get a string representation of a title suitable for including in a search index. More...
 
static makeName ( $ns, $title, $fragment='', $interwiki='')
 Make a prefixed DB key from a DB key and a namespace index. More...
 
static escapeFragmentForURL ( $fragment)
 Escape a text fragment, say from a link, for a URL. More...
 
static compare ( $a, $b)
 Callback for usort() to do title sorts by (namespace, title) More...
 
static getFilteredRestrictionTypes ( $exists=true)
 Get a filtered list of all restriction types supported by this wiki. More...
 
static purgeExpiredRestrictions ()
 Purge expired restrictions from the page_restrictions table. More...
 
static capitalize ( $text, $ns=NS_MAIN)
 Capitalize a text string for a title if it belongs to a namespace that capitalizes. More...
 
static getSelectFields ()
 Returns a list of fields that are to be selected for initializing Title objects or LinkCache entries. More...
 
 prefix ( $name)
 Prefix some arbitrary text with the namespace or interwiki prefix of this object. More...
 
 checkQuickPermissions ( $action, $user, $errors, $doExpensiveQueries, $short)
 Permissions checks that fail most often, and which are easiest to test. More...
 
 resultToError ( $errors, $result)
 Add the resulting error code to the errors array. More...
 
 checkPermissionHooks ( $action, $user, $errors, $doExpensiveQueries, $short)
 Check various permission hooks. More...
 
 checkSpecialsAndNSPermissions ( $action, $user, $errors, $doExpensiveQueries, $short)
 Check permissions on special pages & namespaces. More...
 
 checkCSSandJSPermissions ( $action, $user, $errors, $doExpensiveQueries, $short)
 Check CSS/JS sub-page permissions. More...
 
 checkPageRestrictions ( $action, $user, $errors, $doExpensiveQueries, $short)
 Check against page_restrictions table requirements on this page. More...
 
 checkCascadingSourcesRestrictions ( $action, $user, $errors, $doExpensiveQueries, $short)
 Check restrictions on cascading pages. More...
 
 checkActionPermissions ( $action, $user, $errors, $doExpensiveQueries, $short)
 Check action permissions not already checked in checkQuickPermissions. More...
 
 checkUserBlock ( $action, $user, $errors, $doExpensiveQueries, $short)
 Check that the user isn't blocked from editing. More...
 
 checkReadPermissions ( $action, $user, $errors, $doExpensiveQueries, $short)
 Check that the user is allowed to read this page. More...
 
 missingPermissionError ( $action, $short)
 Get a description array when the user doesn't have the right to perform $action (i.e. More...
 
 getTitleProtection ()
 Is this title subject to title protection? Title protection is the one applied against creation of such title. More...
 
 loadRestrictionsFromResultWrapper ( $res, $oldFashionedRestrictions=null)
 Loads a string into mRestrictions array. More...
 
 secureAndSplit ()
 Secure and split - main initialisation function for this object. More...
 
 moveToInternal (&$nt, $reason='', $createRedirect=true)
 Move page to a title which is either a redirect to the source page or nonexistent. More...
 
 getUserPermissionsErrorsInternal ( $action, $user, $doExpensiveQueries=true, $short=false)
 Can $user perform $action on this page? This is an internal function, which checks ONLY that previously checked by userCan (i.e. More...
 
 validateFileMoveOperation ( $nt)
 Check if the requested move target is a valid file move target. 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 35 of file Title.php.

Constructor & Destructor Documentation

◆ __construct()

Title::__construct ( )

Constructor.

Definition at line 142 of file Title.php.

Member Function Documentation

◆ __toString()

Title::__toString ( )

Return a string representation of this title.

Returns
String representation of this title

Definition at line 1383 of file Title.php.

References getPrefixedText().

◆ areCascadeProtectionSourcesLoaded()

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

◆ areRestrictionsCascading()

Title::areRestrictionsCascading ( )

Returns cascading restrictions for the current article.

Returns
Boolean

Reimplemented in FakeTitle.

Definition at line 2822 of file Title.php.

References $mCascadeRestriction, and loadRestrictions().

◆ areRestrictionsLoaded()

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

References $mRestrictionsLoaded.

◆ canExist()

Title::canExist ( )

Is this in a namespace that allows actual pages?

Returns
Bool

Reimplemented in FakeTitle.

Definition at line 979 of file Title.php.

References NS_MAIN.

Referenced by RequestContext\canUseWikiPage().

◆ canTalk()

Title::canTalk ( )

Could this title have a corresponding talk page?

Returns
Bool TRUE or FALSE

Reimplemented in FakeTitle.

Definition at line 969 of file Title.php.

References MWNamespace\canTalk().

◆ canUseNoindex()

Title::canUseNoindex ( )

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

Returns
Boolean

Reimplemented in FakeTitle.

Definition at line 4820 of file Title.php.

References global.

◆ capitalize()

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

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

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

◆ checkActionPermissions()

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

Check action permissions not already checked in checkQuickPermissions.

Parameters
string$actionthe action to check
$userUser to check
array$errorslist of current errors
$doExpensiveQueriesBoolean whether or not to perform expensive queries
$shortBoolean short circuit on first error
Returns
Array list of errors

Definition at line 2209 of file Title.php.

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

◆ checkCascadingSourcesRestrictions()

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

Check restrictions on cascading pages.

Parameters
string$actionthe action to check
$userUser to check
array$errorslist of current errors
$doExpensiveQueriesBoolean whether or not to perform expensive queries
$shortBoolean short circuit on first error
Returns
Array list of errors

Definition at line 2162 of file Title.php.

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

◆ checkCSSandJSPermissions()

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

Check CSS/JS sub-page permissions.

Parameters
string$actionthe action to check
$userUser user to check
array$errorslist of current errors
$doExpensiveQueriesBoolean whether or not to perform expensive queries
$shortBoolean short circuit on first error
Returns
Array list of errors

Definition at line 2092 of file Title.php.

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

◆ checkPageRestrictions()

Title::checkPageRestrictions (   $action,
  $user,
  $errors,
  $doExpensiveQueries,
  $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
$userUser user to check
array$errorslist of current errors
$doExpensiveQueriesBoolean whether or not to perform expensive queries
$shortBoolean short circuit on first error
Returns
Array list of errors

Definition at line 2128 of file Title.php.

References $right, $user, array(), as, and getRestrictions().

◆ checkPermissionHooks()

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

Check various permission hooks.

Parameters
string$actionthe action to check
$userUser user to check
array$errorslist of current errors
$doExpensiveQueriesBoolean whether or not to perform expensive queries
$shortBoolean short circuit on first error
Returns
Array list of errors

Definition at line 2030 of file Title.php.

References $user, array(), resultToError(), and wfRunHooks().

◆ checkQuickPermissions()

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

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

Parameters
string$actionthe action to check
$userUser user to check
array$errorslist of current errors
$doExpensiveQueriesBoolean whether or not to perform expensive queries
$shortBoolean short circuit on first error
Returns
Array list of errors

Definition at line 1943 of file Title.php.

References $user, array(), User\groupHasPermission(), isSubpage(), isTalkPage(), missingPermissionError(), NS_FILE, NS_USER, and wfRunHooks().

◆ checkReadPermissions()

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

Check that the user is allowed to read this page.

Parameters
string$actionthe action to check
$userUser to check
array$errorslist of current errors
$doExpensiveQueriesBoolean whether or not to perform expensive queries
$shortBoolean short circuit on first error
Returns
Array list of errors

Definition at line 2303 of file Title.php.

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

◆ checkSpecialsAndNSPermissions()

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

Check permissions on special pages & namespaces.

Parameters
string$actionthe action to check
$userUser user to check
array$errorslist of current errors
$doExpensiveQueriesBoolean whether or not to perform expensive queries
$shortBoolean short circuit on first error
Returns
Array list of errors

Definition at line 2063 of file Title.php.

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

◆ checkUserBlock()

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

Check that the user isn't blocked from editing.

Parameters
string$actionthe action to check
$userUser to check
array$errorslist of current errors
$doExpensiveQueriesBoolean whether or not to perform expensive queries
$shortBoolean short circuit on first error
Returns
Array list of errors

Definition at line 2268 of file Title.php.

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

◆ compare()

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

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

Parameters
$aTitle
$bTitle
Returns
Integer: result of string comparison, or namespace comparison

Definition at line 738 of file Title.php.

Referenced by ApiQueryInfo\execute().

◆ convertByteClassToUnicodeClass()

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

References $out.

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

◆ countAuthorsBetween()

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

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

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

◆ countRevisionsBetween()

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

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

◆ deleteTitleProtection()

Title::deleteTitleProtection ( )

Remove any title protection due to page existing.

Reimplemented in FakeTitle.

Definition at line 2548 of file Title.php.

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

◆ equals()

Title::equals ( Title  $title)

Compare with another title.

Parameters
$titleTitle
Returns
Bool

Reimplemented in FakeTitle.

Definition at line 4474 of file Title.php.

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

Referenced by isMainPage(), and isValidMoveOperation().

◆ escapeCanonicalURL()

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

HTML-escaped version of getCanonicalURL()

See also
self::getLocalURL for the arguments.
Since
1.18
Returns
string
Deprecated:
since 1.19

Definition at line 1817 of file Title.php.

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

◆ escapeFragmentForURL()

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

References Sanitizer\escapeId().

Referenced by getFragmentForURL().

◆ escapeFullURL()

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

Get an HTML-escaped version of the URL form, suitable for using in a link, including the server name and fragment.

See also
self::getLocalURL for the arguments.
Returns
String the URL
Deprecated:
since 1.19

Reimplemented in FakeTitle.

Definition at line 1765 of file Title.php.

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

◆ escapeLocalURL()

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

Get an HTML-escaped version of the URL form, suitable for using in a link, without a server name or fragment.

See also
self::getLocalURL for the arguments.
Parameters
$querystring
$query2bool|string
Returns
String the URL
Deprecated:
since 1.19

Reimplemented in FakeTitle.

Definition at line 1752 of file Title.php.

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

◆ estimateRevisionCount()

Title::estimateRevisionCount ( )

Get the approximate revision count of this page.

Returns
int

Definition at line 4324 of file Title.php.

References $dbr, $mEstimateRevisions, array(), DB_SLAVE, exists(), getArticleID(), and wfGetDB().

Referenced by isBigDeletion().

◆ exists()

Title::exists ( )

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.

Returns
Bool

Reimplemented in FakeTitle.

Definition at line 4502 of file Title.php.

References getArticleID().

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

◆ fixSpecialName()

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

Reimplemented in FakeTitle.

Definition at line 1023 of file Title.php.

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

◆ fixUrlQueryArgs()

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
$query
$query2bool
Returns
String

Definition at line 1560 of file Title.php.

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

Referenced by getCanonicalURL(), getFullURL(), getInternalURL(), and getLocalURL().

◆ flushRestrictions()

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

◆ getAllRestrictions()

Title::getAllRestrictions ( )

Accessor/initialisation for mRestrictions.

Returns
Array of Arrays of Strings the first level indexed by action, the second level containing the names of the groups allowed to perform each action
Since
1.23

Definition at line 2796 of file Title.php.

References $mRestrictions, and loadRestrictions().

◆ getArticleID()

Title::getArticleID (   $flags = 0)

◆ getAuthorsBetween()

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

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

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

Referenced by countAuthorsBetween().

◆ getBacklinkCache()

Title::getBacklinkCache ( )

Get a backlink cache object.

Returns
BacklinkCache

Reimplemented in FakeTitle.

Definition at line 4811 of file Title.php.

References BacklinkCache\get().

◆ getBaseText()

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

Reimplemented in FakeTitle.

Definition at line 1448 of file Title.php.

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

Referenced by getBaseTitle().

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

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

◆ getBrokenLinksFrom()

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
Array of Title the Title objects

Reimplemented in FakeTitle.

Definition at line 3467 of file Title.php.

References $dbr, $res, array(), as, DB_SLAVE, getArticleID(), makeTitle(), and wfGetDB().

◆ getCanonicalURL()

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

References $query, array(), fixUrlQueryArgs(), getFragmentForURL(), getLocalURL(), PROTO_CANONICAL, wfExpandUrl(), and wfRunHooks().

Referenced by escapeCanonicalURL().

◆ getCascadeProtectionSources()

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.
Returns
Mixed 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. The restriction array is an array of each type, each of which contains a array of unique groups.

Reimplemented in FakeTitle.

Definition at line 2672 of file Title.php.

References $dbr, $res, $tables, $wgContLang, array(), as, DB_SLAVE, getDBkey(), getNamespace(), global, makeTitle(), NS_FILE, purgeExpiredRestrictions(), TS_MW, wfGetDB(), wfProfileIn(), wfProfileOut(), and wfTimestampNow().

Referenced by checkCascadingSourcesRestrictions(), and isCascadeProtected().

◆ getCategorySortkey()

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

References array(), getText(), and wfRunHooks().

Referenced by CategoryViewer\doCategoryQuery().

◆ getContentModel()

Title::getContentModel ( )

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

Exceptions
MWException
Returns
String: Content model id

Definition at line 890 of file Title.php.

References $mContentModel, ContentHandler\getDefaultModelFor(), and LinkCache\singleton().

Referenced by hasContentModel(), isValidMoveOperation(), loadFromRow(), and makeTitle().

◆ getDBkey()

◆ getDefaultMessageText()

Title::getDefaultMessageText ( )

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

Returns
String or false

Definition at line 4608 of file Title.php.

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

◆ getDefaultNamespace()

Title::getDefaultNamespace ( )

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

Returns
Int Default namespace index

Reimplemented in FakeTitle.

Definition at line 1270 of file Title.php.

References $mDefaultNamespace.

Referenced by secureAndSplit().

◆ getEarliestRevTime()

Title::getEarliestRevTime (   $flags = 0)

Get the oldest revision timestamp of this page.

Parameters
int$flagsTitle::GAID_FOR_UPDATE
Returns
String: MW timestamp

Reimplemented in FakeTitle.

Definition at line 4288 of file Title.php.

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

◆ getEditNotices()

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

References array(), getDBkey(), getNamespace(), MWNamespace\hasSubpages(), wfMessage(), and wfRunHooks().

◆ getEditURL()

Title::getEditURL ( )

Get the edit URL for this Title.

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

Reimplemented in FakeTitle.

Definition at line 1828 of file Title.php.

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

◆ getEscapedText()

Title::getEscapedText ( )

Get the HTML-escaped displayable text form.

Used for the title field in tags.

Returns
String the text, including any prefixes
Deprecated:
since 1.19

Reimplemented in FakeTitle.

Definition at line 1520 of file Title.php.

References getPrefixedText(), and wfDeprecated().

◆ getFilteredRestrictionTypes()

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

References array(), and global.

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

◆ getFirstRevision()

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

Reimplemented in FakeTitle.

Definition at line 4266 of file Title.php.

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

Referenced by getEarliestRevTime().

◆ getFragment()

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

Reimplemented in FakeTitle.

Definition at line 1291 of file Title.php.

References $mFragment.

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

◆ getFragmentForURL()

Title::getFragmentForURL ( )

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

Returns
String Fragment in URL form

Reimplemented in FakeTitle.

Definition at line 1309 of file Title.php.

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

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

◆ getFullText()

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 '#'

Reimplemented in FakeTitle.

Definition at line 1393 of file Title.php.

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

Referenced by getParentCategories(), WikitextContentHandler\makeRedirectContent(), and WikitextContent\updateRedirect().

◆ getFullURL()

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
$query
$query2bool
$protoProtocol type to use in URL
Returns
String the URL

Definition at line 1598 of file Title.php.

References $query, array(), fixUrlQueryArgs(), getFragmentForURL(), getLocalURL(), wfExpandUrl(), and wfRunHooks().

Referenced by escapeFullURL(), and getLinkURL().

◆ getIndexTitle()

Title::getIndexTitle ( )

Get title for search index.

Returns
String a stripped-down title string ready for the search index

Reimplemented in FakeTitle.

Definition at line 1280 of file Title.php.

References indexTitle().

◆ getInternalURL()

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

Get the URL form for an internal link.

  • Used in various Squid-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

Reimplemented in FakeTitle.

Definition at line 1782 of file Title.php.

References $query, array(), fixUrlQueryArgs(), getLocalURL(), global, PROTO_HTTP, wfExpandUrl(), and wfRunHooks().

Referenced by getSquidURLs().

◆ getInterwiki()

Title::getInterwiki ( )

Get the interwiki prefix.

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

Returns
String Interwiki prefix

Reimplemented in FakeTitle.

Definition at line 778 of file Title.php.

References $mInterwiki.

Referenced by equals(), getRedirectsHere(), isSubpageOf(), and WikitextContentHandler\makeRedirectContent().

◆ getLatestRevID()

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 or 0 if the page doesn't exist

Reimplemented in FakeTitle.

Definition at line 3210 of file Title.php.

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

◆ getLength()

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

Reimplemented in FakeTitle.

Definition at line 3182 of file Title.php.

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

◆ getLinksFrom()

Title::getLinksFrom (   $options = array(),
  $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$optionsmay be FOR UPDATE
string$tabletable name
string$prefixfields prefix
Returns
Array of Title objects linking here

Definition at line 3396 of file Title.php.

References $options, $res, array(), as, DB_MASTER, DB_SLAVE, getArticleID(), global, makeTitle(), LinkCache\singleton(), and wfGetDB().

Referenced by getTemplateLinksFrom().

◆ getLinksTo()

Title::getLinksTo (   $options = array(),
  $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
Array of Title objects linking here

Reimplemented in FakeTitle.

Definition at line 3338 of file Title.php.

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

Referenced by getTemplateLinksTo().

◆ getLinkURL()

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
$query
$query2bool
$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 1729 of file Title.php.

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

◆ getLocalURL()

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::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.
$query2Mixed: An optional secondary query array. This one MUST be an array. If a string is passed it will be interpreted as a deprecated variant argument and urlencoded into a variant= argument. This second query argument will be added to the $query The second parameter is deprecated since 1.19. Pass it as a key,value pair in the first parameter array instead.
Returns
String of the URL.

Reimplemented in FakeTitle.

Definition at line 1637 of file Title.php.

References $matches, $query, $wgActionPaths, $wgArticlePath, $wgContLang, array(), Interwiki\fetch(), fixUrlQueryArgs(), getDBkey(), getNsText(), getPageLanguage(), getPrefixedDBkey(), global, wfAppendQuery(), wfRunHooks(), and wfUrlencode().

Referenced by escapeLocalURL(), getCanonicalURL(), getEditURL(), getFullURL(), getInternalURL(), and getLinkURL().

◆ getNamespace()

◆ getNamespaceKey()

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

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

Parameters
string$prependdefaults to 'nstab-'
Returns
String XML 'id' name

Reimplemented in FakeTitle.

Definition at line 4722 of file Title.php.

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

◆ getNextRevisionID()

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

Reimplemented in FakeTitle.

Definition at line 4242 of file Title.php.

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

◆ getNotificationTimestamp()

Title::getNotificationTimestamp (   $user = null)

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

Parameters
$userUser
Returns
String|Null

Reimplemented in FakeTitle.

Definition at line 4683 of file Title.php.

References $dbr, $user, $wgUser, array(), CACHE_MAX, DB_SLAVE, getDBkey(), getNamespace(), global, and wfGetDB().

◆ getNsText()

Title::getNsText ( )

Get the namespace text.

Returns
String: Namespace text

Reimplemented in FakeTitle.

Definition at line 922 of file Title.php.

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

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

◆ getPageLanguage()

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

References $wgLang, array(), ContentHandler\getForTitle(), global, isSpecialPage(), wfGetLangObj(), wfProfileIn(), and wfProfileOut().

Referenced by getLocalURL(), and getSquidURLs().

◆ getPageViewLanguage()

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

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

◆ getParentCategories()

Title::getParentCategories ( )

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

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

Reimplemented in FakeTitle.

Definition at line 4139 of file Title.php.

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

Referenced by getParentCategoryTree().

◆ getParentCategoryTree()

Title::getParentCategoryTree (   $children = array())

Get a tree of parent categories.

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

Reimplemented in FakeTitle.

Definition at line 4174 of file Title.php.

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

◆ getPartialURL()

Title::getPartialURL ( )

Get the URL-encoded form of the main part.

Returns
String Main part of the title, URL-encoded

Reimplemented in FakeTitle.

Definition at line 848 of file Title.php.

References $mUrlform.

◆ getPrefixedDBkey()

Title::getPrefixedDBkey ( )

Get the prefixed database key form.

Returns
String the prefixed title, with underscores and any interwiki and namespace prefixes

Reimplemented in FakeTitle.

Definition at line 1357 of file Title.php.

References $s, and prefix().

Referenced by PPTemplateFrame_Hash\__construct(), PPTemplateFrame_DOM\__construct(), checkReadPermissions(), DoubleRedirectJob\fixRedirects(), DoubleRedirectJob\getFinalDestination(), getLocalURL(), isValidMoveTarget(), PPFrame_Hash\loopCheck(), and PPFrame_DOM\loopCheck().

◆ getPrefixedText()

Title::getPrefixedText ( )

Get the prefixed title with spaces.

This is the form usually used for display

Returns
String the prefixed title, with spaces

Reimplemented in FakeTitle.

Definition at line 1369 of file Title.php.

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

Referenced by __toString(), checkReadPermissions(), FileDeleteForm\doDelete(), getEscapedText(), getFullText(), getLinkURL(), getRestrictionTypes(), CategoryViewer\getSubcategorySortChar(), getTitleValue(), LogPager\limitTitle(), moveTo(), MovePageForm\showForm(), ApiWatch\watchTitle(), SpecialWhatLinksHere\whatlinkshereForm(), and SpecialWhatLinksHere\wlhLink().

◆ getPrefixedURL()

Title::getPrefixedURL ( )

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

Returns
String the URL-encoded form

Reimplemented in FakeTitle.

Definition at line 1541 of file Title.php.

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

◆ getPreviousRevisionID()

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

Reimplemented in FakeTitle.

Definition at line 4217 of file Title.php.

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

◆ getRedirectsHere()

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

Reimplemented in FakeTitle.

Definition at line 4753 of file Title.php.

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

◆ getRestrictionExpiry()

Title::getRestrictionExpiry (   $action)

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

Parameters
$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.

Reimplemented in FakeTitle.

Definition at line 2810 of file Title.php.

References loadRestrictions().

◆ getRestrictions()

Title::getRestrictions (   $action)

Accessor/initialisation for mRestrictions.

Parameters
string$actionaction that permission needs to be checked for
Returns
Array of Strings the array of groups allowed to edit this article

Reimplemented in FakeTitle.

Definition at line 2779 of file Title.php.

References array(), and loadRestrictions().

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

◆ getRestrictionTypes()

Title::getRestrictionTypes ( )

Returns restriction types for the current Title.

Returns
array applicable restriction types

Reimplemented in FakeTitle.

Definition at line 2468 of file Title.php.

References array(), exists(), getFilteredRestrictionTypes(), getNamespace(), getPrefixedText(), isSpecialPage(), NS_FILE, wfDebug(), and wfRunHooks().

Referenced by isProtected(), and loadRestrictionsFromRows().

◆ getRootText()

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

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

Referenced by getRootTitle().

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

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

◆ getSelectFields()

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

References array(), and global.

◆ getSkinFromCssJsSubpage()

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

Reimplemented in FakeTitle.

Definition at line 1202 of file Title.php.

References in, and only.

◆ getSquidURLs()

Title::getSquidURLs ( )

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

Returns
Array of String the URLs

Reimplemented in FakeTitle.

Definition at line 3503 of file Title.php.

References array(), as, getInternalURL(), getPageLanguage(), isCssSubpage(), isJsSubpage(), and wfRunHooks().

Referenced by MediaWiki\performAction(), and purgeSquid().

◆ getSubjectNsText()

Title::getSubjectNsText ( )

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

Returns
String Namespace text

Reimplemented in FakeTitle.

Definition at line 949 of file Title.php.

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

Referenced by getNamespaceKey().

◆ getSubjectPage()

Title::getSubjectPage ( )

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

Returns
Title the object for the subject page

Reimplemented in FakeTitle.

Definition at line 1256 of file Title.php.

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

◆ getSubpage()

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

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

◆ getSubpages()

Title::getSubpages (   $limit = -1)

Get all subpages of this page.

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

Reimplemented in FakeTitle.

Definition at line 3042 of file Title.php.

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

Referenced by hasSubpages(), and moveSubpages().

◆ getSubpageText()

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

Reimplemented in FakeTitle.

Definition at line 1488 of file Title.php.

References $mTextform, and MWNamespace\hasSubpages().

Referenced by getSubpageUrlForm().

◆ getSubpageUrlForm()

Title::getSubpageUrlForm ( )

Get a URL-encoded form of the subpage text.

Returns
String URL-encoded subpage name

Reimplemented in FakeTitle.

Definition at line 1530 of file Title.php.

References getSubpageText(), and wfUrlencode().

◆ getTalkNsText()

Title::getTalkNsText ( )

Get the namespace text of the talk page.

Returns
String Namespace text

Reimplemented in FakeTitle.

Definition at line 959 of file Title.php.

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

◆ getTalkPage()

Title::getTalkPage ( )

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

Returns
Title the object for the talk page

Reimplemented in FakeTitle.

Definition at line 1246 of file Title.php.

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

◆ getTemplateLinksFrom()

Title::getTemplateLinksFrom (   $options = array())

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
Array of Title the Title objects used here

Definition at line 3457 of file Title.php.

References $options, and getLinksFrom().

◆ getTemplateLinksTo()

Title::getTemplateLinksTo (   $options = array())

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$optionsmay be FOR UPDATE
Returns
Array of Title the Title objects linking here

Reimplemented in FakeTitle.

Definition at line 3380 of file Title.php.

References $options, and getLinksTo().

◆ getText()

Title::getText ( )

Get the text form (spaces not underscores) of the main part.

Returns
String Main part of the title

Reimplemented in FakeTitle.

Definition at line 839 of file Title.php.

References $mTextform.

Referenced by EmailNotification\actuallyNotifyOnPageChange(), CategoryViewer\addSubcategoryObject(), EmailNotification\canSendUserTalkEmail(), getBaseText(), getCategorySortkey(), getRootText(), getSubpage(), isConversionTable(), isSubpage(), and MovePageForm\showForm().

◆ getTitleCache()

static Title::getTitleCache ( )
staticprivate
Returns
MapCacheLRU

Definition at line 262 of file Title.php.

References $titleCache.

Referenced by newFromText().

◆ getTitleFormatter()

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

References getTitleParser().

Referenced by getNsText().

◆ getTitleInvalidRegex()

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.

Todo:
: move this into MediaWikiTitleCodec
Returns
String regex string

Definition at line 543 of file Title.php.

References character(), is(), legalChars(), and URL.

Referenced by Language\isValidCode(), and MediaWikiTitleCodec\splitTitleString().

◆ getTitleParser()

static Title::getTitleParser ( )
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
TitleParser

Definition at line 101 of file Title.php.

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

Referenced by getTitleFormatter(), and secureAndSplit().

◆ getTitleProtection()

Title::getTitleProtection ( )
private

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

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

Definition at line 2495 of file Title.php.

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

Referenced by checkActionPermissions(), and loadRestrictions().

◆ getTitleValue()

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

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

◆ getTouched()

Title::getTouched (   $db = null)

Get the last touched timestamp.

Parameters
$dbDatabaseBase: optional db
Returns
String last-touched timestamp

Reimplemented in FakeTitle.

Definition at line 4671 of file Title.php.

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

◆ getTransWikiID()

Title::getTransWikiID ( )

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

Returns
String the DB name

Definition at line 801 of file Title.php.

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

◆ getUserCaseDBKey()

Title::getUserCaseDBKey ( )

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

Returns
String DB key

Reimplemented in FakeTitle.

Definition at line 866 of file Title.php.

References $mDbkeyform, and $mUserCaseDBKey.

◆ getUserPermissionsErrors()

Title::getUserPermissionsErrors (   $action,
  $user,
  $doExpensiveQueries = true,
  $ignoreErrors = array() 
)

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
$userUser to check
bool$doExpensiveQueriesSet this to false to avoid doing unnecessary queries by skipping checks for cascading protections and user blocks.
array$ignoreErrorsof Strings Set this to a list of message keys whose corresponding errors may be ignored.
Returns
Array of arguments to wfMessage to explain permissions problems.

Reimplemented in FakeTitle.

Definition at line 1917 of file Title.php.

References $error, $user, as, and getUserPermissionsErrorsInternal().

Referenced by isValidMoveOperation().

◆ getUserPermissionsErrorsInternal()

Title::getUserPermissionsErrorsInternal (   $action,
  $user,
  $doExpensiveQueries = true,
  $short = false 
)
protected

Can $user perform $action on this page? This is an internal function, which checks ONLY that previously checked by userCan (i.e.

it leaves out checks on wfReadOnly() and blocks)

Parameters
string$actionaction that permission needs to be checked for
$userUser to check
bool$doExpensiveQueriesSet this to false to avoid doing unnecessary queries.
bool$shortSet this to true to stop after the first permission error.
Returns
Array of arrays of the arguments to wfMessage to explain permissions problems.

Definition at line 2410 of file Title.php.

References $user, array(), wfProfileIn(), and wfProfileOut().

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

◆ hasContentModel()

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
Boolean true if $this->getContentModel() == $id

Definition at line 913 of file Title.php.

References getContentModel().

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

◆ hasFragment()

Title::hasFragment ( )

Check if a Title fragment is set.

Returns
bool
Since
1.23

Reimplemented in FakeTitle.

Definition at line 1301 of file Title.php.

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

◆ hasSourceText()

Title::hasSourceText ( )

Does this page have source text?

Returns
Boolean

Definition at line 4584 of file Title.php.

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

Referenced by isAlwaysKnown().

◆ hasSubjectNamespace()

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
$nsint
Returns
bool

Definition at line 1085 of file Title.php.

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

◆ hasSubpages()

Title::hasSubpages ( )

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

Returns
Bool

Reimplemented in FakeTitle.

Definition at line 3014 of file Title.php.

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

◆ indexTitle()

static Title::indexTitle (   $ns,
  $title 
)
static

Get a string representation of a title suitable for including in a search index.

Parameters
int$nsa namespace index
string$titletext-form main part
Returns
String a stripped-down title string ready for the search index

Definition at line 673 of file Title.php.

References $t, $title, $wgContLang, global, SearchEngine\legalSearchChars(), and NS_FILE.

Referenced by getIndexTitle().

◆ inNamespace()

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

Definition at line 1046 of file Title.php.

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

Referenced by inNamespaces().

◆ inNamespaces()

Title::inNamespaces ( )

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

Parameters
...$namespacesThe namespaces to check for
Returns
bool
Since
1.19

Definition at line 1057 of file Title.php.

References $namespaces, as, and inNamespace().

◆ invalidateCache()

Title::invalidateCache ( )

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

Returns
Bool true if the update succeeded

Reimplemented in FakeTitle.

Definition at line 4630 of file Title.php.

References array(), DB_MASTER, pageCond(), wfGetDB(), and wfReadOnly().

Referenced by File\purgeDescription().

◆ isAlwaysKnown()

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

Reimplemented in FakeTitle.

Definition at line 4522 of file Title.php.

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

Referenced by isKnown().

◆ isBigDeletion()

Title::isBigDeletion ( )

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

Returns
bool

Definition at line 4308 of file Title.php.

References estimateRevisionCount(), and global.

Referenced by checkActionPermissions().

◆ isCascadeProtected()

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.

Reimplemented in FakeTitle.

Definition at line 2644 of file Title.php.

References getCascadeProtectionSources(), and list.

◆ isContentPage()

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
Boolean

Reimplemented in FakeTitle.

Definition at line 1096 of file Title.php.

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

◆ isConversionTable()

Title::isConversionTable ( )

Is this a conversion table for the LanguageConverter?

Returns
Bool

Reimplemented in FakeTitle.

Definition at line 1147 of file Title.php.

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

◆ isCssJsSubpage()

Title::isCssJsSubpage ( )

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

Returns
Bool

Reimplemented in FakeTitle.

Definition at line 1191 of file Title.php.

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

Referenced by checkCascadingSourcesRestrictions().

◆ isCssOrJsPage()

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

Reimplemented in FakeTitle.

Definition at line 1174 of file Title.php.

References array(), CONTENT_MODEL_CSS, CONTENT_MODEL_JAVASCRIPT, hasContentModel(), NS_MEDIAWIKI, and wfRunHooks().

◆ isCssSubpage()

Title::isCssSubpage ( )

Is this a .css subpage of a user page?

Returns
Bool

Reimplemented in FakeTitle.

Definition at line 1217 of file Title.php.

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

Referenced by checkCSSandJSPermissions(), and getSquidURLs().

◆ isDeleted()

Title::isDeleted ( )

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

Returns
Int the number of archived revisions

Reimplemented in FakeTitle.

Definition at line 3070 of file Title.php.

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

◆ isDeletedQuick()

Title::isDeletedQuick ( )

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

Returns
Boolean

Reimplemented in FakeTitle.

Definition at line 3095 of file Title.php.

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

Referenced by File\wasDeleted().

◆ isExternal()

Title::isExternal ( )

◆ isJsSubpage()

Title::isJsSubpage ( )

Is this a .js subpage of a user page?

Returns
Bool

Reimplemented in FakeTitle.

Definition at line 1227 of file Title.php.

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

Referenced by checkCSSandJSPermissions(), and getSquidURLs().

◆ isKnown()

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

Reimplemented in FakeTitle.

Definition at line 4575 of file Title.php.

References exists(), and isAlwaysKnown().

◆ isLocal()

Title::isLocal ( )

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

Returns
Bool TRUE if this is an in-project interwiki link or a wikilink, FALSE otherwise

Reimplemented in FakeTitle.

Definition at line 752 of file Title.php.

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

◆ isMainPage()

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

References equals(), and newMainPage().

◆ isMovable()

Title::isMovable ( )

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

Returns
Bool TRUE or FALSE

Reimplemented in FakeTitle.

Definition at line 1106 of file Title.php.

References array(), getNamespace(), isExternal(), MWNamespace\isMovable(), and wfRunHooks().

Referenced by checkActionPermissions(), and isValidMoveOperation().

◆ isNamespaceProtected()

Title::isNamespaceProtected ( User  $user)

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

Parameters
$userUser object to check permissions
Returns
Bool

Reimplemented in FakeTitle.

Definition at line 2626 of file Title.php.

References $right, $user, $wgNamespaceProtection, array(), as, and global.

Referenced by checkSpecialsAndNSPermissions().

◆ isNewPage()

Title::isNewPage ( )

Check if this is a new page.

Returns
bool

Reimplemented in FakeTitle.

Definition at line 4298 of file Title.php.

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

◆ isProtected()

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

Reimplemented in FakeTitle.

Definition at line 2594 of file Title.php.

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

Referenced by moveTo().

◆ isRedirect()

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

Reimplemented in FakeTitle.

Definition at line 3147 of file Title.php.

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

Referenced by CategoryViewer\addSubcategoryObject().

◆ isSemiProtected()

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

Reimplemented in FakeTitle.

Definition at line 2566 of file Title.php.

References as, getRestrictions(), and global.

◆ isSingleRevRedirect()

Title::isSingleRevRedirect ( )

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

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

Returns
Bool

Reimplemented in FakeTitle.

Definition at line 4045 of file Title.php.

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

◆ isSpecial()

Title::isSpecial (   $name)

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

Parameters
string$nameThe special page name
Returns
boolean

Reimplemented in FakeTitle.

Definition at line 1007 of file Title.php.

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

Referenced by checkReadPermissions(), and isValidRedirectTarget().

◆ isSpecialPage()

Title::isSpecialPage ( )

Returns true if this is a special page.

Returns
boolean

Reimplemented in FakeTitle.

Definition at line 997 of file Title.php.

References getNamespace(), and NS_SPECIAL.

Referenced by SkinTemplate\buildPersonalUrls(), checkReadPermissions(), fixSpecialName(), getPageLanguage(), getPageViewLanguage(), getRestrictionTypes(), isProtected(), and isSpecial().

◆ isSubpage()

Title::isSubpage ( )

Is this a subpage?

Returns
Bool

Reimplemented in FakeTitle.

Definition at line 1136 of file Title.php.

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

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

◆ isSubpageOf()

Title::isSubpageOf ( Title  $title)

Check if this title is a subpage of another title.

Parameters
$titleTitle
Returns
Bool

Definition at line 4487 of file Title.php.

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

◆ isTalkPage()

Title::isTalkPage ( )

Is this a talk page of some sort?

Returns
Bool

Reimplemented in FakeTitle.

Definition at line 1237 of file Title.php.

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

Referenced by checkQuickPermissions().

◆ isTrans()

Title::isTrans ( )

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

Returns
Bool TRUE if this is transcludable

Reimplemented in FakeTitle.

Definition at line 788 of file Title.php.

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

◆ isValidMoveOperation()

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

Parameters
$ntTitle the new title
bool$authindicates whether $wgUser's permissions should be checked
string$reasonis the log summary of the move, used for spam checking
Returns
Mixed True on success, getUserPermissionsErrors()-like array on failure

Reimplemented in FakeTitle.

Definition at line 3560 of file Title.php.

References $right, $wgUser, array(), check, equals(), exists(), getArticleID(), getContentModel(), getDBkey(), ContentHandler\getLocalizedName(), getNamespace(), getNsText(), getUserPermissionsErrors(), global, isMovable(), isValidMoveTarget(), NS_FILE, validateFileMoveOperation(), wfMergeErrorArrays(), and wfRunHooks().

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

◆ isValidMoveTarget()

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
Parameters
$ntTitle the new title to check
Returns
Bool

Reimplemented in FakeTitle.

Definition at line 4092 of file Title.php.

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

Referenced by isValidMoveOperation().

◆ isValidRedirectTarget()

Title::isValidRedirectTarget ( )

Check if this Title is a valid redirect target.

Returns
Bool

Reimplemented in FakeTitle.

Definition at line 4789 of file Title.php.

References as, global, and isSpecial().

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

◆ isWatchable()

Title::isWatchable ( )

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

Returns
Bool TRUE or FALSE

Reimplemented in FakeTitle.

Definition at line 988 of file Title.php.

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

◆ isWikitextPage()

Title::isWikitextPage ( )

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

Returns
Bool

Definition at line 1159 of file Title.php.

References CONTENT_MODEL_WIKITEXT, and hasContentModel().

◆ legalChars()

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

References global.

Referenced by ImageCleanup\buildSafeTitle(), ResourceLoaderStartUpModule\getConfig(), getTitleInvalidRegex(), and TitleTest\testLegalChars().

◆ loadFromRow()

Title::loadFromRow (   $row)

Load Title object fields from a DB row.

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

Parameters
$rowstdClass|bool database row

Definition at line 357 of file Title.php.

References getContentModel(), and in.

◆ loadRestrictions()

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)

Reimplemented in FakeTitle.

Definition at line 2939 of file Title.php.

References $dbr, $res, $wgContLang, array(), DB_SLAVE, exists(), getArticleID(), getTitleProtection(), global, loadRestrictionsFromResultWrapper(), purgeExpiredRestrictions(), TS_MW, wfGetDB(), and wfTimestampNow().

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

◆ loadRestrictionsFromResultWrapper()

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

Loads a string into mRestrictions array.

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

Definition at line 2837 of file Title.php.

References $res, array(), as, and loadRestrictionsFromRows().

Referenced by loadRestrictions().

◆ loadRestrictionsFromRows()

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$rowsof db result objects
string$oldFashionedRestrictionscomma-separated list of page restrictions from page table (pre 1.10)

Reimplemented in FakeTitle.

Definition at line 2856 of file Title.php.

References $dbr, $type, $wgContLang, array(), as, DB_SLAVE, getArticleID(), getRestrictionTypes(), global, purgeExpiredRestrictions(), TS_MW, wfGetDB(), and wfTimestampNow().

Referenced by loadRestrictionsFromResultWrapper().

◆ makeName()

static Title::makeName (   $ns,
  $title,
  $fragment = '',
  $interwiki = '' 
)
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
Returns
String the prefixed form of the title

Definition at line 702 of file Title.php.

References $name, $title, $wgContLang, and global.

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

◆ makeTitle()

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

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

Referenced by FakeDimensionFile\__construct(), CategoryViewer\addFragmentToTitle(), LinkBatch\addResultToCache(), ProtectionForm\buildForm(), ChangesFeed\buildItems(), LocalRepo\checkRedirect(), Orphans\checkSeparation(), CompressOld\compressWithConcat(), Article\confirmDelete(), SpecialRedirect\dispatchUser(), SpecialTags\doTagRow(), LinkHolderArray\doVariants(), CheckBadRedirects\execute(), ApiQueryDeletedrevs\execute(), DeleteDefaultMessages\execute(), ApiQueryFilearchive\execute(), DumpSisterSites\execute(), FixDoubleRedirects\execute(), AttachLatest\execute(), DumpLinks\execute(), PurgeChangedPages\execute(), NukeNS\execute(), DeleteEqualMessages\execute(), ApiQueryBacklinks\extractRedirRowInfo(), ApiQueryRandom\extractRowInfo(), ApiQueryWatchlist\extractRowInfo(), ApiQueryContributions\extractRowInfo(), ApiQueryLogEvents\extractRowInfo(), ApiQueryBacklinks\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(), NewFilesPager\formatRow(), DeletedContribsPager\formatRow(), SpecialNewpages\formatRow(), AllmessagesTablePager\formatValue(), ImageListPager\formatValue(), LinksUpdate\getAddedLinks(), JobQueueDB\getAllQueuedJobs(), getBaseTitle(), getBrokenLinksFrom(), User\getCanonicalName(), getCascadeProtectionSources(), ApiUpload\getChunkResult(), DoubleRedirectJob\getFinalDestination(), WikiPage\getHiddenCategories(), RevDel_LogItem\getHTML(), JobQueueRedis\getJobFromUidInternal(), SpecialExport\getLinks(), getLinksFrom(), getLinksTo(), MessageCache\getMsgFromNamespace(), SearchEngine\getNearMatchInternal(), 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(), RecentChange\getTitle(), SpecialPage\getTitleFor(), SpecialPageTest\getTitleForWithWarningProvider(), ResourceLoaderWikiModule\getTitleMtimes(), User\getTokenUrl(), UserRightsProxy\getUserPage(), User\getUserPage(), ImagePage\imageLinks(), ApiPageSet\initFromQueryResult(), SearchResult\initFromRow(), MediaWiki\main(), Revision\newFromArchiveRow(), SquidUpdate\newFromLinksTo(), ForeignDBFile\newFromRow(), OldLocalFile\newFromRow(), LocalFile\newFromRow(), ArchivedFile\newFromRow(), newFromRow(), Article\newFromTitle(), newFromTitleValue(), Revision\newNullRevision(), PageORMTableForTesting\newRow(), XmlDumpWriter\openPage(), MediaWiki\parseTitle(), ApiUpload\performUpload(), RebuildTextIndex\populateSearchIndex(), SpecialBlock\postText(), SpecialBlock\processForm(), WatchlistCleanup\processRow(), CapsCleanup\processRow(), SpecialUnblock\processUnblock(), WikitextContentHandlerTest\provideMakeRedirectContent(), GlobalWithDBTest\provideWfIsBadImageList(), PurgeChangedFiles\purgeFromLogType(), PurgeList\purgeNamespace(), LinkHolderArray\replaceInternal(), ApiQueryRedirects\run(), ApiQueryLangBacklinks\run(), ApiQueryImages\run(), ApiQueryIWBacklinks\run(), ApiQueryProtectedTitles\run(), ApiQueryWatchlistRaw\run(), ApiQueryExtLinksUsage\run(), ApiQueryCategories\run(), ApiQueryCategoryMembers\run(), ApiQueryAllCategories\run(), ApiQueryPagesWithProp\run(), ApiQueryQueryPage\run(), ApiQueryAllPages\run(), ApiQueryAllImages\run(), ApiQueryLinks\run(), DoubleRedirectJob\run(), ApiQueryAllLinks\run(), ApiQueryRecentChanges\run(), ApiQueryBacklinks\run(), TitlePermissionTest\setTitle(), ArticleTest\setUp(), TitlePermissionTest\setUp(), SpecialAllpages\showChunk(), FileDeleteForm\showForm(), SpecialRevisionDelete\showForm(), SpecialWhatLinksHere\showIndirectLinks(), SpecialPrefixindex\showPrefixChunk(), SpecialUpload\showUploadWarning(), TitlePermissionTest\testCascadingSourcesRestrictions(), SpecialPageTest\testGetTitleFor(), SpecialPageTest\testInvalidGetTitleFor(), RefreshLinksPartitionTest\testRefreshLinks(), LinksUpdateTest\testUpdate_pagelinks(), CoreParserFunctions\urlFunction(), Linker\userLink(), Linker\userTalkLink(), ImagePage\view(), XmlDumpWriter\writeLogItem(), and XmlDumpWriter\writeRevision().

◆ makeTitleSafe()

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 the new object, or NULL on an error

Definition at line 422 of file Title.php.

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

Referenced by UsersPager\__construct(), ActiveUsersPager\__construct(), AllmessagesTablePager\__construct(), OutputPage\addCategoryLinks(), LoginForm\addNewAccountInternal(), ImageCleanup\buildSafeTitle(), DifferenceEngine\deletedLink(), SpecialRedirect\dispatchFile(), JobQueueDB\doPop(), MovePageForm\doSubmit(), LinkHolderArray\doVariants(), SpecialContributions\execute(), SpecialTrackingCategories\execute(), SpecialExport\execute(), ApiFeedContributions\execute(), ImportSiteScripts\execute(), MovePageForm\execute(), SpecialLog\execute(), RebuildFileCache\execute(), SpecialRandomInCategory\execute(), ApiQueryInfo\execute(), SpecialNewpages\form(), Linker\formatAutocommentsCallback(), Linker\formatLinksInCommentCallback(), PageQueryPage\formatResult(), PopularPagesPage\formatResult(), FewestrevisionsPage\formatResult(), UnwatchedpagesPage\formatResult(), MostlinkedCategoriesPage\formatResult(), ShortPagesPage\formatResult(), MostcategoriesPage\formatResult(), MostinterwikisPage\formatResult(), MostlinkedTemplatesPage\formatResult(), MostlinkedPage\formatResult(), WantedQueryPage\formatResult(), SpecialProtectedtitles\formatRow(), ProtectedPagesPager\formatValue(), ImageListPager\formatValue(), Preferences\generateSkinOptions(), CategoryPager\getBody(), LinksUpdate\getCategoryInsertions(), JobQueueRedis\getJobFromFields(), SpecialStatistics\getMostViewedPages(), SpecialAllpages\getNamespaceKeyAndText(), SpecialEditWatchlist\getNormalForm(), WantedFilesPage\getPageHeader(), ResourceLoaderUserModule\getPages(), NewPagesPager\getQueryInfo(), RandomPage\getRandomTitle(), SpecialPage\getSafeTitleFor(), LogPager\getStartBody(), MergeHistoryPager\getStartBody(), getSubpage(), SpecialBlock\getTargetUserTitle(), Category\getTitle(), UploadBase\getTitle(), SpecialUpload\getUploadForm(), SpecialUpload\getWatchCheck(), SpecialEditWatchlist\getWatchlist(), User\idFromName(), LogPager\limitPerformer(), Skin\makeNSUrl(), Linker\makeThumbLink2(), TitleCleanup\moveInconsistentPage(), moveSubpages(), Category\newFromName(), File\normalizeTitle(), ImageQueryPage\outputResults(), CoreParserFunctions\pagesincategory(), ApiQueryBacklinks\parseContinueParam(), ImageCleanup\processRow(), WikiImporter\processTitle(), NamespaceConflictChecker\reportConflict(), NamespaceConflictChecker\resolveConflict(), NamespaceConflictChecker\resolveConflictOn(), RefreshLinksJob\run(), 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(), and wfStreamThumb().

◆ missingPermissionError()

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
$shortBoolean short circuit on first error
Returns
Array list of errors

Definition at line 2378 of file Title.php.

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

Referenced by checkQuickPermissions(), and checkReadPermissions().

◆ moveNoAuth()

Title::moveNoAuth ( $nt)

Move this page without authentication.

Parameters
$ntTitle the new page Title
Returns
Mixed true on success, getUserPermissionsErrors()-like array on failure

Reimplemented in FakeTitle.

Definition at line 3546 of file Title.php.

References moveTo().

◆ moveSubpages()

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

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

Parameters
$ntTitle Move 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
mixed 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

Reimplemented in FakeTitle.

Definition at line 3978 of file Title.php.

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

◆ moveTo()

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

Move a title to a new location.

Parameters
$ntTitle the 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
Mixed true on success, getUserPermissionsErrors()-like array on failure

Reimplemented in FakeTitle.

Definition at line 3712 of file Title.php.

References $comment, $file, $wgUser, array(), as, cache, DB_MASTER, WatchedItem\duplicateEntries(), getArticleID(), getDBkey(), getNamespace(), getPrefixedText(), MWNamespace\getSubject(), global, isProtected(), isValidMoveOperation(), moveToInternal(), NS_FILE, Collation\singleton(), RepoGroup\singleton(), wfGetDB(), wfLocalFile(), wfMessage(), and wfRunHooks().

Referenced by moveNoAuth().

◆ moveToInternal()

Title::moveToInternal ( $nt,
  $reason = '',
  $createRedirect = true 
)
private

Move page to a title which is either a redirect to the source page or nonexistent.

Parameters
$ntTitle the page to move to, which should be a redirect or nonexistent
string$reasonThe reason for the move
bool$createRedirectWhether to leave a redirect at the old title. Does not check if the user has the suppressredirect right
Exceptions
MWException

Definition at line 3843 of file Title.php.

References $comment, $wgContLang, $wgUser, array(), DB_MASTER, WikiPage\factory(), getArticleID(), ContentHandler\getForTitle(), global, RequestContext\newExtraneousContext(), LogFormatter\newFromEntry(), Revision\newNullRevision(), WikiPage\onArticleCreate(), WikiPage\onArticleDelete(), IDBAccessObject\READ_LOCKING, resetArticleID(), wfGetDB(), wfMessage(), and wfRunHooks().

Referenced by moveTo().

◆ nameOf()

static Title::nameOf (   $id)
static

Get the prefixed DB key associated with an ID.

Parameters
int$idthe page_id of the article
Returns
Title an object representing the article, or NULL if no such article was found

Definition at line 507 of file Title.php.

References $dbr, $n, $s, array(), DB_SLAVE, makeName(), and wfGetDB().

◆ newFromDBkey()

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, or NULL on an error

Definition at line 152 of file Title.php.

References $t.

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

◆ newFromID()

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

Create a new Title from an article ID.

Parameters
int$idthe page_id corresponding to the Title to create
int$flagsuse Title::GAID_FOR_UPDATE to use master
Returns
Title|null the new object, or NULL on an error

Definition at line 297 of file Title.php.

References $flags, $title, array(), DB_MASTER, DB_SLAVE, GAID_FOR_UPDATE, newFromRow(), and wfGetDB().

Referenced by CleanupSpam\cleanupArticle(), ApiMove\execute(), Revision\getTitle(), SpecialMergeHistory\merge(), CategoryPage\newFromID(), ImagePage\newFromID(), Article\newFromID(), MediaWiki\parseTitle(), and ApiComparePages\revisionOrTitleOrId().

◆ newFromIDs()

static Title::newFromIDs (   $ids)
static

Make an array of titles from an array of IDs.

Parameters
array$idsof Int Array of IDs
Returns
Array of Titles

Definition at line 319 of file Title.php.

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

◆ newFromRedirect()

static Title::newFromRedirect (   $text)
static

Extract a redirect destination from a string and return the Title, or null if the text doesn't contain a valid redirect This will only return the very next target, useful for the redirect table and other checks that don't need full recursion.

Parameters
string$textText with possible redirect
Returns
Title: The corresponding Title
Deprecated:
since 1.21, use Content::getRedirectTarget instead.

Definition at line 460 of file Title.php.

References CONTENT_MODEL_WIKITEXT, ContentHandler\deprecated(), and ContentHandler\makeContent().

◆ newFromRedirectArray()

static Title::newFromRedirectArray (   $text)
static

Extract a redirect destination from a string and return an array of Titles, or null if the text doesn't contain a valid redirect The last element in the array is the final destination after all redirects have been resolved (up to $wgMaxRedirects times)

Parameters
string$textText with possible redirect
Returns
Array of Titles, with the destination last
Deprecated:
since 1.21, use Content::getRedirectChain instead.

Definition at line 494 of file Title.php.

References CONTENT_MODEL_WIKITEXT, ContentHandler\deprecated(), and ContentHandler\makeContent().

◆ newFromRedirectRecurse()

static Title::newFromRedirectRecurse (   $text)
static

Extract a redirect destination from a string and return the Title, or null if the text doesn't contain a valid redirect This will recurse down $wgMaxRedirects times or until a non-redirect target is hit in order to provide (hopefully) the Title of the final destination instead of another redirect.

Parameters
string$textText with possible redirect
Returns
Title
Deprecated:
since 1.21, use Content::getUltimateRedirectTarget instead.

Definition at line 477 of file Title.php.

References CONTENT_MODEL_WIKITEXT, ContentHandler\deprecated(), and ContentHandler\makeContent().

◆ newFromRow()

◆ newFromText()

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$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
MWException
Returns
Title|null - Title or null on an error.
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 189 of file Title.php.

References $cache, $ret, $t, Sanitizer\decodeCharReferencesAndNormalize(), getTitleCache(), and NS_MAIN.

Referenced by RecentChangeTest\__construct(), PreferencesTest\__construct(), ImageListPager\__construct(), DoubleRedirectJob\__construct(), Installer\__construct(), LinkHolderArray\__wakeup(), MediaWikiTestCase\addCoreDBData(), BackupDumperPageTest\addDBData(), TextPassDumperTest\addDBData(), ApiQueryBasicTest\addDBData(), FetchTextTest\addDBData(), BackupDumperLoggerTest\addLogEntry(), ApiQueryLogEvents\addLogParams(), Skin\addToSidebarPlain(), EditPageTest\assertEdit(), CoreParserFunctions\basepagename(), CoreParserFunctions\basepagenamee(), SkinTemplate\buildPersonalUrls(), CoreParserFunctions\cascadingsources(), SpecialComparePages\checkExistingTitle(), LocalRepo\checkRedirect(), Skin\checkTitle(), ApiFeedWatchlist\createFeedItem(), RevisionStorageTest\createPage(), PrefixSearch\defaultSearchBackend(), UploadFromUrlTest\deleteFile(), ApiTestCaseUpload\deleteFileByFileName(), ApiTestCaseUpload\deleteFileByTitle(), CoreParserFunctions\displaytitle(), SpecialExport\doExport(), PurgeList\doPurge(), SpecialChangeEmail\doReturnTo(), GenderCache\doTitlesArray(), Skin\drawCategoryBrowser(), ApiTestCase\editPage(), ApiUndelete\execute(), ApiMove\execute(), ApiRevisionDelete\execute(), Undelete\execute(), ApiWatch\execute(), ApiParse\execute(), ApiExpandTemplates\execute(), ApiQueryLangLinks\execute(), ApiQueryAllMessages\execute(), ApiQueryIWLinks\execute(), MaintenanceFormatInstallDoc\execute(), GetTextMaint\execute(), NukePage\execute(), SpecialListGroupRights\execute(), Protect\execute(), ApiQueryLogEvents\execute(), RollbackEdits\execute(), FixDoubleRedirects\execute(), MovePageForm\execute(), EditCLI\execute(), SpecialLog\execute(), DumpIterator\execute(), DeleteBatch\execute(), SpecialExpandTemplates\execute(), BenchmarkParse\execute(), MoveBatch\execute(), SpecialRandomInCategory\execute(), FileDuplicateSearchPage\execute(), SpecialRevisionDelete\execute(), LoginForm\executeReturnTo(), SpecialEditWatchlist\extractTitles(), Skin\footerLink(), foreach(), Linker\formatAutocommentsCallback(), ApiParse\formatIWLinks(), ApiParse\formatLangLinks(), Linker\formatLinksInCommentCallback(), LogFormatter\formatParameterValue(), MIMEsearchPage\formatResult(), FileDuplicateSearchPage\formatResult(), CoreParserFunctions\fullpagename(), CoreParserFunctions\fullpagenamee(), CoreParserFunctions\gender(), MoveLogFormatter\getActionLinks(), User\getCanonicalName(), Skin\getCategoryLinks(), RCCacheEntryFactoryTest\getContext(), Skin\getCopyright(), ApiFeedRecentChanges\getFeedObject(), User\getGroupPage(), SpecialStatistics\getGroupStats(), OutputPage\getHeadLinksArray(), ApiPageSet\getInterwikiTitlesAsResult(), SkinTemplate\getLanguages(), IRCColourfulRCFeedFormatter\getLine(), SpecialExport\getLinks(), MoveLogFormatter\getMessageParameters(), SearchEngine\getNearMatchInternal(), WantedFilesPage\getPageHeader(), getParentCategoryTree(), MoveLogFormatter\getPreloadTitles(), ApiRollback\getRbTitle(), WikitextContent\getRedirectTarget(), ResourceLoaderWikiModule\getScript(), ParserOutput\getSecondaryDataUpdates(), ResourceLoaderWikiModule\getStyles(), SpecialRecentChangesLinked\getTargetTitle(), DifferenceEngineTest\getTitle(), CLIParser\getTitle(), UploadBase\getTitle(), LogPage\getTitleLink(), ResourceLoaderWikiModule\getTitleMtimes(), SpecialSearch\goResult(), SideBarTest\initMessagesHref(), SearchEngineTest\insertPage(), User\isValidUserName(), ApiParse\languagesHtml(), LogPager\limitTitle(), PageArchive\listPagesByPrefix(), LoginForm\load(), MediaWiki\main(), SkinTemplate\makeArticleUrlDetails(), Skin\makeI18nUrl(), Skin\makeKnownUrlDetails(), MessageCacheTest\makePage(), SkinTemplate\makeTalkUrlDetails(), PPFuzzTester\makeTitle(), LinksUpdateTest\makeTitleAndParserOutput(), Skin\makeUrl(), Skin\makeUrlDetails(), TitleCleanup\moveIllegalPage(), CoreParserFunctions\mwnamespace(), CoreParserFunctions\namespacee(), CoreParserFunctions\namespacenumber(), ImportStreamSource\newFromInterwiki(), ForeignAPIFile\newFromTitle(), newMainPage(), WikiPageTest\newPage(), RevisionTest\newTestRevision(), MediaWikiSite\normalizePageName(), SpecialChangePassword\onSubmit(), WikiExporter\pageByName(), CoreParserFunctions\pageid(), CoreParserFunctions\pagename(), CoreParserFunctions\pagenamee(), CoreParserFunctions\pagesize(), MessageCache\parse(), WikiImporter\processLogItem(), TitleCleanup\processRow(), WatchlistCleanup\processRow(), WikiImporter\processTitle(), ApiPageSet\processTitlesArray(), CoreParserFunctions\protectionlevel(), ParserOutput\replaceEditSectionLinksCallback(), 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(), ApiQueryImages\run(), ApiQueryCategories\run(), ApiQueryLinks\run(), PrefixSearch\search(), WikiImporter\setTargetRootPage(), TextContentTest\setUp(), ParserPreloadTest\setUp(), ApiOptionsTest\setUp(), MagicVariableTest\setUp(), SpecialSearch\showInterwikiHit(), SpecialSearch\showResults(), SpecialEditWatchlist\showTitles(), CoreParserFunctions\subjectpagename(), CoreParserFunctions\subjectpagenamee(), CoreParserFunctions\subjectspace(), CoreParserFunctions\subjectspacee(), CoreParserFunctions\subpagename(), CoreParserFunctions\subpagenamee(), Skin\subPageSubtitle(), CologneBlueTemplate\sysLinks(), CoreParserFunctions\talkpagename(), CoreParserFunctions\talkpagenamee(), CoreParserFunctions\talkspace(), CoreParserFunctions\talkspacee(), EditPageTest\testAutoMerge(), TagHookTest\testBadFunctionTagHooks(), TagHookTest\testBadTagHooks(), ArticleTablesTest\testbug14404(), ApiQueryAllPagesTest\testBug25702(), TitleTest\testBug31100FixSpecialName(), SpecialPreferencesTest\testBug41337(), ParserMethodsTest\testCallParserFunction(), ExtraParserTest\testCleanSig(), ExtraParserTest\testCleanSigDisabled(), RevisionTest\testConstructWithContent(), ApiQueryRevisionsTest\testContentComesWithContentModelAndFormat(), TestSample\testCreateBasicListOfTitles(), TextContentTest\testDeletionUpdates(), WikiPageTest\testDoDeleteArticle(), WikiPageTest\testDoEdit(), ApiEditPageTest\testEditAppend(), ApiEditPageTest\testEditConflict(), ApiEditPageTest\testEditConflict_bug41990(), ApiEditPageTest\testEditConflict_redirect(), UserTest\testEditCount(), ApiEditPageTest\testEditNewSection(), ApiEditPageTest\testEditSection(), TitleMethodsTest\testEquals(), TagHookTest\testFunctionTagHooks(), TitleTest\testGetBaseText(), RevisionTest\testGetContentClone(), TitleMethodsTest\testGetContentModel(), ContentHandlerTest\testGetDefaultModelFor(), ContentHandlerTest\testGetForTitle(), TitleTest\testGetFragment(), ContentHandlerTest\testGetPageLanguage(), TitleTest\testGetPageViewLanguage(), TextContentTest\testGetParserOutput(), ExtraParserTest\testGetPreloadText(), ApiWatchTest\testGetRollbackToken(), TitleTest\testGetRootText(), WikitextContentTest\testGetSecondaryDataUpdates(), ParserMethodsTest\testGetSections(), TitleTest\testGetSubpageText(), TitleTest\testGetTitleValue(), TitleMethodsTest\testHasContentModel(), TitleMethodsTest\testHasSubjectNamespace(), TitleMethodsTest\testInNamespace(), TitleMethodsTest\testInNamespaces(), WikiPageTest\testIsCountable(), TitleMethodsTest\testIsCssJsSubpage(), TitleMethodsTest\testIsCssOrJsPage(), TitleMethodsTest\testIsCssSubpage(), TitleMethodsTest\testIsJsSubpage(), TitleTest\testIsValidMoveOperation(), TitleMethodsTest\testIsWikitextPage(), ExtraParserTest\testLongNumericLinesDontKillTheParser(), ContentHandlerTest\testMakeContent(), WikitextContentHandlerTest\testMakeRedirectContent(), ApiEditPageTest\testNonTextEdit(), ExtraParserTest\testParse(), ExtraParserTest\testPreprocess(), ParserMethodsTest\testPreSaveTransform(), ExtraParserTest\testPreSaveTransform(), ApiPurgeTest\testPurgeMainPage(), SpecialSearchTest\testSearchTermIsNotExpanded(), TitleTest\testSecureAndSplit(), TagHookTest\testTagHooks(), TemplateCategoriesTest\testTemplateCategories(), TestSample\testTitleObjectFromObject(), TestSample\testTitleObjectStringConversion(), ApiQueryTest\testTitlesAreRejectedIfInvalid(), ApiQueryTest\testTitlesGetNormalized(), ExtraParserTest\testTrackingCategory(), LinksUpdateTest\testUpdate_langlinks(), LinksUpdateTest\testUpdate_pagelinks(), LinksUpdateTest\testUpdate_templatelinks(), JavaScriptContentTest\testUpdateRedirect(), RevisionStorageTest\testUserWasLastToEdit(), RequestContextTest\testWikiPageTitle(), ApiQueryBase\titleToKey(), SpecialEditWatchlist\unwatchTitles(), CoreParserFunctions\urlFunction(), and SpecialEditWatchlist\watchTitles().

◆ newFromTitleValue()

static Title::newFromTitleValue ( TitleValue  $titleValue)
static

Create a new Title from a TitleValue.

Parameters
TitleValue$titleValue,assumedto be safe.
Returns
Title

Definition at line 169 of file Title.php.

References TitleValue\getFragment(), TitleValue\getNamespace(), TitleValue\getText(), and makeTitle().

Referenced by MediaWikiPageLinkRenderer\renderHtmlLink(), and TitleTest\testNewFromTitleValue().

◆ newFromURL()

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 the new object, or NULL on an error

Definition at line 241 of file Title.php.

References $t.

Referenced by ImageListPager\__construct(), ImageListPager\buildQueryConds(), SpecialRecentChangesLinked\doMainQuery(), SpecialWhatLinksHere\execute(), NewFilesPager\getQueryInfo(), SpecialUndelete\loadRequest(), SpecialMergeHistory\loadRequestParams(), MediaWiki\parseTitle(), OutputPage\showPermissionsErrorPage(), and CoreParserFunctions\urlFunction().

◆ newMainPage()

◆ pageCond()

Title::pageCond ( )

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

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

Reimplemented in FakeTitle.

Definition at line 4201 of file Title.php.

References array().

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

◆ prefix()

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

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

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

◆ purgeExpiredRestrictions()

static Title::purgeExpiredRestrictions ( )
static

Purge expired restrictions from the page_restrictions table.

Definition at line 2988 of file Title.php.

References array(), DB_MASTER, wfGetDB(), and wfReadOnly().

Referenced by WikiPage\doUpdateRestrictions(), SpecialProtectedtitles\execute(), SpecialProtectedpages\execute(), getCascadeProtectionSources(), loadRestrictions(), and loadRestrictionsFromRows().

◆ purgeSquid()

Title::purgeSquid ( )

Purge all applicable Squid URLs.

Reimplemented in FakeTitle.

Definition at line 3531 of file Title.php.

References getSquidURLs(), and global.

Referenced by File\purgeDescription().

◆ quickUserCan()

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
$userUser to check (since 1.19); $wgUser will be used if not provided.
Returns
Bool

Reimplemented in FakeTitle.

Definition at line 1882 of file Title.php.

References $user, and userCan().

Referenced by MovePageForm\showForm().

◆ resetArticleID()

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

Reimplemented in FakeTitle.

Definition at line 3243 of file Title.php.

References array(), and LinkCache\singleton().

Referenced by moveToInternal().

◆ resultToError()

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

Add the resulting error code to the errors array.

Parameters
array$errorslist of current errors
$resultMixed result of errors
Returns
Array list of errors

Definition at line 2002 of file Title.php.

References array().

Referenced by checkPermissionHooks().

◆ secureAndSplit()

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.

Returns
Bool true on success

Definition at line 3290 of file Title.php.

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

◆ setFragment()

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. Still in active use privately.

Parameters
string$fragmenttext

Reimplemented in FakeTitle.

Definition at line 1327 of file Title.php.

Referenced by secureAndSplit().

◆ touchLinks()

Title::touchLinks ( )

Update page_touched timestamps and send squid 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.

Reimplemented in FakeTitle.

Definition at line 4655 of file Title.php.

References getNamespace(), and NS_CATEGORY.

◆ updateTitleProtection()

Title::updateTitleProtection (   $create_perm,
  $reason,
  $expiry 
)

Update the title protection status.

Deprecated:
in 1.19; use WikiPage::doUpdateRestrictions() instead.
Parameters
$create_permString Permission required for creation
string$reasonReason for protection
string$expiryExpiry timestamp
Returns
boolean true

Reimplemented in FakeTitle.

Definition at line 2530 of file Title.php.

References $limit, $wgUser, array(), WikiPage\factory(), global, and wfDeprecated().

◆ userCan()

Title::userCan (   $action,
  $user = null,
  $doExpensiveQueries = true 
)

Can $user perform $action on this page?

Parameters
string$actionaction that permission needs to be checked for
$userUser to check (since 1.19); $wgUser will be used if not provided.
bool$doExpensiveQueriesSet this to false to avoid doing unnecessary queries.
Returns
Bool

Reimplemented in FakeTitle.

Definition at line 1896 of file Title.php.

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

Referenced by checkActionPermissions(), moveSubpages(), quickUserCan(), and userCanRead().

◆ userCanRead()

Title::userCanRead ( )

Can $wgUser read this page?

Deprecated:
in 1.19; use userCan(), quickUserCan() or getUserPermissionsErrors() instead
Returns
Bool

Reimplemented in FakeTitle.

Definition at line 1862 of file Title.php.

References userCan(), and wfDeprecated().

◆ userIsWatching()

Title::userIsWatching ( )

Is $wgUser watching this page?

Deprecated:
in 1.20; use User::isWatched() instead.
Returns
Bool

Reimplemented in FakeTitle.

Definition at line 1843 of file Title.php.

References $mWatched, $wgUser, global, and NS_SPECIAL.

◆ validateFileMoveOperation()

Title::validateFileMoveOperation (   $nt)
protected

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

Parameters
Title$ntTarget title
Returns
array List of errors

Definition at line 3667 of file Title.php.

References $file, $wgUser, array(), File\checkExtensionCompatibility(), global, NS_FILE, wfFindFile(), wfLocalFile(), and wfStripIllegalFilenameChars().

Referenced by isValidMoveOperation().

Member Data Documentation

◆ $mArticleID

Title::$mArticleID = -1

Cascade restrictions on this page to included templates and images?

Definition at line 66 of file Title.php.

Referenced by getArticleID().

◆ $mCascadeRestriction

Title::$mCascadeRestriction

Cascade restrictions on this page to included templates and images?

Definition at line 72 of file Title.php.

Referenced by areRestrictionsCascading().

◆ $mCascadeSources

Title::$mCascadeSources

Where are the cascading restrictions coming from on this page?

Definition at line 76 of file Title.php.

◆ $mCascadingRestrictions

Title::$mCascadingRestrictions

Cascade restrictions on this page to included templates and images?

Definition at line 73 of file Title.php.

◆ $mContentModel

Title::$mContentModel = false

Cascade restrictions on this page to included templates and images?

Definition at line 68 of file Title.php.

Referenced by getContentModel().

◆ $mDbkeyform

Title::$mDbkeyform = ''

Cascade restrictions on this page to included templates and images?

Definition at line 61 of file Title.php.

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

◆ $mDefaultNamespace

Title::$mDefaultNamespace = NS_MAIN

Cascade restrictions on this page to included templates and images?

Definition at line 83 of file Title.php.

Referenced by getDefaultNamespace(), and secureAndSplit().

◆ $mEstimateRevisions

Title::$mEstimateRevisions
private

Cascade restrictions on this page to included templates and images?

Definition at line 69 of file Title.php.

Referenced by estimateRevisionCount().

◆ $mFragment

Title::$mFragment = ''

Cascade restrictions on this page to included templates and images?

Definition at line 65 of file Title.php.

Referenced by getFragment().

◆ $mHasCascadingRestrictions

Title::$mHasCascadingRestrictions

Are cascading restrictions in effect on this page?

Definition at line 75 of file Title.php.

◆ $mHasSubpage

Title::$mHasSubpage

Cascade restrictions on this page to included templates and images?

Definition at line 88 of file Title.php.

◆ $mInterwiki

Title::$mInterwiki = ''

Cascade restrictions on this page to included templates and images?

Definition at line 64 of file Title.php.

Referenced by getInterwiki().

◆ $mLatestID

Title::$mLatestID = false

Cascade restrictions on this page to included templates and images?

Definition at line 67 of file Title.php.

Referenced by getLatestRevID().

◆ $mLength

Title::$mLength = -1

Cascade restrictions on this page to included templates and images?

Definition at line 85 of file Title.php.

Referenced by getLength().

◆ $mNamespace

Title::$mNamespace = NS_MAIN

Cascade restrictions on this page to included templates and images?

Definition at line 63 of file Title.php.

Referenced by getNamespace().

◆ $mNotificationTimestamp

Title::$mNotificationTimestamp = array()

Cascade restrictions on this page to included templates and images?

Definition at line 87 of file Title.php.

◆ $mOldRestrictions

Title::$mOldRestrictions = false

Cascade restrictions on this page to included templates and images?

Definition at line 71 of file Title.php.

◆ $mPageLanguage

Title::$mPageLanguage = false
private

Cascade restrictions on this page to included templates and images?

Definition at line 89 of file Title.php.

◆ $mPrefixedText

Title::$mPrefixedText = null

Text form including namespace/interwiki, initialised on demand.

Definition at line 78 of file Title.php.

Referenced by getPrefixedText().

◆ $mRedirect

Title::$mRedirect = null

Cascade restrictions on this page to included templates and images?

Definition at line 86 of file Title.php.

Referenced by isRedirect().

◆ $mRestrictions

Title::$mRestrictions = array()

Cascade restrictions on this page to included templates and images?

Definition at line 70 of file Title.php.

Referenced by getAllRestrictions().

◆ $mRestrictionsExpiry

Title::$mRestrictionsExpiry = array()

When do the restrictions on this page expire?

Definition at line 74 of file Title.php.

◆ $mRestrictionsLoaded

Title::$mRestrictionsLoaded = false

Boolean for initialisation on demand.

Definition at line 77 of file Title.php.

Referenced by areRestrictionsLoaded().

◆ $mTextform

Title::$mTextform = ''

Cascade restrictions on this page to included templates and images?

Definition at line 59 of file Title.php.

Referenced by getSubpageText(), and getText().

◆ $mTitleProtection

Title::$mTitleProtection

Cached value for getTitleProtection (create protection)

Definition at line 79 of file Title.php.

Referenced by getTitleProtection().

◆ $mTitleValue

Title::$mTitleValue = null
private

Cascade restrictions on this page to included templates and images?

Definition at line 90 of file Title.php.

Referenced by getTitleValue().

◆ $mUrlform

Title::$mUrlform = ''

Cascade restrictions on this page to included templates and images?

Definition at line 60 of file Title.php.

Referenced by getPartialURL().

◆ $mUserCaseDBKey

Title::$mUserCaseDBKey

Cascade restrictions on this page to included templates and images?

Definition at line 62 of file Title.php.

Referenced by getUserCaseDBKey().

◆ $mWatched

Title::$mWatched = null

Cascade restrictions on this page to included templates and images?

Definition at line 84 of file Title.php.

Referenced by userIsWatching().

◆ $titleCache

Title::$titleCache = null
staticprivate

Definition at line 37 of file Title.php.

Referenced by getTitleCache().

◆ CACHE_MAX

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

Referenced by getNotificationTimestamp().

◆ GAID_FOR_UPDATE

const Title::GAID_FOR_UPDATE = 1

Used to be GAID_FOR_UPDATE define.

Used with getArticleID() and friends to use the master DB

Definition at line 50 of file Title.php.

Referenced by getFirstRevision(), getLatestRevID(), getNextRevisionID(), getPreviousRevisionID(), newFromID(), and UploadFromUrlTest\testLeaveMessage().


The documentation for this class was generated from the following file:
Title\newFromText
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:189