r75078 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75077‎ | r75078 | r75079 >
Date:09:25, 20 October 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.7.2, follow up to r75077
Modified paths:
  • /trunk/extensions/Maps/INSTALL (modified) (history)
  • /trunk/extensions/Maps/Maps.php (modified) (history)
  • /trunk/extensions/Maps/RELEASE-NOTES (modified) (history)
  • /trunk/extensions/Maps/includes/Maps_Layer.php (modified) (history)
  • /trunk/extensions/Maps/includes/parserHooks/Maps_Coordinates.php (modified) (history)
  • /trunk/extensions/Maps/includes/parserHooks/Maps_DisplayMap.php (modified) (history)
  • /trunk/extensions/Maps/includes/parserHooks/Maps_DisplayPoint.php (modified) (history)
  • /trunk/extensions/Maps/includes/parserHooks/Maps_Finddestination.php (modified) (history)
  • /trunk/extensions/Maps/includes/parserHooks/Maps_Geocode.php (modified) (history)
  • /trunk/extensions/Maps/includes/parserHooks/Maps_Geodistance.php (modified) (history)
  • /trunk/extensions/Maps/includes/services/GoogleMaps/Maps_GoogleMaps.php (modified) (history)
  • /trunk/extensions/Maps/includes/services/GoogleMaps/Maps_ParamGMapType.php (modified) (history)
  • /trunk/extensions/Maps/includes/services/GoogleMaps3/Maps_ParamGMap3Type.php (modified) (history)
  • /trunk/extensions/Maps/includes/services/OpenLayers/Maps_OpenLayers.php (modified) (history)
  • /trunk/extensions/Maps/includes/services/YahooMaps/Maps_ParamYMapType.php (modified) (history)
  • /trunk/extensions/Maps/includes/services/YahooMaps/Maps_YahooMaps.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/INSTALL
@@ -1,4 +1,4 @@
2 -[[Maps 0.7.1]]
 2+[[Maps 0.7.2]]
