$this->mNamespace = 0;
$this->mRestrictionsLoaded = false;
$this->mRestrictions = array();
- $this->mPrefixedText = false;
}
# Static factory methods
return $t;
else
return NULL;
- return $t;
}
function newFromText( $text )
function newFromURL( $url )
{
- global $wgLang, $wgServer, $HTTP_SERVER_VARS;
+ global $wgLang, $wgServer;
$t = new Title();
$s = urldecode( $url ); # This is technically wrong, as anything
# For links that came from outside, check for alternate/legacy
# character encoding.
- if( strncmp($wgServer, $HTTP_SERVER_VARS["HTTP_REFERER"], strlen( $wgServer ) ) )
+ wfDebug( "Refer: {$_SERVER['HTTP_REFERER']}\n" );
+ wfDebug( "Servr: $wgServer\n" );
+ if( empty( $_SERVER["HTTP_REFERER"] ) ||
+ strncmp($wgServer, $_SERVER["HTTP_REFERER"], strlen( $wgServer ) ) )
$s = $wgLang->checkTitleEncoding( $s );
$t->mDbkeyform = str_replace( " ", "_", $s );
function getPrefixedText()
{
- if ( $this->mPrefixedText === false ) {
+ # TEST THIS @@@
+ if ( empty( $this->mPrefixedText ) ) {
$s = $this->prefix( $this->mTextform );
$s = str_replace( "_", " ", $s );
$this->mPrefixedText = $s;
{
return wfEscapeHTML( $this->getPrefixedText() );
}
-
+
function isExternal() { return ( "" != $this->mInterwiki ); }
function isProtected()
$this->mRestrictionsLoaded = false;
$this->mRestrictions = array();
}
+
+ function invalidateCache() {
+ $now = wfTimestampNow();
+ $ns = $this->getNamespace();
+ $ti = wfStrencode( $this->getDBkey() );
+ $sql = "UPDATE cur SET cur_touched='$now' WHERE cur_namespace=$ns AND cur_title='$ti'";
+ return wfQuery( $sql, "Title::invalidateCache" );
+ }
/* private */ function prefix( $name )
{
if ( ":" == $t{0} ) {
$r = substr( $t, 1 );
} else {
- if ( preg_match( "/^((?:i|x|[a-z]{2,3})(?:-[a-z0-9]+)?|[A-Za-z0-9_\\x80-\\xff]+):(.*)$/", $t, $m ) ) {
+ if ( preg_match( "/^((?:i|x|[a-z]{2,3})(?:-[a-z0-9]+)?|[A-Za-z0-9_\\x80-\\xff]+):_*(.*)$/", $t, $m ) ) {
#$p = strtolower( $m[1] );
$p = $m[1];
if ( $ns = $wgLang->getNsIndex( strtolower( $p ) )) {
wfProfileOut( $fname );
return true;
}
+
+ function getTalkPage() {
+ return Title::makeTitle( Namespace::getTalk( $this->getNamespace() ), $this->getDBkey() );
+ }
+
+ function getSubjectPage() {
+ return Title::makeTitle( Namespace::getSubject( $this->getNamespace() ), $this->getDBkey() );
+ }
}
?>