r84084 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84083‎ | r84084 | r84085 >
Date:11:03, 16 March 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
fixing bug 27272
Modified paths:
  • /trunk/extensions/Maps/includes/features/Maps_BaseMap.php (modified) (history)
  • /trunk/extensions/Maps/includes/features/Maps_BasePointMap.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/includes/features/Maps_BasePointMap.php
@@ -98,7 +98,7 @@
9999 $this->addSpecificMapHTML( $parser );
100100
101101 global $wgTitle;
102 - if ( $wgTitle->getNamespace() == NS_SPECIAL ) {
 102+ if ( !is_null( $wgTitle ) && $wgTitle->getNamespace() == NS_SPECIAL ) {
103103 global $wgOut;
104104 $this->service->addDependencies( $wgOut );
105105 }
@@ -113,14 +113,12 @@
114114 * Fills the $markerData array with the locations and their meta data.
115115 */
116116 private function setMarkerData( Parser $parser, PPFrame $frame = null ) {
117 - global $wgTitle;
118 -
119117 // New parser object to render popup contents with.
120 - $parser = new Parser();
 118+ $parser = clone $parser;
 119+
 120+ $this->title = $parser->parse( $this->title, $parser->getTitle(), new ParserOptions() )->getText();
 121+ $this->label = $parser->parse( $this->label, $parser->getTitle(), new ParserOptions() )->getText();
121122
122 - $this->title = $parser->parse( $this->title, $wgTitle, new ParserOptions() )->getText();
123 - $this->label = $parser->parse( $this->label, $wgTitle, new ParserOptions() )->getText();
124 -
125123 // Each $args is an array containg the coordinate set as first element, possibly followed by meta data.
126124 foreach ( $this->coordinates as $args ) {
127125 $markerData = MapsCoordinateParser::parseCoordinates( array_shift( $args ) );
@@ -131,11 +129,11 @@
132130
133131 if ( count( $args ) > 0 ) {
134132 // Parse and add the point specific title if it's present.
135 - $markerData['title'] = $parser->parse( $args[0], $wgTitle, new ParserOptions() )->getText();
 133+ $markerData['title'] = $parser->parse( $args[0], $parser->getTitle(), new ParserOptions() )->getText();
136134
137135 if ( count( $args ) > 1 ) {
138136 // Parse and add the point specific label if it's present.
139 - $markerData['label'] = $parser->parse( $args[1], $wgTitle, new ParserOptions() )->getText();
 137+ $markerData['label'] = $parser->parse( $args[1], $parser->getTitle(), new ParserOptions() )->getText();
140138
141139 if ( count( $args ) > 2 ) {
142140 // Add the point specific icon if it's present.
Index: trunk/extensions/Maps/includes/features/Maps_BaseMap.php
@@ -82,7 +82,7 @@
8383 }
8484
8585 global $wgTitle;
86 - if ( $wgTitle->getNamespace() == NS_SPECIAL ) {
 86+ if ( !is_null( $wgTitle ) && $wgTitle->getNamespace() == NS_SPECIAL ) {
8787 global $wgOut;
8888 $this->service->addDependencies( $wgOut );
8989 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r84085fixing bug 27272jeroendedauw11:03, 16 March 2011
r84087follow up to r84084jeroendedauw11:20, 16 March 2011

Status & tagging log