r86943 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86942‎ | r86943 | r86944 >
Date:13:29, 26 April 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
fix info window contents and title for static location markers
Modified paths:
  • /trunk/extensions/SemanticMaps/includes/queryprinters/SM_MapPrinter.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMaps/includes/queryprinters/SM_MapPrinter.php
@@ -285,18 +285,33 @@
286286 * @param array $queryLocations
287287 */
288288 protected function handleMarkerData( array &$params, array $queryLocations ) {
289 - global $wgTitle;
 289+ global $wgParser;
290290
291 - $parser = new Parser();
 291+ $parserClone = clone $wgParser;
292292 $iconUrl = MapsMapper::getFileUrl( $params['icon'] );
293293 $params['locations'] = array();
294294
295 - foreach ( array_merge( $params['staticlocations'], $queryLocations ) as $location ) {
 295+ foreach ( $params['staticlocations'] as $location ) {
296296 if ( $location->isValid() ) {
297297 $jsonObj = $location->getJSONObject( $params['title'], $params['label'], $iconUrl );
298298
 299+ $jsonObj['title'] = $parserClone->parse( $jsonObj['title'], $parserClone->getTitle(), new ParserOptions() )->getText();
 300+ $jsonObj['text'] = $parserClone->parse( $jsonObj['text'], $parserClone->getTitle(), new ParserOptions() )->getText();
 301+
 302+ $hasTitleAndtext = $jsonObj['title'] != '' && $jsonObj['text'] != '';
 303+ $jsonObj['text'] = ( $hasTitleAndtext ? '<b>' . $jsonObj['title'] . '</b><hr />' : $jsonObj['title'] ) . $jsonObj['text'];
299304 $jsonObj['title'] = strip_tags( $jsonObj['title'] );
300305
 306+ $params['locations'][] = $jsonObj;
 307+ }
 308+ }
 309+
 310+ foreach ( $queryLocations as $location ) {
 311+ if ( $location->isValid() ) {
 312+ $jsonObj = $location->getJSONObject( $params['title'], $params['label'], $iconUrl );
 313+
 314+ $jsonObj['title'] = strip_tags( $jsonObj['title'] );
 315+
301316 $params['locations'][] = $jsonObj;
302317 }
303318 }

Status & tagging log