var $mTablesLoaded = false;
var $mTables;
var $mNamespaceTables;
- var $mTitleDisplay='';
var $mDoTitleConvert=true, $mDoContentConvert=true;
var $mManualLevel; // 'bidirectional' 'unidirectional' 'disable' for each variants
var $mTitleFromFlag = false;
var $mFlags;
var $mDescCodeSep = ':',$mDescVarSep = ';';
var $mUcfirst = false;
+ var $mTitleOriginal = '';
+ var $mTitleDisplay = '';
const CACHE_VERSION_KEY = 'VERSION 6';
$text = $this->convert( $text );
- if ( $this->mTitleFromFlag )
- $parser->mOutput->setTitleText( $this->mTitleDisplay );
+ $this->convertTitle();
+ $parser->mOutput->setTitleText( $this->mTitleDisplay );
+
return $text;
}
}
/**
- * convert title
+ * Pre convert title. Store the original title $this->mTitleOrginal;
+ * store the default converted title to $this->mTitleDisplay.
* @private
*/
- function convertTitle( $text, $variant ){
- global $wgDisableTitleConversion, $wgUser;
-
- // check for global param and __NOTC__ tag
- if( $wgDisableTitleConversion || !$this->mDoTitleConvert || $wgUser->getOption('noconvertlink') == 1 ) {
- $this->mTitleDisplay = $text;
- return $text;
- }
-
- // use the title from the T flag if any
- if( $this->mTitleFromFlag ){
- $this->mTitleFromFlag = false;
- return $this->mTitleDisplay;
- }
+ function preConvertTitle( $text, $variant ){
+ $this->mTitleOriginal = $text;
+
+ $text = $this->convertNamespace( $text, $variant );
+ $this->mTitleDisplay = $this->convert( $text );
+ }
- global $wgRequest;
+ /**
+ * convert title
+ * @private
+ */
+ function convertTitle(){
+ global $wgDisableTitleConversion, $wgUser, $wgRequest;
$isredir = $wgRequest->getText( 'redirect', 'yes' );
$action = $wgRequest->getText( 'action' );
$linkconvert = $wgRequest->getText( 'linkconvert', 'yes' );
- if ( $isredir == 'no' || $action == 'edit' || $action == 'submit' || $linkconvert == 'no' ) {
- return $text;
- } else {
- $text = $this->convertNamespace( $text, $variant );
- $this->mTitleDisplay = $this->convert( $text );
- return $this->mTitleDisplay;
+
+ // check for the global variable, __NOTC__ magic word, and user setting
+ if( $wgDisableTitleConversion || !$this->mDoTitleConvert ||
+ $wgUser->getOption('noconvertlink') == 1 ) {
+ $this->mTitleDisplay = $this->mTitleOriginal;
+ }
+
+ // check for GET params
+ elseif ( $isredir == 'no' || $action == 'edit' || $linkconvert == 'no' ) {
+ $this->mTitleDisplay = $this->mTitleOriginal;
}
}
$plang = $this->getPreferredVariant();
// for title convertion
- if ( $isTitle ) return $this->convertTitle( $text, $plang );
+ if ( $isTitle ) {
+ $this->preConvertTitle( $text, $plang );
+ return $text;
+ }
$tarray = StringUtils::explode( $this->mMarkup['end'], $text );
$text = '';