Index: trunk/extensions/Maps/Maps_Mapper.php |
— | — | @@ -13,9 +13,12 @@ |
14 | 14 | } |
15 | 15 | |
16 | 16 | final class MapsMapper { |
| 17 | + |
| 18 | + /** |
| 19 | + * Initialization function. Needs to be called before parameters using Maps defined validation |
| 20 | + * or formatting functions are handled. |
| 21 | + */ |
17 | 22 | public static function initialize() { |
18 | | - global $egMapsSizeRestrictions, $egMapsMapWidth, $egMapsMapHeight; |
19 | | - |
20 | 23 | Validator::addValidationFunction( 'is_map_dimension', array( __CLASS__, 'isMapDimension' ) ); |
21 | 24 | Validator::addValidationFunction( 'is_location', array( __CLASS__, 'isLocation' ) ); |
22 | 25 | Validator::addValidationFunction( 'are_locations', array( __CLASS__, 'areLocations' ) ); |
— | — | @@ -25,6 +28,15 @@ |
26 | 29 | Validator::addOutputFormat( 'coordinateSets', array( __CLASS__, 'formatLocations' ) ); |
27 | 30 | } |
28 | 31 | |
| 32 | + /** |
| 33 | + * Returns if the value is a location. |
| 34 | + * |
| 35 | + * @param string $location |
| 36 | + * @param string $name The name of the parameter. |
| 37 | + * @param array $parameters Array containing data about the so far handled parameters. |
| 38 | + * |
| 39 | + * @return boolean |
| 40 | + */ |
29 | 41 | public static function isLocation( $location, $name, array $parameters ) { |
30 | 42 | if ( self::geocoderIsAvailable() ) { |
31 | 43 | return MapsGeocoder::isLocation( $location ); |
— | — | @@ -33,6 +45,15 @@ |
34 | 46 | } |
35 | 47 | } |
36 | 48 | |
| 49 | + /** |
| 50 | + * Returns if the values are a locations. |
| 51 | + * |
| 52 | + * @param string $locations |
| 53 | + * @param string $name The name of the parameter. |
| 54 | + * @param array $parameters Array containing data about the so far handled parameters. |
| 55 | + * |
| 56 | + * @return boolean |
| 57 | + */ |
37 | 58 | public static function areLocations( $locations, $name, array $parameters ) { |
38 | 59 | $locations = (array)$locations; |
39 | 60 | foreach ( $locations as $location ) { |
— | — | @@ -43,6 +64,13 @@ |
44 | 65 | return true; |
45 | 66 | } |
46 | 67 | |
| 68 | + /** |
| 69 | + * Formats a location to a coordinate set in a certain representation. |
| 70 | + * |
| 71 | + * @param string $locations |
| 72 | + * @param string $name The name of the parameter. |
| 73 | + * @param array $parameters Array containing data about the so far handled parameters. |
| 74 | + */ |
47 | 75 | public static function formatLocation( &$location, $name, array $parameters ) { |
48 | 76 | if ( self::geocoderIsAvailable() ) { |
49 | 77 | $location = MapsGeocoder::attemptToGeocodeToString( $location ); |
— | — | @@ -51,6 +79,13 @@ |
52 | 80 | } |
53 | 81 | } |
54 | 82 | |
| 83 | + /** |
| 84 | + * Formats a set of locations to coordinate sets in a certain representation. |
| 85 | + * |
| 86 | + * @param string $locations |
| 87 | + * @param string $name The name of the parameter. |
| 88 | + * @param array $parameters Array containing data about the so far handled parameters. |
| 89 | + */ |
55 | 90 | public static function formatLocations( &$locations, $name, array $parameters ) { |
56 | 91 | $locations = (array)$locations; |
57 | 92 | foreach ( $locations as &$location ) { |
— | — | @@ -280,4 +315,4 @@ |
281 | 316 | ), |
282 | 317 | ); |
283 | 318 | } |
284 | | -} |
| 319 | +} |
\ No newline at end of file |