Index: trunk/extensions/GoogleMaps/GoogleMaps.body.php |
— | — | @@ -5,9 +5,9 @@ |
6 | 6 | die( ); |
7 | 7 | } |
8 | 8 | |
9 | | -define(GOOGLE_MAPS_PARSE_INCLUDES, 0); |
10 | | -define(GOOGLE_MAPS_PARSE_ADD_MARKER, 1); |
11 | | -define(GOOGLE_MAPS_PARSE_POINTS, 2); |
| 9 | +define('GOOGLE_MAPS_PARSE_INCLUDES', 0); |
| 10 | +define('GOOGLE_MAPS_PARSE_ADD_MARKER', 1); |
| 11 | +define('GOOGLE_MAPS_PARSE_POINTS', 2); |
12 | 12 | /** |
13 | 13 | * This is a class for adding Google maps to Mediawiki articles. The class |
14 | 14 | * takes care of all hook registration and output of both the map editing |
— | — | @@ -359,7 +359,7 @@ |
360 | 360 | global $wgGoogleMaps; |
361 | 361 | // pass through to the main render function, creating a new parser |
362 | 362 | // for parsing the local content |
363 | | - return $wgGoogleMaps->render( $pContent, $pArgv, $pParser, new Parser() ); |
| 363 | + return $wgGoogleMaps->render( $pContent, $pArgv, $pParser, new Parser() ); |
364 | 364 | } |
365 | 365 | |
366 | 366 | /** |
— | — | @@ -376,7 +376,6 @@ |
377 | 377 | function render ( $pContent, $pArgv, &$pParser, &$pLocalParser ) { |
378 | 378 | $pLocalParser->mTitle = $this->mTitle; |
379 | 379 | $pLocalParser->mOptions = $pParser->mOptions; |
380 | | - $pLocalParser->clearState(); |
381 | 380 | |
382 | 381 | // Keep a count of how many <googlemap> tags were used for unique ids |
383 | 382 | if( !isset( $this->mGoogleMapsOnThisPage ) ) { |
— | — | @@ -574,12 +573,9 @@ |
575 | 574 | } |
576 | 575 | |
577 | 576 | static function parseWikiText(&$pParser, &$pLocalParser, $pText, $pTitle, &$pOptions) { |
578 | | - if (method_exists($pLocalParser, 'recursiveTagParse')) { |
579 | | - $html = $pLocalParser->recursiveTagParse($pText); |
580 | | - } else { |
581 | | - $parsed = $pLocalParser->parse( $pText, $pTitle, $pOptions, false ); |
582 | | - $html = $parsed->getText(); |
583 | | - } |
| 577 | + // recursiveTagParse seems broken, so do it the old-fashioned way. |
| 578 | + $parsed = $pLocalParser->parse( $pText, $pTitle, $pOptions, false ); |
| 579 | + $html = $parsed->getText(); |
584 | 580 | return preg_replace('/<script.*?<\/script>/', '', $html); |
585 | 581 | } |
586 | 582 | |
Index: trunk/extensions/GoogleMaps/SpecialGoogleMapsKML.php |
— | — | @@ -33,22 +33,21 @@ |
34 | 34 | $wgParser->mOptions = ParserOptions::newFromUser( $wgUser ); |
35 | 35 | $wgParser->mOptions->setEditSection( false ); |
36 | 36 | $wgParser->mTitle = $wgTitle; |
| 37 | + $wgParser->clearState(); |
37 | 38 | |
38 | 39 | $localParser = new Parser(); |
39 | 40 | $localParser->mTitle = $title; |
40 | 41 | $localParser->mOptions = $wgParser->mOptions; |
41 | | - $localParser->clearState(); |
42 | 42 | |
43 | | - |
44 | 43 | if (preg_match_all("/<googlemap( .*?|)>(.*?)<\/googlemap>/s", $revision->getText(), $matches)) { |
45 | 44 | $exporter->addFileHeader(); |
46 | 45 | for($i=0;$i<count($matches[2]);$i++) { |
47 | | - $attrs = Sanitizer::decodeTagAttributes($matches[1][$i]); |
48 | | - $mapOptions['version'] = isset($attrs['version']) ? $attrs['version'] : "0"; |
49 | | - $exporter->addHeader(isset($attrs['title']) ? $attrs['title'] : "Map #".($i+1)); |
50 | | - GoogleMaps::renderContent($matches[2][$i], $wgParser, $localParser, $exporter, $mapOptions); |
51 | | - $exporter->addTrailer(); |
52 | | - } |
| 46 | + $attrs = Sanitizer::decodeTagAttributes($matches[1][$i]); |
| 47 | + $mapOptions['version'] = isset($attrs['version']) ? $attrs['version'] : "0"; |
| 48 | + $exporter->addHeader(isset($attrs['title']) ? $attrs['title'] : "Map #".($i+1)); |
| 49 | + GoogleMaps::renderContent($matches[2][$i], $wgParser, $localParser, $exporter, $mapOptions); |
| 50 | + $exporter->addTrailer(); |
| 51 | + } |
53 | 52 | $exporter->addFileTrailer(); |
54 | 53 | echo $exporter->render(); |
55 | 54 | } else { |