Pastakhov has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/332211 )
Change subject: add $egMultiMapsGoogleApiKey parameter and use latest google
map API
......................................................................
add $egMultiMapsGoogleApiKey parameter and use latest google map API
Change-Id: Ie572aff27982e3b3b50e888eabc6c69767eea297
---
M MultiMaps.php
M includes/mapelements/Marker.php
M services/Google/Google.php
M services/Leaflet/Leaflet.php
4 files changed, 27 insertions(+), 20 deletions(-)
Approvals:
Pastakhov: Verified; Looks good to me, approved
diff --git a/MultiMaps.php b/MultiMaps.php
index e283ea6..86709e2 100644
--- a/MultiMaps.php
+++ b/MultiMaps.php
@@ -104,12 +104,15 @@
* @codeCoverageIgnore
*/
$wgHooks['UnitTestsList'][] = function ( &$files ) {
- $testDir = __DIR__ . '/tests/phpunit';
- $files = array_merge( $files, glob(
"$testDir/includes/*Test.php" ) );
- $files = array_merge( $files, glob(
"$testDir/includes/mapelements/*Test.php" ) );
- $files = array_merge( $files, glob(
"$testDir/services/*Test.php" ) );
- $files = array_merge( $files, glob(
"$testDir/services/Google/*Test.php" ) );
- $files = array_merge( $files, glob(
"$testDir/services/Leaflet/*Test.php" ) );
- $files = array_merge( $files, glob(
"$testDir/services/Yandex/*Test.php" ) );
+ $files[] = __DIR__ . '/tests/phpunit/includes/BoundsTest.php';
+ $files[] = __DIR__ .
'/tests/phpunit/includes/GeoCoordinateTest.php';
+ $files[] = __DIR__ .
'/tests/phpunit/includes/GeocodersTest.php';
+ $files[] = __DIR__ .
'/tests/phpunit/includes/MapServicesTest.php';
+ $files[] = __DIR__ . '/tests/phpunit/includes/PointTest.php';
+ $files[] = __DIR__ .
'/tests/phpunit/includes/mapelements/PolygonTest.php';
+ $files[] = __DIR__ .
'/tests/phpunit/includes/mapelements/RectangleTest.php';
+ $files[] = __DIR__ .
'/tests/phpunit/services/Google/GoogleTest.php';
+ $files[] = __DIR__ .
'/tests/phpunit/services/Leaflet/LeafletTest.php';
+ $files[] = __DIR__ .
'/tests/phpunit/services/Yandex/YandexTest.php';
return true;
};
diff --git a/includes/mapelements/Marker.php b/includes/mapelements/Marker.php
index 3161441..5471342 100644
--- a/includes/mapelements/Marker.php
+++ b/includes/mapelements/Marker.php
@@ -35,7 +35,8 @@
}
public function setProperty($name, $value) {
- global $egMultiMaps_CoordinatesSeparator,
$egMultiMaps_OptionsSeparator;
+ global $egMultiMaps_CoordinatesSeparator,
$egMultiMaps_OptionsSeparator,
+ $egMultiMaps_IconPath,
$egMultiMaps_IconAllowFromDirectory;
if ( strtolower($name) != 'icon' ) {
return parent::setProperty( $name, $value );
@@ -50,12 +51,12 @@
// Icon URL
if ( !empty($properties[0]) ) {
$v = $properties[0];
- if ( $v[0] == '/' &&
$GLOBALS['egMultiMaps_IconAllowFromDirectory'] === true ) {
+ if ( $v[0] == '/' &&
$egMultiMaps_IconAllowFromDirectory ) {
if (
preg_match('#[^0-9a-zA-Zа-яА-Я/_=\.\+\-]#', $v) || mb_strpos($v, '/../') !==
false ) {
$this->errormessages[] = \wfMessage(
'multimaps-marker-incorrect-icon-url', $v )->escaped();
return false;
}
- $v = $GLOBALS['wgServer'] .
$GLOBALS['egMultiMaps_IconPath'] . $v;
+ $v = $GLOBALS['wgServer'] .
$egMultiMaps_IconPath . $v;
} else {
$title = \Title::newFromText( $v, NS_FILE );
if ( !is_null( $title ) && $title->exists() ) {
@@ -73,7 +74,7 @@
if ( !empty($properties[1]) ) {
$v = array_map(
'intval',
- explode($egMultiMaps_OptionsSeparator,
$properties[1])
+ explode( $egMultiMaps_OptionsSeparator,
$properties[1] )
);
if ( count($v) != 2) {
$this->errormessages[] = \wfMessage(
'multimaps-marker-incorrect-icon-size', $v, $value )->escaped();
@@ -86,7 +87,7 @@
if ( !empty($properties[2]) ) {
$v = array_map(
'intval',
- explode($egMultiMaps_OptionsSeparator,
$properties[2])
+ explode( $egMultiMaps_OptionsSeparator,
$properties[2] )
);
if ( count($v) != 2) {
$this->errormessages[] = \wfMessage(
'multimaps-marker-incorrect-icon-anchor', $v, $value )->escaped();
@@ -98,12 +99,12 @@
// Shadow URL
if ( !empty($properties[3]) ) {
$v = $properties[3];
- if ( $v[0] == '/' &&
$GLOBALS['egMultiMaps_IconAllowFromDirectory'] === true ) {
+ if ( $v[0] == '/' &&
$egMultiMaps_IconAllowFromDirectory ) {
if ( preg_match('#[^0-9a-zA-Zа-яА-Я./_=\+\-]#',
$v) || preg_match('#/../#', $v) ) {
$this->errormessages[] = \wfMessage(
'multimaps-marker-incorrect-shadow-url', $v )->escaped();
return false;
}
- $v = $GLOBALS['wgServer'] .
$GLOBALS['egMultiMaps_IconPath'] . $v;
+ $v = $GLOBALS['wgServer'] .
$egMultiMaps_IconPath . $v;
} else {
$title = \Title::newFromText( $v, NS_FILE );
if ( !is_null( $title ) && $title->exists() ) {
@@ -121,7 +122,7 @@
if ( !empty($properties[4]) ) {
$v = array_map(
'intval',
- explode($egMultiMaps_OptionsSeparator,
$properties[4])
+ explode( $egMultiMaps_OptionsSeparator,
$properties[4] )
);
if ( count($v) != 2) {
$this->errormessages[] = \wfMessage(
'multimaps-marker-incorrect-shadow-size', $v, $value )->escaped();
@@ -134,7 +135,7 @@
if ( !empty($properties[5]) ) {
$v = array_map(
'intval',
- explode($egMultiMaps_OptionsSeparator,
$properties[5])
+ explode( $egMultiMaps_OptionsSeparator,
$properties[5] )
);
if ( count($v) != 2) {
$this->errormessages[] = \wfMessage(
'multimaps-marker-incorrect-shadow-anchor', $v, $value )->escaped();
diff --git a/services/Google/Google.php b/services/Google/Google.php
index c0406d3..4b6581b 100644
--- a/services/Google/Google.php
+++ b/services/Google/Google.php
@@ -24,9 +24,11 @@
$this->resourceModules[] = 'ext.MultiMaps.Google';
$urlArgs = array();
- $urlArgs['sensor'] = 'false';
- $urlArgs['v'] = '3.10';
+ global $egMultiMapsGoogleApiKey;
+ if ( $egMultiMapsGoogleApiKey ) {
+ $urlArgs['key'] = $egMultiMapsGoogleApiKey;
+ }
$this->headerItem .= \Html::linkedScript(
'//maps.googleapis.com/maps/api/js?'.wfArrayToCgi($urlArgs) ) . "\n";
}
-}
\ No newline at end of file
+}
diff --git a/services/Leaflet/Leaflet.php b/services/Leaflet/Leaflet.php
index 650b98c..7717340 100644
--- a/services/Leaflet/Leaflet.php
+++ b/services/Leaflet/Leaflet.php
@@ -23,7 +23,8 @@
$this->classname="leaflet";
$this->resourceModules[] = 'ext.MultiMaps.Leaflet';
- $leafletPath = $GLOBALS['egMultiMapsScriptPath'] .
'/services/Leaflet/leaflet';
+ global $egMultiMapsScriptPath;
+ $leafletPath = $egMultiMapsScriptPath .
'/services/Leaflet/leaflet';
$this->headerItem .= \Html::linkedStyle(
"$leafletPath/leaflet.css" ) .
'<!--[if lte IE 8]>' . \Html::linkedStyle(
"$leafletPath/leaflet.ie.css" ). '<![endif]-->' .
\Html::linkedScript( "$leafletPath/leaflet.js" );
--
To view, visit https://gerrit.wikimedia.org/r/332211
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie572aff27982e3b3b50e888eabc6c69767eea297
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MultiMaps
Gerrit-Branch: REL1_25
Gerrit-Owner: Pastakhov <[email protected]>
Gerrit-Reviewer: Pastakhov <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits