Index: trunk/extensions/Maps/includes/Maps_CoordinateParser.php |
— | — | @@ -528,17 +528,28 @@ |
529 | 529 | if ( $isNegative ) $coordinate = substr( $coordinate, 1 ); |
530 | 530 | |
531 | 531 | $degreePosition = strpos( $coordinate, self::SYMBOL_DEG ); |
| 532 | + $degrees = substr ( $coordinate, 0, $degreePosition ); |
| 533 | + |
532 | 534 | $minutePosition = strpos( $coordinate, self::SYMBOL_MIN ); |
533 | | - $secondPosition = strpos( $coordinate, self::SYMBOL_SEC ); |
534 | 535 | |
535 | | - $degSignLength = strlen( self::SYMBOL_DEG ); |
| 536 | + if ( $minutePosition === false ) { |
| 537 | + $minutes = 0; |
| 538 | + } |
| 539 | + else { |
| 540 | + $degSignLength = strlen( self::SYMBOL_DEG ); |
| 541 | + $minuteLength = $minutePosition - $degreePosition - $degSignLength; |
| 542 | + $minutes = substr ( $coordinate, $degreePosition + $degSignLength, $minuteLength ); |
| 543 | + } |
536 | 544 | |
537 | | - $minuteLength = $minutePosition - $degreePosition - $degSignLength; |
538 | | - $secondLength = $secondPosition - $minutePosition - 1; |
| 545 | + $secondPosition = strpos( $coordinate, self::SYMBOL_SEC ); |
539 | 546 | |
540 | | - $degrees = substr ( $coordinate, 0, $degreePosition ); |
541 | | - $minutes = substr ( $coordinate, $degreePosition + $degSignLength, $minuteLength ); |
542 | | - $seconds = substr ( $coordinate, $minutePosition + 1, $secondLength ); |
| 547 | + if ( $minutePosition === false ) { |
| 548 | + $seconds = 0; |
| 549 | + } |
| 550 | + else { |
| 551 | + $secondLength = $secondPosition - $minutePosition - 1; |
| 552 | + $seconds = substr ( $coordinate, $minutePosition + 1, $secondLength ); |
| 553 | + } |
543 | 554 | |
544 | 555 | $coordinate = $degrees + ( $minutes + $seconds / 60 ) / 60; |
545 | 556 | if ( $isNegative ) $coordinate *= -1; |