Skip to content

Commit

Permalink
1) Make googlemaps use the language specified for the wiki rather tha…
Browse files Browse the repository at this point in the history
…n by

the user in her or his preferences

Refs issue #106

Thanks go to James Hong Kong

2) Also removed tabs and trailing white spaces
  • Loading branch information
kghbln committed Feb 9, 2016
1 parent bf22847 commit 7e34c16
Showing 1 changed file with 49 additions and 48 deletions.
97 changes: 49 additions & 48 deletions includes/services/GoogleMaps3/Maps_GoogleMaps3.php
Expand Up @@ -3,19 +3,20 @@
/**
* Class holding information and functionality specific to Google Maps v3.
* This information and features can be used by any mapping feature.
*
*
* @since 0.7
*
*
* @licence GNU GPL v2+
* @author Jeroen De Dauw < jeroendedauw@gmail.com >
*/

class MapsGoogleMaps3 extends MapsMappingService {

/**
* List of map types (keys) and their internal values (values).
*
* List of map types (keys) and their internal values (values).
*
* @since 0.7
*
*
* @var array
*/
public static $mapTypes = array(
Expand All @@ -27,30 +28,30 @@ class MapsGoogleMaps3 extends MapsMappingService {
'physical' => 'TERRAIN',
'earth' => 'earth'
);

/**
* List of supported map layers.
*
* List of supported map layers.
*
* @since 1.0
*
*
* @var array
*/
protected static $mapLayers = array(
'traffic',
'bicycling'
);
);

public static $typeControlStyles = array(
'default' => 'DEFAULT',
'horizontal' => 'HORIZONTAL_BAR',
'dropdown' => 'DROPDOWN_MENU'
);

/**
* List of supported control names.
*
*
* @since 1.0
*
*
* @var array
*/
protected static $controlNames = array(
Expand All @@ -59,25 +60,25 @@ class MapsGoogleMaps3 extends MapsMappingService {
'type',
'scale',
'streetview'
);
);

/**
* Constructor.
*
*
* @since 0.6.6
*/
*/
public function __construct( $serviceName ) {
parent::__construct(
$serviceName,
array( 'googlemaps', 'google' )
);
}

/**
* @see MapsMappingService::addParameterInfo
*
*
* @since 0.7
*/
*/
public function addParameterInfo( array &$params ) {
global $egMapsGMaps3Type, $egMapsGMaps3Types, $egMapsGMaps3Controls, $egMapsGMaps3Layers;
global $egMapsGMaps3DefTypeStyle, $egMapsGMaps3DefZoomStyle, $egMapsGMaps3AutoInfoWindows;
Expand Down Expand Up @@ -222,60 +223,60 @@ public function addParameterInfo( array &$params ) {
'message' => 'maps-googlemaps3-par-enable-fullscreen',
);
}

/**
* @see iMappingService::getDefaultZoom
*
*
* @since 0.6.5
*/
*/
public function getDefaultZoom() {
global $egMapsGMaps3Zoom;
return $egMapsGMaps3Zoom;
}
}

/**
* @see MapsMappingService::getMapId
*
*
* @since 0.6.5
*/
public function getMapId( $increment = true ) {
static $mapsOnThisPage = 0;

if ( $increment ) {
$mapsOnThisPage++;
}

return 'map_google3_' . $mapsOnThisPage;
}
}

/**
* Returns the names of all supported map types.
*
*
* @return array
*/
public static function getTypeNames() {
return array_keys( self::$mapTypes );
}

/**
* Returns the names of all supported map layers.
*
*
* @since 1.0
*
*
* @return array
*/
public static function getLayerNames() {
return self::$mapLayers;
}
}

/**
* @see MapsMappingService::getDependencies
*
*
* @return array
*/
protected function getDependencies() {
return array(
self::getApiScript( $GLOBALS['wgLang']->getCode() ),
self::getApiScript( $GLOBALS['wgContLang']->getCode() ),
);
}

Expand All @@ -290,12 +291,12 @@ public static function getApiScript( $langCode, array $urlArgs = array() ) {

return Html::linkedScript( '//maps.googleapis.com/maps/api/js?' . wfArrayToCgi( $urlArgs ) );
}

/**
* Maps language codes to Google Maps API v3 compatible values.
*
*
* @param string $code
*
*
* @return string The mapped code
*/
protected static function getMappedLanguageCode( $code ) {
Expand All @@ -304,19 +305,19 @@ protected static function getMappedLanguageCode( $code ) {
'he' => 'iw', // iw is googlish for hebrew
'fj' => 'fil', // google does not support Fijian - use Filipino as close(?) supported relative
);

if ( array_key_exists( $code, $mappings ) ) {
$code = $mappings[$code];
}

return $code;
}

/**
* @see MapsMappingService::getResourceModules
*
*
* @since 1.0
*
*
* @return array of string
*/
public function getResourceModules() {
Expand Down

0 comments on commit 7e34c16

Please sign in to comment.