I'm trying to fix McNaught's <ImageMap> extension to work with MW1.9.2 and a Wiki family.
The input is a file [[Media:World-map.map]] which contains the map information in HTML format. The purpose of the code below is to read the .map file and write it to output. A snippet of the content of the map file looks like:
<map name="map"> <AREA SHAPE="POLY" COORDS = "168,117,139,125,120,108,151,104" HREF = "http://kw.org/index.php/Caribbean" TITLE="Caribbean"> </map>
The following code taken from imagemap.php is interspersed with comments that show the actual values as found from dumping the info to error.log. The **OK** means it's what I expect. The ***?????*** is what I don't understand.
$html = $localParser->parse($MapURL,$wgTitle,$parserOptions);
= <p><a href="http://pool.kw.org/images/4/47/World-map.map" class="internal" title="World-map.map">Media:World-map.map</a> </p> **OK**
$MapUrl=preg_replace('/^.*<a[\s]+href=*"(.*?)".*$/is','\1',html->mText);
= http://pool.kw.org/images/4/47/World-map.map **OK**
$mapData = file($MapUrl);
= <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> ***?????*** <html><head> <title>Menu for /images/4/47/World-map.map</title> </head><body> <h1>Menu for /images/4/47/World-map.map</h1> <hr />
<pre> <a href="http://pool.kw.org/images/4/47/name=%22map%22%3E%22%3Ename=%22map%22%3E </a></pre> <pre> <a href="http://pool.kw.org/images/4/47/SHAPE=%22POLY%22%22%3E SHAPE="POLY"</a></pre>
etc. It looks like the file has been preprocessed to generate HTML in some way. Is this normal for file()? Is there a way to tell it to just give me the content of the file?
Mike