| Index: trunk/extensions/ImageMap/ImageMap_body.php |
| — | — | @@ -42,6 +42,7 @@ |
| 43 | 43 | $links = array(); |
| 44 | 44 | $descType = self::BOTTOM_RIGHT; |
| 45 | 45 | $defaultLinkAttribs = false; |
| | 46 | + $realmap = true; |
| 46 | 47 | foreach ( $lines as $line ) { |
| 47 | 48 | ++$lineNum; |
| 48 | 49 | |
| — | — | @@ -187,17 +188,21 @@ |
| 188 | 189 | return self::error( 'imagemap_no_image' ); |
| 189 | 190 | } |
| 190 | 191 | |
| 191 | | - if ( $output == '' ) { |
| | 192 | + if ( $output == '' && $defaultLinkAttribs == '' ) { |
| 192 | 193 | 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; |
| 193 | 197 | } |
| 194 | 198 | |
| 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 | + } |
| 202 | 207 | # Add a surrounding div, remove the default link to the description page |
| 203 | 208 | $anchor = $imageNode->parentNode; |
| 204 | 209 | $parent = $anchor->parentNode; |