Skip to content
This repository has been archived by the owner on Aug 14, 2023. It is now read-only.

Merge pull request #228 from EkoJr/issue-201 #201 #228

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 21 additions & 13 deletions classes/simplemap.php
Original file line number Diff line number Diff line change
Expand Up @@ -688,20 +688,28 @@ function general_options_js_script() {
do_action( 'sm-general-options-js' );
?>
function codeAddress() {
// if this is modified, modify mirror function in master-js php function
var d_address = document.getElementById("default_address").value;

geocoder = new google.maps.Geocoder();
geocoder.geocode( { 'address': d_address }, function( results, status ) {
if ( status == google.maps.GeocoderStatus.OK ) {
var latlng = results[0].geometry.location;
document.getElementById("default_lat").value = latlng.lat();
document.getElementById("default_lng").value = latlng.lng();
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
var gm_api_key = document.getElementById("api_key").value;
// if this is modified, modify mirror function in master-js php function
var d_address = document.getElementById("default_address").value;

if ( gm_api_key ) {
geocoder = new google.maps.Geocoder();
var a = geocoder.geocode( { 'address': d_address }, function( results, status ) {
if ( status == google.maps.GeocoderStatus.OK ) {
var latlng = results[0].geometry.location;
document.getElementById("default_lat").value = latlng.lat();
document.getElementById("default_lng").value = latlng.lng();
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
} else {
gm_authFailure();
}
}
function gm_authFailure() {
alert("Google Maps API Key is Required within Map Configuration.");
};
<?php
die();
}
Expand Down