function newFromText( $text, $defaultNamespace = NS_MAIN ) {
global $wgTitleCache;
$fname = 'Title::newFromText';
- wfProfileIn( $fname );
if( is_object( $text ) ) {
wfDebugDieBacktrace( 'Title::newFromText given an object' );
* In theory these are value objects and won't get changed...
*/
if( $defaultNamespace == NS_MAIN && isset( $wgTitleCache[$text] ) ) {
- wfProfileOut( $fname );
return $wgTitleCache[$text];
}
$cachedcount++;
$wgTitleCache[$text] =& $t;
}
- wfProfileOut( $fname );
return $t;
} else {
- wfProfileOut( $fname );
$ret = NULL;
return $ret;
}
global $wgInterwikiCache;
$fname = 'Title::getInterwikiLink';
- wfProfileIn( $fname );
-
$key = strtolower( $key );
$k = $wgDBname.':interwiki:'.$key;
if( array_key_exists( $k, $wgTitleInterwikiCache ) ) {
- wfProfileOut( $fname );
return $wgTitleInterwikiCache[$k]->iw_url;
}
if ($wgInterwikiCache) {
- wfProfileOut( $fname );
return Title::getInterwikiCached( $key );
}
# Ignore old keys with no iw_local
if( $s && isset( $s->iw_local ) && isset($s->iw_trans)) {
$wgTitleInterwikiCache[$k] = $s;
- wfProfileOut( $fname );
return $s->iw_url;
}
array( 'iw_url', 'iw_local', 'iw_trans' ),
array( 'iw_prefix' => $key ), $fname );
if( !$res ) {
- wfProfileOut( $fname );
return '';
}
$wgMemc->set( $k, $s, $wgInterwikiExpiry );
$wgTitleInterwikiCache[$k] = $s;
- wfProfileOut( $fname );
return $s->iw_url;
}
/* private */ function secureAndSplit() {
global $wgContLang, $wgLocalInterwiki, $wgCapitalLinks;
$fname = 'Title::secureAndSplit';
- wfProfileIn( $fname );
# Initialisation
static $rxTc = false;
$t = trim( $t, '_' );
if ( '' == $t ) {
- wfProfileOut( $fname );
return false;
}
if( false !== strpos( $t, UTF8_REPLACEMENT ) ) {
# Contained illegal UTF-8 sequences or forbidden Unicode chars.
- wfProfileOut( $fname );
return false;
}
if( !$firstPass ) {
# Can't make a local interwiki link to an interwiki link.
# That's just crazy!
- wfProfileOut( $fname );
return false;
}
if ( 0 == strcasecmp( $this->mInterwiki, $wgLocalInterwiki ) ) {
if( $t == '' ) {
# Can't have an empty self-link
- wfProfileOut( $fname );
return false;
}
$this->mInterwiki = '';
# Reject illegal characters.
#
if( preg_match( $rxTc, $r ) ) {
- wfProfileOut( $fname );
return false;
}
strpos( $r, '/./' ) !== false ||
strpos( $r, '/../' ) !== false ) )
{
- wfProfileOut( $fname );
return false;
}
# We shouldn't need to query the DB for the size.
#$maxSize = $dbr->textFieldSize( 'page', 'page_title' );
if ( strlen( $r ) > 255 ) {
- wfProfileOut( $fname );
return false;
}
if( $t == '' &&
$this->mInterwiki == '' &&
$this->mNamespace != NS_MAIN ) {
- wfProfileOut( $fname );
return false;
}
$this->mTextform = str_replace( '_', ' ', $t );
- wfProfileOut( $fname );
return true;
}