33
44 In order to use this version of Maps, you need to have Validator 0.3.6 installed. If you get a distribution
55 from this page, you don't need to bother this, since Validator comes bundled with every release, and will
Index: trunk/extensions/Maps/Maps.php
@@ -36,7 +36,7 @@
3737 echo '<b>Warning:</b> You need to have <a href="http://www.mediawiki.org/wiki/Extension:Validator">Validator</a> installed in order to use <a href="http://www.mediawiki.org/wiki/Extension:Maps">Maps</a>.';
3838 }
3939 else {
40 - define( 'Maps_VERSION', '0.7.1' );
 40+ define( 'Maps_VERSION', '0.7.2 alpha' );
4141
4242 // The different coordinate notations.
4343 define( 'Maps_COORDS_FLOAT', 'float' );
Index: trunk/extensions/Maps/RELEASE-NOTES
@@ -7,6 +7,11 @@
88 http://mapping.referata.com/wiki/Maps/Version_history#Maps_change_log
99
1010
 11+=== Maps 0.7.2 ===
 12+(2010-1x-xx)
 13+
 14+* ...
 15+
1116 === Maps 0.7.1 ===
1217 (2010-10-20)
1318
Index: trunk/extensions/Maps/includes/Maps_Layer.php
@@ -123,12 +123,6 @@
124124 protected function getParameterDefinitions() {
125125 $params = array();
126126
127 - $params['type'] = new Parameter( 'type' );
128 - $params['type']->addCriteria( New CriterionInArray( array_keys( self::$types ) ) );
129 -
130 - $params['label'] = new Parameter( 'label' );
131 - $params['label']->lowerCaseValue = false;
132 -
133127 $params[] = new Parameter( 'lowerbound', Parameter::TYPE_FLOAT );
134128 $params[] = new Parameter( 'upperbound', Parameter::TYPE_FLOAT );
135129 $params[] = new Parameter( 'leftbound', Parameter::TYPE_FLOAT );
@@ -136,12 +130,17 @@
137131 $params[] = new Parameter( 'width', Parameter::TYPE_FLOAT );
138132 $params[] = new Parameter( 'height', Parameter::TYPE_FLOAT );
139133
 134+ $params['type'] = new Parameter( 'type' );
 135+ $params['type']->addCriteria( New CriterionInArray( array_keys( self::$types ) ) );
 136+ $params['type']->addManipulations( new ParamManipulationFunctions( 'strtolower' ) );
 137+
140138 $params[] = new Parameter( 'zoomlevels', Parameter::TYPE_INTEGER, false );
141139
 140+ $params['label'] = new Parameter( 'label' );
 141+
142142 $params['source'] = new Parameter( 'source' );
143143 $params['source']->addCriteria( new CriterionIsImage() );
144144 $params['source']->addManipulations( new MapsParamImage() );
145 - $params['source']->lowerCaseValue = false;
146145
147146 return $params;
148147 }
Index: trunk/extensions/Maps/includes/services/GoogleMaps3/Maps_ParamGMap3Type.php
@@ -29,7 +29,7 @@
3030 * @since 0.7
3131 */
3232 public function doManipulation( &$value, Parameter $parameter, array &$parameters ) {
33 - $value = 'google.maps.MapTypeId.' . MapsGoogleMaps3::$mapTypes[$value];
 33+ $value = 'google.maps.MapTypeId.' . MapsGoogleMaps3::$mapTypes[strtolower( $value )];
3434 }
3535
3636 }
\ No newline at end of file
Index: trunk/extensions/Maps/includes/services/YahooMaps/Maps_ParamYMapType.php
@@ -29,7 +29,7 @@
3030 * @since 0.7
3131 */
3232 public function doManipulation( &$value, Parameter $parameter, array &$parameters ) {
33 - $value = MapsYahooMaps::$mapTypes[$value];
 33+ $value = MapsYahooMaps::$mapTypes[strtolower( $value )];
3434 }
3535
3636 }
\ No newline at end of file
Index: trunk/extensions/Maps/includes/services/YahooMaps/Maps_YahooMaps.php
@@ -48,22 +48,18 @@
4949 $params['zoom']->addCriteria( new CriterionInRange( 1, 13 ) );
5050 $params['zoom']->setDefault( self::getDefaultZoom() );
5151
52 - $params['controls'] = new ListParameter(
53 - 'controls',
54 - ListParameter::DEFAULT_DELIMITER,
55 - Parameter::TYPE_STRING,
56 - $egMapsYMapControls,
57 - array(),
58 - array(
59 - new CriterionInArray( self::getControlNames() ),
60 - )
61 - );
62 - $params['controls']->addManipulations( new ParamManipulationImplode( ',', "'" ) );
 52+ $params['controls'] = new ListParameter( 'controls' );
 53+ $params['controls']->setDefault( $egMapsYMapControls );
 54+ $params['controls']->addCriteria( new CriterionInArray( self::getControlNames() ) );
 55+ $params['controls']->addManipulations(
 56+ new ParamManipulationFunctions( 'strtolower' ),
 57+ new ParamManipulationImplode( ',', "'" )
 58+ );
