Index: trunk/extensions/Maps/RELEASE-NOTES |
— | — | @@ -10,8 +10,14 @@ |
11 | 11 | === Maps 0.7.1 === |
12 | 12 | (2010-1x-xx) |
13 | 13 | |
14 | | -* |
| 14 | +==== New features ==== |
15 | 15 | |
| 16 | +* Image layers for OpenLayers maps, defined via pages in the Layer namespace. |
| 17 | + |
| 18 | +==== Bug fixes ==== |
| 19 | + |
| 20 | +* Support for images without namespace prefix in the display points parser hook. |
| 21 | + |
16 | 22 | === Maps 0.7 === |
17 | 23 | (2010-10-15) |
18 | 24 | |
Index: trunk/extensions/Maps/includes/Maps_Layer.php |
— | — | @@ -70,7 +70,9 @@ |
71 | 71 | $this->properties = $properties; |
72 | 72 | |
73 | 73 | // TODO |
74 | | - $this->properties['source'] = MapsMapper::getImageUrl( $this->properties['source'] ); |
| 74 | + if ( array_key_exists( 'source', $this->properties ) ) { |
| 75 | + $this->properties['source'] = MapsMapper::getImageUrl( $this->properties['source'] ); |
| 76 | + } |
75 | 77 | } |
76 | 78 | |
77 | 79 | /** |
— | — | @@ -198,7 +200,7 @@ |
199 | 201 | |
200 | 202 | $options = array(); |
201 | 203 | |
202 | | - if ( array_key_exists( 'zoomlevels', $this->properties ) ) { |
| 204 | + if ( $this->properties !== false ) { |
203 | 205 | $options['numZoomLevels'] = $zoomlevels; |
204 | 206 | } |
205 | 207 | |
Index: trunk/extensions/Maps/includes/Maps_Mapper.php |
— | — | @@ -13,86 +13,6 @@ |
14 | 14 | final class MapsMapper { |
15 | 15 | |
16 | 16 | /** |
17 | | - * Determines if a value is a valid map dimension, and optionally corrects it. |
18 | | - * |
19 | | - * TODO: move to param validation and manipulation classes |
20 | | - * |
21 | | - * @since 0.6 |
22 | | - * |
23 | | - * @param string or number $value The value as it was entered by the user. |
24 | | - * @param string $dimension Must be width or height. |
25 | | - * @param boolean $correct If true, the value will be corrected when invalid. Defaults to false. |
26 | | - * @param number $default The default value for this dimension. Must be set when $correct = true. |
27 | | - * |
28 | | - * @return boolean |
29 | | - */ |
30 | | - public static function isMapDimension( &$value, $name, array $parameters, $dimension, $correct = false, $default = 0 ) { |
31 | | - global $egMapsSizeRestrictions; |
32 | | - |
33 | | - // See if the notation is valid. |
34 | | - if ( !preg_match( '/^\d+(\.\d+)?(px|ex|em|%)?$/', $value ) ) { |
35 | | - if ( $correct ) { |
36 | | - $value = $default; |
37 | | - } else { |
38 | | - return false; |
39 | | - } |
40 | | - } |
41 | | - |
42 | | - // Determine the minimum and maximum values. |
43 | | - if ( preg_match( '/^.*%$/', $value ) ) { |
44 | | - if ( count( $egMapsSizeRestrictions[$dimension] ) >= 4 ) { |
45 | | - $min = $egMapsSizeRestrictions[$dimension][2]; |
46 | | - $max = $egMapsSizeRestrictions[$dimension][3]; |
47 | | - } else { |
48 | | - // This is for backward compatibility with people who have set a custom min and max before 0.6. |
49 | | - $min = 1; |
50 | | - $max = 100; |
51 | | - } |
52 | | - } else { |
53 | | - $min = $egMapsSizeRestrictions[$dimension][0]; |
54 | | - $max = $egMapsSizeRestrictions[$dimension][1]; |
55 | | - } |
56 | | - |
57 | | - // See if the actual value is withing the limits. |
58 | | - $number = preg_replace( '/[^0-9]/', '', $value ); |
59 | | - if ( $number < $min ) { |
60 | | - if ( $correct ) { |
61 | | - $value = $min; |
62 | | - } else { |
63 | | - return false; |
64 | | - } |
65 | | - } else if ( $number > $max ) { |
66 | | - if ( $correct ) { |
67 | | - $value = $max; |
68 | | - } else { |
69 | | - return false; |
70 | | - } |
71 | | - } |
72 | | - |
73 | | - // If this is a 'correct the value call', add 'px' if no unit has been provided. |
74 | | - if ( $correct ) { |
75 | | - if ( !preg_match( '/(px|ex|em|%)$/', $value ) ) { |
76 | | - $value .= 'px'; |
77 | | - } |
78 | | - } |
79 | | - |
80 | | - return true; |
81 | | - } |
82 | | - |
83 | | - /** |
84 | | - * Corrects the provided map demension value when not valid. |
85 | | - * |
86 | | - * @since 0.6 |
87 | | - * |
88 | | - * @param string or number $value The value as it was entered by the user. |
89 | | - * @param string $dimension Must be width or height. |
90 | | - * @param number $default The default value for this dimension. |
91 | | - */ |
92 | | - public static function setMapDimension( &$value, $name, array $parameters, $dimension, $default ) { |
93 | | - self::isMapDimension( $value, $name, $parameters, $dimension, true, $default ); |
94 | | - } |
95 | | - |
96 | | - /** |
97 | 17 | * Add a JavaScript file out of skins/common, or a given relative path. |
98 | 18 | * |
99 | 19 | * This is a copy of the native function in OutputPage to work around a pre MW 1.16 bug. |
— | — | @@ -209,8 +129,8 @@ |
210 | 130 | */ |
211 | 131 | public static function getImageUrl( $image ) { |
212 | 132 | $title = Title::newFromText( $image, NS_FILE ); |
213 | | - |
214 | | - if ( $title->getNamespace() == NS_FILE && $title->exists() ) { |
| 133 | + |
| 134 | + if ( !is_null( $title ) && $title->getNamespace() == NS_FILE && $title->exists() ) { |
215 | 135 | $imagePage = new ImagePage( $title ); |
216 | 136 | $image = $imagePage->getDisplayedFile()->getURL(); |
217 | 137 | } |
Index: trunk/extensions/Maps/includes/features/Maps_BasePointMap.php |
— | — | @@ -148,16 +148,7 @@ |
149 | 149 | } |
150 | 150 | |
151 | 151 | if ( $markerData['icon'] != '' ) { |
152 | | - if ( strpos( $markerData['icon'], ':' ) === false ) { |
153 | | - $markerData['icon'] = 'File:' . $markerData['icon']; |
154 | | - } |
155 | | - |
156 | | - $title = Title::newFromText( $markerData['icon'] ); |
157 | | - |
158 | | - if ( !is_null( $title ) && $title->exists() ) { |
159 | | - $iconImagePage = new ImagePage( $title ); |
160 | | - $markerData['icon'] = $iconImagePage->getDisplayedFile()->getURL(); |
161 | | - } |
| 152 | + $markerData['icon'] = MapsMapper::getImageUrl( $markerData['icon'] ); |
162 | 153 | } |
163 | 154 | |
164 | 155 | // Temporary fix, will refactor away later |