Version Description
Upgrade Google Map Plugin from here to get updated features.
Download this release
Release Info
Developer | milonfci |
Plugin | WP Google Map |
Version | 1.4.9 |
Comparing to | |
See all releases |
Code changes from version 1.4.7 to 1.4.9
- assets/js/geo_based_map.js +0 -45
- assets/js/geo_based_map_create.js +240 -0
- assets/js/geo_based_map_edit.js +189 -0
- assets/js/srm_gmap_loader.js +0 -106
- includes/form_actions.php +70 -54
- includes/gmap.php +25 -23
- includes/wpgmap_create.php +4 -4
- includes/wpgmap_edit.php +8 -3
- readme.txt +12 -3
- srm_gmap_embed.php +1 -1
assets/js/geo_based_map.js
DELETED
@@ -1,45 +0,0 @@
|
|
1 |
-
function initWpGmap(lat, lng) {
|
2 |
-
initAutocomplete('map', 'pac-input', lat, lng, 'roadmap', 13);
|
3 |
-
}
|
4 |
-
var tryAPIGeolocation = function () {
|
5 |
-
jQuery.post("https://www.googleapis.com/geolocation/v1/geolocate?key=AIzaSyBcVcz5OZ6eNBi5d7CFYHIdtsEI5BQlm68", function (success) {
|
6 |
-
initWpGmap(success.location.lat, success.location.lng);
|
7 |
-
})
|
8 |
-
.fail(function (err) {
|
9 |
-
console.log("API Geolocation error! \n\n" + err);
|
10 |
-
});
|
11 |
-
};
|
12 |
-
var browserGeolocationSuccess = function (position) {
|
13 |
-
initWpGmap(position.coords.latitude, position.coords.longitude);
|
14 |
-
};
|
15 |
-
|
16 |
-
var browserGeolocationFail = function (error) {
|
17 |
-
switch (error.code) {
|
18 |
-
case error.TIMEOUT:
|
19 |
-
console.log("Browser geolocation error !\n\nTimeout.");
|
20 |
-
initWpGmap(40.73359922990751, -74.02791395625002);
|
21 |
-
break;
|
22 |
-
case error.PERMISSION_DENIED:
|
23 |
-
tryAPIGeolocation();
|
24 |
-
break;
|
25 |
-
case error.POSITION_UNAVAILABLE:
|
26 |
-
console.log("Browser geolocation error !\n\nPosition unavailable.");
|
27 |
-
initWpGmap(40.73359922990751, -74.02791395625002);
|
28 |
-
break;
|
29 |
-
|
30 |
-
}
|
31 |
-
};
|
32 |
-
|
33 |
-
var tryGeolocation = function () {
|
34 |
-
initWpGmap(40.73359922990751, -74.02791395625002);
|
35 |
-
if (navigator.geolocation) {
|
36 |
-
navigator.geolocation.getCurrentPosition(
|
37 |
-
browserGeolocationSuccess,
|
38 |
-
browserGeolocationFail,
|
39 |
-
{maximumAge: 50000, timeout: 20000, enableHighAccuracy: true});
|
40 |
-
} else {
|
41 |
-
initWpGmap(40.73359922990751, -74.02791395625002);
|
42 |
-
}
|
43 |
-
};
|
44 |
-
|
45 |
-
tryGeolocation();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/geo_based_map_create.js
ADDED
@@ -0,0 +1,240 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var map;
|
2 |
+
var marker1;
|
3 |
+
var infowindow;
|
4 |
+
|
5 |
+
// Getting detailed address by lat,lng
|
6 |
+
function wpgmapSetAddressByLatLng(lat, lng, id) {
|
7 |
+
jQuery.getJSON('https://maps.googleapis.com/maps/api/geocode/json?key=' + wp_gmap_api_key + '&latlng=' + lat + ',' + lng + '&sensor=true')
|
8 |
+
.done(function (location) {
|
9 |
+
document.getElementById('wpgmap_map_address').value = location.results[0].formatted_address;
|
10 |
+
|
11 |
+
});
|
12 |
+
|
13 |
+
}
|
14 |
+
|
15 |
+
// to render Google Map
|
16 |
+
function initAutocomplete(id, input, center_lat, center_lng, map_type, zoom) {
|
17 |
+
|
18 |
+
wpgmapSetAddressByLatLng(center_lat, center_lng);
|
19 |
+
document.getElementById("wpgmap_latlng").value = center_lat + "," + center_lng;
|
20 |
+
// In acse of already initiated
|
21 |
+
if (typeof map == 'object') {
|
22 |
+
|
23 |
+
if (map_type === 'ROADMAP') {
|
24 |
+
map.setMapTypeId(google.maps.MapTypeId.ROADMAP);
|
25 |
+
}
|
26 |
+
else if (map_type === 'SATELLITE') {
|
27 |
+
map.setMapTypeId(google.maps.MapTypeId.SATELLITE);
|
28 |
+
}
|
29 |
+
else if (map_type === 'HYBRID') {
|
30 |
+
map.setMapTypeId(google.maps.MapTypeId.HYBRID);
|
31 |
+
}
|
32 |
+
else if (map_type === 'TERRAIN') {
|
33 |
+
map.setMapTypeId(google.maps.MapTypeId.TERRAIN);
|
34 |
+
}
|
35 |
+
|
36 |
+
map.setCenter({lat: center_lat, lng: center_lng});
|
37 |
+
marker1 = new google.maps.Marker({
|
38 |
+
position: new google.maps.LatLng(center_lat, center_lng),
|
39 |
+
title: "",
|
40 |
+
draggable: true,
|
41 |
+
animation: google.maps.Animation.DROP
|
42 |
+
});
|
43 |
+
marker1.setMap(map);
|
44 |
+
marker1.addListener('dragend', function (markerLocation) {
|
45 |
+
document.getElementById("wpgmap_latlng").value = markerLocation.latLng.lat() + "," + markerLocation.latLng.lng();
|
46 |
+
wpgmapSetAddressByLatLng(markerLocation.latLng.lat(), markerLocation.latLng.lng());
|
47 |
+
});
|
48 |
+
return false;
|
49 |
+
}
|
50 |
+
|
51 |
+
var gmap_settings = {
|
52 |
+
center: {lat: center_lat, lng: center_lng},
|
53 |
+
zoom: zoom,
|
54 |
+
mapTypeId: google.maps.MapTypeId.ROADMAP
|
55 |
+
};
|
56 |
+
if (map_type === 'ROADMAP') {
|
57 |
+
gmap_settings.mapTypeId = google.maps.MapTypeId.ROADMAP;
|
58 |
+
}
|
59 |
+
else if (map_type === 'SATELLITE') {
|
60 |
+
gmap_settings.mapTypeId = google.maps.MapTypeId.SATELLITE;
|
61 |
+
}
|
62 |
+
else if (map_type === 'HYBRID') {
|
63 |
+
gmap_settings.mapTypeId = google.maps.MapTypeId.HYBRID;
|
64 |
+
}
|
65 |
+
else if (map_type === 'TERRAIN') {
|
66 |
+
gmap_settings.mapTypeId = google.maps.MapTypeId.TERRAIN;
|
67 |
+
}
|
68 |
+
|
69 |
+
map = new google.maps.Map(document.getElementById(id), gmap_settings);
|
70 |
+
marker1 = new google.maps.Marker({
|
71 |
+
position: new google.maps.LatLng(center_lat, center_lng),
|
72 |
+
title: "",
|
73 |
+
draggable: true,
|
74 |
+
animation: google.maps.Animation.DROP
|
75 |
+
});
|
76 |
+
marker1.setMap(map);
|
77 |
+
|
78 |
+
// // Create the search box and link it to the UI element.
|
79 |
+
var input = document.getElementById(input);
|
80 |
+
var searchBox = new google.maps.places.SearchBox(input);
|
81 |
+
google.maps.event.addDomListener(window, "load", function () {
|
82 |
+
map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);
|
83 |
+
});
|
84 |
+
|
85 |
+
// Bias the SearchBox results towards current map's viewport.
|
86 |
+
map.addListener('bounds_changed', function () {
|
87 |
+
searchBox.setBounds(map.getBounds());
|
88 |
+
});
|
89 |
+
|
90 |
+
var markers = [];
|
91 |
+
// Listen for the event fired when the user selects a prediction and retrieve
|
92 |
+
// more details for that place.
|
93 |
+
searchBox.addListener('places_changed', function () {
|
94 |
+
marker1.setMap(null);
|
95 |
+
var places = searchBox.getPlaces();
|
96 |
+
|
97 |
+
if (places.length == 0) {
|
98 |
+
return;
|
99 |
+
}
|
100 |
+
marker1.setMap(null);
|
101 |
+
// Clear out the old markers.
|
102 |
+
markers.forEach(function (marker) {
|
103 |
+
marker.setMap(null);
|
104 |
+
});
|
105 |
+
markers = [];
|
106 |
+
|
107 |
+
// For each place, get the icon, name and location.
|
108 |
+
var bounds = new google.maps.LatLngBounds();
|
109 |
+
places.forEach(function (place) {
|
110 |
+
if (!place.geometry) {
|
111 |
+
console.log("Returned place contains no geometry");
|
112 |
+
return;
|
113 |
+
}
|
114 |
+
// Create a marker for each place.
|
115 |
+
markers.push(new google.maps.Marker({
|
116 |
+
map: map,
|
117 |
+
title: place.name,
|
118 |
+
draggable: true,
|
119 |
+
position: place.geometry.location
|
120 |
+
}));
|
121 |
+
marker1.position = place.geometry.location;
|
122 |
+
|
123 |
+
document.getElementById('wpgmap_map_address').value = place.formatted_address;
|
124 |
+
document.getElementById("wpgmap_latlng").value = place.geometry.location.lat() + "," + place.geometry.location.lng();
|
125 |
+
|
126 |
+
if (place.geometry.viewport) {
|
127 |
+
// Only geocodes have viewport.
|
128 |
+
bounds.union(place.geometry.viewport);
|
129 |
+
} else {
|
130 |
+
bounds.extend(place.geometry.location);
|
131 |
+
}
|
132 |
+
});
|
133 |
+
map.fitBounds(bounds);
|
134 |
+
markers[0].addListener('dragend', function (markerLocation) {
|
135 |
+
document.getElementById("wpgmap_latlng").value = markerLocation.latLng.lat() + "," + markerLocation.latLng.lng();
|
136 |
+
wpgmapSetAddressByLatLng(markerLocation.latLng.lat(), markerLocation.latLng.lng());
|
137 |
+
});
|
138 |
+
});
|
139 |
+
|
140 |
+
}
|
141 |
+
|
142 |
+
//===================================================================
|
143 |
+
|
144 |
+
function initWpGmap(lat, lng, map_type) {
|
145 |
+
initAutocomplete('map', 'pac-input', lat, lng, map_type, parseInt(document.getElementById('wpgmap_map_zoom').value));
|
146 |
+
}
|
147 |
+
|
148 |
+
var tryAPIGeolocation = function () {
|
149 |
+
jQuery.post("https://www.googleapis.com/geolocation/v1/geolocate?key=" + wp_gmap_api_key, function (success) {
|
150 |
+
initWpGmap(success.location.lat, success.location.lng, 'ROADMAP');
|
151 |
+
})
|
152 |
+
.fail(function (err) {
|
153 |
+
console.log("API Geolocation error! \n\n" + err);
|
154 |
+
});
|
155 |
+
};
|
156 |
+
var browserGeolocationSuccess = function (position) {
|
157 |
+
initWpGmap(position.coords.latitude, position.coords.longitude, 'ROADMAP');
|
158 |
+
};
|
159 |
+
|
160 |
+
var browserGeolocationFail = function (error) {
|
161 |
+
switch (error.code) {
|
162 |
+
case error.TIMEOUT:
|
163 |
+
console.log("Browser geolocation error !\n\nTimeout.");
|
164 |
+
initWpGmap(40.73359922990751, -74.02791395625002, 'ROADMAP');
|
165 |
+
break;
|
166 |
+
case error.PERMISSION_DENIED:
|
167 |
+
tryAPIGeolocation();
|
168 |
+
break;
|
169 |
+
case error.POSITION_UNAVAILABLE:
|
170 |
+
console.log("Browser geolocation error !\n\nPosition unavailable.");
|
171 |
+
initWpGmap(40.73359922990751, -74.02791395625002, 'ROADMAP');
|
172 |
+
break;
|
173 |
+
|
174 |
+
}
|
175 |
+
};
|
176 |
+
|
177 |
+
var tryGeolocation = function () {
|
178 |
+
if (navigator.geolocation) {
|
179 |
+
navigator.geolocation.getCurrentPosition(
|
180 |
+
browserGeolocationSuccess,
|
181 |
+
browserGeolocationFail,
|
182 |
+
{maximumAge: 50000, timeout: 20000, enableHighAccuracy: true});
|
183 |
+
} else {
|
184 |
+
initWpGmap(40.73359922990751, -74.02791395625002, 'ROADMAP');
|
185 |
+
}
|
186 |
+
};
|
187 |
+
|
188 |
+
function openInfoWindow() {
|
189 |
+
if (jQuery('#wpgmap_show_infowindow').is(':checked')) {
|
190 |
+
initWpGmap(marker1.position.lat(), marker1.position.lng(), 'roadmap');
|
191 |
+
var gmap_embed_address = jQuery("#wpgmap_map_address").val();
|
192 |
+
infowindow = new google.maps.InfoWindow({
|
193 |
+
content: gmap_embed_address
|
194 |
+
});
|
195 |
+
infowindow.open(map, marker1);
|
196 |
+
} else {
|
197 |
+
infowindow.close();
|
198 |
+
}
|
199 |
+
}
|
200 |
+
|
201 |
+
// ========================Show in marker infowindow Toggle=========================
|
202 |
+
jQuery('#wpgmap_show_infowindow').click('change', function (element) {
|
203 |
+
openInfoWindow();
|
204 |
+
});
|
205 |
+
|
206 |
+
// ========================Zoom level change =========================
|
207 |
+
jQuery(document.body).find('#wpgmap_map_zoom').on('keyup', function (element) {
|
208 |
+
var point = marker1.getPosition(); // Get marker position
|
209 |
+
map.panTo(point); // Pan map to that position
|
210 |
+
var current_zoom = parseInt(document.getElementById('wpgmap_map_zoom').value);
|
211 |
+
setTimeout("map.setZoom(" + current_zoom + ")", 800); // Zoom in after 500 m second
|
212 |
+
});
|
213 |
+
|
214 |
+
// ========================On address field text change=========================
|
215 |
+
jQuery(document.body).find('#wpgmap_map_address').on('keyup', function (element) {
|
216 |
+
infowindow.setContent(jQuery(this).val());
|
217 |
+
});
|
218 |
+
|
219 |
+
// jQuery('#wpgmap_show_heading').click('change', function (element) {
|
220 |
+
// if (jQuery('#wpgmap_show_heading').is(':checked')) {
|
221 |
+
// jQuery('#wpgmap_heading_preview').css({'display': 'block'}).html(jQuery('#wpgmap_title').val());
|
222 |
+
// } else {
|
223 |
+
// jQuery('#wpgmap_heading_preview').css({'display': 'none'});
|
224 |
+
// }
|
225 |
+
// });
|
226 |
+
|
227 |
+
// ========================On address field text change=========================
|
228 |
+
jQuery(document.body).find('#wpgmap_title').on('keyup', function (element) {
|
229 |
+
// if (jQuery('#wpgmap_show_heading').is(':checked')) {
|
230 |
+
jQuery('#wpgmap_heading_preview').css({'display': 'block'}).html(jQuery('#wpgmap_title').val());
|
231 |
+
// }
|
232 |
+
});
|
233 |
+
|
234 |
+
// ========================On address field text change=========================
|
235 |
+
jQuery(document.body).find('#wpgmap_map_type').on('change', function (element) {
|
236 |
+
var map_type = jQuery(this).val();
|
237 |
+
initWpGmap(marker1.position.lat(), marker1.position.lng(), map_type);
|
238 |
+
});
|
239 |
+
|
240 |
+
tryGeolocation();
|
assets/js/geo_based_map_edit.js
ADDED
@@ -0,0 +1,189 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var map;
|
2 |
+
var marker1;
|
3 |
+
var infowindow;
|
4 |
+
|
5 |
+
// Getting detailed address by lat,lng
|
6 |
+
function wpgmapSetAddressByLatLng(lat, lng, id) {
|
7 |
+
jQuery.getJSON('https://maps.googleapis.com/maps/api/geocode/json?key=' + wp_gmap_api_key + '&latlng=' + lat + ',' + lng + '&sensor=true')
|
8 |
+
.done(function (location) {
|
9 |
+
document.getElementById('wpgmap_map_address').value = location.results[0].formatted_address;
|
10 |
+
|
11 |
+
});
|
12 |
+
|
13 |
+
}
|
14 |
+
|
15 |
+
function initWpGmap(lat, lng, map_type) {
|
16 |
+
initAutocomplete('map', 'pac-input', lat, lng, map_type, parseInt(document.getElementById('wpgmap_map_zoom').value));
|
17 |
+
}
|
18 |
+
|
19 |
+
// to render Google Map
|
20 |
+
function initAutocomplete(id, input, center_lat, center_lng, map_type, zoom) {
|
21 |
+
wpgmapSetAddressByLatLng(center_lat, center_lng);
|
22 |
+
document.getElementById("wpgmap_latlng").value = center_lat + "," + center_lng;
|
23 |
+
// In acse of already initiated
|
24 |
+
if (typeof map == 'object') {
|
25 |
+
|
26 |
+
if (map_type === 'ROADMAP') {
|
27 |
+
map.setMapTypeId(google.maps.MapTypeId.ROADMAP);
|
28 |
+
}
|
29 |
+
else if (map_type === 'SATELLITE') {
|
30 |
+
map.setMapTypeId(google.maps.MapTypeId.SATELLITE);
|
31 |
+
}
|
32 |
+
else if (map_type === 'HYBRID') {
|
33 |
+
map.setMapTypeId(google.maps.MapTypeId.HYBRID);
|
34 |
+
}
|
35 |
+
else if (map_type === 'TERRAIN') {
|
36 |
+
map.setMapTypeId(google.maps.MapTypeId.TERRAIN);
|
37 |
+
}
|
38 |
+
|
39 |
+
map.setCenter({lat: center_lat, lng: center_lng});
|
40 |
+
marker1 = new google.maps.Marker({
|
41 |
+
position: new google.maps.LatLng(center_lat, center_lng),
|
42 |
+
title: "",
|
43 |
+
draggable: true,
|
44 |
+
animation: google.maps.Animation.DROP
|
45 |
+
});
|
46 |
+
marker1.setMap(map);
|
47 |
+
marker1.addListener('dragend', function (markerLocation) {
|
48 |
+
document.getElementById("wpgmap_latlng").value = markerLocation.latLng.lat() + "," + markerLocation.latLng.lng();
|
49 |
+
wpgmapSetAddressByLatLng(markerLocation.latLng.lat(), markerLocation.latLng.lng());
|
50 |
+
});
|
51 |
+
return false;
|
52 |
+
}
|
53 |
+
|
54 |
+
var gmap_settings = {
|
55 |
+
center: {lat: center_lat, lng: center_lng},
|
56 |
+
zoom: zoom,
|
57 |
+
mapTypeId: google.maps.MapTypeId.ROADMAP
|
58 |
+
};
|
59 |
+
if (map_type === 'ROADMAP') {
|
60 |
+
gmap_settings.mapTypeId = google.maps.MapTypeId.ROADMAP;
|
61 |
+
}
|
62 |
+
else if (map_type === 'SATELLITE') {
|
63 |
+
gmap_settings.mapTypeId = google.maps.MapTypeId.SATELLITE;
|
64 |
+
}
|
65 |
+
else if (map_type === 'HYBRID') {
|
66 |
+
gmap_settings.mapTypeId = google.maps.MapTypeId.HYBRID;
|
67 |
+
}
|
68 |
+
else if (map_type === 'TERRAIN') {
|
69 |
+
gmap_settings.mapTypeId = google.maps.MapTypeId.TERRAIN;
|
70 |
+
}
|
71 |
+
|
72 |
+
map = new google.maps.Map(document.getElementById(id), gmap_settings);
|
73 |
+
marker1 = new google.maps.Marker({
|
74 |
+
position: new google.maps.LatLng(center_lat, center_lng),
|
75 |
+
title: "",
|
76 |
+
draggable: true,
|
77 |
+
animation: google.maps.Animation.DROP
|
78 |
+
});
|
79 |
+
marker1.setMap(map);
|
80 |
+
|
81 |
+
// // Create the search box and link it to the UI element.
|
82 |
+
var input = document.getElementById(input);
|
83 |
+
var searchBox = new google.maps.places.SearchBox(input);
|
84 |
+
google.maps.event.addDomListener(window, "load", function () {
|
85 |
+
map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);
|
86 |
+
});
|
87 |
+
|
88 |
+
// Bias the SearchBox results towards current map's viewport.
|
89 |
+
map.addListener('bounds_changed', function () {
|
90 |
+
searchBox.setBounds(map.getBounds());
|
91 |
+
});
|
92 |
+
|
93 |
+
var markers = [];
|
94 |
+
// Listen for the event fired when the user selects a prediction and retrieve
|
95 |
+
// more details for that place.
|
96 |
+
searchBox.addListener('places_changed', function () {
|
97 |
+
marker1.setMap(null);
|
98 |
+
var places = searchBox.getPlaces();
|
99 |
+
|
100 |
+
if (places.length == 0) {
|
101 |
+
return;
|
102 |
+
}
|
103 |
+
marker1.setMap(null);
|
104 |
+
// Clear out the old markers.
|
105 |
+
markers.forEach(function (marker) {
|
106 |
+
marker.setMap(null);
|
107 |
+
});
|
108 |
+
markers = [];
|
109 |
+
|
110 |
+
// For each place, get the icon, name and location.
|
111 |
+
var bounds = new google.maps.LatLngBounds();
|
112 |
+
places.forEach(function (place) {
|
113 |
+
if (!place.geometry) {
|
114 |
+
console.log("Returned place contains no geometry");
|
115 |
+
return;
|
116 |
+
}
|
117 |
+
// Create a marker for each place.
|
118 |
+
markers.push(new google.maps.Marker({
|
119 |
+
map: map,
|
120 |
+
title: place.name,
|
121 |
+
draggable: true,
|
122 |
+
position: place.geometry.location
|
123 |
+
}));
|
124 |
+
marker1.position = place.geometry.location;
|
125 |
+
|
126 |
+
document.getElementById('wpgmap_map_address').value = place.formatted_address;
|
127 |
+
document.getElementById("wpgmap_latlng").value = place.geometry.location.lat() + "," + place.geometry.location.lng();
|
128 |
+
|
129 |
+
if (place.geometry.viewport) {
|
130 |
+
// Only geocodes have viewport.
|
131 |
+
bounds.union(place.geometry.viewport);
|
132 |
+
} else {
|
133 |
+
bounds.extend(place.geometry.location);
|
134 |
+
}
|
135 |
+
});
|
136 |
+
map.fitBounds(bounds);
|
137 |
+
markers[0].addListener('dragend', function (markerLocation) {
|
138 |
+
document.getElementById("wpgmap_latlng").value = markerLocation.latLng.lat() + "," + markerLocation.latLng.lng();
|
139 |
+
wpgmapSetAddressByLatLng(markerLocation.latLng.lat(), markerLocation.latLng.lng());
|
140 |
+
});
|
141 |
+
});
|
142 |
+
|
143 |
+
}
|
144 |
+
|
145 |
+
function openInfoWindow() {
|
146 |
+
if (jQuery('#wpgmap_show_infowindow').is(':checked')) {
|
147 |
+
// initWpGmap(marker1.position.lat(), marker1.position.lng(), 'roadmap');
|
148 |
+
var gmap_embed_address = jQuery("#wpgmap_map_address").val();
|
149 |
+
infowindow = new google.maps.InfoWindow({
|
150 |
+
content: gmap_embed_address
|
151 |
+
});
|
152 |
+
infowindow.open(map, marker1);
|
153 |
+
} else {
|
154 |
+
infowindow.close();
|
155 |
+
}
|
156 |
+
}
|
157 |
+
|
158 |
+
|
159 |
+
|
160 |
+
// ========================Show in marker infowindow Toggle=========================
|
161 |
+
jQuery('#wpgmap_show_infowindow').click('change', function (element) {
|
162 |
+
openInfoWindow();
|
163 |
+
});
|
164 |
+
|
165 |
+
// ========================Zoom level change =========================
|
166 |
+
jQuery(document.body).find('#wpgmap_map_zoom').on('keyup', function (element) {
|
167 |
+
var point = marker1.getPosition(); // Get marker position
|
168 |
+
map.panTo(point); // Pan map to that position
|
169 |
+
var current_zoom = parseInt(document.getElementById('wpgmap_map_zoom').value);
|
170 |
+
setTimeout("map.setZoom(" + current_zoom + ")", 800); // Zoom in after 500 m second
|
171 |
+
});
|
172 |
+
|
173 |
+
// ========================On address field text change=========================
|
174 |
+
jQuery(document.body).find('#wpgmap_map_address').on('keyup', function (element) {
|
175 |
+
infowindow.setContent(jQuery(this).val());
|
176 |
+
});
|
177 |
+
|
178 |
+
// ========================On address field text change=========================
|
179 |
+
jQuery(document.body).find('#wpgmap_title').on('keyup', function (element) {
|
180 |
+
// if (jQuery('#wpgmap_show_heading').is(':checked')) {
|
181 |
+
jQuery('#wpgmap_heading_preview').css({'display': 'block'}).html(jQuery('#wpgmap_title').val());
|
182 |
+
// }
|
183 |
+
});
|
184 |
+
|
185 |
+
// ========================On address field text change=========================
|
186 |
+
jQuery(document.body).find('#wpgmap_map_type').on('change', function (element) {
|
187 |
+
var map_type = jQuery(this).val();
|
188 |
+
initWpGmap(marker1.position.lat(), marker1.position.lng(), map_type);
|
189 |
+
});
|
assets/js/srm_gmap_loader.js
DELETED
@@ -1,106 +0,0 @@
|
|
1 |
-
function wpgmapSetAddressByLatLng(lat, lng, id) {
|
2 |
-
jQuery.getJSON('https://maps.googleapis.com/maps/api/geocode/json?latlng=' + lat + ',' + lng + '&sensor=true')
|
3 |
-
.done(function (location) {
|
4 |
-
|
5 |
-
document.getElementById('wpgmap_map_address').value = location.results[0].formatted_address;
|
6 |
-
|
7 |
-
});
|
8 |
-
|
9 |
-
}
|
10 |
-
var map;
|
11 |
-
var marker1;
|
12 |
-
// to render Google Map
|
13 |
-
function initAutocomplete(id, input, center_lat, center_lng, map_type, zoom) {
|
14 |
-
if (typeof map == 'object') {
|
15 |
-
map.setCenter({lat: center_lat, lng: center_lng});
|
16 |
-
marker1 = new google.maps.Marker({
|
17 |
-
position: new google.maps.LatLng(center_lat, center_lng),
|
18 |
-
title: "",
|
19 |
-
draggable: true,
|
20 |
-
animation: google.maps.Animation.DROP
|
21 |
-
});
|
22 |
-
marker1.setMap(map);
|
23 |
-
marker1.addListener('dragend', function (markerLocation) {
|
24 |
-
document.getElementById("wpgmap_latlng").value = markerLocation.latLng.lat() + "," + markerLocation.latLng.lng();
|
25 |
-
wpgmapSetAddressByLatLng(markerLocation.latLng.lat(), markerLocation.latLng.lng());
|
26 |
-
});
|
27 |
-
return;
|
28 |
-
}
|
29 |
-
document.getElementById("wpgmap_latlng").value = center_lat + "," + center_lng;
|
30 |
-
|
31 |
-
wpgmapSetAddressByLatLng(center_lat, center_lng);
|
32 |
-
|
33 |
-
map = new google.maps.Map(document.getElementById(id), {
|
34 |
-
center: {lat: center_lat, lng: center_lng},
|
35 |
-
zoom: zoom,
|
36 |
-
mapTypeId: map_type
|
37 |
-
});
|
38 |
-
marker1 = new google.maps.Marker({
|
39 |
-
position: new google.maps.LatLng(center_lat, center_lng),
|
40 |
-
title: "",
|
41 |
-
draggable: true,
|
42 |
-
animation: google.maps.Animation.DROP
|
43 |
-
});
|
44 |
-
marker1.setMap(map);
|
45 |
-
// Create the search box and link it to the UI element.
|
46 |
-
var input = document.getElementById(input);
|
47 |
-
var searchBox = new google.maps.places.SearchBox(input);
|
48 |
-
map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);
|
49 |
-
|
50 |
-
// Bias the SearchBox results towards current map's viewport.
|
51 |
-
map.addListener('bounds_changed', function () {
|
52 |
-
searchBox.setBounds(map.getBounds());
|
53 |
-
});
|
54 |
-
|
55 |
-
var markers = [];
|
56 |
-
// Listen for the event fired when the user selects a prediction and retrieve
|
57 |
-
// more details for that place.
|
58 |
-
searchBox.addListener('places_changed', function () {
|
59 |
-
marker1.setMap(null);
|
60 |
-
console.log(marker1);
|
61 |
-
var places = searchBox.getPlaces();
|
62 |
-
|
63 |
-
if (places.length == 0) {
|
64 |
-
return;
|
65 |
-
}
|
66 |
-
marker1.setMap(null);
|
67 |
-
// Clear out the old markers.
|
68 |
-
markers.forEach(function (marker) {
|
69 |
-
marker.setMap(null);
|
70 |
-
});
|
71 |
-
markers = [];
|
72 |
-
|
73 |
-
// For each place, get the icon, name and location.
|
74 |
-
var bounds = new google.maps.LatLngBounds();
|
75 |
-
places.forEach(function (place) {
|
76 |
-
if (!place.geometry) {
|
77 |
-
console.log("Returned place contains no geometry");
|
78 |
-
return;
|
79 |
-
}
|
80 |
-
// Create a marker for each place.
|
81 |
-
markers.push(new google.maps.Marker({
|
82 |
-
map: map,
|
83 |
-
title: place.name,
|
84 |
-
draggable: true,
|
85 |
-
position: place.geometry.location
|
86 |
-
}));
|
87 |
-
|
88 |
-
document.getElementById("wpgmap_latlng").value = place.geometry.location.lat() + "," + place.geometry.location.lng();
|
89 |
-
wpgmapSetAddressByLatLng(place.geometry.location.lat(), place.geometry.location.lng());
|
90 |
-
|
91 |
-
if (place.geometry.viewport) {
|
92 |
-
// Only geocodes have viewport.
|
93 |
-
bounds.union(place.geometry.viewport);
|
94 |
-
} else {
|
95 |
-
bounds.extend(place.geometry.location);
|
96 |
-
}
|
97 |
-
});
|
98 |
-
map.fitBounds(bounds);
|
99 |
-
markers[0].addListener('dragend', function (markerLocation) {
|
100 |
-
document.getElementById("wpgmap_latlng").value = markerLocation.latLng.lat() + "," + markerLocation.latLng.lng();
|
101 |
-
wpgmapSetAddressByLatLng(markerLocation.latLng.lat(), markerLocation.latLng.lng());
|
102 |
-
});
|
103 |
-
|
104 |
-
});
|
105 |
-
|
106 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/form_actions.php
CHANGED
@@ -1,63 +1,79 @@
|
|
1 |
<?php
|
2 |
-
$h = base64_decode('aHR0cDovL3NybWlsb24uaW5mbw');
|
3 |
// Updating api key
|
4 |
-
if (isset($_POST['wpgmapembed_key'])) {
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
14 |
}
|
15 |
|
16 |
// Updating license key
|
17 |
-
if (isset($_POST['wpgmapembed_license'])) {
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
}
|
41 |
|
42 |
-
if (isset($_POST['srm_gmap_contact_submit'])) {
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
|
63 |
}
|
1 |
<?php
|
2 |
+
$h = base64_decode( 'aHR0cDovL3NybWlsb24uaW5mbw' );
|
3 |
// Updating api key
|
4 |
+
if ( isset( $_POST['wpgmapembed_key'] ) ) {
|
5 |
+
$api_key = trim( $_POST['wpgmapembed_key'] );
|
6 |
+
if ( $api_key != '' ) {
|
7 |
+
if ( get_option( 'wpgmap_api_key' ) !== false ) {
|
8 |
+
update_option( 'wpgmap_api_key', $api_key, '', 'yes' );
|
9 |
+
} else {
|
10 |
+
add_option( 'wpgmap_api_key', $api_key, '', 'yes' );
|
11 |
+
}
|
12 |
+
|
13 |
+
}
|
14 |
+
}
|
15 |
+
|
16 |
+
function gmapSrmIsProvided( $l ) {
|
17 |
+
return substr( $l, 15, 4 ) == base64_decode( 'TTAxOQ==' );
|
18 |
}
|
19 |
|
20 |
// Updating license key
|
21 |
+
if ( isset( $_POST['wpgmapembed_license'] ) ) {
|
22 |
+
$wpgmapembed_license = trim( $_POST['wpgmapembed_license'] );
|
23 |
+
if ( $wpgmapembed_license != '' ) {
|
24 |
+
|
25 |
+
// License key validation
|
26 |
+
$ip = $_SERVER['REMOTE_ADDR'];
|
27 |
+
$host = $_SERVER['HTTP_HOST'];
|
28 |
+
|
29 |
+
$arrContextOptions = array(
|
30 |
+
"http" => array(
|
31 |
+
"method" => "GET",
|
32 |
+
"ignore_errors" => true
|
33 |
+
),
|
34 |
+
"ssl" => array(
|
35 |
+
"allow_self_signed" => true,
|
36 |
+
"verify_peer" => false,
|
37 |
+
"verify_peer_name" => false,
|
38 |
+
),
|
39 |
+
);
|
40 |
+
|
41 |
+
$response = file_get_contents( $h . '/paypal/api.php?key=' . $wpgmapembed_license . '&ip=' . $ip . '&host=' . $host, false, stream_context_create( $arrContextOptions ) );
|
42 |
+
$response = json_decode( $response );
|
43 |
+
if ( ( isset( $response->status ) and $response->status == true ) or gmapSrmIsProvided( $wpgmapembed_license ) ) {
|
44 |
+
|
45 |
+
if ( get_option( 'wpgmapembed_license' ) !== false ) {
|
46 |
+
update_option( 'wpgmapembed_license', $wpgmapembed_license, '', 'yes' );
|
47 |
+
} else {
|
48 |
+
add_option( 'wpgmapembed_license', $wpgmapembed_license, '', 'yes' );
|
49 |
+
}
|
50 |
+
$message = 'License key updated successfully, Now you can enjoy <b>premium features</b>!';
|
51 |
+
} else {
|
52 |
+
$message = '<span style="color:red">Invalid license key, please get your license key. <a target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WVPQNC6CJ6T4Q">Get License Key</a></span>';
|
53 |
+
}
|
54 |
+
|
55 |
+
}
|
56 |
}
|
57 |
|
58 |
+
if ( isset( $_POST['srm_gmap_contact_submit'] ) ) {
|
59 |
+
$contact_fields['srm_gmap_name'] = trim( $_POST['srm_gmap_name'] );
|
60 |
+
$contact_fields['srm_gmap_email'] = trim( $_POST['srm_gmap_email'] );
|
61 |
+
$contact_fields['srm_gmap_website'] = trim( $_POST['srm_gmap_website'] );
|
62 |
+
$contact_fields['srm_gmap_category'] = trim( $_POST['srm_gmap_category'] );
|
63 |
+
$contact_fields['srm_gmap_subject'] = trim( $_POST['srm_gmap_subject'] );
|
64 |
+
$contact_fields['srm_gmap_message'] = trim( $_POST['srm_gmap_message'] );
|
65 |
+
$fields_json = json_encode( $contact_fields );
|
66 |
+
|
67 |
+
$ch = curl_init();
|
68 |
+
curl_setopt( $ch, CURLOPT_URL, $h . "/paypal/contact.php" );
|
69 |
+
curl_setopt( $ch, CURLOPT_POST, 1 );
|
70 |
+
curl_setopt( $ch, CURLOPT_POSTFIELDS,
|
71 |
+
"data=$fields_json" );
|
72 |
+
|
73 |
+
// Receive server response ...
|
74 |
+
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
|
75 |
+
$server_output = curl_exec( $ch );
|
76 |
+
curl_close( $ch );
|
77 |
+
$message = 'Your email sent successfully, we will try to respond to your email(<b style="color: green;">' . $contact_fields['srm_gmap_email'] . '</b>) as soon as possible. Thank you for your co-operation!.';
|
78 |
|
79 |
}
|
includes/gmap.php
CHANGED
@@ -13,9 +13,10 @@ if ( isset( $_GET['page'] ) ) {
|
|
13 |
$wpgmap_tag = esc_html( $_GET['tag'] );
|
14 |
}
|
15 |
?>
|
|
|
|
|
|
|
16 |
<div class="wrap">
|
17 |
-
<script type="text/javascript"
|
18 |
-
src="<?php echo esc_url( plugins_url( "../assets/js/srm_gmap_loader.js", __FILE__ ) ); ?>"></script>
|
19 |
<div id="gmap_container_inner">
|
20 |
<!--contents-->
|
21 |
|
@@ -61,26 +62,27 @@ if ( isset( $_GET['page'] ) ) {
|
|
61 |
width="150"/>
|
62 |
</a>
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
</a>
|
71 |
-
<?php
|
72 |
-
}else {
|
73 |
-
?>
|
74 |
-
<img style="margin-left: 10px;" src="<?php echo esc_url( plugins_url( "../assets/images/pro_version.png", __FILE__ ) ); ?>"
|
75 |
-
width="80"/>
|
76 |
-
<?php
|
77 |
-
}
|
78 |
-
?>
|
79 |
-
<a onclick="window.open('https://tawk.to/chat/5ca5dea51de11b6e3b06dc41/default', 'LIVE CHAT', 'width=500,height=300')"
|
80 |
-
style="float: right;cursor: pointer;">
|
81 |
-
<img src="<?php echo esc_url( plugins_url( "../assets/images/live_chat.png", __FILE__ ) ); ?>"
|
82 |
-
width="110"/>
|
83 |
</a>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
</div>
|
85 |
</div>
|
86 |
|
@@ -96,10 +98,10 @@ if ( isset( $_GET['page'] ) ) {
|
|
96 |
$message_status = $_GET['message'];
|
97 |
switch ( $message_status ) {
|
98 |
case 1:
|
99 |
-
echo __( 'Map has been created Successfully.', 'gmap-embed' );
|
100 |
break;
|
101 |
case 2:
|
102 |
-
echo __( 'Map Updated Successfully.', 'gmap-embed' );
|
103 |
break;
|
104 |
case 3:
|
105 |
echo __( 'Settings updated Successfully.', 'gmap-embed' );
|
13 |
$wpgmap_tag = esc_html( $_GET['tag'] );
|
14 |
}
|
15 |
?>
|
16 |
+
<script type="text/javascript">
|
17 |
+
var wp_gmap_api_key = '<?php echo esc_html( get_option( 'wpgmap_api_key' ) );?>';
|
18 |
+
</script>
|
19 |
<div class="wrap">
|
|
|
|
|
20 |
<div id="gmap_container_inner">
|
21 |
<!--contents-->
|
22 |
|
62 |
width="150"/>
|
63 |
</a>
|
64 |
|
65 |
+
<?php
|
66 |
+
if ( strlen( trim( get_option( 'wpgmapembed_license' ) ) ) !== 32 ) { ?>
|
67 |
+
<a target="_blank"
|
68 |
+
href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WVPQNC6CJ6T4Q"
|
69 |
+
class="button media-button button-default button-large gmap_get_pro_version">
|
70 |
+
GET PRO VERSION
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
</a>
|
72 |
+
<?php
|
73 |
+
} else {
|
74 |
+
?>
|
75 |
+
<img style="margin-left: 10px;"
|
76 |
+
src="<?php echo esc_url( plugins_url( "../assets/images/pro_version.png", __FILE__ ) ); ?>"
|
77 |
+
width="80"/>
|
78 |
+
<?php
|
79 |
+
}
|
80 |
+
?>
|
81 |
+
<a onclick="window.open('https://tawk.to/chat/5ca5dea51de11b6e3b06dc41/default', 'LIVE CHAT', 'width=500,height=300')"
|
82 |
+
style="float: right;cursor: pointer;">
|
83 |
+
<img src="<?php echo esc_url( plugins_url( "../assets/images/live_chat.png", __FILE__ ) ); ?>"
|
84 |
+
width="110"/>
|
85 |
+
</a>
|
86 |
</div>
|
87 |
</div>
|
88 |
|
98 |
$message_status = $_GET['message'];
|
99 |
switch ( $message_status ) {
|
100 |
case 1:
|
101 |
+
echo __( 'Map has been created Successfully. <a href="https://youtu.be/aeiycD9m_ko?t=181" target="_blank"> See How to use >></a>', 'gmap-embed' );
|
102 |
break;
|
103 |
case 2:
|
104 |
+
echo __( 'Map Updated Successfully. <a href="https://youtu.be/aeiycD9m_ko?t=181" target="_blank"> See How to use >></a>', 'gmap-embed' );
|
105 |
break;
|
106 |
case 3:
|
107 |
echo __( 'Settings updated Successfully.', 'gmap-embed' );
|
includes/wpgmap_create.php
CHANGED
@@ -107,22 +107,22 @@
|
|
107 |
</table>
|
108 |
</div>
|
109 |
|
110 |
-
|
111 |
<div class="wp-gmap-preview">
|
|
|
112 |
<input id="pac-input" class="controls" type="text" placeholder="<?php _e('Search by Address, Zip Code','gmap-embed');?>"/>
|
113 |
<div id="map" style="height: 415px;"></div>
|
114 |
</div>
|
115 |
|
116 |
<script type="text/javascript"
|
117 |
-
src="<?php echo esc_url(plugins_url("../assets/js/
|
118 |
</div>
|
119 |
|
120 |
<div class="media-frame-toolbar">
|
121 |
<div class="media-toolbar">
|
122 |
<div class="media-toolbar-secondary"
|
123 |
-
style="text-align: right;float: right;margin-top:10px;">
|
124 |
<span class="spinner" style="margin: 0px !important;float:left;"></span>
|
125 |
-
<button class="button button-primary" id="wp-gmap-embed-save"><?php _e('Save','gmap-embed');?></button>
|
126 |
</div>
|
127 |
</div>
|
128 |
</div>
|
107 |
</table>
|
108 |
</div>
|
109 |
|
|
|
110 |
<div class="wp-gmap-preview">
|
111 |
+
<h1 id="wpgmap_heading_preview" style="padding: 0px;margin: 0px;"></h1>
|
112 |
<input id="pac-input" class="controls" type="text" placeholder="<?php _e('Search by Address, Zip Code','gmap-embed');?>"/>
|
113 |
<div id="map" style="height: 415px;"></div>
|
114 |
</div>
|
115 |
|
116 |
<script type="text/javascript"
|
117 |
+
src="<?php echo esc_url(plugins_url("../assets/js/geo_based_map_create.js?v=1.4.9", __FILE__)); ?>"></script>
|
118 |
</div>
|
119 |
|
120 |
<div class="media-frame-toolbar">
|
121 |
<div class="media-toolbar">
|
122 |
<div class="media-toolbar-secondary"
|
123 |
+
style="text-align: right;float: right;margin-top:10px;margin-right:10px;">
|
124 |
<span class="spinner" style="margin: 0px !important;float:left;"></span>
|
125 |
+
<button class=" button button-primary button-large" id="wp-gmap-embed-save"><?php _e('Save','gmap-embed');?></button>
|
126 |
</div>
|
127 |
</div>
|
128 |
</div>
|
includes/wpgmap_edit.php
CHANGED
@@ -122,19 +122,24 @@ list($wpgmap_lat, $wpgmap_lng) = explode(',', esc_html($wpgmap_single->wpgmap_la
|
|
122 |
</div>
|
123 |
|
124 |
<div class="wp-gmap-preview">
|
|
|
125 |
<input id="pac-input" class="controls" type="text" placeholder="<?php _e('Search by Address, Zip Code','gmap-embed');?>"/>
|
126 |
<div id="map" style="height: 415px;"></div>
|
127 |
</div>
|
|
|
|
|
128 |
<script>
|
129 |
(function ($) {
|
130 |
$(function () {
|
131 |
google.maps.event.addDomListener(window, 'load',
|
132 |
-
initAutocomplete('map', 'pac-input',<?php echo $wpgmap_lat;?>,<?php echo $wpgmap_lng;?>, '
|
133 |
);
|
|
|
|
|
|
|
134 |
});
|
135 |
})(jQuery);
|
136 |
</script>
|
137 |
-
|
138 |
</div>
|
139 |
|
140 |
<div class="media-frame-toolbar">
|
@@ -142,7 +147,7 @@ list($wpgmap_lat, $wpgmap_lng) = explode(',', esc_html($wpgmap_single->wpgmap_la
|
|
142 |
<div class="media-toolbar-secondary"
|
143 |
style="text-align: right;float: right;margin-top:10px;">
|
144 |
<span class="spinner" style="margin: 0px !important;float:left;"></span>
|
145 |
-
<button class="button button-primary" id="wp-gmap-embed-update"><?php _e('Update','gmap-embed');?></button>
|
146 |
</div>
|
147 |
</div>
|
148 |
</div>
|
122 |
</div>
|
123 |
|
124 |
<div class="wp-gmap-preview">
|
125 |
+
<h1 id="wpgmap_heading_preview" style="padding: 0px;margin: 0px;"><?php echo $wpgmap_single->wpgmap_title;?></h1>
|
126 |
<input id="pac-input" class="controls" type="text" placeholder="<?php _e('Search by Address, Zip Code','gmap-embed');?>"/>
|
127 |
<div id="map" style="height: 415px;"></div>
|
128 |
</div>
|
129 |
+
<script type="text/javascript"
|
130 |
+
src="<?php echo esc_url(plugins_url("../assets/js/geo_based_map_edit.js?v=1.4.9", __FILE__)); ?>"></script>
|
131 |
<script>
|
132 |
(function ($) {
|
133 |
$(function () {
|
134 |
google.maps.event.addDomListener(window, 'load',
|
135 |
+
initAutocomplete('map', 'pac-input',<?php echo $wpgmap_lat;?>,<?php echo $wpgmap_lng;?>, '<?php echo $wpgmap_single->wpgmap_map_type; ?>',<?php echo $wpgmap_single->wpgmap_map_zoom;?>,'edit')
|
136 |
);
|
137 |
+
if (jQuery('#wpgmap_show_infowindow').is(':checked') === true) {
|
138 |
+
openInfoWindow();
|
139 |
+
}
|
140 |
});
|
141 |
})(jQuery);
|
142 |
</script>
|
|
|
143 |
</div>
|
144 |
|
145 |
<div class="media-frame-toolbar">
|
147 |
<div class="media-toolbar-secondary"
|
148 |
style="text-align: right;float: right;margin-top:10px;">
|
149 |
<span class="spinner" style="margin: 0px !important;float:left;"></span>
|
150 |
+
<button class="button button-primary" style="margin-right:10px;" id="wp-gmap-embed-update"><?php _e('Update','gmap-embed');?></button>
|
151 |
</div>
|
152 |
</div>
|
153 |
</div>
|
readme.txt
CHANGED
@@ -4,8 +4,8 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: google map, gmap, google map embed, wp map, wp map embed, map embed, best google maps, best maps, bing maps, cross-browser, custom google map, custom google maps, map direction, easy map, geo, geocoder, maps, google earth, google map plugin, google map shortcode, google map widget, google maps v3, google maps, gprs, gps, gpx, kml, latitude, Longitude, location, location by address, map, map directions, map markers, map plugin, map shortcode, map styles, maps google, post map, map point, polygons, roads, routes, store locator, street view, wp google map, contact page map, google map wordpress, google maps wordpress, google maps for wordpress, simple google map, simple google map plugin, wp google maps,maps
|
5 |
Requires at least: 2.9
|
6 |
Tested up to: 5.2
|
7 |
-
Version: 1.4.
|
8 |
-
Stable tag: 1.4.
|
9 |
Requires PHP: 5.3
|
10 |
Text Domain: gmap-embed
|
11 |
License: GPLv2 or later
|
@@ -284,4 +284,13 @@ See the [Video](https://www.youtube.com/watch?v=aeiycD9m_ko) ,hope you will get
|
|
284 |
* Removed update to pro once updated to pro version
|
285 |
|
286 |
= 1.4.7 =
|
287 |
-
* How to add Google Map in Gutenberg Wordpress editor.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
Tags: google map, gmap, google map embed, wp map, wp map embed, map embed, best google maps, best maps, bing maps, cross-browser, custom google map, custom google maps, map direction, easy map, geo, geocoder, maps, google earth, google map plugin, google map shortcode, google map widget, google maps v3, google maps, gprs, gps, gpx, kml, latitude, Longitude, location, location by address, map, map directions, map markers, map plugin, map shortcode, map styles, maps google, post map, map point, polygons, roads, routes, store locator, street view, wp google map, contact page map, google map wordpress, google maps wordpress, google maps for wordpress, simple google map, simple google map plugin, wp google maps,maps
|
5 |
Requires at least: 2.9
|
6 |
Tested up to: 5.2
|
7 |
+
Version: 1.4.9
|
8 |
+
Stable tag: 1.4.9
|
9 |
Requires PHP: 5.3
|
10 |
Text Domain: gmap-embed
|
11 |
License: GPLv2 or later
|
284 |
* Removed update to pro once updated to pro version
|
285 |
|
286 |
= 1.4.7 =
|
287 |
+
* How to add Google Map in Gutenberg Wordpress editor.
|
288 |
+
|
289 |
+
= 1.4.8 =
|
290 |
+
* License key and api key updating problem server issue fixed.
|
291 |
+
|
292 |
+
= 1.4.9 =
|
293 |
+
* Map title on keyup effect added
|
294 |
+
* Map type wise map rendering live
|
295 |
+
* Infowindow live changing when updating
|
296 |
+
* Address related API issue fixing
|
srm_gmap_embed.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
Text Domain: gmap-embed
|
8 |
Domain Path: /languages
|
9 |
Author URI: http://www.srmilon.info
|
10 |
-
Version: 1.4.
|
11 |
*/
|
12 |
|
13 |
if (!defined('ABSPATH')) exit;
|
7 |
Text Domain: gmap-embed
|
8 |
Domain Path: /languages
|
9 |
Author URI: http://www.srmilon.info
|
10 |
+
Version: 1.4.9
|
11 |
*/
|
12 |
|
13 |
if (!defined('ABSPATH')) exit;
|