WP Google Map - Version 1.8.2

Version Description

  • Clickable marker infowindow introduced.
Download this release

Release Info

Developer milonfci
Plugin Icon 128x128 WP Google Map
Version 1.8.2
Comparing to
See all releases

Code changes from version 1.8.1 to 1.8.2

admin/assets/js/geo_based_map_create.js CHANGED
@@ -834,6 +834,7 @@ jQuery(document).ready(function ($) {
834
  var wgm_marker_lat_lng = response.lat_lng.split(',');
835
  $('#wpgmap_marker_lat_lng').val(wgm_marker_lat_lng[0] + ',' + wgm_marker_lat_lng[1]);
836
  $('#wpgmap_marker_link').val(response.marker_link);
 
837
  if (response.have_marker_link === '1') {
838
  $("#wpgmap_marker_link_area").show();
839
  } else {
@@ -851,6 +852,7 @@ jQuery(document).ready(function ($) {
851
  $(document.body).find('.add_new_marker_form').show();
852
  $(document.body).find('.wgm_gmap_marker_list').hide();
853
  $(document.body).find('#marker_errors,#marker_success').html('');
 
854
  wgm_map.panTo(wgm_existing_marker.getPosition());
855
  current_map_markers[marker_id].setDraggable(true);
856
  wgm_addMarkerDragendListener(current_map_markers[marker_id]);
834
  var wgm_marker_lat_lng = response.lat_lng.split(',');
835
  $('#wpgmap_marker_lat_lng').val(wgm_marker_lat_lng[0] + ',' + wgm_marker_lat_lng[1]);
836
  $('#wpgmap_marker_link').val(response.marker_link);
837
+ $('#wpgmap_marker_icon').val(response.icon);
838
  if (response.have_marker_link === '1') {
839
  $("#wpgmap_marker_link_area").show();
840
  } else {
852
  $(document.body).find('.add_new_marker_form').show();
853
  $(document.body).find('.wgm_gmap_marker_list').hide();
854
  $(document.body).find('#marker_errors,#marker_success').html('');
855
+ $(document.body).find("#wpgmap_marker_icon_preview").attr('src', response.icon);
856
  wgm_map.panTo(wgm_existing_marker.getPosition());
857
  current_map_markers[marker_id].setDraggable(true);
858
  wgm_addMarkerDragendListener(current_map_markers[marker_id]);
admin/assets/js/geo_based_map_edit.js CHANGED
@@ -699,6 +699,7 @@ jQuery(document).ready(function ($) {
699
  var wgm_marker_lat_lng = response.lat_lng.split(',');
700
  $('#wpgmap_marker_lat_lng').val(wgm_marker_lat_lng[0] + ',' + wgm_marker_lat_lng[1]);
701
  $('#wpgmap_marker_link').val(response.marker_link);
 
702
  if (response.have_marker_link === '1') {
703
  $("#wpgmap_marker_link_area").show();
704
  } else {
699
  var wgm_marker_lat_lng = response.lat_lng.split(',');
700
  $('#wpgmap_marker_lat_lng').val(wgm_marker_lat_lng[0] + ',' + wgm_marker_lat_lng[1]);
701
  $('#wpgmap_marker_link').val(response.marker_link);
702
+ $('#wpgmap_marker_icon').val(response.icon);
703
  if (response.have_marker_link === '1') {
704
  $("#wpgmap_marker_link_area").show();
705
  } else {
admin/assets/js/wgm_marker_crud.js CHANGED
@@ -30,6 +30,7 @@
30
  $('#wpgmap_have_marker_link').val("0").change();
31
  $(document.body).find('#marker_errors,#marker_success').html('');
32
  $(document.body).find("#wpgmap_marker_icon_preview").attr('src', 'https://maps.gstatic.com/mapfiles/api-3/images/spotlight-poi2.png');
 
33
  // Reset wp editor content
34
  tmce_setContent('', 'wpgmap_marker_desc', 'wpgmap_marker_desc');
35
  }
30
  $('#wpgmap_have_marker_link').val("0").change();
31
  $(document.body).find('#marker_errors,#marker_success').html('');
32
  $(document.body).find("#wpgmap_marker_icon_preview").attr('src', 'https://maps.gstatic.com/mapfiles/api-3/images/spotlight-poi2.png');
33
+ $(document.body).find("#wpgmap_marker_icon").val('https://maps.gstatic.com/mapfiles/api-3/images/spotlight-poi2.png');
34
  // Reset wp editor content
35
  tmce_setContent('', 'wpgmap_marker_desc', 'wpgmap_marker_desc');
36
  }
admin/includes/markers-settings.php CHANGED
@@ -146,7 +146,7 @@
146
  <span class="alignleft"><?php _e('Open marker Info Window by default', 'gmap-embed'); ?></span>&nbsp;
147
  <select name="wpgmap_marker_infowindow_show" id="wpgmap_marker_infowindow_show">
148
  <option value="1">Yes</option>
149
- <option value="0" selected="selected">No</option>
150
  </select>
151
  </label>
152
  </td>
146
  <span class="alignleft"><?php _e('Open marker Info Window by default', 'gmap-embed'); ?></span>&nbsp;
147
  <select name="wpgmap_marker_infowindow_show" id="wpgmap_marker_infowindow_show">
148
  <option value="1">Yes</option>
149
+ <option value="0" selected="selected">No, Open description on click</option>
150
  </select>
151
  </label>
152
  </td>
includes/Classes/Bootstrap.php CHANGED
@@ -88,9 +88,9 @@ class Bootstrap
88
  add_action('wp_ajax_wpgmapembed_get_marker_icons', array($this, 'get_marker_icons'));
89
  add_action('wp_ajax_wpgmapembed_save_marker_icon', array($this, 'save_marker_icon'));
90
  add_action('wp_ajax_wpgmapembed_get_markers_by_map_id', array($this, 'get_markers_by_map_id'));
91
- add_action('wp_ajax_nopriv_wpgmapembed_get_markers_by_map_id', array($this, 'get_markers_by_map_id'));
 
92
  add_action('wp_ajax_wgm_get_markers_by_map_id', array($this, 'wgm_get_markers_by_map_id_for_dt'));
93
- add_action('wp_ajax_wpgmapembed_get_marker_icons_list_view', array($this, 'get_marker_icons_list_view'));
94
  add_action('wp_ajax_wpgmapembed_delete_marker', array($this, 'delete_marker'));
95
  add_action('wp_ajax_wpgmapembed_get_marker_data_by_marker_id', array($this, 'get_marker_data_by_marker_id'));
96
  }
88
  add_action('wp_ajax_wpgmapembed_get_marker_icons', array($this, 'get_marker_icons'));
89
  add_action('wp_ajax_wpgmapembed_save_marker_icon', array($this, 'save_marker_icon'));
90
  add_action('wp_ajax_wpgmapembed_get_markers_by_map_id', array($this, 'get_markers_by_map_id'));
91
+ add_action('wp_ajax_wpgmapembed_p_get_markers_by_map_id', array($this, 'p_get_markers_by_map_id'));
92
+ add_action('wp_ajax_nopriv_wpgmapembed_p_get_markers_by_map_id', array($this, 'p_get_markers_by_map_id'));
93
  add_action('wp_ajax_wgm_get_markers_by_map_id', array($this, 'wgm_get_markers_by_map_id_for_dt'));
 
94
  add_action('wp_ajax_wpgmapembed_delete_marker', array($this, 'delete_marker'));
95
  add_action('wp_ajax_wpgmapembed_get_marker_data_by_marker_id', array($this, 'get_marker_data_by_marker_id'));
96
  }
includes/Classes/Migration.php CHANGED
@@ -97,7 +97,7 @@ class Migration
97
  'file_name' => $map_marker_data['icon']
98
  );
99
 
100
- $is_marker_icon_already_exist = $wpdb->get_var($wpdb->prepare("SELECT COUNT(id) FROM {$wpdb->prefix}wgm_icons WHERE file_name='%'",$map_marker_data['icon']));
101
  if ($is_marker_icon_already_exist == 0) {
102
  $defaults = array(
103
  'type' => 'uploaded_marker_icon',
97
  'file_name' => $map_marker_data['icon']
98
  );
99
 
100
+ $is_marker_icon_already_exist = $wpdb->get_var($wpdb->prepare("SELECT COUNT(id) FROM {$wpdb->prefix}wgm_icons WHERE file_name='%s'",$map_marker_data['icon']));
101
  if ($is_marker_icon_already_exist == 0) {
102
  $defaults = array(
103
  'type' => 'uploaded_marker_icon',
includes/Traits/InitActions.php CHANGED
@@ -30,7 +30,7 @@ trait InitActions
30
  add_action('gmap_embed_review_already_did', array($this, 'review_already_did'));
31
  add_action('gmap_embed_review_later', array($this, 'review_later'));
32
  if (isset($_GET['plugin'])) {
33
- $plugin = sanitize_text_field(esc_html(($_GET['plugin'])));
34
  if ($plugin === $this->plugin_slug) {
35
  if (isset($_GET['dismiss']) and sanitize_text_field(esc_html($_GET['dismiss'])) == 1) {
36
  do_action('gmap_embed_review_already_did');
30
  add_action('gmap_embed_review_already_did', array($this, 'review_already_did'));
31
  add_action('gmap_embed_review_later', array($this, 'review_later'));
32
  if (isset($_GET['plugin'])) {
33
+ $plugin = sanitize_text_field(esc_html($_GET['plugin']));
34
  if ($plugin === $this->plugin_slug) {
35
  if (isset($_GET['dismiss']) and sanitize_text_field(esc_html($_GET['dismiss'])) == 1) {
36
  do_action('gmap_embed_review_already_did');
includes/Traits/MarkerCRUD.php CHANGED
@@ -201,6 +201,14 @@ trait MarkerCRUD
201
  */
202
  public function get_marker_icons()
203
  {
 
 
 
 
 
 
 
 
204
  ob_start();
205
  require_once WGM_PLUGIN_PATH . 'admin/includes/markers-icons.php';
206
  echo ob_get_clean();
@@ -275,6 +283,42 @@ trait MarkerCRUD
275
  * Get all markers by map id
276
  */
277
  public function get_markers_by_map_id()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
278
  {
279
  if (!wp_verify_nonce(sanitize_text_field(esc_html($_POST['data']['ajax_nonce'])), 'ajax_nonce')) {
280
  die ('Busted!');
@@ -305,6 +349,13 @@ trait MarkerCRUD
305
  */
306
  public function wgm_get_markers_by_map_id_for_dt()
307
  {
 
 
 
 
 
 
 
308
  $return_json = array();
309
  global $wpdb;
310
  $map_id = intval(sanitize_text_field(esc_html($_GET['map_id'])));
@@ -363,6 +414,14 @@ trait MarkerCRUD
363
  */
364
  public function get_marker_data_by_marker_id()
365
  {
 
 
 
 
 
 
 
 
366
  global $wpdb;
367
  $marker_id = sanitize_text_field(esc_html(($_POST['data']['marker_id'])));
368
  $result = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->prefix}wgm_markers WHERE id='%d'", $marker_id), OBJECT);
201
  */
202
  public function get_marker_icons()
203
  {
204
+ if (!current_user_can('administrator')) {
205
+ $returnArray = array(
206
+ 'responseCode' => 0,
207
+ 'message' => "Unauthorized access tried."
208
+ );
209
+ echo json_encode($returnArray);
210
+ wp_die();
211
+ }
212
  ob_start();
213
  require_once WGM_PLUGIN_PATH . 'admin/includes/markers-icons.php';
214
  echo ob_get_clean();
283
  * Get all markers by map id
284
  */
285
  public function get_markers_by_map_id()
286
+ {
287
+ if (!current_user_can('administrator')) {
288
+ echo json_encode(array(
289
+ 'responseCode' => 0,
290
+ 'message' => 'Unauthorized access tried.'
291
+ ));
292
+ wp_die();
293
+ }
294
+ if (!wp_verify_nonce(sanitize_text_field(esc_html($_POST['data']['ajax_nonce'])), 'ajax_nonce')) {
295
+ die ('Busted!');
296
+ }
297
+
298
+ global $wpdb;
299
+ $map_id = sanitize_text_field(esc_html($_POST['data']['map_id']));
300
+ $filtered_map_markers = [];
301
+ $map_markers = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}wgm_markers WHERE map_id='%d'", $map_id));
302
+ if (count($map_markers) > 0) {
303
+ foreach ($map_markers as $key => $map_marker) {
304
+ $map_marker->marker_desc = wp_unslash(html_entity_decode($map_marker->marker_desc));
305
+ $filtered_map_markers[$key] = $map_marker;
306
+ }
307
+
308
+ }
309
+ $returnArray = array(
310
+ 'responseCode' => 1,
311
+ 'markers' => $filtered_map_markers
312
+ );
313
+ $returnArray['message'] = 'Markers fetched successfully.';
314
+ echo json_encode($returnArray);
315
+ wp_die();
316
+ }
317
+
318
+ /**
319
+ * Public Get all markers by map id
320
+ */
321
+ public function p_get_markers_by_map_id()
322
  {
323
  if (!wp_verify_nonce(sanitize_text_field(esc_html($_POST['data']['ajax_nonce'])), 'ajax_nonce')) {
324
  die ('Busted!');
349
  */
350
  public function wgm_get_markers_by_map_id_for_dt()
351
  {
352
+ if (!current_user_can('administrator')) {
353
+ echo json_encode(array(
354
+ 'responseCode' => 0,
355
+ 'message' => 'Unauthorized access tried.'
356
+ ));
357
+ wp_die();
358
+ }
359
  $return_json = array();
360
  global $wpdb;
361
  $map_id = intval(sanitize_text_field(esc_html($_GET['map_id'])));
414
  */
415
  public function get_marker_data_by_marker_id()
416
  {
417
+ if (!current_user_can('administrator')) {
418
+ $returnArray = array(
419
+ 'responseCode' => 0,
420
+ 'message' => "Unauthorized access tried."
421
+ );
422
+ echo json_encode($returnArray);
423
+ wp_die();
424
+ }
425
  global $wpdb;
426
  $marker_id = sanitize_text_field(esc_html(($_POST['data']['marker_id'])));
427
  $result = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->prefix}wgm_markers WHERE id='%d'", $marker_id), OBJECT);
public/includes/shortcodes.php CHANGED
@@ -95,7 +95,7 @@ if (!function_exists('srm_gmap_embed_shortcode')) {
95
  });
96
  <?php }?>
97
  var wgm_data_<?php echo $count;?> = {
98
- 'action': 'wpgmapembed_get_markers_by_map_id',
99
  'data': {
100
  map_id: '<?php echo $wgm_map_id;?>',
101
  ajax_nonce: '<?php echo wp_create_nonce('ajax_nonce'); ?>'
@@ -110,7 +110,9 @@ if (!function_exists('srm_gmap_embed_shortcode')) {
110
  }
111
  var wgm_default_marker_icon_<?php echo $count;?> = 'https://maps.gstatic.com/mapfiles/api-3/images/spotlight-poi2.png';
112
  if (response.markers.length > 0) {
113
- response.markers.forEach(function (wgm_marker) {
 
 
114
  var wgm_marker_lat_lng_<?php echo $count;?> = wgm_marker.lat_lng.split(',');
115
  wgm_custom_marker_<?php echo $count;?> = new google.maps.Marker({
116
  position: new google.maps.LatLng(wgm_marker_lat_lng_<?php echo $count;?>[0], wgm_marker_lat_lng_<?php echo $count;?>[1]),
@@ -118,6 +120,7 @@ if (!function_exists('srm_gmap_embed_shortcode')) {
118
  animation: google.maps.Animation.DROP,
119
  icon: (wgm_marker.icon === '') ? wgm_default_marker_icon_<?php echo $count;?> : wgm_marker.icon
120
  });
 
121
  wgm_custom_marker_<?php echo $count;?>.setMap(wgm_map);
122
  var wgm_marker_name_<?php echo $count;?> = (wgm_marker.marker_name !== null) ? ('<span class="info_content_title" style="font-size:18px;font-weight: bold;font-family: Arial;">'
123
  + wgm_marker.marker_name +
@@ -126,11 +129,19 @@ if (!function_exists('srm_gmap_embed_shortcode')) {
126
  custom_marker_infowindow = new google.maps.InfoWindow({
127
  content: wgm_marker_name_<?php echo $count;?> + wgm_marker.marker_desc
128
  });
 
129
  if (wgm_marker.show_desc_by_default === '1') {
130
  custom_marker_infowindow.open({
131
  anchor: wgm_custom_marker_<?php echo $count;?>,
132
  shouldFocus: false
133
  });
 
 
 
 
 
 
 
134
  }
135
  if (wgm_marker.have_marker_link === '1') {
136
  google.maps.event.addListener(wgm_custom_marker_<?php echo $count;?>, 'click', function () {
95
  });
96
  <?php }?>
97
  var wgm_data_<?php echo $count;?> = {
98
+ 'action': 'wpgmapembed_p_get_markers_by_map_id',
99
  'data': {
100
  map_id: '<?php echo $wgm_map_id;?>',
101
  ajax_nonce: '<?php echo wp_create_nonce('ajax_nonce'); ?>'
110
  }
111
  var wgm_default_marker_icon_<?php echo $count;?> = 'https://maps.gstatic.com/mapfiles/api-3/images/spotlight-poi2.png';
112
  if (response.markers.length > 0) {
113
+ var custom_markers = [];
114
+ var custom_marker_infowindows = [];
115
+ response.markers.forEach(function (wgm_marker, i) {
116
  var wgm_marker_lat_lng_<?php echo $count;?> = wgm_marker.lat_lng.split(',');
117
  wgm_custom_marker_<?php echo $count;?> = new google.maps.Marker({
118
  position: new google.maps.LatLng(wgm_marker_lat_lng_<?php echo $count;?>[0], wgm_marker_lat_lng_<?php echo $count;?>[1]),
120
  animation: google.maps.Animation.DROP,
121
  icon: (wgm_marker.icon === '') ? wgm_default_marker_icon_<?php echo $count;?> : wgm_marker.icon
122
  });
123
+ custom_markers[i] = wgm_custom_marker_<?php echo $count;?>;
124
  wgm_custom_marker_<?php echo $count;?>.setMap(wgm_map);
125
  var wgm_marker_name_<?php echo $count;?> = (wgm_marker.marker_name !== null) ? ('<span class="info_content_title" style="font-size:18px;font-weight: bold;font-family: Arial;">'
126
  + wgm_marker.marker_name +
129
  custom_marker_infowindow = new google.maps.InfoWindow({
130
  content: wgm_marker_name_<?php echo $count;?> + wgm_marker.marker_desc
131
  });
132
+ custom_marker_infowindows[i] = custom_marker_infowindow;
133
  if (wgm_marker.show_desc_by_default === '1') {
134
  custom_marker_infowindow.open({
135
  anchor: wgm_custom_marker_<?php echo $count;?>,
136
  shouldFocus: false
137
  });
138
+ }else{
139
+ google.maps.event.addListener(wgm_custom_marker_<?php echo $count;?>, 'click', function () {
140
+ custom_marker_infowindows[i].open({
141
+ anchor: custom_markers[i],
142
+ shouldFocus: false
143
+ });
144
+ });
145
  }
146
  if (wgm_marker.have_marker_link === '1') {
147
  google.maps.event.addListener(wgm_custom_marker_<?php echo $count;?>, 'click', function () {
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, map, maps, google maps, map markers, google map plugin, google map embed, google maps plugin, wp google map, map plugin, map embed, best google maps, store locator, map direction, map widget, street view
5
  Requires at least: 2.9
6
  Tested up to: 5.8
7
- Version: 1.8.1
8
- Stable tag: 1.8.1
9
  Requires PHP: 5.3
10
  Text Domain: gmap-embed
11
  License: GPLv2 or later
@@ -199,6 +199,13 @@ Learn more about how [Appsero collects and uses this data](https://appsero.com/p
199
 
200
  == Changelog ==
201
 
 
 
 
 
 
 
 
202
  = 1.8.1 =
203
  * Hot fix: Security issue fixed.
204
 
4
  Tags: google map, map, maps, google maps, map markers, google map plugin, google map embed, google maps plugin, wp google map, map plugin, map embed, best google maps, store locator, map direction, map widget, street view
5
  Requires at least: 2.9
6
  Tested up to: 5.8
7
+ Version: 1.8.2
8
+ Stable tag: 1.8.2
9
  Requires PHP: 5.3
10
  Text Domain: gmap-embed
11
  License: GPLv2 or later
199
 
200
  == Changelog ==
201
 
202
+ = 1.8.3 =
203
+ * Ajax Security issues resolved
204
+ * Marker Edit page minor bug fixing
205
+
206
+ = 1.8.2 =
207
+ * Clickable marker infowindow introduced.
208
+
209
  = 1.8.1 =
210
  * Hot fix: Security issue fixed.
211
 
srm_gmap_embed.php CHANGED
@@ -7,7 +7,7 @@
7
  Text Domain: gmap-embed
8
  Domain Path: /languages
9
  Author URI: https://www.srmilon.info?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash
10
- Version: 1.8.1
11
  */
12
 
13
  use WGMSRM\Classes\Database;
@@ -16,7 +16,7 @@ if (!defined('ABSPATH')) {
16
  exit;
17
  }
18
 
19
- define('WGM_PLUGIN_VERSION', '1.8.0');
20
  define('WGM_PLUGIN_PATH', trailingslashit(plugin_dir_path(__FILE__)));
21
  define('WGM_PLUGIN_URL', trailingslashit(plugins_url('/', __FILE__)));
22
 
7
  Text Domain: gmap-embed
8
  Domain Path: /languages
9
  Author URI: https://www.srmilon.info?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash
10
+ Version: 1.8.2
11
  */
12
 
13
  use WGMSRM\Classes\Database;
16
  exit;
17
  }
18
 
19
+ define('WGM_PLUGIN_VERSION', '1.8.3');
20
  define('WGM_PLUGIN_PATH', trailingslashit(plugin_dir_path(__FILE__)));
21
  define('WGM_PLUGIN_URL', trailingslashit(plugins_url('/', __FILE__)));
22