function setRobotpolicy( $str ) { $this->mRobotpolicy = $str; }
function setHTMLTitle( $name ) {$this->mHTMLtitle = $name; }
function setPageTitle( $name ) {
- global $action;
+ global $action, $wgContLang;
+ $name = $wgContLang->autoConvert($name);
$this->mPagetitle = $name;
if(!empty($action)) {
$taction = $this->getPageTitleActionText();
global $wgUser, $wgLang, $wgDebugComments, $wgCookieExpiration;
global $wgInputEncoding, $wgOutputEncoding, $wgContLanguageCode;
global $wgDebugRedirects, $wgMimeType, $wgProfiler;
+
if( $this->mDoNothing ){
return;
}
$fname = 'OutputPage::output';
wfProfileIn( $fname );
-
$sk = $wgUser->getSkin();
if ( '' != $this->mRedirect ) {
$text);
wfProfileOut( $fname.'-interwiki' );
}
+
wfProfileOut( $fname );
return $colours;
}
* Hence, we limit the number of inclusions of any given page, thus bringing any
* attack back to O(N).
*/
+
define( 'MAX_INCLUDE_REPEAT', 100 );
define( 'MAX_INCLUDE_SIZE', 1000000 ); // 1 Million
* @return ParserOutput a ParserOutput
*/
function parse( $text, &$title, $options, $linestart = true, $clearState = true ) {
- global $wgUseTidy;
+ global $wgUseTidy, $wgContLang;
$fname = 'Parser::parse';
wfProfileIn( $fname );
$stripState = NULL;
$text = $this->strip( $text, $this->mStripState );
+
$text = $this->internalParse( $text, $linestart );
$text = $this->unstrip( $text, $this->mStripState );
# Clean up special characters, only run once, next-to-last before doBlockLevels
}
# only once and last
$text = $this->doBlockLevels( $text, $linestart );
+
+ $text = $wgContLang->convert($text);
+
$text = $this->unstripNoWiki( $text, $this->mStripState );
$this->mOutput->setText( $text );
wfProfileOut( $fname );
$text = $this->removeHTMLtags( $text );
$text = $this->replaceVariables( $text, $args );
- $text = $wgContLang->convert($text);
-
$text = preg_replace( '/(^|\n)-----*/', '\\1<hr />', $text );
$text = $this->doHeadings( $text );
*
* @access private
*/
+
function replaceInternalLinks( $s ) {
global $wgLang, $wgContLang, $wgLinkCache;
static $fname = 'Parser::replaceInternalLinks' ;
+ # use a counter to prevent too much unknown links from
+ # being checked for different language variants.
+ static $convertCount;
wfProfileIn( $fname );
wfProfileIn( $fname.'-setup' );
//if the article does not exist
global $wgContLang;
$variants = $wgContLang->getVariants();
- if(sizeof($variants) > 1) {
+
+ if(sizeof($variants) > 1 && $convertCount < 200) {
$varnt = false;
if($nt->getArticleID() == 0) {
foreach ( $variants as $v ) {
if($v == $wgContLang->getPreferredVariant())
continue;
+ $convertCount ++;
$varlink = $wgContLang->autoConvert($link, $v);
$varnt = Title::newFromText($varlink);
if($varnt && $varnt->getArticleID()>0) {
continue;
}
}
-
+
+ $text = $wgContLang->convert($text);
+
if( ( $nt->getPrefixedText() === $this->mTitle->getPrefixedText() ) &&
( strpos( $link, '#' ) === FALSE ) ) {
# Self-links are handled specially; generally de-link and change to bold.
$s = str_replace( '_', ' ', $s );
$this->mPrefixedText = $s;
}
- //convert to the desired language variant
- $t = $wgContLang->convert($this->mPrefixedText);
- return $t;
+ return $this->mPrefixedText;
}
/**
if( '' != $this->mFragment ) {
$text .= '#' . $this->mFragment;
}
- //convert to desired language variant
- $t = $wgContLang->convert($text);
- return $t;
+ return $text;
}
/**