r74462 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74461‎ | r74462 | r74463 >
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/Maps/Maps_Settings.php (modified) (history)
  • /trunk/extensions/Maps/includes/features/Maps_BasePointMap.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/Maps_Settings.php
@@ -34,8 +34,8 @@
3535 $egMapsFeatures['pf'][] = 'MapsDisplayPoint::initialize';
3636
3737 # Required for #coordinates.
38 - $wgHooks['ParserFirstCallInit'][] = 'MapsCoordinates::staticInit';//array( 'MapsCoordinates', 'staticInit' );
39 - $wgHooks['LanguageGetMagic'][] = 'MapsCoordinates::staticMagic';// array( 'MapsCoordinates', 'staticMagic' );//;
 38+ $wgHooks['ParserFirstCallInit'][] = 'MapsCoordinates::staticInit';
 39+ $wgHooks['LanguageGetMagic'][] = 'MapsCoordinates::staticMagic';
4040 # Required for #display_map.
4141 $wgHooks['ParserFirstCallInit'][] = 'MapsDisplayMap::staticInit';
4242 $wgHooks['LanguageGetMagic'][] = 'MapsDisplayMap::staticMagic';
Index: trunk/extensions/Maps/includes/features/Maps_BasePointMap.php
@@ -136,18 +136,18 @@
137137 }
138138
139139 // If there is no point specific icon, use the general icon parameter when available.
140 - if ( !array_key_exists( 'icon', $markerData ) && $this->icon != '' ) {
 140+ if ( !array_key_exists( 'icon', $markerData ) ) {
141141 $markerData['icon'] = $this->icon;
142142 }
143143
144 - // Get the url for the icon when there is one, else set the icon to an empty string.
145 - if ( array_key_exists( 'icon', $markerData ) ) {
146 - $icon_image_page = new ImagePage( Title::newFromText( $markerData['icon'] ) );
147 - $markerData['icon'] = $icon_image_page->getDisplayedFile()->getURL();
 144+ if ( $markerData['icon'] != '' ) {
 145+ $title = Title::newFromText( $markerData['icon'] );
 146+
 147+ if ( !is_null( $title ) && $title->exists() ) {
 148+ $iconImagePage = new ImagePage( $title );
 149+ $markerData['icon'] = $iconImagePage->getDisplayedFile()->getURL();
 150+ }
148151 }
149 - else {
150 - $markerData['icon'] = '';
151 - }
152152
153153 // Temporary fix, will refactor away later
154154 // TODO

Status & tagging log