Index: trunk/extensions/SemanticGoogleMaps/SGM_Utils.inc |
— | — | @@ -21,6 +21,9 @@ |
22 | 22 | if (!$wgGoogleMapsOnThisPage) {$wgGoogleMapsOnThisPage = 0;} |
23 | 23 | $wgGoogleMapsOnThisPage++; |
24 | 24 | |
| 25 | + $coordinates = str_replace('″', '"', $coordinates); |
| 26 | + $coordinates = str_replace('′', "'", $coordinates); |
| 27 | + |
25 | 28 | list($lat, $lon) = SGMUtils::getLatLon($coordinates); |
26 | 29 | |
27 | 30 | $output =<<<END |
— | — | @@ -44,20 +47,20 @@ |
45 | 48 | return array(null, null); |
46 | 49 | } |
47 | 50 | |
48 | | - function degree2Decimal($deg_coord="") { |
49 | | - $dpos=strpos($deg_coord,'°'); |
50 | | - $mpos=strpos($deg_coord,'.'); |
51 | | - $spos=strpos($deg_coord,'"'); |
52 | | - $mlen=(($mpos-$dpos)-1); |
53 | | - $slen=(($spos-$mpos)-1); |
54 | | - $direction=substr(strrev($deg_coord),0,1); |
55 | | - $degrees=substr($deg_coord,0,$dpos); |
56 | | - $minutes=substr($deg_coord,$dpos+1,$mlen); |
57 | | - $seconds=substr($deg_coord,$mpos+1,$slen); |
58 | | - $seconds=($seconds/60); |
59 | | - $minutes=($minutes+$seconds); |
60 | | - $minutes=($minutes/60); |
61 | | - $decimal=($degrees+$minutes); |
| 51 | + function degree2Decimal($deg_coord = "") { |
| 52 | + $dpos = mb_strpos($deg_coord, '°'); |
| 53 | + $mpos = mb_strpos($deg_coord, '.'); |
| 54 | + $spos = mb_strpos($deg_coord, '"'); |
| 55 | + $mlen = ($mpos - $dpos) - 1; |
| 56 | + $slen = ($spos - $mpos) - 1; |
| 57 | + $direction = substr(strrev($deg_coord), 0, 1); |
| 58 | + $degrees = mb_substr($deg_coord, 0,$dpos); |
| 59 | + $minutes = mb_substr($deg_coord, $dpos + 1, $mlen); |
| 60 | + $seconds = mb_substr($deg_coord, $mpos + 1, $slen); |
| 61 | + $seconds = $seconds / 60; |
| 62 | + $minutes = $minutes + $seconds; |
| 63 | + $minutes = $minutes / 60; |
| 64 | + $decimal = $degrees + $minutes; |
62 | 65 | //South latitudes and West longitudes need to return a negative result |
63 | 66 | if (($direction=="S") or ($direction=="W")) { |
64 | 67 | $decimal *= -1; |