From 68252e75664db4c3a6bdf5647de2284f7dd25afd Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Sat, 5 Jul 2003 01:12:22 +0000 Subject: [PATCH] Tarquin's interlanguage link hack --- includes/OutputPage.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/includes/OutputPage.php b/includes/OutputPage.php index bb12b4c8ce..b026906de6 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -287,17 +287,22 @@ class OutputPage { } $text = $this->doWikiPass2( $stripped3, $linestart ); - + + $specialChars = array("\\", "$"); + $escapedChars = array("\\\\", "\\$"); for ( $i = 1; $i <= $presecs; ++$i ) { - $text = preg_replace( "/{$unique3}/", str_replace( '$', '\$', $prelist[$i] ), $text, 1 ); + $text = preg_replace( "/{$unique3}/", str_replace( $specialChars, + $escapedChars, $prelist[$i] ), $text, 1 ); } for ( $i = 1; $i <= $mathsecs; ++$i ) { - $text = preg_replace( "/{$unique2}/", str_replace( '$', '\$', $mathlist[$i] ), $text, 1 ); + $text = preg_replace( "/{$unique2}/", str_replace( $specialChars, + $escapedChars, $mathlist[$i] ), $text, 1 ); } for ( $i = 1; $i <= $nwsecs; ++$i ) { - $text = preg_replace( "/{$unique}/", str_replace( '$', '\$', $nwlist[$i] ), $text, 1 ); + $text = preg_replace( "/{$unique}/", str_replace( $specialChars, + $escapedChars, $nwlist[$i] ), $text, 1 ); } $this->addHTML( $text ); wfProfileOut(); @@ -787,7 +792,7 @@ class OutputPage { { global $wgTitle, $wgUser, $wgLang; global $wgLinkCache, $wgInterwikiMagic; - global $wgNamespacesWithSubpages; + global $wgNamespacesWithSubpages, $wgLanguageCode; wfProfileIn( $fname = "OutputPage::replaceInternalLinks" ); wfProfileIn( "$fname-setup" ); @@ -867,7 +872,7 @@ class OutputPage { Namespace::isTalk( $wgTitle->getNamespace() ) ) { if ( "" == $text ) { $text = $link; } $s .= $sk->makeLink( $link, $text, "", $trail ); - } else { + } else if ( $pre != $wgLanguageCode ) { array_push( $this->mLanguageLinks, "$pre:$suf" ); $s .= $trail; } -- 2.20.1