(Bug 3090) mask all external links in image captions against double-parsing, rather...
authorRowan Collins <imsop@users.mediawiki.org>
Sat, 20 Aug 2005 12:44:32 +0000 (12:44 +0000)
committerRowan Collins <imsop@users.mediawiki.org>
Sat, 20 Aug 2005 12:44:32 +0000 (12:44 +0000)
includes/Parser.php

index 4f6fcba..2c3b48b 100644 (file)
@@ -782,7 +782,7 @@ class Parser
 
                # replaceInternalLinks may sometimes leave behind
                # absolute URLs, which have to be masked to hide them from replaceExternalLinks
-               $text = str_replace("http-noparse://","http://",$text);
+               $text = str_replace(UNIQ_PREFIX."NOPARSE", "", $text);
 
                $text = $this->doMagicLinks( $text );
                $text = $this->doTableStuff( $text );
@@ -1397,7 +1397,7 @@ class Parser
                                                $text = $this->replaceInternalLinks($text);
 
                                                # cloak any absolute URLs inside the image markup, so replaceExternalLinks() won't touch them
-                                               $s .= $prefix . str_replace('http://', 'http-noparse://', $this->makeImage( $nt, $text ) ) . $trail;
+                                               $s .= $prefix . preg_replace("/\b($wgUrlProtocols)/", UNIQ_PREFIX."NOPARSE$1", $this->makeImage( $nt, $text) ) . $trail;
                                                $wgLinkCache->addImageLinkObj( $nt );
 
                                                wfProfileOut( "$fname-image" );