r67287 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r67286‎ | r67287 | r67288 >
Date:17:52, 3 June 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.6.1 - fixed issue with SF features
Modified paths:
  • /trunk/extensions/SemanticMaps/Features/FormInputs/SM_FormInputs.php (modified) (history)
  • /trunk/extensions/SemanticMaps/Services/GoogleMaps/SM_GoogleMaps.php (modified) (history)
  • /trunk/extensions/SemanticMaps/Services/OpenLayers/SM_OpenLayers.php (modified) (history)
  • /trunk/extensions/SemanticMaps/Services/YahooMaps/SM_YahooMaps.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMaps/Services/YahooMaps/SM_YahooMaps.php
@@ -21,7 +21,7 @@
2222 }
2323
2424 $wgAutoloadClasses['SMYahooMapsQP'] = dirname( __FILE__ ) . '/SM_YahooMapsQP.php';
25 -$wgAutoloadClasses['SMYahooMapsFormInput'] = dirname( __FILE__ ) . '/SM_YahooMapsFormInput.php';
 25+if ( class_exists( 'SMFormInput' ) ) $wgAutoloadClasses['SMYahooMapsFormInput'] = dirname( __FILE__ ) . '/SM_YahooMapsFormInput.php';
2626
2727 $egMapsServices['yahoomaps']['features']['qp'] = 'SMYahooMapsQP';
2828 $egMapsServices['yahoomaps']['features']['fi'] = 'SMYahooMapsFormInput';
\ No newline at end of file
Index: trunk/extensions/SemanticMaps/Services/OpenLayers/SM_OpenLayers.php
@@ -21,7 +21,7 @@
2222 }
2323
2424 $wgAutoloadClasses['SMOpenLayersQP'] = dirname( __FILE__ ) . '/SM_OpenLayersQP.php';
25 -$wgAutoloadClasses['SMOpenLayersFormInput'] = dirname( __FILE__ ) . '/SM_OpenLayersFormInput.php';
 25+if ( class_exists( 'SMFormInput' ) ) $wgAutoloadClasses['SMOpenLayersFormInput'] = dirname( __FILE__ ) . '/SM_OpenLayersFormInput.php';
2626
2727 $egMapsServices['openlayers']['features']['qp'] = 'SMOpenLayersQP';
2828 $egMapsServices['openlayers']['features']['fi'] = 'SMOpenLayersFormInput';
\ No newline at end of file
Index: trunk/extensions/SemanticMaps/Services/GoogleMaps/SM_GoogleMaps.php
@@ -21,7 +21,7 @@
2222 }
2323
2424 $wgAutoloadClasses['SMGoogleMapsQP'] = dirname( __FILE__ ) . '/SM_GoogleMapsQP.php';
25 -$wgAutoloadClasses['SMGoogleMapsFormInput'] = dirname( __FILE__ ) . '/SM_GoogleMapsFormInput.php';
 25+if ( class_exists( 'SMFormInput' ) ) $wgAutoloadClasses['SMGoogleMapsFormInput'] = dirname( __FILE__ ) . '/SM_GoogleMapsFormInput.php';
2626
2727 $egMapsServices['googlemaps2']['features']['qp'] = 'SMGoogleMapsQP';
2828 $egMapsServices['googlemaps2']['features']['fi'] = 'SMGoogleMapsFormInput';
\ No newline at end of file
Index: trunk/extensions/SemanticMaps/Features/FormInputs/SM_FormInputs.php
@@ -24,35 +24,36 @@
2525 public static function initialize() {
2626 global $smgDir, $wgAutoloadClasses, $egMapsServices, $sfgFormPrinter;
2727
28 - // This feature can only be enbled when Semantic Forms is loaded.
29 - if ( isset( $sfgFormPrinter ) ) {
30 - $hasFormInputs = false;
 28+ // This code should not get called when SF is not loaded, but let's have this
 29+ // check to not run into problems when people mess up the settings.
 30+ if ( !defined( 'SF_VERSION' ) ) return true;
 31+
 32+ $wgAutoloadClasses['SMFormInput'] = dirname( __FILE__ ) . '/SM_FormInput.php';
 33+
 34+ $hasFormInputs = false;
 35+
 36+ self::initializeParams();
 37+
 38+ foreach ( $egMapsServices as $serviceName => $serviceData ) {
 39+ // Check if the service has a form input
 40+ $hasFI = array_key_exists( 'fi', $serviceData['features'] );
3141
32 - $wgAutoloadClasses['SMFormInput'] = dirname( __FILE__ ) . '/SM_FormInput.php';
 42+ // If the service has no FI, skipt it and continue with the next one.
 43+ if ( !$hasFI ) continue;
3344
34 - self::initializeParams();
35 -
36 - foreach ( $egMapsServices as $serviceName => $serviceData ) {
37 - // Check if the service has a form input
38 - $hasFI = array_key_exists( 'fi', $serviceData['features'] );
39 -
40 - // If the service has no FI, skipt it and continue with the next one.
41 - if ( !$hasFI ) continue;
42 -
43 - // At least one form input will be enabled when this point is reached.
44 - $hasFormInputs = true;
 45+ // At least one form input will be enabled when this point is reached.
 46+ $hasFormInputs = true;
4547
46 - // Add the result form input type for the service name.
47 - self::initFormHook( $serviceName, $serviceName );
48 -
49 - // Loop through the service alliases, and add them as form input types.
50 - foreach ( $serviceData['aliases'] as $alias ) self::initFormHook( $alias, $serviceName );
51 - }
 48+ // Add the result form input type for the service name.
 49+ self::initFormHook( $serviceName, $serviceName );
5250
53 - // Add the 'map' form input type if there are mapping services that have FI's loaded.
54 - if ( $hasFormInputs ) self::initFormHook( 'map' );
 51+ // Loop through the service alliases, and add them as form input types.
 52+ foreach ( $serviceData['aliases'] as $alias ) self::initFormHook( $alias, $serviceName );
5553 }
5654
 55+ // Add the 'map' form input type if there are mapping services that have FI's loaded.
 56+ if ( $hasFormInputs ) self::initFormHook( 'map' );
 57+
5758 return true;
5859 }
5960

Follow-up revisions

RevisionCommit summaryAuthorDate
r67422Follow up to r67287jeroendedauw05:52, 6 June 2010

Status & tagging log