r21318 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r21317‎ | r21318 | r21319 >
Date:09:18, 17 April 2007
Author:raymond
Status:old
Tags:
Comment:
* (bug 8603) Allow the "default" parameter as minimum
Modified paths:
  • /trunk/extensions/ImageMap/ImageMap_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ImageMap/ImageMap_body.php
@@ -42,6 +42,7 @@
4343 $links = array();
4444 $descType = self::BOTTOM_RIGHT;
4545 $defaultLinkAttribs = false;
 46+ $realmap = true;
4647 foreach ( $lines as $line ) {
4748 ++$lineNum;
4849
@@ -187,17 +188,21 @@
188189 return self::error( 'imagemap_no_image' );
189190 }
190191
191 - if ( $output == '' ) {
 192+ if ( $output == '' && $defaultLinkAttribs == '' ) {
192193 return self::error( 'imagemap_no_areas' );
 194+ } elseif ( $output == '' && $defaultLinkAttribs != '' ) {
 195+ // no areas defined, default only. It's not a real imagemap, so we do not need some tags
 196+ $realmap = false;
193197 }
194198
195 - # Construct the map
196 - $mapName = "ImageMap_" . ++self::$id;
197 - $output = "<map name=\"$mapName\">\n$output</map>\n";
198 -
199 - # Alter the image tag
200 - $imageNode->setAttribute( 'usemap', "#$mapName" );
201 -
 199+ if ( $realmap ) {
 200+ # Construct the map
 201+ $mapName = "ImageMap_" . ++self::$id;
 202+ $output = "<map name=\"$mapName\">\n$output</map>\n";
 203+
 204+ # Alter the image tag
 205+ $imageNode->setAttribute( 'usemap', "#$mapName" );
 206+ }
202207 # Add a surrounding div, remove the default link to the description page
203208 $anchor = $imageNode->parentNode;
204209 $parent = $anchor->parentNode;