6359
6460 $params['type'] = new Parameter(
6561 'type',
6662 Parameter::TYPE_STRING,
67 - $egMapsYahooMapsType,// FIXME: default value should not be used when not present in types parameter.
 63+ $egMapsYahooMapsType, // FIXME: default value should not be used when not present in types parameter.
6864 array(),
6965 array(
7066 new CriterionInArray( self::getTypeNames() ),
Index: trunk/extensions/Maps/includes/services/OpenLayers/Maps_OpenLayers.php
@@ -39,14 +39,16 @@
4040 $params['controls'] = new ListParameter( 'controls' );
4141 $params['controls']->setDefault( $egMapsOLControls );
4242 $params['controls']->addCriteria( new CriterionInArray( self::getControlNames() ) );
43 - $params['controls']->addManipulations( new ParamManipulationImplode( ',', "'" ) );
 43+ $params['controls']->addManipulations(
 44+ new ParamManipulationFunctions( 'strtolower' ),
 45+ new ParamManipulationImplode( ',', "'" )
 46+ );
4447
4548 $params['layers'] = new ListParameter( 'layers' );
4649 $params['layers']->addManipulations( new MapsParamOLLayers() );
4750 $params['layers']->setDoManipulationOfDefault( true );
4851 $params['layers']->addCriteria( new CriterionOLLayer() );
4952 $params['layers']->setDefault( $egMapsOLLayers );
50 - $params['layers']->lowerCaseValue = false;
5153
5254 //$params['imagelayers'] = new ListParameter();
5355 }
Index: trunk/extensions/Maps/includes/services/GoogleMaps/Maps_GoogleMaps.php
@@ -48,17 +48,13 @@
4949 $params['zoom']->addCriteria( new CriterionInRange( 0, 20 ) );
5050 $params['zoom']->setDefault( self::getDefaultZoom() );
5151
52 - $params['controls'] = new ListParameter(
53 - 'controls',
54 - ListParameter::DEFAULT_DELIMITER,
55 - Parameter::TYPE_STRING,
56 - $egMapsGMapControls,
57 - array(),
58 - array(
59 - new CriterionInArray( self::getControlNames() ),
60 - )
61 - );
62 - $params['controls']->addManipulations( new ParamManipulationImplode( ',', "'" ) );
 52+ $params['controls'] = new ListParameter( 'controls' );
 53+ $params['controls']->setDefault( $egMapsGMapControls );
 54+ $params['controls']->addCriteria( new CriterionInArray( self::getControlNames() ) );
 55+ $params['controls']->addManipulations(
 56+ new ParamManipulationFunctions( 'strtolower' ),
 57+ new ParamManipulationImplode( ',', "'" )
 58+ );
6359
6460 $params['type'] = new Parameter(
6561 'type',
@@ -91,24 +87,14 @@
9288 );
9389 $params['autozoom']->addManipulations( new ParamManipulationBoolstr() );
9490
95 - $params['kml'] = new ListParameter(
96 - 'kml',
97 - ListParameter::DEFAULT_DELIMITER,
98 - Parameter::TYPE_STRING,
99 - array() // TODO
100 - );
 91+ $params['kml'] = new ListParameter( 'kml' );
 92+ $params['kml']->setDefault( array() );
10193 $params['kml']->addManipulations( new ParamManipulationImplode( ',', "'" ) );
10294
103 - $params['overlays'] = new ListParameter(
104 - 'overlays',
105 - ListParameter::DEFAULT_DELIMITER,
106 - Parameter::TYPE_STRING,
107 - $egMapsGMapOverlays,
108 - array(),
109 - array(
110 - new CriterionGoogleOverlay( self::$overlayData )
111 - )
112 - );
 95+ $params['overlays'] = new ListParameter( 'overlays' );
 96+ $params['overlays']->setDefault( $egMapsGMapOverlays );
 97+ $params['overlays']->addCriteria( new CriterionGoogleOverlay( self::$overlayData ) );
 98+ $params['overlays']->addManipulations( new ParamManipulationFunctions( 'strtolower' ) ); // TODO
11399 }
114100
115101 /**
Index: trunk/extensions/Maps/includes/services/GoogleMaps/Maps_ParamGMapType.php
@@ -29,7 +29,7 @@
3030 * @since 0.7
3131 */
3232 public function doManipulation( &$value, Parameter $parameter, array &$parameters ) {
33 - $value = MapsGoogleMaps::$mapTypes[$value];
 33+ $value = MapsGoogleMaps::$mapTypes[strtolower( $value )];
3434 }
3535
3636 }
\ No newline at end of file
Index: trunk/extensions/Maps/includes/parserHooks/Maps_Coordinates.php
@@ -67,11 +67,9 @@
6868 array(),
6969 array(
7070 new CriterionIsLocation(),
71 - )
 71+ )
