r84087 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84086‎ | r84087 | r84088 >
Date:11:20, 16 March 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
follow up to r84084
Modified paths:
  • /branches/Maps0.8/includes/features/Maps_BaseMap.php (modified) (history)
  • /branches/Maps0.8/includes/features/Maps_BasePointMap.php (modified) (history)

Diff [purge]

Index: branches/Maps0.8/includes/features/Maps_BasePointMap.php
@@ -33,14 +33,14 @@
3434 * @return html
3535 */
3636 public final function renderMap( array $params, Parser $parser ) {
37 - $this->handleMarkerData( $params );
 37+ $this->handleMarkerData( $params, $parser );
3838
3939 $mapName = $this->service->getMapId();
4040
4141 $output = $this->getMapHTML( $params, $parser, $mapName ) . $this->getJSON( $params, $parser, $mapName );
4242
4343 global $wgTitle;
44 - if ( $wgTitle->isSpecialPage() ) {
 44+ if ( !is_null( $wgTitle ) && $wgTitle->isSpecialPage() ) {
4545 global $wgOut;
4646 $this->service->addDependencies( $wgOut );
4747 }
@@ -118,11 +118,10 @@
119119 * @since 0.8
120120 *
121121 * @param array &$params
 122+ * @param Parser $parser
122123 */
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;
127126 $iconUrl = MapsMapper::getFileUrl( $params['icon'] );
128127 $params['locations'] = array();
129128
@@ -130,8 +129,8 @@
131130 if ( $location->isValid() ) {
132131 $jsonObj = $location->getJSONObject( $params['title'], $params['label'], $iconUrl );
133132
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();
136135
137136 $hasTitleAndtext = $jsonObj['title'] != '' && $jsonObj['text'] != '';
138137 $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 @@
6565 $output = $this->getMapHTML( $params, $parser, $mapName ) . $this->getJSON( $params, $parser, $mapName );
6666
6767 global $wgTitle;
68 - if ( $wgTitle->isSpecialPage() ) {
 68+ if ( !is_null( $wgTitle ) && $wgTitle->isSpecialPage() ) {
6969 global $wgOut;
7070 $this->service->addDependencies( $wgOut );
7171 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r84084fixing bug 27272jeroendedauw11:03, 16 March 2011

Status & tagging log