Index: trunk/extensions/SemanticMaps/Services/YahooMaps/SM_YahooMaps.php |
— | — | @@ -21,7 +21,7 @@ |
22 | 22 | } |
23 | 23 | |
24 | 24 | $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'; |
26 | 26 | |
27 | 27 | $egMapsServices['yahoomaps']['features']['qp'] = 'SMYahooMapsQP'; |
28 | 28 | $egMapsServices['yahoomaps']['features']['fi'] = 'SMYahooMapsFormInput'; |
\ No newline at end of file |
Index: trunk/extensions/SemanticMaps/Services/OpenLayers/SM_OpenLayers.php |
— | — | @@ -21,7 +21,7 @@ |
22 | 22 | } |
23 | 23 | |
24 | 24 | $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'; |
26 | 26 | |
27 | 27 | $egMapsServices['openlayers']['features']['qp'] = 'SMOpenLayersQP'; |
28 | 28 | $egMapsServices['openlayers']['features']['fi'] = 'SMOpenLayersFormInput'; |
\ No newline at end of file |
Index: trunk/extensions/SemanticMaps/Services/GoogleMaps/SM_GoogleMaps.php |
— | — | @@ -21,7 +21,7 @@ |
22 | 22 | } |
23 | 23 | |
24 | 24 | $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'; |
26 | 26 | |
27 | 27 | $egMapsServices['googlemaps2']['features']['qp'] = 'SMGoogleMapsQP'; |
28 | 28 | $egMapsServices['googlemaps2']['features']['fi'] = 'SMGoogleMapsFormInput'; |
\ No newline at end of file |
Index: trunk/extensions/SemanticMaps/Features/FormInputs/SM_FormInputs.php |
— | — | @@ -24,35 +24,36 @@ |
25 | 25 | public static function initialize() { |
26 | 26 | global $smgDir, $wgAutoloadClasses, $egMapsServices, $sfgFormPrinter; |
27 | 27 | |
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'] ); |
31 | 41 | |
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; |
33 | 44 | |
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; |
45 | 47 | |
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 ); |
52 | 50 | |
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 ); |
55 | 53 | } |
56 | 54 | |
| 55 | + // Add the 'map' form input type if there are mapping services that have FI's loaded. |
| 56 | + if ( $hasFormInputs ) self::initFormHook( 'map' ); |
| 57 | + |
57 | 58 | return true; |
58 | 59 | } |
59 | 60 | |