is intended to be an immutable "value" class, so there are no mutator functions.
To get a new instance, call Title::newFromText(). Once instantiated, the
-non-static accessor methods can be used, such as getText(), getDBKey(),
+non-static accessor methods can be used, such as getText(), getDBkey(),
getNamespace(), etc. Note that Title::newFromText() may return false if the text
is illegal according to the rules below.
handling for interlanguage links, image links, and category links. It is also
used to indicate the main namespace in template inclusions.
-Once prefixes have been stripped, the rest of the title processed this way:
+Once prefixes have been stripped, the rest of the title processed this way:
* Spaces and underscores are treated as equivalent and each is converted to the
other in the appropriate context (underscore in URL and database keys, spaces
- in plain text).
+ in plain text).
* Multiple consecutive spaces are converted to a single space.
* Leading or trailing space is removed.
* If $wgCapitalLinks is enabled (the default), the first letter is capitalised,
be up to 512 bytes.
Note that Unicode Normal Form C (NFC) is enforced by MediaWiki's user interface
-input functions, and so titles will typically be in this form.
+input functions, and so titles will typically be in this form.
getArticleID() needs some explanation: for "internal" articles, it should return
the "page_id" field if the article exists, else it returns 0. For all external
# Handle redirects
$redirectTitle = RepoGroup::singleton()->checkRedirect( Title::makeTitle( NS_FILE, $name ) );
if( $redirectTitle ) {
- $name = $redirectTitle->getDbKey();
+ $name = $redirectTitle->getDBkey();
}
# Run the extension hook
$limit = 100;
$out = $this->getContext()->getOutput();
- $res = $this->queryImageLinks( $this->getTitle()->getDbKey(), $limit + 1 );
+ $res = $this->queryImageLinks( $this->getTitle()->getDBkey(), $limit + 1 );
$rows = array();
$redirects = array();
foreach ( $res as $row ) {
*/
protected static function getUploadUrl( $destFile, $query = '' ) {
global $wgUploadMissingFileUrl, $wgUploadNavigationUrl;
- $q = 'wpDestFile=' . $destFile->getPartialUrl();
+ $q = 'wpDestFile=' . $destFile->getPartialURL();
if ( $query != '' )
$q .= '&' . $query;
$nodotdot = substr( $nodotdot, 3 );
}
if ( $dotdotcount > 0 ) {
- $exploded = explode( '/', $contextTitle->GetPrefixedText() );
+ $exploded = explode( '/', $contextTitle->getPrefixedText() );
if ( count( $exploded ) > $dotdotcount ) { # not allowed to go below top level page
$ret = implode( '/', array_slice( $exploded, 0, -$dotdotcount ) );
# / at the end means don't show full path
if ( $res->numRows() > 0 ) {
foreach ( $res as $row ) {
- // $data[] = Title::newFromText($wgContLang->getNSText ( NS_CATEGORY ).':'.$row->cl_to);
- $data[$wgContLang->getNSText( NS_CATEGORY ) . ':' . $row->cl_to] = $this->getFullText();
+ // $data[] = Title::newFromText($wgContLang->getNsText ( NS_CATEGORY ).':'.$row->cl_to);
+ $data[$wgContLang->getNsText( NS_CATEGORY ) . ':' . $row->cl_to] = $this->getFullText();
}
}
return $data;
ApiQueryBase::addTitleInfo( $vals, $title );
$vals['special'] = '';
if ( $title->isSpecialPage() &&
- !SpecialPageFactory::exists( $title->getDbKey() ) ) {
+ !SpecialPageFactory::exists( $title->getDBkey() ) ) {
$vals['missing'] = '';
} elseif ( $title->getNamespace() == NS_MEDIA &&
!wfFindFile( $title ) ) {
if ( trim( $key ) == '' ) {
return '';
}
- $t = Title::newFromDbKey( $key );
+ $t = Title::newFromDBkey( $key );
// This really shouldn't happen but we gotta check anyway
if ( !$t ) {
$this->dieUsageMsg( array( 'invalidtitle', $key ) );
*/
static function newFromTitle( Title $title, $repo ) {
$data = $repo->fetchImageQuery( array(
- 'titles' => 'File:' . $title->getDBKey(),
+ 'titles' => 'File:' . $title->getDBkey(),
'iiprop' => self::getProps(),
'prop' => 'imageinfo',
'iimetadataversion' => MediaHandler::getMetadataVersion()
$t = Title::newFromText( $title );
if ( is_null( $t ) || !$t->canTalk() )
return '';
- return wfEscapeWikiText( $t->getTalkPage()->getPrefixedUrl() );
+ return wfEscapeWikiText( $t->getTalkPage()->getPrefixedURL() );
}
static function subjectpagename( $parser, $title = null ) {
$t = Title::newFromText( $title );
$t = Title::newFromText( $title );
if ( is_null( $t ) )
return '';
- return wfEscapeWikiText( $t->getSubjectPage()->getPrefixedUrl() );
+ return wfEscapeWikiText( $t->getSubjectPage()->getPrefixedURL() );
}
/**
case 'talkpagenamee':
if ( $this->mTitle->canTalk() ) {
$talkPage = $this->mTitle->getTalkPage();
- $value = wfEscapeWikiText( $talkPage->getPrefixedUrl() );
+ $value = wfEscapeWikiText( $talkPage->getPrefixedURL() );
} else {
$value = '';
}
break;
case 'subjectpagenamee':
$subjPage = $this->mTitle->getSubjectPage();
- $value = wfEscapeWikiText( $subjPage->getPrefixedUrl() );
+ $value = wfEscapeWikiText( $subjPage->getPrefixedURL() );
break;
case 'pageid': // requested in bug 23427
$pageid = $this->getTitle()->getArticleId();
if ( !$found && $title ) {
if ( !Profiler::instance()->isPersistent() ) {
# Too many unique items can kill profiling DBs/collectors
- $titleProfileIn = __METHOD__ . "-title-" . $title->getDBKey();
+ $titleProfileIn = __METHOD__ . "-title-" . $title->getDBkey();
wfProfileIn( $titleProfileIn ); // template in
}
wfProfileIn( __METHOD__ . '-loadtpl' );
*/
function autoConvert( $text, $toVariant = false ) {
global $wgTitle;
- if ( is_object( $wgTitle ) && $wgTitle->getNameSpace() == NS_FILE ) {
+ if ( is_object( $wgTitle ) && $wgTitle->getNamespace() == NS_FILE ) {
$imagename = $wgTitle->getNsText();
if ( preg_match( "/^$imagename:/", $text ) ) return $text;
}
*/
function autoConvert( $text, $toVariant = false ) {
global $wgTitle;
- if ( is_object( $wgTitle ) && $wgTitle->getNameSpace() == NS_FILE ) {
+ if ( is_object( $wgTitle ) && $wgTitle->getNamespace() == NS_FILE ) {
$imagename = $wgTitle->getNsText();
if ( preg_match( "/^$imagename:/", $text ) ) return $text;
}
*/
function autoConvert( $text, $toVariant = false ) {
global $wgTitle;
- if ( is_object( $wgTitle ) && $wgTitle->getNameSpace() == NS_FILE ) {
+ if ( is_object( $wgTitle ) && $wgTitle->getNamespace() == NS_FILE ) {
$imagename = $wgTitle->getNsText();
if ( preg_match( "/^$imagename:/", $text ) ) return $text;
}
*/
function autoConvert( $text, $toVariant = false ) {
global $wgTitle;
- if ( is_object( $wgTitle ) && $wgTitle->getNameSpace() == NS_FILE ) {
+ if ( is_object( $wgTitle ) && $wgTitle->getNamespace() == NS_FILE ) {
$imagename = $wgTitle->getNsText();
if ( preg_match( "/^$imagename:/", $text ) ) return $text;
}
*/
function autoConvert( $text, $toVariant = false ) {
global $wgTitle;
- if ( is_object( $wgTitle ) && $wgTitle->getNameSpace() == NS_FILE ) {
+ if ( is_object( $wgTitle ) && $wgTitle->getNamespace() == NS_FILE ) {
$imagename = $wgTitle->getNsText();
if ( preg_match( "/^$imagename:/", $text ) ) return $text;
}
$this->output( "\n" );
}
$page = Title::makeTitle( $row->page_namespace, $row->page_title );
- $this->output( $page->getPrefixedUrl() );
+ $this->output( $page->getPrefixedURL() );
$lastPage = $row->page_id;
}
$link = Title::makeTitle( $row->pl_namespace, $row->pl_title );
- $this->output( " " . $link->getPrefixedUrl() );
+ $this->output( " " . $link->getPrefixedURL() );
}
if ( isset( $lastPage ) )
$this->output( "\n" );
function testBug31100FixSpecialName( $text, $expectedParam ) {
$title = Title::newFromText( $text );
$fixed = $title->fixSpecialName();
- $stuff = explode( '/', $fixed->getDbKey(), 2 );
+ $stuff = explode( '/', $fixed->getDBkey(), 2 );
if ( count( $stuff ) == 2 ) {
$par = $stuff[1];
} else {