7272 );
7373
74 - $params['location']->lowerCaseValue = false;
75 -
7674 $params['format'] = new Parameter(
7775 'format',
7876 Parameter::TYPE_STRING,
@@ -80,7 +78,8 @@
8179 array(
8280 new CriterionInArray( $egMapsAvailableCoordNotations ),
8381 )
84 - );
 82+ );
 83+ $params['format']->addManipulations( new ParamManipulationFunctions( 'strtolower' ) );
8584
8685 $params['directional'] = new Parameter(
8786 'directional',
Index: trunk/extensions/Maps/includes/parserHooks/Maps_DisplayPoint.php
@@ -67,7 +67,6 @@
6868 $params['coordinates']->addAliases( 'coords', 'location', 'address', 'addresses', 'locations' );
6969 $params['coordinates']->addCriteria( new CriterionIsLocation( $type === ParserHook::TYPE_FUNCTION ? '~' : '|' ) );
7070 $params['coordinates']->addManipulations( new MapsParamCoordSet( $type === ParserHook::TYPE_FUNCTION ? '~' : '|' ) );
71 - $params['coordinates']->lowerCaseValue = false;
7271 $params['coordinates']->addDependencies( 'mappingservice', 'geoservice' );
7372
7473 $params['centre'] = new Parameter(
@@ -79,14 +78,12 @@
8079 new CriterionIsLocation(),
8180 )
8281 );
83 - $params['centre']->lowerCaseValue = false;
8482
8583 $params['title'] = new Parameter(
8684 'title',
8785 Parameter::TYPE_STRING,
8886 $egMapsDefaultTitle
8987 );
90 - $params['title']->lowerCaseValue = false;
9188
9289 $params['label'] = new Parameter(
9390 'label',
@@ -94,7 +91,6 @@
9592 $egMapsDefaultLabel,
9693 array( 'text' )
9794 );
98 - $params['label']->lowerCaseValue = false;
9995
10096 $params['icon'] = new Parameter(
10197 'icon',
@@ -105,7 +101,6 @@
106102 New CriterionNotEmpty()
107103 )
108104 );
109 - $params['icon']->lowerCaseValue = false;
110105
111106 return $params;
112107 }
Index: trunk/extensions/Maps/includes/parserHooks/Maps_Finddestination.php
@@ -61,7 +61,6 @@
6262
6363 $params['location'] = new Parameter( 'location' );
6464 $params['location']->addCriteria( new CriterionIsLocation() );
65 - $params['location']->lowerCaseValue = false;
6665 $params['location']->addDependencies( 'mappingservice', 'geoservice' );
6766
6867 $params['bearing'] = new Parameter(
@@ -71,6 +70,7 @@
7271
7372 $params['distance'] = new Parameter( 'distance' );
7473 $params['distance']->addCriteria( new CriterionIsDistance() );
 74+ // TODO: manipulate to distance object
7575
7676 $params['mappingservice'] = new Parameter(
7777 'mappingservice',
@@ -81,6 +81,7 @@
8282 new CriterionInArray( MapsMappingServices::getAllServiceValues() ),
8383 )
8484 );
 85+ $params['mappingservice']->addManipulations( new ParamManipulationFunctions( 'strtolower' ) );
8586
8687 $params['geoservice'] = new Parameter(
8788 'geoservice',
@@ -90,7 +91,8 @@
9192 array(
9293 new CriterionInArray( $egMapsAvailableGeoServices ),
9394 )
94 - );
 95+ );
 96+ $params['geoservice']->addManipulations( new ParamManipulationFunctions( 'strtolower' ) );
9597
9698 $params['allowcoordinates'] = new Parameter(
9799 'allowcoordinates',
@@ -106,7 +108,8 @@
107109 array(
108110 new CriterionInArray( $egMapsAvailableCoordNotations ),
109111 )
110 - );
 112+ );
 113+ $params['format']->addManipulations( new ParamManipulationFunctions( 'strtolower' ) );
