These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
0 ignored issues
–
show
|
|||
2 | |||
3 | /** |
||
4 | * This group contains all Google Maps v3 related files of the Semantic Maps extension. |
||
5 | * |
||
6 | * @defgroup SMGoogleMaps3 Google Maps v3 |
||
7 | * @ingroup SMGoogleMaps3 |
||
8 | */ |
||
9 | |||
10 | /** |
||
11 | * This file holds the general information for the Google Maps v3 service. |
||
12 | * |
||
13 | * @since 1.0 |
||
14 | * |
||
15 | * @file SM_GoogleMaps3.php |
||
16 | * @ingroup SMGoogleMaps3 |
||
17 | * |
||
18 | * @licence GNU GPL v2+ |
||
19 | * @author Jeroen De Dauw < [email protected] > |
||
20 | */ |
||
21 | |||
22 | if ( !defined( 'MEDIAWIKI' ) ) { |
||
23 | die( 'Not an entry point.' ); |
||
24 | } |
||
25 | |||
26 | $moduleTemplate = array( |
||
27 | 'localBasePath' => __DIR__, |
||
28 | 'remoteExtPath' => 'SemanticMaps/src/services/GoogleMaps3', |
||
29 | 'group' => 'ext.semanticmaps', |
||
30 | ); |
||
31 | |||
32 | $GLOBALS['wgResourceModules']['ext.sm.fi.googlemaps3'] = $moduleTemplate + array( |
||
33 | 'dependencies' => array( |
||
34 | 'ext.sm.fi.googlemaps3.single', |
||
35 | ), |
||
36 | 'scripts' => array( |
||
37 | 'ext.sm.googlemapsinput.js', |
||
38 | ), |
||
39 | ); |
||
40 | |||
41 | $GLOBALS['wgResourceModules']['ext.sm.fi.googlemaps3.single'] = $moduleTemplate + array( |
||
42 | 'dependencies' => array( |
||
43 | 'ext.maps.googlemaps3', |
||
44 | 'ext.sm.forminputs', |
||
45 | ), |
||
46 | 'scripts' => array( |
||
47 | 'jquery.googlemapsinput.js', |
||
48 | ), |
||
49 | 'messages' => array( |
||
50 | ) |
||
51 | ); |
||
52 | |||
53 | unset( $moduleTemplate ); |
||
54 | |||
55 | $GLOBALS['wgHooks']['MappingServiceLoad'][] = 'smfInitGoogleMaps3'; |
||
56 | |||
57 | function smfInitGoogleMaps3() { |
||
58 | global $wgAutoloadClasses; |
||
59 | |||
60 | $wgAutoloadClasses['SMGoogleMaps3FormInput'] = __DIR__ . '/SM_GoogleMaps3FormInput.php'; |
||
61 | |||
62 | MapsMappingServices::registerServiceFeature( 'googlemaps3', 'qp', 'SMMapPrinter' ); |
||
63 | MapsMappingServices::registerServiceFeature( 'googlemaps3', 'fi', 'SMGoogleMaps3FormInput' ); |
||
64 | |||
65 | return true; |
||
66 | } |
||
67 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.