r74463 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74462‎ | r74463 | r74464 >
Date:21:06, 7 October 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.7 - added some validation for the icon parameter
Modified paths:
  • /trunk/extensions/SemanticMaps/includes/queryprinters/SM_MapPrinter.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMaps/includes/queryprinters/SM_MapPrinter.php
@@ -286,18 +286,18 @@
287287 }
288288
289289 // If there is no point specific icon, use the general icon parameter when available.
290 - if ( !array_key_exists( 'icon', $markerData ) && $this->icon != '' ) {
 290+ if ( !array_key_exists( 'icon', $markerData ) ) {
291291 $markerData['icon'] = $this->icon;
292292 }
293293
294 - // Get the url for the icon when there is one, else set the icon to an empty string.
295 - if ( array_key_exists( 'icon', $markerData ) ) {
296 - $icon_image_page = new ImagePage( Title::newFromText( $markerData['icon'] ) );
297 - $markerData['icon'] = $icon_image_page->getDisplayedFile()->getURL();
 294+ if ( $markerData['icon'] != '' ) {
 295+ $title = Title::newFromText( $markerData['icon'] );
 296+
 297+ if ( !is_null( $title ) && $title->exists() ) {
 298+ $iconImagePage = new ImagePage( $title );
 299+ $markerData['icon'] = $iconImagePage->getDisplayedFile()->getURL();
 300+ }
298301 }
299 - else {
300 - $markerData['icon'] = '';
301 - }
302302
303303 // Temporary fix, will refactor away later
304304 // TODO

Status & tagging log