r71450 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71449‎ | r71450 | r71451 >
Date:21:53, 22 August 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.6.6 - fixed issue with using templates to format popup contents
Modified paths:
  • /trunk/extensions/SemanticMaps/Features/QueryPrinters/SM_MapPrinter.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMaps/Features/QueryPrinters/SM_MapPrinter.php
@@ -249,7 +249,7 @@
250250 * @param array $row The record you want to add data from
251251 */
252252 private function addResultRow( $outputmode, array $row ) {
253 - global $wgUser, $smgUseSpatialExtensions;
 253+ global $wgUser, $smgUseSpatialExtensions, $wgTitle;
254254
255255 $skin = $wgUser->getSkin();
256256
@@ -292,6 +292,11 @@
293293 }
294294 }
295295
 296+ if ( $this->template ) {
 297+ // New parser object to render the templates with.
 298+ $parser = new Parser();
 299+ }
 300+
296301 foreach ( $coords as $coord ) {
297302 if ( count( $coord ) >= 2 ) {
298303 if ( $smgUseSpatialExtensions ) {
@@ -305,14 +310,13 @@
306311 $icon = $this->getLocationIcon( $row );
307312
308313 if ( $this->template ) {
309 - global $wgParser;
310 -
311314 $segments = array_merge(
312315 array( $this->template, 'title=' . $titleForTemplate, 'latitude=' . $lat, 'longitude=' . $lon ),
313316 $label
314317 );
315318
316 - $text = preg_replace( '/\n+/m', '<br />', $wgParser->recursiveTagParse( '{{' . implode( '|', $segments ) . '}}' ) );
 319+
 320+ $text = $parser->parse( '{{' . implode( '|', $segments ) . '}}', $wgTitle, new ParserOptions() )->getText();
317321 }
318322
319323 $this->locations[] = array(
@@ -340,7 +344,7 @@
341345
342346 // Look for display_options field, which can be set by Semantic Compound Queries
343347 // the location of this field changed in SMW 1.5
344 - $display_location = method_exists( $row[0], 'getResultSubject' ) ? $display_location = $row[0]->getResultSubject() : $row[0];
 348+ $display_location = method_exists( $row[0], 'getResultSubject' ) ? $row[0]->getResultSubject() : $row[0];
345349
346350 if ( property_exists( $display_location, 'display_options' ) && is_array( $display_location->display_options ) ) {
347351 $display_options = $display_location->display_options;

Follow-up revisions

RevisionCommit summaryAuthorDate
r71543Last followup to r71450...reedy01:41, 24 August 2010

Status & tagging log