Index: branches/Maps0.8/includes/features/Maps_BasePointMap.php |
— | — | @@ -33,14 +33,14 @@ |
34 | 34 | * @return html |
35 | 35 | */ |
36 | 36 | public final function renderMap( array $params, Parser $parser ) { |
37 | | - $this->handleMarkerData( $params ); |
| 37 | + $this->handleMarkerData( $params, $parser ); |
38 | 38 | |
39 | 39 | $mapName = $this->service->getMapId(); |
40 | 40 | |
41 | 41 | $output = $this->getMapHTML( $params, $parser, $mapName ) . $this->getJSON( $params, $parser, $mapName ); |
42 | 42 | |
43 | 43 | global $wgTitle; |
44 | | - if ( $wgTitle->isSpecialPage() ) { |
| 44 | + if ( !is_null( $wgTitle ) && $wgTitle->isSpecialPage() ) { |
45 | 45 | global $wgOut; |
46 | 46 | $this->service->addDependencies( $wgOut ); |
47 | 47 | } |
— | — | @@ -118,11 +118,10 @@ |
119 | 119 | * @since 0.8 |
120 | 120 | * |
121 | 121 | * @param array &$params |
| 122 | + * @param Parser $parser |
122 | 123 | */ |
123 | | - protected function handleMarkerData( array &$params ) { |
124 | | - global $wgTitle; |
125 | | - |
126 | | - $parser = new Parser(); |
| 124 | + protected function handleMarkerData( array &$params, Parser $parser ) { |
| 125 | + $parserClone = clone $parser; |
127 | 126 | $iconUrl = MapsMapper::getFileUrl( $params['icon'] ); |
128 | 127 | $params['locations'] = array(); |
129 | 128 | |
— | — | @@ -130,8 +129,8 @@ |
131 | 130 | if ( $location->isValid() ) { |
132 | 131 | $jsonObj = $location->getJSONObject( $params['title'], $params['label'], $iconUrl ); |
133 | 132 | |
134 | | - $jsonObj['title'] = $parser->parse( $jsonObj['title'], $wgTitle, new ParserOptions() )->getText(); |
135 | | - $jsonObj['text'] = $parser->parse( $jsonObj['text'], $wgTitle, new ParserOptions() )->getText(); |
| 133 | + $jsonObj['title'] = $parserClone->parse( $jsonObj['title'], $parserClone->getTitle(), new ParserOptions() )->getText(); |
| 134 | + $jsonObj['text'] = $parserClone->parse( $jsonObj['text'], $parserClone->getTitle(), new ParserOptions() )->getText(); |
136 | 135 | |
137 | 136 | $hasTitleAndtext = $jsonObj['title'] != '' && $jsonObj['text'] != ''; |
138 | 137 | $jsonObj['text'] = ( $hasTitleAndtext ? '<b>' . $jsonObj['title'] . '</b><hr />' : $jsonObj['title'] ) . $jsonObj['text']; |
Index: branches/Maps0.8/includes/features/Maps_BaseMap.php |
— | — | @@ -64,7 +64,7 @@ |
65 | 65 | $output = $this->getMapHTML( $params, $parser, $mapName ) . $this->getJSON( $params, $parser, $mapName ); |
66 | 66 | |
67 | 67 | global $wgTitle; |
68 | | - if ( $wgTitle->isSpecialPage() ) { |
| 68 | + if ( !is_null( $wgTitle ) && $wgTitle->isSpecialPage() ) { |
69 | 69 | global $wgOut; |
70 | 70 | $this->service->addDependencies( $wgOut ); |
71 | 71 | } |