111114
112115 $params['directional'] = new Parameter(
113116 'directional',
Index: trunk/extensions/Maps/includes/parserHooks/Maps_DisplayMap.php
@@ -68,7 +68,6 @@
6969 $params['coordinates']->addAliases( 'coords', 'location', 'address' );
7070 $params['coordinates']->addCriteria( new CriterionIsLocation() );
7171 $params['coordinates']->addManipulations( new MapsParamCoordSet() );
72 - $params['coordinates']->lowerCaseValue = false;
7372 $params['coordinates']->addDependencies( 'mappingservice', 'geoservice' );
7473
7574 return $params;
Index: trunk/extensions/Maps/includes/parserHooks/Maps_Geocode.php
@@ -61,7 +61,6 @@
6262 $params = array();
6363
6464 $params['location'] = new Parameter( 'location' );
65 - $params['location']->lowerCaseValue = false;
6665 $params['location']->addDependencies( 'mappingservice', 'geoservice' );
6766 $params['location']->addCriteria( new CriterionIsLocation() );
6867
@@ -74,6 +73,7 @@
7574 new CriterionInArray( MapsMappingServices::getAllServiceValues() ),
7675 )
7776 );
 77+ $params['mappingservice']->addManipulations( new ParamManipulationFunctions( 'strtolower' ) );
7878
7979 $params['geoservice'] = new Parameter(
8080 'geoservice',
@@ -83,13 +83,14 @@
8484 array(
8585 new CriterionInArray( $egMapsAvailableGeoServices ),
8686 )
87 - );
 87+ );
 88+ $params['geoservice']->addManipulations( new ParamManipulationFunctions( 'strtolower' ) );
8889
8990 $params['allowcoordinates'] = new Parameter(
9091 'allowcoordinates',
9192 Parameter::TYPE_BOOLEAN,
9293 $egMapsAllowCoordsGeocoding
93 - );
 94+ );
9495
9596 $params['format'] = new Parameter(
9697 'format',
@@ -98,8 +99,9 @@
99100 array( 'notation' ),
100101 array(
101102 new CriterionInArray( $egMapsAvailableCoordNotations ),
102 - )
103 - );
 103+ )
 104+ );
 105+ $params['format']->addManipulations( new ParamManipulationFunctions( 'strtolower' ) );
104106
105107 $params['directional'] = new Parameter(
106108 'directional',
Index: trunk/extensions/Maps/includes/parserHooks/Maps_Geodistance.php
@@ -67,7 +67,6 @@
6868 new CriterionIsLocation(),
6969 )
7070 );
71 - $params['location1']->lowerCaseValue = false;
7271 $params['location1']->addDependencies( 'mappingservice', 'geoservice' );
7372
7473 $params['location2'] = new Parameter(
@@ -79,7 +78,6 @@
8079 new CriterionIsLocation(),
8180 )
8281 );
83 - $params['location2']->lowerCaseValue = false;
8482 $params['location2']->addDependencies( 'mappingservice', 'geoservice' );
8583
8684 $params['unit'] = new Parameter(
@@ -90,7 +88,8 @@
9189 array(
9290 new CriterionInArray( MapsDistanceParser::getUnits() ),
9391 )
94 - );
 92+ );
 93+ $params['unit']->addManipulations( new ParamManipulationFunctions( 'strtolower' ) );
9594
9695 $params['decimals'] = new Parameter(
9796 'decimals',
@@ -107,6 +106,7 @@
108107 new CriterionInArray( MapsMappingServices::getAllServiceValues() ),
109108 )
110109 );
 110+ $params['mappingservice']->addManipulations( new ParamManipulationFunctions( 'strtolower' ) );
111111
112112 $params['geoservice'] = new Parameter(
113113 'geoservice',
@@ -116,7 +116,8 @@
117117 array(
118118 new CriterionInArray( $egMapsAvailableGeoServices ),
119119 )
120 - );
 120+ );
 121+ $params['geoservice']->addManipulations( new ParamManipulationFunctions( 'strtolower' ) );
121122
122123 return $params;
123124 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r75079Changes for 0.7.2, follow up to r75078jeroendedauw09:26, 20 October 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r75077Changes for 0.4.2 - threw out $parameter->lowerCaseValue because it was to eviljeroendedauw09:24, 20 October 2010

Status & tagging log