Pastakhov has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/52218


Change subject: fix some bugs (version 0.4.1)
......................................................................

fix some bugs (version 0.4.1)

* error parse coordinates 0,0

Change-Id: Ic8366b94b604a71e87da746733ddf2d324cbe8fd
---
M MultiMaps.php
M Settings.php
M includes/GeoCoordinate.php
M tests/phpunit/services/Leaflet/LeafletTest.php
4 files changed, 15 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MultiMaps 
refs/changes/18/52218/1

diff --git a/MultiMaps.php b/MultiMaps.php
index eeff601..5248e92 100644
--- a/MultiMaps.php
+++ b/MultiMaps.php
@@ -15,7 +15,7 @@
        die( 'This file is an extension to MediaWiki and thus not a valid entry 
point.' );
 }
 
-define( 'MultiMaps_VERSION' , '0.4' );
+define( 'MultiMaps_VERSION' , '0.4.1' );
 
 // Register this extension on Special:Version
 $wgExtensionCredits['parserhook'][] = array(
diff --git a/Settings.php b/Settings.php
index b7dfbc8..c7273a8 100644
--- a/Settings.php
+++ b/Settings.php
@@ -41,4 +41,8 @@
 // Integer or string. The default width and height of a map. These values will
 // only be used when the user does not provide them.
 $egMultiMaps_Width = 'auto';
-$egMultiMaps_Height = '350px';
\ No newline at end of file
+$egMultiMaps_Height = '350px';
+
+//TODO
+//$egMultiMaps_GoogleApiKey = false;
+//$egMultiMaps_YandexApiKey = false;
diff --git a/includes/GeoCoordinate.php b/includes/GeoCoordinate.php
index 1750833..f2e0736 100644
--- a/includes/GeoCoordinate.php
+++ b/includes/GeoCoordinate.php
@@ -81,7 +81,7 @@
                                $lat = self::getFloatFromString($array[0]);
                        }
 
-                       if( !$lat && !$lon ) {
+                       if( $lat === false && $lon === false ) {
                                return false;
                        }
 
@@ -116,14 +116,14 @@
                                                break;
                                 }
                        } else {
-                               if( $lat ) {
+                               if( $lat !== false ) {
                                        $lon = 
self::getFloatFromString($array[1]);
                                } else {
                                        $lat = 
self::getFloatFromString($array[1]);
                                }
                        }
 
-                       if( $lat && $lon ) {
+                       if( $lat !== false && $lon !== false ) {
                                return array ('lat'=>$lat, 'lon'=>$lon);
                        }
                }
diff --git a/tests/phpunit/services/Leaflet/LeafletTest.php 
b/tests/phpunit/services/Leaflet/LeafletTest.php
index bcf3919..11ebc0b 100644
--- a/tests/phpunit/services/Leaflet/LeafletTest.php
+++ b/tests/phpunit/services/Leaflet/LeafletTest.php
@@ -28,6 +28,12 @@
 
        }
 
+       public function testParseMarkerInZerro() {
+               $this->assertEquals(
+                               \FormatJson::encode( $this->object->getMapData( 
array('0,0', 'service=leaflet') ) ),
+                               
'{"markers":[{"pos":[{"lat":0,"lon":0}]}],"zoom":14,"center":{"lat":0,"lon":0}}'
+                               );
+       }
 
        public function testParseOneMarker() {
                $this->assertEquals(

-- 
To view, visit https://gerrit.wikimedia.org/r/52218
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic8366b94b604a71e87da746733ddf2d324cbe8fd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MultiMaps
Gerrit-Branch: master
Gerrit-Owner: Pastakhov <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to