5 define(
'NS_MAIN', 
"nsmain");
     6 define(
'NS_SPECIAL', 
"nsspecial");
     8 define(
'GAID_FOR_UPDATE', 1);
    10 # Title::newFromTitle maintains a cache to avoid    11 # expensive re-normalization of commonly used titles.    12 # On a batch operation this can become a memory leak    13 # if not bounded. After hitting this many titles,    15 define(
'MW_TITLECACHE_MAX', 1000);
    17 # Constants for pr_cascade bitfield    50     public $mNamespace;                 # Namespace index, i.e. one of the NS_xxxx constants
    52     public 
$mFragment;                  
# Title fragment (i.e. the bit after the #)    63     # Zero except in {{transclusion}} tags    64     public $mWatched;                   # Is $wgUser watching 
this page? NULL 
if unfilled, accessed through userIsWatching()
    74         $this->mInterwiki = $this->mUrlform =
    75         $this->mTextform = $this->mDbkeyform = 
'';
    76         $this->mArticleID = -1;
    78         $this->mRestrictionsLoaded = 
false;
    79         $this->mRestrictions = array();
    80         # Dont change the following, NS_MAIN is hardcoded in several place    82         $this->mDefaultNamespace = 
NS_MAIN;
    83         $this->mWatched = null;
    84         $this->mLatestID = 
false;
    85         $this->mOldRestrictions = 
