Index: trunk/extensions/UKGeocodingForMaps/ParserFunctions/DisplayUkPoint/UKG_DisplayUkPoint.php |
— | — | @@ -9,7 +9,7 @@ |
10 | 10 | * @author Jeroen De Dauw |
11 | 11 | */ |
12 | 12 | |
13 | | -if( !defined( 'MEDIAWIKI' ) ) { |
| 13 | +if ( !defined( 'MEDIAWIKI' ) ) { |
14 | 14 | die( 'Not an entry point.' ); |
15 | 15 | } |
16 | 16 | |
— | — | @@ -27,14 +27,14 @@ |
28 | 28 | function efUKGDisplayUkPointMagic( &$magicWords, $langCode ) { |
29 | 29 | $magicWords['display_uk_point'] = array( 0, 'display_uk_point', 'display_uk_points' ); |
30 | 30 | return true; // Unless we return true, other parser functions won't get loaded. |
31 | | -} |
| 31 | +} |
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Adds the parser function hooks |
35 | 35 | */ |
36 | | -function efUKGRegisterDisplayPoint(&$wgParser) { |
| 36 | +function efUKGRegisterDisplayPoint( &$wgParser ) { |
37 | 37 | // Hooks to enable the '#display_uk_point' and '#display_uk_points' parser functions. |
38 | | - $wgParser->setFunctionHook( 'display_uk_point', array('UKGDisplayUkPoint', 'displayUkPointRender') ); |
| 38 | + $wgParser->setFunctionHook( 'display_uk_point', array( 'UKGDisplayUkPoint', 'displayUkPointRender' ) ); |
39 | 39 | return true; |
40 | 40 | } |
41 | 41 | |
— | — | @@ -61,58 +61,58 @@ |
62 | 62 | * |
63 | 63 | * @return array |
64 | 64 | */ |
65 | | - public static function displayUkPointRender(&$parser) { |
| 65 | + public static function displayUkPointRender( &$parser ) { |
66 | 66 | global $wgLang, $egValidatorErrorLevel; |
67 | 67 | |
68 | 68 | $params = func_get_args(); |
69 | 69 | |
70 | 70 | array_shift( $params ); // We already know the $parser. |
71 | | - |
| 71 | + |
72 | 72 | $map = array(); |
73 | 73 | $coordFails = array(); |
74 | 74 | |
75 | | - $paramInfo = array_merge(MapsMapper::getMainParams(), self::$parameters); |
| 75 | + $paramInfo = array_merge( MapsMapper::getMainParams(), self::$parameters ); |
76 | 76 | |
77 | 77 | // Go through all parameters, split their names and values, and put them in the $map array. |
78 | | - foreach($params as $param) { |
79 | | - $split = explode('=', $param); |
80 | | - if (count($split) > 1) { |
81 | | - $paramName = strtolower(trim($split[0])); |
82 | | - $paramValue = trim($split[1]); |
83 | | - if (strlen($paramName) > 0 && strlen($paramValue) > 0) { |
| 78 | + foreach ( $params as $param ) { |
| 79 | + $split = explode( '=', $param ); |
| 80 | + if ( count( $split ) > 1 ) { |
| 81 | + $paramName = strtolower( trim( $split[0] ) ); |
| 82 | + $paramValue = trim( $split[1] ); |
| 83 | + if ( strlen( $paramName ) > 0 && strlen( $paramValue ) > 0 ) { |
84 | 84 | $map[$paramName] = $paramValue; |
85 | | - if (MapsParserFunctions::inParamAliases($paramName, 'coordinates', $paramInfo)) { |
86 | | - $coordFails = MapsParserFunctions::filterInvalidCoords($map[$paramName]); |
| 85 | + if ( MapsParserFunctions::inParamAliases( $paramName, 'coordinates', $paramInfo ) ) { |
| 86 | + $coordFails = MapsParserFunctions::filterInvalidCoords( $map[$paramName] ); |
87 | 87 | } |
88 | 88 | } |
89 | 89 | } |
90 | | - else if (count($split) == 1) { // Default parameter (without name) |
91 | | - $split[0] = trim($split[0]); |
92 | | - if (strlen($split[0]) > 0) $map['coordinates'] = $split[0]; |
93 | | - } |
| 90 | + else if ( count( $split ) == 1 ) { // Default parameter (without name) |
| 91 | + $split[0] = trim( $split[0] ); |
| 92 | + if ( strlen( $split[0] ) > 0 ) $map['coordinates'] = $split[0]; |
| 93 | + } |
94 | 94 | } |
95 | 95 | |
96 | | - if (! MapsParserFunctions::paramIsPresent('service', $map, $paramInfo)) $map['service'] = ''; |
| 96 | + if ( ! MapsParserFunctions::paramIsPresent( 'service', $map, $paramInfo ) ) $map['service'] = ''; |
97 | 97 | |
98 | | - $map['service'] = MapsMapper::getValidService($map['service'], 'pf', 'display_uk_point'); |
| 98 | + $map['service'] = MapsMapper::getValidService( $map['service'], 'pf', 'display_uk_point' ); |
99 | 99 | |
100 | | - $mapClass = MapsParserFunctions::getParserClassInstance($map['service'], 'display_uk_point'); |
| 100 | + $mapClass = MapsParserFunctions::getParserClassInstance( $map['service'], 'display_uk_point' ); |
101 | 101 | |
102 | 102 | // Call the function according to the map service to get the HTML output |
103 | | - $output = $mapClass->displayMap($parser, $map); |
| 103 | + $output = $mapClass->displayMap( $parser, $map ); |
104 | 104 | |
105 | | - if ($egValidatorErrorLevel >= Validator_ERRORS_WARN && count($coordFails) > 0) { |
106 | | - $output .= '<i>' . wfMsgExt( 'maps_unrecognized_coords_for', array( 'parsemag' ), $wgLang->listToText( $coordFails ), count( $coordFails ) ) . '</i>'; |
| 105 | + if ( $egValidatorErrorLevel >= Validator_ERRORS_WARN && count( $coordFails ) > 0 ) { |
| 106 | + $output .= '<i>' . wfMsgExt( 'maps_unrecognized_coords_for', array( 'parsemag' ), $wgLang->listToText( $coordFails ), count( $coordFails ) ) . '</i>'; |
107 | 107 | } |
108 | 108 | |
109 | 109 | // Return the result |
110 | | - return $parser->insertStripItem($output, $parser->mStripState); |
| 110 | + return $parser->insertStripItem( $output, $parser->mStripState ); |
111 | 111 | } |
112 | 112 | |
113 | 113 | private static function initializeParams() { |
114 | 114 | global $egMapsDefaultCentre, $egMapsDefaultTitle, $egMapsDefaultLabel, $egMapsAvailableServices, $egMapsDefaultServices; |
115 | 115 | |
116 | | - self::$parameters = array( |
| 116 | + self::$parameters = array( |
117 | 117 | 'service' => array( |
118 | 118 | 'criteria' => array( |
119 | 119 | 'in_array' => $egMapsAvailableServices |
— | — | @@ -120,7 +120,7 @@ |
121 | 121 | 'default' => $egMapsDefaultServices['pf'] |
122 | 122 | ), |
123 | 123 | 'coordinates' => array( |
124 | | - 'aliases' => array('coords', 'location', 'locations'), |
| 124 | + 'aliases' => array( 'coords', 'location', 'locations' ), |
125 | 125 | ), |
126 | 126 | 'title' => array( |
127 | 127 | 'default' => $egMapsDefaultTitle |
— | — | @@ -128,11 +128,11 @@ |
129 | 129 | 'label' => array( |
130 | 130 | 'default' => $egMapsDefaultLabel |
131 | 131 | ), |
132 | | - 'icon' => array( |
| 132 | + 'icon' => array( |
133 | 133 | 'criteria' => array( |
134 | 134 | 'not_empty' => array() |
135 | 135 | ), |
136 | | - ), |
| 136 | + ), |
137 | 137 | ); |
138 | | - } |
| 138 | + } |
139 | 139 | } |
\ No newline at end of file |
Index: trunk/extensions/UKGeocodingForMaps/ParserFunctions/DisplayUkPoint/UKG_BaseUkPointMap.php |
— | — | @@ -9,7 +9,7 @@ |
10 | 10 | * @author Jeroen De Dauw |
11 | 11 | */ |
12 | 12 | |
13 | | -if( !defined( 'MEDIAWIKI' ) ) { |
| 13 | +if ( !defined( 'MEDIAWIKI' ) ) { |
14 | 14 | die( 'Not an entry point.' ); |
15 | 15 | } |
16 | 16 | |
— | — | @@ -36,24 +36,24 @@ |
37 | 37 | * |
38 | 38 | * @return html |
39 | 39 | */ |
40 | | - public final function displayMap(&$parser, array $params) { |
| 40 | + public final function displayMap( &$parser, array $params ) { |
41 | 41 | $this->setMapSettings(); |
42 | 42 | |
43 | 43 | $this->featureParameters = MapsDisplayPoint::$parameters; |
44 | 44 | |
45 | | - if (parent::manageMapProperties($params, __CLASS__)) { |
| 45 | + if ( parent::manageMapProperties( $params, __CLASS__ ) ) { |
46 | 46 | $this->doMapServiceLoad(); |
47 | 47 | |
48 | 48 | $this->setMapName(); |
49 | 49 | |
50 | | - $this->setMarkerData($parser); |
| 50 | + $this->setMarkerData( $parser ); |
51 | 51 | |
52 | 52 | $this->createMarkerString(); |
53 | 53 | |
54 | 54 | $this->setZoom(); |
55 | 55 | |
56 | 56 | $this->addSpecificMapHTML(); |
57 | | - } |
| 57 | + } |
58 | 58 | |
59 | 59 | return $this->output . $this->errorList; |
60 | 60 | } |
— | — | @@ -65,44 +65,44 @@ |
66 | 66 | * |
67 | 67 | */ |
68 | 68 | private function setZoom() { |
69 | | - if (strlen($this->zoom) < 1) { |
70 | | - if (count($this->markerData) > 1) { |
| 69 | + if ( strlen( $this->zoom ) < 1 ) { |
| 70 | + if ( count( $this->markerData ) > 1 ) { |
71 | 71 | $this->zoom = 'null'; |
72 | 72 | } |
73 | 73 | else { |
74 | 74 | $this->zoom = $this->defaultZoom; |
75 | 75 | } |
76 | | - } |
77 | | - } |
| 76 | + } |
| 77 | + } |
78 | 78 | |
79 | 79 | /** |
80 | 80 | * Fills the $markerData array with the locations and their meta data. |
81 | 81 | * |
82 | 82 | * @param unknown_type $parser |
83 | 83 | */ |
84 | | - private function setMarkerData($parser) { |
85 | | - $this->coordinates = explode(';', $this->coordinates); |
| 84 | + private function setMarkerData( $parser ) { |
| 85 | + $this->coordinates = explode( ';', $this->coordinates ); |
86 | 86 | |
87 | 87 | $this->title = Xml::escapeJsString( $parser->recursiveTagParse( $this->title ) ); |
88 | | - $this->label = Xml::escapeJsString( $parser->recursiveTagParse( $this->label ) ); |
| 88 | + $this->label = Xml::escapeJsString( $parser->recursiveTagParse( $this->label ) ); |
89 | 89 | |
90 | | - foreach($this->coordinates as $coordinates) { |
91 | | - $args = explode('~', $coordinates); |
| 90 | + foreach ( $this->coordinates as $coordinates ) { |
| 91 | + $args = explode( '~', $coordinates ); |
92 | 92 | |
93 | | - $args[0] = str_replace('″', '"', $args[0]); |
94 | | - $args[0] = str_replace('′', "'", $args[0]); |
| 93 | + $args[0] = str_replace( '″', '"', $args[0] ); |
| 94 | + $args[0] = str_replace( '′', "'", $args[0] ); |
95 | 95 | |
96 | | - $markerData = array('location' => $args[0]); |
| 96 | + $markerData = array( 'location' => $args[0] ); |
97 | 97 | |
98 | | - if (count($args) > 1) { |
| 98 | + if ( count( $args ) > 1 ) { |
99 | 99 | // Parse and add the point specific title if it's present. |
100 | 100 | $markerData['title'] = $parser->recursiveTagParse( $args[1] ); |
101 | 101 | |
102 | | - if (count($args) > 2) { |
| 102 | + if ( count( $args ) > 2 ) { |
103 | 103 | // Parse and add the point specific label if it's present. |
104 | 104 | $markerData['label'] = $parser->recursiveTagParse( $args[2] ); |
105 | 105 | |
106 | | - if (count($args) > 3) { |
| 106 | + if ( count( $args ) > 3 ) { |
107 | 107 | // Add the point specific icon if it's present. |
108 | 108 | $markerData['icon'] = $args[3]; |
109 | 109 | } |
— | — | @@ -110,12 +110,12 @@ |
111 | 111 | } |
112 | 112 | |
113 | 113 | // If there is no point specific icon, use the general icon parameter when available. |
114 | | - if (! array_key_exists('icon', $markerData) && strlen($this->icon) > 0) $markerData['icon'] = $this->icon; |
| 114 | + if ( ! array_key_exists( 'icon', $markerData ) && strlen( $this->icon ) > 0 ) $markerData['icon'] = $this->icon; |
115 | 115 | |
116 | 116 | // Get the url for the icon when there is one, else set the icon to an empty string. |
117 | | - if (array_key_exists('icon', $markerData)) { |
| 117 | + if ( array_key_exists( 'icon', $markerData ) ) { |
118 | 118 | $icon_image_page = new ImagePage( Title::newFromText( $markerData['icon'] ) ); |
119 | | - $markerData['icon'] = $icon_image_page->getDisplayedFile()->getURL(); |
| 119 | + $markerData['icon'] = $icon_image_page->getDisplayedFile()->getURL(); |
120 | 120 | } |
121 | 121 | else { |
122 | 122 | $markerData['icon'] = ''; |
— | — | @@ -131,9 +131,9 @@ |
132 | 132 | private function createMarkerString() { |
133 | 133 | $markerItems = array(); |
134 | 134 | |
135 | | - foreach ($this->markerData as $markerData) { |
136 | | - $title = array_key_exists('title', $markerData) ? Xml::escapeJsString($markerData['title']) : $this->title; |
137 | | - $label = array_key_exists('label', $markerData) ? Xml::escapeJsString($markerData['label']) : $this->label; |
| 135 | + foreach ( $this->markerData as $markerData ) { |
| 136 | + $title = array_key_exists( 'title', $markerData ) ? Xml::escapeJsString( $markerData['title'] ) : $this->title; |
| 137 | + $label = array_key_exists( 'label', $markerData ) ? Xml::escapeJsString( $markerData['label'] ) : $this->label; |
138 | 138 | |
139 | 139 | $markerData['location'] = Xml::escapeJsString( $markerData['location'] ); |
140 | 140 | $icon = Xml::escapeJsString( $markerData['icon'] ); |
— | — | @@ -142,6 +142,6 @@ |
143 | 143 | $markerItems[] = "{'location': '$location', 'title': '$title', 'label': '$label', 'icon': '$icon'}"; |
144 | 144 | } |
145 | 145 | |
146 | | - $this->markerString = implode(',', $markerItems); |
| 146 | + $this->markerString = implode( ',', $markerItems ); |
147 | 147 | } |
148 | 148 | } |
Index: trunk/extensions/UKGeocodingForMaps/UKGeocodingForMaps.i18n.php |
— | — | @@ -7,7 +7,7 @@ |
8 | 8 | * @ingroup UKGeocodingForMaps |
9 | 9 | * |
10 | 10 | * @author Jeroen De Dauw |
11 | | - */ |
| 11 | + */ |
12 | 12 | |
13 | 13 | $messages = array(); |
14 | 14 | |
Index: trunk/extensions/UKGeocodingForMaps/UKGeocodingForMaps.php |
— | — | @@ -17,19 +17,19 @@ |
18 | 18 | * @defgroup UKGeocodingForMaps UK Geocoding for Maps |
19 | 19 | */ |
20 | 20 | |
21 | | -if( !defined( 'MEDIAWIKI' ) ) { |
| 21 | +if ( !defined( 'MEDIAWIKI' ) ) { |
22 | 22 | die( 'Not an entry point.' ); |
23 | 23 | } |
24 | 24 | |
25 | | -define('UKG_VERSION', '0.2 a1'); |
| 25 | +define( 'UKG_VERSION', '0.2 a1' ); |
26 | 26 | |
27 | | -$ukggScriptPath = (isset($wgExtensionAssetsPath) && $wgExtensionAssetsPath ? $wgExtensionAssetsPath : $wgScriptPath . '/extensions') . '/UKGeocodingForMaps'; |
| 27 | +$ukggScriptPath = ( isset( $wgExtensionAssetsPath ) && $wgExtensionAssetsPath ? $wgExtensionAssetsPath : $wgScriptPath . '/extensions' ) . '/UKGeocodingForMaps'; |
28 | 28 | $ukggDir = dirname( __FILE__ ) . '/'; |
29 | 29 | |
30 | 30 | $ukggStyleVersion = $wgStyleVersion . '-' . UKG_VERSION; |
31 | 31 | |
32 | 32 | // Include the settings file |
33 | | -require_once($ukggDir . 'UKGeocodingForMaps_Settings.php'); |
| 33 | +require_once( $ukggDir . 'UKGeocodingForMaps_Settings.php' ); |
34 | 34 | |
35 | 35 | $wgExtensionMessagesFiles['UKGeocodingForMaps'] = $ukggDir . 'UKGeocodingForMaps.i18n.php'; |
36 | 36 | |
— | — | @@ -47,7 +47,7 @@ |
48 | 48 | |
49 | 49 | wfLoadExtensionMessages( 'UKGeocodingForMaps' ); |
50 | 50 | |
51 | | - $wgExtensionCredits['parserhook'][]= array( |
| 51 | + $wgExtensionCredits['parserhook'][] = array( |
52 | 52 | 'path' => __FILE__, |
53 | 53 | 'name' => wfMsg( 'ukgeocoding_name' ), |
54 | 54 | 'version' => UKG_VERSION, |
— | — | @@ -56,5 +56,5 @@ |
57 | 57 | 'descriptionmsg' => 'ukgeocoding_desc', |
58 | 58 | ); |
59 | 59 | |
60 | | - return true; |
| 60 | + return true; |
61 | 61 | } |
\ No newline at end of file |
Index: trunk/extensions/UKGeocodingForMaps/UKGeocodingForMaps_Settings.php |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | * @author Jeroen De Dauw |
15 | 15 | */ |
16 | 16 | |
17 | | -if( !defined( 'MEDIAWIKI' ) ) { |
| 17 | +if ( !defined( 'MEDIAWIKI' ) ) { |
18 | 18 | die( 'Not an entry point.' ); |
19 | 19 | } |
20 | 20 | |
Index: trunk/extensions/UKGeocodingForMaps/GoogleMaps/UKG_GoogleMapsDispUkPoint.php |
— | — | @@ -9,7 +9,7 @@ |
10 | 10 | * @author Jeroen De Dauw |
11 | 11 | */ |
12 | 12 | |
13 | | -if( !defined( 'MEDIAWIKI' ) ) { |
| 13 | +if ( !defined( 'MEDIAWIKI' ) ) { |
14 | 14 | die( 'Not an entry point.' ); |
15 | 15 | } |
16 | 16 | |
— | — | @@ -27,7 +27,7 @@ |
28 | 28 | /** |
29 | 29 | * @see MapsBaseMap::setMapSettings() |
30 | 30 | * |
31 | | - */ |
| 31 | + */ |
32 | 32 | protected function setMapSettings() { |
33 | 33 | global $egMapsGoogleMapsZoom, $egMapsGoogleMapsPrefix, $egMapsGMapOverlays; |
34 | 34 | |
— | — | @@ -36,19 +36,19 @@ |
37 | 37 | |
38 | 38 | $this->spesificParameters = array( |
39 | 39 | 'overlays' => array( |
40 | | - 'type' => array('string', 'list'), |
| 40 | + 'type' => array( 'string', 'list' ), |
41 | 41 | 'criteria' => array( |
42 | 42 | 'is_google_overlay' => array() |
43 | | - ), |
44 | | - 'default' => $egMapsGMapOverlays, |
| 43 | + ), |
| 44 | + 'default' => $egMapsGMapOverlays, |
45 | 45 | ), |
46 | | - ); |
| 46 | + ); |
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
50 | 50 | * @see MapsBaseMap::doMapServiceLoad() |
51 | 51 | * |
52 | | - */ |
| 52 | + */ |
53 | 53 | protected function doMapServiceLoad() { |
54 | 54 | global $egGoogleMapsOnThisPage, $loadedAjaxApi, $egGoogleAjaxSearchKey; |
55 | 55 | |
— | — | @@ -66,11 +66,11 @@ |
67 | 67 | /** |
68 | 68 | * @see MapsBaseMap::addSpecificMapHTML() |
69 | 69 | * |
70 | | - */ |
| 70 | + */ |
71 | 71 | public function addSpecificMapHTML() { |
72 | 72 | global $wgJsMimeType, $egValidatorErrorLevel; |
73 | 73 | |
74 | | - $onloadFunctions = MapsGoogleMaps::addOverlayOutput( $this->output, $this->mapName, $this->overlays, $this->controls ); |
| 74 | + $onloadFunctions = MapsGoogleMaps::addOverlayOutput( $this->output, $this->mapName, $this->overlays, $this->controls ); |
75 | 75 | |
76 | 76 | if ( $egValidatorErrorLevel >= Validator_ERRORS_WARN ) { |
77 | 77 | $couldNotGeocodeMsg = Xml::escapeJsString( wfMsg( 'ukgeocoding_couldNotGeocode' ) ); |
— | — | @@ -79,7 +79,7 @@ |
80 | 80 | $showErrorJs = ''; |
81 | 81 | } |
82 | 82 | |
83 | | - $this->output .=<<<EOT |
| 83 | + $this->output .= <<<EOT |
84 | 84 | <div id="$this->mapName"></div> |
85 | 85 | <div id="{$this->mapName}_errors"></div> |
86 | 86 | <script type="$wgJsMimeType"> /*<![CDATA[*/ |
Index: trunk/extensions/UKGeocodingForMaps/GoogleMaps/UKG_GoogleMaps.php |
— | — | @@ -6,8 +6,8 @@ |
7 | 7 | * @ingroup UKGeocodingForMaps |
8 | 8 | */ |
9 | 9 | |
10 | | -if( !defined( 'MEDIAWIKI' ) ) { |
| 10 | +if ( !defined( 'MEDIAWIKI' ) ) { |
11 | 11 | die( 'Not an entry point.' ); |
12 | 12 | } |
13 | 13 | |
14 | | -$egMapsServices['googlemaps2']['pf']['display_uk_point'] = array('class' => 'UKGGoogleMapsDispUkPoint', 'file' => 'UKGeocodingForMaps/GoogleMaps/UKG_GoogleMapsDispUkPoint.php'); |
\ No newline at end of file |
| 14 | +$egMapsServices['googlemaps2']['pf']['display_uk_point'] = array( 'class' => 'UKGGoogleMapsDispUkPoint', 'file' => 'UKGeocodingForMaps/GoogleMaps/UKG_GoogleMapsDispUkPoint.php' ); |
\ No newline at end of file |