From: Tim Starling Date: Sat, 5 Jul 2003 01:12:22 +0000 (+0000) Subject: Tarquin's interlanguage link hack X-Git-Tag: 1.1.0~453 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/ajouter.php?a=commitdiff_plain;h=68252e75664db4c3a6bdf5647de2284f7dd25afd;p=lhc%2Fweb%2Fwiklou.git Tarquin's interlanguage link hack --- 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; }