false;
   120         $t->mDbkeyform = str_replace(
' ', 
'_', $filteredText);
   121         $t->mDefaultNamespace = $defaultNamespace;
   123         static $cachedcount = 0 ;
   124         if ($t->secureAndSplit()) {
   125             if ($defaultNamespace == 
NS_MAIN) {
   127                     # Avoid memory leaks on mass operations...   142     #----------------------------------------------------------------------------   144     #----------------------------------------------------------------------------   153         global $wgLegalTitleChars;
   155         $wgLegalTitleChars = 
" %!\"$&'()*,\\-.\\/0-9:;=?@A-Z\\\\^_`a-z~\\x80-\\xFF+";
   157         return $wgLegalTitleChars;
   173     #----------------------------------------------------------------------------   175     #----------------------------------------------------------------------------   209         global $wgContLang, $wgCanonicalNamespaceNames;
   211         if (
'' != $this->mInterwiki) {
   218             if (isset($wgCanonicalNamespaceNames[$this->mNamespace])) {
   222         return $wgContLang->getNsText($this->mNamespace);
   252         if (
'' != $this->mInterwiki) {
   253             $p = $this->mInterwiki . 
':';
   255         if (0 != $this->mNamespace) {
   273         global $wgContLang, $wgLocalInterwiki, $wgCapitalLinks;
   276         static $rxTc = 
false;
   278             # % is needed as well   282         $this->mInterwiki = $this->mFragment = 
'';
   287         # Strip Unicode bidi override characters.   288         # Sometimes they slip into cut-n-pasted page titles, where the   289         # override chars get included in list displays.   290         $dbkey = str_replace(
"\xE2\x80\x8E", 
'', $dbkey); 
   291         $dbkey = str_replace(
"\xE2\x80\x8F", 
'', $dbkey); 
   293         # Clean up whitespace   295         $dbkey = preg_replace(
'/[ _]+/', 
'_', $dbkey);
   296         $dbkey = trim($dbkey, 
'_');
   302         if (
false !== strpos($dbkey, UTF8_REPLACEMENT)) {
   303             # Contained illegal UTF-8 sequences or forbidden Unicode chars.   307         $this->mDbkeyform = $dbkey;
   309         # Initial colon indicates main namespace rather than specified default   310         # but should not create invalid {ns,title} pairs such as {0,Project:Foo}   311         if (
':' == $dbkey[0]) {
   313             $dbkey = substr($dbkey, 1); # 
remove the colon but 
continue processing
   314             $dbkey = trim($dbkey, 
'_'); # 
remove any subsequent whitespace
   317         # Namespace or interwiki prefix   321             if (preg_match(
"/^(.+?)_*:_*(.*)$/S", $dbkey, $m)) {
   323                 if ($ns = $wgContLang->getNsIndex($p)) {
   326                     $this->mNamespace = $ns;
   329                         # Can't make a local interwiki link to an interwiki link.   336                     $this->mInterwiki = $wgContLang->lc($p);
   338                     # Redundant interwiki prefix to the local wiki   339                     if (0 == strcasecmp($this->mInterwiki, $wgLocalInterwiki)) {
   341                             # Can't have an empty self-link   344                         $this->mInterwiki = 
'';
   346                         # Do another namespace split...   350                     # If there's an initial colon after the interwiki, that also   351                     # resets the default namespace   352                     if ($dbkey !== 
'' && $dbkey[0] == 
':') {
   354                         $dbkey = substr($dbkey, 1);
   357                 # If there's no recognized interwiki or namespace,   358                 # then let the colon expression be part of the title.   363         # We already know that some pages won't be in the database!   365         if (
'' != $this->mInterwiki || 
NS_SPECIAL == $this->mNamespace) {
   366             $this->mArticleID = 0;
   368         $fragment = strstr($dbkey, 
'#');
   369         if (
false !== $fragment) {
   371             $dbkey = substr($dbkey, 0, strlen($dbkey) - strlen($fragment));
   372             # remove whitespace again: prevents "Foo_bar_#"   373             # becoming "Foo_bar_"   374             $dbkey = preg_replace(
'/_*$/', 
'', $dbkey);
   377         # Reject illegal characters.   379         if (preg_match($rxTc, $dbkey)) {
   388         if (strpos($dbkey, 
'.') !== 
false &&
   389              ($dbkey === 
'.' || $dbkey === 
'..' ||
   390                strpos($dbkey, 
'./') === 0 ||
   391                strpos($dbkey, 
'../') === 0 ||
   392                strpos($dbkey, 
'/./') !== 
false ||
   393                strpos($dbkey, 
'/../') !== 
false)) {
   400         if (strpos($dbkey, 
'~~~') !== 
false) {
   411         if (($this->mNamespace != 
NS_SPECIAL && strlen($dbkey) > 255) ||
   412           strlen($dbkey) > 512) {
   424         if ($wgCapitalLinks && $this->mInterwiki == 
'') {
   425             $dbkey = $wgContLang->ucfirst($dbkey);
   434             $this->mInterwiki == 
'' &&
   435             $this->mNamespace != 
NS_MAIN) {
   440         if ($dbkey !== 
'' && 
':' == $dbkey[0]) {
   445         $this->mDbkeyform = $dbkey;
   448         $this->mTextform = str_replace(
'_', 
' ', $dbkey);
   464         $this->mFragment = str_replace(
'_', 
' ', substr($fragment, 1));
   478             && $this->
getDBkey() === $title->getDBkey();
 setFragment($fragment)
Set the fragment for this title This is kind of bad, since except for this rarely-used function...
 
getFragment()
Get the Title fragment (i.e. 
 
getText()
Simple accessors. 
 
secureAndSplit()
Secure and split - main initialisation function for this object. 
 
getInterwikiLink($key)
Returns the URL associated with an interwiki prefix. 
 
prefix($name)
Prefix some arbitrary text with the namespace or interwiki prefix of this object. ...
 
$mHasCascadingRestrictions
 
static newFromText($text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link. 
 
static decodeCharReferences($text)
Decode any character references, numeric or named entities, in the text and return a UTF-8 string...
 
getNsText()
Get the namespace text. 
 
getDBkey()
Get the main part with underscores. 
 
static $titleCache
Static cache variables. 
 
getNamespace()
Get the namespace index, i.e. 
 
getInterwiki()
Get the interwiki prefix (or null string) 
 
to(\GdImage $image, int $quality=null)
Currently this is the only way to make a FileStream from a GD image resource. 
 
form( $class_path, string $cmd, string $submit_caption="")
 
$mTextform
All member variables should be considered private Please use the accessor functions. 
 
link(string $caption, string $href, bool $new_viewport=false)
 
static legalChars()
Get a regex character class describing the legal characters in a link. 
 
static wfUrlencode(string $s)
 
$mCascadeRestrictionSources
 
equals($title)
Compare with another title.