r54992 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r54991‎ | r54992 | r54993 >
Date:04:06, 14 August 2009
Author:yaron
Status:deferred
Tags:
Comment:
Improved service-setting in form input code to make more readable and remove PHP "notice" error
Modified paths:
  • /trunk/extensions/SemanticMaps/SemanticMaps.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMaps/SemanticMaps.php
@@ -151,14 +151,20 @@
152152 function smfSelectFormInputHTML($coordinates, $input_name, $is_mandatory, $is_disabled, $field_args) {
153153 global $egMapsServices;
154154
155 - // If service_name is set, use this value, and ignore any given service parameters
156 - // This will prevent ..input type=googlemaps|service=yahoo.. from shwoing up a Yahoo! Maps map
157 - if (array_key_exists('service_name', $field_args)) $field_args['service'] = $field_args['service_name'];
158 -
159 - $field_args['service'] = MapsMapper::getValidService($field_args['service']);
 155+ // If service_name is set, use this value, and ignore any given
 156+ // service parameters
 157+ // This will prevent ..input type=googlemaps|service=yahoo.. from
 158+ // showing up as a Yahoo! Maps map
 159+ if (array_key_exists('service_name', $field_args))
 160+ $service_name = $field_args['service_name'];
 161+ elseif (array_key_exists('service', $field_args))
 162+ $service_name = $field_args['service'];
 163+ else
 164+ $service_name = null;
 165+ $service_name = MapsMapper::getValidService($service_name);
160166
161 - if (array_key_exists('fi', $egMapsServices[$field_args['service']])) {
162 - $formInput = new $egMapsServices[$field_args['service']]['fi']['class']();
 167+ if (array_key_exists('fi', $egMapsServices[$service_name])) {
 168+ $formInput = new $egMapsServices[$service_name]['fi']['class']();
163169
164170 // Get and return the form input HTML from the hook corresponding with the provided service
165171 return $formInput->formInputHTML($coordinates, $input_name, $is_mandatory, $is_disabled, $field_args);

Status & tagging log