WP Google Map - Version 1.8.9

Version Description

  • Copy to clipboard for map shortcode
  • Default markers bundle added
  • CADATA introduced for frontend
  • Auto-Complete/Auto suggestion option added for direction From/To input field
  • Added Distance Unit (Miles and KM) configurable
Download this release

Release Info

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

Code changes from version 1.8.8 to 1.8.9

admin/assets/js/common.js CHANGED
@@ -223,7 +223,7 @@
223
  icon: 'info',
224
  showCloseButton: true,
225
  title: wgm_l.locales.sweet_alert.oops,
226
- html: wgm_notice_text + '<br><br><span style="font-size:25px;font-weight:bold;">Only $10 for Lifetime</span><br><br><a target="_blank" href="' + wgm_l.get_p_v_url + '">Upgrade to Pro</a>',
227
  confirmButtonText: 'Close',
228
  }
229
  );
223
  icon: 'info',
224
  showCloseButton: true,
225
  title: wgm_l.locales.sweet_alert.oops,
226
+ html: wgm_notice_text + '<br><br><span style="font-size:25px;font-weight:bold;">Only $19 for Lifetime</span><br><br><a target="_blank" href="' + wgm_l.get_p_v_url + '">Upgrade to Pro</a>',
227
  confirmButtonText: 'Close',
228
  }
229
  );
admin/assets/js/wgm_marker_crud.js CHANGED
@@ -127,7 +127,7 @@
127
  {
128
  icon: 'info',
129
  title: wgm_l.locales.sweet_alert.oops,
130
- html: wgm_l.locales.sweet_alert.notice_unlimited_marker + '<br><br><span style="font-size:25px;font-weight:bold;">Only $10 for Lifetime</span><br><br><a target="_blank" href="' + wgm_l.get_p_v_url + '">Upgrade to Pro Version (Only $10 for Lifetime)</a>'
131
  }
132
  );
133
  parent.find( '.spinner' ).css( 'visibility', 'hidden' );
@@ -174,7 +174,7 @@
174
  {
175
  icon: 'info',
176
  title: wgm_l.locales.sweet_alert.oops,
177
- html: wgm_l.locales.sweet_alert.notice_unlimited_marker + '<br><br><span style="font-size:25px;font-weight:bold;">Only $10 for Lifetime</span><br><br><a target="_blank" href="' + wgm_l.get_p_v_url + '">Upgrade to Pro Version (Only $10 for Lifetime)</a>'
178
  }
179
  );
180
  return false;
127
  {
128
  icon: 'info',
129
  title: wgm_l.locales.sweet_alert.oops,
130
+ html: wgm_l.locales.sweet_alert.notice_unlimited_marker + '<br><br><span style="font-size:25px;font-weight:bold;">Only $19 for Lifetime</span><br><br><a target="_blank" href="' + wgm_l.get_p_v_url + '">Upgrade to Pro Version (Only $19 for Lifetime)</a>'
131
  }
132
  );
133
  parent.find( '.spinner' ).css( 'visibility', 'hidden' );
174
  {
175
  icon: 'info',
176
  title: wgm_l.locales.sweet_alert.oops,
177
+ html: wgm_l.locales.sweet_alert.notice_unlimited_marker + '<br><br><span style="font-size:25px;font-weight:bold;">Only $19 for Lifetime</span><br><br><a target="_blank" href="' + wgm_l.get_p_v_url + '">Upgrade to Pro Version (Only $19 for Lifetime)</a>'
178
  }
179
  );
180
  return false;
admin/includes/markers-icons.php CHANGED
@@ -30,7 +30,7 @@
30
  $file_display = array( 'jpg', 'jpeg', 'png', 'gif' );
31
 
32
  if ( file_exists( $dir ) == false ) {
33
- echo 'Directory \'', $dir, '\' not found!';
34
 
35
  } else {
36
  $dir_contents = scandir( $dir );
30
  $file_display = array( 'jpg', 'jpeg', 'png', 'gif' );
31
 
32
  if ( file_exists( $dir ) == false ) {
33
+ echo 'Directory \'', esc_html($dir), '\' not found!';
34
 
35
  } else {
36
  $dir_contents = scandir( $dir );
admin/includes/wpgmap_create.php CHANGED
@@ -8,7 +8,7 @@
8
  <h1 class="wp-heading-inline"><?php esc_html_e( 'Add New Map', 'gmap-embed' ); ?></h1>
9
  <?php
10
  if ( ! _wgm_is_premium() ) {
11
- echo '<a target="_blank" href="' . esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_map_create&utm_medium=admin_link&utm_campaign=header_menu' ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-left:5px;"><i style="line-height: 25px;" class="dashicons dashicons-star-filled"></i> Upgrade ($10 only)</a>';
12
  }
13
  echo '<a target="_blank" href="' . esc_url( 'https://tawk.to/chat/6083e29962662a09efc1acd5/1f41iqarp' ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;background-color: #cb5757 !important;color: white !important;"><i style="line-height: 28px;" class="dashicons dashicons-format-chat"></i> ' . esc_html__( 'LIVE Chat', 'gmap-embed' ) . '</a>';
14
  echo '<a href="' . esc_url( admin_url( 'admin.php?page=wpgmapembed-support' ) ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;"><i style="line-height: 25px;" class="dashicons dashicons-editor-help"></i> ' . esc_html__( 'Documentation', 'gmap-embed' ) . '</a>';
8
  <h1 class="wp-heading-inline"><?php esc_html_e( 'Add New Map', 'gmap-embed' ); ?></h1>
9
  <?php
10
  if ( ! _wgm_is_premium() ) {
11
+ echo '<a target="_blank" href="' . esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_map_create&utm_medium=admin_link&utm_campaign=header_menu' ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-left:5px;"><i style="line-height: 25px;" class="dashicons dashicons-star-filled"></i> Upgrade ($19 only)</a>';
12
  }
13
  echo '<a target="_blank" href="' . esc_url( 'https://tawk.to/chat/6083e29962662a09efc1acd5/1f41iqarp' ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;background-color: #cb5757 !important;color: white !important;"><i style="line-height: 28px;" class="dashicons dashicons-format-chat"></i> ' . esc_html__( 'LIVE Chat', 'gmap-embed' ) . '</a>';
14
  echo '<a href="' . esc_url( admin_url( 'admin.php?page=wpgmapembed-support' ) ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;"><i style="line-height: 25px;" class="dashicons dashicons-editor-help"></i> ' . esc_html__( 'Documentation', 'gmap-embed' ) . '</a>';
admin/includes/wpgmap_edit.php CHANGED
@@ -22,7 +22,7 @@ list( $wpgmap_center_lat, $wpgmap_center_lng ) = explode( ',', esc_html( $wpgmap
22
  ?>
23
  <?php
24
  if ( ! _wgm_is_premium() ) {
25
- echo '<a target="_blank" href="' . esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_map_edit&utm_medium=admin_link&utm_campaign=header_menu' ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-left:5px;"><i style="line-height: 25px;" class="dashicons dashicons-star-filled"></i> Upgrade ($10 only)</a>';
26
  }
27
  echo '<a target="_blank" href="' . esc_url( 'https://tawk.to/chat/6083e29962662a09efc1acd5/1f41iqarp' ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;background-color: #cb5757 !important;color: white !important;"><i style="line-height: 28px;" class="dashicons dashicons-format-chat"></i> ' . esc_html__( 'LIVE Chat', 'gmap-embed' ) . '</a>';
28
  echo '<a href="' . esc_url( admin_url( 'admin.php?page=wpgmapembed-support' ) ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;"><i style="line-height: 25px;" class="dashicons dashicons-editor-help"></i> ' . esc_html__( 'Documentation', 'gmap-embed' ) . '</a>';
22
  ?>
23
  <?php
24
  if ( ! _wgm_is_premium() ) {
25
+ echo '<a target="_blank" href="' . esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_map_edit&utm_medium=admin_link&utm_campaign=header_menu' ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-left:5px;"><i style="line-height: 25px;" class="dashicons dashicons-star-filled"></i> Upgrade ($19 only)</a>';
26
  }
27
  echo '<a target="_blank" href="' . esc_url( 'https://tawk.to/chat/6083e29962662a09efc1acd5/1f41iqarp' ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;background-color: #cb5757 !important;color: white !important;"><i style="line-height: 28px;" class="dashicons dashicons-format-chat"></i> ' . esc_html__( 'LIVE Chat', 'gmap-embed' ) . '</a>';
28
  echo '<a href="' . esc_url( admin_url( 'admin.php?page=wpgmapembed-support' ) ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;"><i style="line-height: 25px;" class="dashicons dashicons-editor-help"></i> ' . esc_html__( 'Documentation', 'gmap-embed' ) . '</a>';
admin/includes/wpgmap_installation_manuals.php CHANGED
@@ -19,6 +19,6 @@
19
  </li>
20
  <li>
21
  <a href="<?php echo esc_url( 'https://wpgooglemap.com/documentation/how-to-get-your-license-key?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_installation' ); ?>"
22
- target="_blank"><i class="fa fa-link"></i>How to get your Lifetime License key? ($10 only)?</a>
23
  </li>
24
  </ul>
19
  </li>
20
  <li>
21
  <a href="<?php echo esc_url( 'https://wpgooglemap.com/documentation/how-to-get-your-license-key?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_installation' ); ?>"
22
+ target="_blank"><i class="fa fa-link"></i>How to get your Lifetime License key? ($19 only)?</a>
23
  </li>
24
  </ul>
admin/includes/wpgmap_list.php CHANGED
@@ -18,7 +18,7 @@ require_once WGM_PLUGIN_PATH . '/includes/helper.php';
18
  echo '<a href="#" class="page-title-action wgm_enable_premium" style="opacity: .3" data-notice="' . esc_html__( sprintf( __( 'You need to upgrade to the <a target="_blank" href="%s">Premium</a> Version to <b> Create Unlimited Maps</b>.', 'gmap-embed' ), esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_map_list&utm_medium=admin_link&utm_campaign=add_new_map' ) ) ) . '">Add New</a><sup class="wgm-pro-label">Pro</sup>';
19
  }
20
  if ( ! _wgm_is_premium() ) {
21
- echo '<a target="_blank" href="' . esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_map_list&utm_medium=admin_link&utm_campaign=header_menu' ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-left:5px;"><i style="line-height: 25px;" class="dashicons dashicons-star-filled"></i> Upgrade ($10 only)</a>';
22
  }
23
  echo '<a target="_blank" href="' . esc_url( 'https://tawk.to/chat/6083e29962662a09efc1acd5/1f41iqarp' ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;background-color: #cb5757 !important;color: white !important;"><i style="line-height: 28px;" class="dashicons dashicons-format-chat"></i> ' . esc_html__( 'LIVE Chat', 'gmap-embed' ) . '</a>';
24
  echo '<a href="' . esc_url( admin_url( 'admin.php?page=wpgmapembed-support' ) ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;"><i style="line-height: 25px;" class="dashicons dashicons-editor-help"></i> ' . esc_html__( 'Documentation', 'gmap-embed' ) . '</a>';
18
  echo '<a href="#" class="page-title-action wgm_enable_premium" style="opacity: .3" data-notice="' . esc_html__( sprintf( __( 'You need to upgrade to the <a target="_blank" href="%s">Premium</a> Version to <b> Create Unlimited Maps</b>.', 'gmap-embed' ), esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_map_list&utm_medium=admin_link&utm_campaign=add_new_map' ) ) ) . '">Add New</a><sup class="wgm-pro-label">Pro</sup>';
19
  }
20
  if ( ! _wgm_is_premium() ) {
21
+ echo '<a target="_blank" href="' . esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_map_list&utm_medium=admin_link&utm_campaign=header_menu' ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-left:5px;"><i style="line-height: 25px;" class="dashicons dashicons-star-filled"></i> Upgrade ($19 only)</a>';
22
  }
23
  echo '<a target="_blank" href="' . esc_url( 'https://tawk.to/chat/6083e29962662a09efc1acd5/1f41iqarp' ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;background-color: #cb5757 !important;color: white !important;"><i style="line-height: 28px;" class="dashicons dashicons-format-chat"></i> ' . esc_html__( 'LIVE Chat', 'gmap-embed' ) . '</a>';
24
  echo '<a href="' . esc_url( admin_url( 'admin.php?page=wpgmapembed-support' ) ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;"><i style="line-height: 25px;" class="dashicons dashicons-editor-help"></i> ' . esc_html__( 'Documentation', 'gmap-embed' ) . '</a>';
admin/includes/wpgmap_settings.php CHANGED
@@ -49,7 +49,7 @@ if ( isset( $_POST['wpgmapembed_license'] ) ) {
49
 
50
 
51
  $response = array();
52
- $request = wp_remote_get( esc_url( $h . '/paypal/api.php?key=' . $wpgmapembed_license . '&ip=' . $ip . '&host=' . $host ) );
53
  $http_code = wp_remote_retrieve_response_code( $request );
54
  if ( $http_code === 200 ) {
55
  $body = wp_remote_retrieve_body( $request );
@@ -74,7 +74,7 @@ if ( isset( $_POST['wpgmapembed_license'] ) ) {
74
  <h1 class="wp-heading-inline"><?php esc_html_e( 'Settings', 'gmap-embed' ); ?></h1>
75
  <?php
76
  if ( ! _wgm_is_premium() ) {
77
- echo '<a target="_blank" href="' . esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_settings&utm_medium=admin_link&utm_campaign=header_menu' ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-left:5px;"><i style="line-height: 25px;" class="dashicons dashicons-star-filled"></i> Upgrade ($10 only)</a>';
78
  }
79
  echo '<a target="_blank" href="' . esc_url( 'https://tawk.to/chat/6083e29962662a09efc1acd5/1f41iqarp' ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;background-color: #cb5757 !important;color: white !important;"><i style="line-height: 28px;" class="dashicons dashicons-format-chat"></i> ' . esc_html__( 'LIVE Chat', 'gmap-embed' ) . '</a>';
80
  echo '<a href="' . esc_url( admin_url( 'admin.php?page=wpgmapembed-support' ) ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;"><i style="line-height: 25px;" class="dashicons dashicons-editor-help"></i> ' . esc_html__( 'Documentation', 'gmap-embed' ) . '</a>';
49
 
50
 
51
  $response = array();
52
+ $request = wp_remote_get( esc_url_raw( $h . '/paypal/api.php?key=' . $wpgmapembed_license . '&ip=' . $ip . '&host=' . $host ) );
53
  $http_code = wp_remote_retrieve_response_code( $request );
54
  if ( $http_code === 200 ) {
55
  $body = wp_remote_retrieve_body( $request );
74
  <h1 class="wp-heading-inline"><?php esc_html_e( 'Settings', 'gmap-embed' ); ?></h1>
75
  <?php
76
  if ( ! _wgm_is_premium() ) {
77
+ echo '<a target="_blank" href="' . esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_settings&utm_medium=admin_link&utm_campaign=header_menu' ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-left:5px;"><i style="line-height: 25px;" class="dashicons dashicons-star-filled"></i> Upgrade ($19 only)</a>';
78
  }
79
  echo '<a target="_blank" href="' . esc_url( 'https://tawk.to/chat/6083e29962662a09efc1acd5/1f41iqarp' ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;background-color: #cb5757 !important;color: white !important;"><i style="line-height: 28px;" class="dashicons dashicons-format-chat"></i> ' . esc_html__( 'LIVE Chat', 'gmap-embed' ) . '</a>';
80
  echo '<a href="' . esc_url( admin_url( 'admin.php?page=wpgmapembed-support' ) ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;"><i style="line-height: 25px;" class="dashicons dashicons-editor-help"></i> ' . esc_html__( 'Documentation', 'gmap-embed' ) . '</a>';
admin/includes/wpgmap_support.php CHANGED
@@ -4,7 +4,7 @@
4
  <h1 class="wp-heading-inline"><?php esc_html_e( 'Support', 'gmap-embed' ); ?></h1>
5
  <?php
6
  if ( ! _wgm_is_premium() ) {
7
- echo '<a target="_blank" href="' . esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_support&utm_medium=admin_link&utm_campaign=header_menu' ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-left:5px;"><i style="line-height: 25px;" class="dashicons dashicons-star-filled"></i> Upgrade ($10 only)</a>';
8
  }
9
 
10
 
4
  <h1 class="wp-heading-inline"><?php esc_html_e( 'Support', 'gmap-embed' ); ?></h1>
5
  <?php
6
  if ( ! _wgm_is_premium() ) {
7
+ echo '<a target="_blank" href="' . esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_support&utm_medium=admin_link&utm_campaign=header_menu' ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-left:5px;"><i style="line-height: 25px;" class="dashicons dashicons-star-filled"></i> Upgrade ($19 only)</a>';
8
  }
9
 
10
 
includes/Traits/ActionLinks.php CHANGED
@@ -20,7 +20,7 @@ trait ActionLinks {
20
  public function gmap_srm_settings_link( $actions ) {
21
  $links = array();
22
  if ( ! _wgm_is_premium() ) {
23
- $links['upgrade-to-pro'] = '<a target="_blank" style="color: #11967A;font-weight:bold;" href="' . esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_plugins&utm_medium=admin_link&utm_campaign=plugin_action_link' ) . '">' . __( 'Upgrade To Pro ($10 only)' ) . '</a>';
24
  }
25
  $links['rate-us'] = '<a target="_blank" href="' . esc_url( 'https://wordpress.org/support/plugin/gmap-embed/reviews/#new-post' ) . '">' . __( 'Rate Us' ) . '</a>';
26
  $links['support'] = '<a target="_blank" href="' . esc_url( 'https://wordpress.org/support/plugin/gmap-embed/#new-topic-0' ) . '">' . __( 'Support' ) . '</a>';
20
  public function gmap_srm_settings_link( $actions ) {
21
  $links = array();
22
  if ( ! _wgm_is_premium() ) {
23
+ $links['upgrade-to-pro'] = '<a target="_blank" style="color: #11967A;font-weight:bold;" href="' . esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_plugins&utm_medium=admin_link&utm_campaign=plugin_action_link' ) . '">' . __( 'Upgrade To Pro ($19 only)' ) . '</a>';
24
  }
25
  $links['rate-us'] = '<a target="_blank" href="' . esc_url( 'https://wordpress.org/support/plugin/gmap-embed/reviews/#new-post' ) . '">' . __( 'Rate Us' ) . '</a>';
26
  $links['support'] = '<a target="_blank" href="' . esc_url( 'https://wordpress.org/support/plugin/gmap-embed/#new-topic-0' ) . '">' . __( 'Support' ) . '</a>';
includes/Traits/AssetHandler.php CHANGED
@@ -101,6 +101,7 @@ trait AssetHandler {
101
  'd_m_w_z' => esc_html( get_option( '_wgm_disable_mouse_wheel_zoom', 'N' ) ),
102
  'd_m_d' => esc_html( get_option( '_wgm_disable_mouse_dragging', 'N' ) ),
103
  'd_m_d_c_z' => esc_html( get_option( '_wgm_disable_mouse_double_click_zooming', 'N' ) ),
 
104
  )
105
  );
106
  }
101
  'd_m_w_z' => esc_html( get_option( '_wgm_disable_mouse_wheel_zoom', 'N' ) ),
102
  'd_m_d' => esc_html( get_option( '_wgm_disable_mouse_dragging', 'N' ) ),
103
  'd_m_d_c_z' => esc_html( get_option( '_wgm_disable_mouse_double_click_zooming', 'N' ) ),
104
+ 'e_d_f_a_c' => esc_html( get_option( '_wgm_enable_direction_form_auto_complete', 'N' ) ),
105
  )
106
  );
107
  }
includes/Traits/Settings.php CHANGED
@@ -4,298 +4,343 @@ namespace WGMSRM\Traits;
4
 
5
  use WGMSRM\Classes\Migration;
6
 
7
- if ( ! defined( 'ABSPATH' ) ) {
8
- exit;
9
  }
10
 
11
  /**
12
  * Trait Settings
13
  */
14
- trait Settings {
 
15
 
16
- /**
17
- * Settings section callback code(BLANK NOW)
18
- */
19
- public function gmap_embed_settings_section_callback() {
20
- // code...
21
- }
 
22
 
23
- /**
24
- * Custom CSS part markup
25
- */
26
- public function gmap_embed_s_custom_css_markup() { ?>
27
- <textarea rows="10" cols="100" name="wpgmap_s_custom_css"
28
- id="wpgmap_custom_css"><?php echo esc_html( get_option( 'wpgmap_s_custom_css' ) ); ?></textarea>
29
- <p class="description" id="tagline-description" style="font-style: italic;">
30
- <?php esc_html_e( 'Add your custom CSS code if needed.', 'gmap-embed' ); ?>
31
- </p>
32
- <?php
33
- }
 
34
 
35
- /**
36
- * Custom JS part markup
37
- */
38
- public function wpgmap_s_custom_js_markup() {
39
- ?>
40
- <textarea rows="10" cols="100" name="wpgmap_s_custom_js"
41
- id="wpgmap_custom_js"><?php echo esc_html( get_option( 'wpgmap_s_custom_js' ) ); ?></textarea>
42
- <p class="description" id="tagline-description" style="font-style: italic;">
43
- <?php esc_html_e( 'Add your custom JS code if needed.', 'gmap-embed' ); ?>
44
- </p>
45
- <?php
46
- }
 
47
 
48
- /**
49
- * Where Map API engine should be -> Markup
50
- *
51
- * @since 1.7.5
52
- */
53
- public function wgm_load_api_condition_markup() {
54
- ?>
55
- <select name="_wgm_load_map_api_condition" id="_wgm_load_map_api_condition">
56
- <option value="where-required" <?php echo esc_attr( get_option( '_wgm_load_map_api_condition' ) == 'where-required' ? 'selected' : '' ); ?>>
57
- Where required
58
- </option>
59
- <option value="always" <?php echo esc_attr( get_option( '_wgm_load_map_api_condition' ) == 'always' ? 'selected' : '' ); ?>>
60
- Always
61
- </option>
62
- <option value="only-front-end" <?php echo esc_attr( get_option( '_wgm_load_map_api_condition' ) == 'only-front-end' ? 'selected' : '' ); ?>>
63
- Only Front End
64
- </option>
65
- <option value="only-back-end" <?php echo esc_attr( get_option( '_wgm_load_map_api_condition' ) == 'only-back-end' ? 'selected' : '' ); ?>>
66
- Only Back End
67
- </option>
68
- <option value="never" <?php echo esc_attr( get_option( '_wgm_load_map_api_condition' ) == 'never' ? 'selected' : '' ); ?>>
69
- Never
70
- </option>
71
- </select>
72
- <?php
73
- }
 
74
 
75
- /**
76
- * Prevent API load by other plugin or theme markup
77
- *
78
- * @since 1.7.5
79
- */
80
- public function wgm_prevent_api_load_markup() {
81
- ?>
82
- <input type="checkbox" name="_wgm_prevent_other_plugin_theme_api_load"
83
- id="_wgm_prevent_other_plugin_theme_api_load"
84
- value="Y" <?php echo esc_attr( get_option( '_wgm_prevent_other_plugin_theme_api_load' ) == 'Y' ? 'checked="checked"' : '' ); ?>> Check this option if your want to prevent other plugin or theme loading map api, in case of you are getting api key error, included multiple api key error.
85
- <br/>
86
- <?php
87
- }
 
 
 
 
 
88
 
89
- /**
90
- * General Map Settings under General Settings
91
- *
92
- * @since 1.7.5
93
- */
94
- public function wgm_general_map_settings_markup() {
95
- ?>
96
- <input type="checkbox" name="_wgm_disable_full_screen_control" id="_wgm_disable_full_screen_control"
97
- value="Y" <?php echo esc_attr( get_option( '_wgm_disable_full_screen_control' ) == 'Y' ? 'checked="checked"' : '' ); ?>> Disable Full Screen Control
98
- <br/>
99
- <input type="checkbox" name="_wgm_disable_street_view" id="_wgm_disable_street_view"
100
- value="Y" <?php echo esc_attr( get_option( '_wgm_disable_street_view' ) == 'Y' ? 'checked="checked"' : '' ); ?>> Disable StreetView
101
- <br/>
102
- <input type="checkbox" name="_wgm_disable_zoom_control" id="_wgm_disable_zoom_control"
103
- value="Y" <?php echo esc_attr( get_option( '_wgm_disable_zoom_control' ) == 'Y' ? 'checked="checked"' : '' ); ?>> Disable Zoom Controls
104
- <br/>
105
- <input type="checkbox" name="_wgm_disable_pan_control" id="_wgm_disable_pan_control"
106
- value="Y" <?php echo esc_attr( get_option( '_wgm_disable_pan_control' ) == 'Y' ? 'checked="checked"' : '' ); ?>> Disable Pan Controls
107
- <br/>
108
- <input type="checkbox" name="_wgm_disable_map_type_control" id="_wgm_disable_map_type_control"
109
- value="Y" <?php echo esc_attr( get_option( '_wgm_disable_map_type_control' ) == 'Y' ? 'checked="checked"' : '' ); ?>> Disable Map Type Controls
110
- <br/>
111
- <input type="checkbox" name="_wgm_disable_mouse_wheel_zoom" id="_wgm_disable_mouse_wheel_zoom"
112
- value="Y" <?php echo esc_attr( get_option( '_wgm_disable_mouse_wheel_zoom' ) == 'Y' ? 'checked="checked"' : '' ); ?>> Disable Mouse Wheel Zoom
113
- <br/>
114
- <input type="checkbox" name="_wgm_disable_mouse_dragging" id="_wgm_disable_mouse_dragging"
115
- value="Y" <?php echo esc_attr( get_option( '_wgm_disable_mouse_dragging' ) == 'Y' ? 'checked="checked"' : '' ); ?>> Disable Mouse Dragging
116
- <br/>
117
- <input type="checkbox" name="_wgm_disable_mouse_double_click_zooming"
118
- id="_wgm_disable_mouse_double_click_zooming"
119
- value="Y" <?php echo esc_attr( get_option( '_wgm_disable_mouse_double_click_zooming' ) == 'Y' ? 'checked="checked"' : '' ); ?>> Disable Mouse Double Click Zooming
120
- <br/>
121
- <?php
122
- }
123
 
124
- /**
125
- * Language selection part markup
126
- */
127
- public function gmap_embed_s_map_language_markup() {
128
- ?>
129
- <select id="srm_gmap_lng" name="srm_gmap_lng" class="regular-text" style="width: 100%;max-width:100%;">
130
- <?php
131
- $wpgmap_languages = gmap_embed_get_languages();
132
- if ( count( $wpgmap_languages ) > 0 ) {
133
- foreach ( $wpgmap_languages as $lng_key => $language ) {
134
- $selected = '';
135
- if ( get_option( 'srm_gmap_lng', 'en' ) == $lng_key ) {
136
- $selected = 'selected';
137
- }
138
- echo "<option value='" . esc_attr( $lng_key ) . "' " . esc_attr( $selected ) . '>' . esc_html( $language ) . '</option>';
139
- }
140
- }
141
- ?>
142
- </select>
143
- <p class="description" id="tagline-description" style="font-style: italic;">
144
- <?php esc_html_e( 'Chose your desired map language', 'gmap-embed' ); ?>
145
- </p>
146
- <?php
147
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
 
149
- /**
150
- * Region selection part markup
151
- */
152
- public function gmap_embed_s_map_region_markup() {
153
- ?>
154
- <select id="region" name="srm_gmap_region" class="regular-text" style="width: 100%;max-width: 100%;">
155
- <?php
156
- $wpgmap_regions = gmap_embed_get_regions();
157
- if ( count( $wpgmap_regions ) > 0 ) {
158
- foreach ( $wpgmap_regions as $region_key => $region ) {
159
- $selected = '';
160
- if ( get_option( 'srm_gmap_region', 'US' ) == $region_key ) {
161
- $selected = 'selected';
162
- }
163
- echo "<option value='" . esc_attr( $region_key ) . "' " . esc_attr( $selected ) . '>' . esc_html( $region ) . '</option>';
164
- }
165
- }
166
- ?>
 
 
 
 
 
 
 
167
 
168
- </select>
169
- <p class="description" id="tagline-description" style="font-style: italic;">
170
- <?php esc_html_e( 'Chose your regional area', 'gmap-embed' ); ?>
171
- </p>
172
- <?php
173
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
174
 
175
- /**
176
- * Settings section, fields register
177
- */
178
- public function gmapsrm_settings() {
179
- // Language settings section and fields
180
- add_settings_section(
181
- 'gmap_embed_language_settings_section',
182
- __( 'Map Language and Regional Settings<hr/>', 'gmap-embed' ),
183
- array( $this, 'gmap_embed_settings_section_callback' ),
184
- 'gmap-embed-settings-page-ls'
185
- );
186
 
187
- add_settings_field(
188
- 'srm_gmap_lng',
189
- __( 'Map Language:', 'gmap-embed' ),
190
- array( $this, 'gmap_embed_s_map_language_markup' ),
191
- 'gmap-embed-settings-page-ls',
192
- 'gmap_embed_language_settings_section'
193
- );
 
 
 
 
 
194
 
195
- add_settings_field(
196
- 'srm_gmap_region',
197
- __( 'Map Region:', 'gmap-embed' ),
198
- array( $this, 'gmap_embed_s_map_region_markup' ),
199
- 'gmap-embed-settings-page-ls',
200
- 'gmap_embed_language_settings_section'
201
- );
202
 
203
- // Custom Scripts section and fields
204
- add_settings_section(
205
- 'gmap_embed_custom_scripts_section',
206
- __( 'Custom Scripts<hr/>', 'gmap-embed' ),
207
- array( $this, 'gmap_embed_settings_section_callback' ),
208
- 'gmap-embed-settings-page-cs'
209
- );
210
 
211
- add_settings_field(
212
- 'wpgmap_s_custom_css',
213
- __( 'Custom CSS:', 'gmap-embed' ),
214
- array( $this, 'gmap_embed_s_custom_css_markup' ),
215
- 'gmap-embed-settings-page-cs',
216
- 'gmap_embed_custom_scripts_section'
217
- );
218
 
219
- add_settings_field(
220
- 'wpgmap_s_custom_js',
221
- __( 'Custom JS:', 'gmap-embed' ),
222
- array( $this, 'wpgmap_s_custom_js_markup' ),
223
- 'gmap-embed-settings-page-cs',
224
- 'gmap_embed_custom_scripts_section'
225
- );
226
 
227
- /**
228
- * General map settings section and fields
229
- *
230
- * @since 1.7.5
231
- */
232
- add_settings_section(
233
- 'gmap_embed_general_map_settings_section',
234
- __( '', 'gmap-embed' ),
235
- array( $this, 'gmap_embed_settings_section_callback' ),
236
- 'gmap-embed-general-settings'
237
- );
238
 
239
- // General map settings related all fields are included
240
- add_settings_field(
241
- 'wpgm_disable_full_screen_control',
242
- __( 'Map Control Options:', 'gmap-embed' ),
243
- array( $this, 'wgm_general_map_settings_markup' ),
244
- 'gmap-embed-general-settings',
245
- 'gmap_embed_general_map_settings_section'
246
- );
 
 
 
247
 
248
- /**
249
- * Advance settings section and fields
250
- *
251
- * @since 1.7.5
252
- */
253
- add_settings_section(
254
- 'wgm_advance_settings_section',
255
- __( '', 'gmap-embed' ),
256
- array( $this, 'gmap_embed_settings_section_callback' ),
257
- 'wgm_advance_settings-page'
258
- );
259
 
260
- add_settings_field(
261
- '_wgm_load_map_api_condition',
262
- __( 'Load Map API:', 'gmap-embed' ),
263
- array( $this, 'wgm_load_api_condition_markup' ),
264
- 'wgm_advance_settings-page',
265
- 'wgm_advance_settings_section'
266
- );
 
 
 
 
267
 
268
- add_settings_field(
269
- '_wgm_prevent_other_plugin_theme_api_load',
270
- __( 'Prevent Map API loading for other plugin and themes:', 'gmap-embed' ),
271
- array( $this, 'wgm_prevent_api_load_markup' ),
272
- 'wgm_advance_settings-page',
273
- 'wgm_advance_settings_section'
274
- );
275
 
276
- register_setting( 'wpgmap_general_settings', 'srm_gmap_lng' );
277
- register_setting( 'wpgmap_general_settings', 'srm_gmap_region' );
278
- register_setting( 'wpgmap_general_settings', 'wpgmap_s_custom_css' );
279
- register_setting( 'wpgmap_general_settings', 'wpgmap_s_custom_js' );
280
- /**
281
- * Map General Settings
282
- *
283
- * @since 1.7.5
284
- */
285
- register_setting( 'wpgmap_general_settings', '_wgm_disable_full_screen_control' );
286
- register_setting( 'wpgmap_general_settings', '_wgm_disable_street_view' );
287
- register_setting( 'wpgmap_general_settings', '_wgm_disable_zoom_control' );
288
- register_setting( 'wpgmap_general_settings', '_wgm_disable_pan_control' );
289
- register_setting( 'wpgmap_general_settings', '_wgm_disable_map_type_control' );
290
- register_setting( 'wpgmap_general_settings', '_wgm_disable_mouse_wheel_zoom' );
291
- register_setting( 'wpgmap_general_settings', '_wgm_disable_mouse_dragging' );
292
- register_setting( 'wpgmap_general_settings', '_wgm_disable_mouse_double_click_zooming' );
293
- /**
294
- * Advance Settings
295
- *
296
- * @since 1.7.5
297
- */
298
- register_setting( 'wgm_advance_settings', '_wgm_load_map_api_condition' );
299
- register_setting( 'wgm_advance_settings', '_wgm_prevent_other_plugin_theme_api_load' );
300
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
301
  }
4
 
5
  use WGMSRM\Classes\Migration;
6
 
7
+ if (!defined('ABSPATH')) {
8
+ exit;
9
  }
10
 
11
  /**
12
  * Trait Settings
13
  */
14
+ trait Settings
15
+ {
16
 
17
+ /**
18
+ * Settings section callback code(BLANK NOW)
19
+ */
20
+ public function gmap_embed_settings_section_callback()
21
+ {
22
+ // code...
23
+ }
24
 
25
+ /**
26
+ * Custom CSS part markup
27
+ */
28
+ public function gmap_embed_s_custom_css_markup()
29
+ { ?>
30
+ <textarea rows="10" cols="100" name="wpgmap_s_custom_css"
31
+ id="wpgmap_custom_css"><?php echo esc_html(get_option('wpgmap_s_custom_css')); ?></textarea>
32
+ <p class="description" id="tagline-description" style="font-style: italic;">
33
+ <?php esc_html_e('Add your custom CSS code if needed.', 'gmap-embed'); ?>
34
+ </p>
35
+ <?php
36
+ }
37
 
38
+ /**
39
+ * Custom JS part markup
40
+ */
41
+ public function wpgmap_s_custom_js_markup()
42
+ {
43
+ ?>
44
+ <textarea rows="10" cols="100" name="wpgmap_s_custom_js"
45
+ id="wpgmap_custom_js"><?php echo esc_html(get_option('wpgmap_s_custom_js')); ?></textarea>
46
+ <p class="description" id="tagline-description" style="font-style: italic;">
47
+ <?php esc_html_e('Add your custom JS code if needed.', 'gmap-embed'); ?>
48
+ </p>
49
+ <?php
50
+ }
51
 
52
+ /**
53
+ * Where Map API engine should be -> Markup
54
+ *
55
+ * @since 1.7.5
56
+ */
57
+ public function wgm_load_api_condition_markup()
58
+ {
59
+ ?>
60
+ <select name="_wgm_load_map_api_condition" id="_wgm_load_map_api_condition">
61
+ <option value="where-required" <?php echo esc_attr(get_option('_wgm_load_map_api_condition') == 'where-required' ? 'selected' : ''); ?>>
62
+ Where required
63
+ </option>
64
+ <option value="always" <?php echo esc_attr(get_option('_wgm_load_map_api_condition') == 'always' ? 'selected' : ''); ?>>
65
+ Always
66
+ </option>
67
+ <option value="only-front-end" <?php echo esc_attr(get_option('_wgm_load_map_api_condition') == 'only-front-end' ? 'selected' : ''); ?>>
68
+ Only Front End
69
+ </option>
70
+ <option value="only-back-end" <?php echo esc_attr(get_option('_wgm_load_map_api_condition') == 'only-back-end' ? 'selected' : ''); ?>>
71
+ Only Back End
72
+ </option>
73
+ <option value="never" <?php echo esc_attr(get_option('_wgm_load_map_api_condition') == 'never' ? 'selected' : ''); ?>>
74
+ Never
75
+ </option>
76
+ </select>
77
+ <?php
78
+ }
79
 
80
+ /**
81
+ * Directions option -> Distance Unit
82
+ *
83
+ * @since 1.7.5
84
+ */
85
+ public function wgm_distance_unit()
86
+ {
87
+ ?>
88
+ <select name="_wgm_distance_unit" id="_wgm_distance_unit">
89
+ <option value="km" <?php echo esc_attr(get_option('_wgm_distance_unit') == 'km' ? 'selected' : ''); ?>>
90
+ Kilometers
91
+ </option>
92
+ <option value="mi" <?php echo esc_attr(get_option('_wgm_distance_unit') == 'mi' ? 'selected' : ''); ?>>
93
+ Miles
94
+ </option>
95
+ </select>
96
+ <?php
97
+ }
98
 
99
+ /**
100
+ * Prevent API load by other plugin or theme markup
101
+ *
102
+ * @since 1.7.5
103
+ */
104
+ public function wgm_prevent_api_load_markup()
105
+ {
106
+ ?>
107
+ <input type="checkbox" name="_wgm_prevent_other_plugin_theme_api_load"
108
+ id="_wgm_prevent_other_plugin_theme_api_load"
109
+ value="Y" <?php echo esc_attr(get_option('_wgm_prevent_other_plugin_theme_api_load') == 'Y' ? 'checked="checked"' : ''); ?>> Check this option if your want to prevent other plugin or theme loading map api, in case of you are getting api key error, included multiple api key error.
110
+ <br/>
111
+ <?php
112
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
 
114
+ /**
115
+ * General Map Settings under General Settings
116
+ *
117
+ * @since 1.7.5
118
+ */
119
+ public function wgm_general_map_settings_markup()
120
+ {
121
+ ?>
122
+ <input type="checkbox" name="_wgm_disable_full_screen_control" id="_wgm_disable_full_screen_control"
123
+ value="Y" <?php echo esc_attr(get_option('_wgm_disable_full_screen_control') == 'Y' ? 'checked="checked"' : ''); ?>> Disable Full Screen Control
124
+ <br/>
125
+ <input type="checkbox" name="_wgm_disable_street_view" id="_wgm_disable_street_view"
126
+ value="Y" <?php echo esc_attr(get_option('_wgm_disable_street_view') == 'Y' ? 'checked="checked"' : ''); ?>> Disable StreetView
127
+ <br/>
128
+ <input type="checkbox" name="_wgm_disable_zoom_control" id="_wgm_disable_zoom_control"
129
+ value="Y" <?php echo esc_attr(get_option('_wgm_disable_zoom_control') == 'Y' ? 'checked="checked"' : ''); ?>> Disable Zoom Controls
130
+ <br/>
131
+ <input type="checkbox" name="_wgm_disable_pan_control" id="_wgm_disable_pan_control"
132
+ value="Y" <?php echo esc_attr(get_option('_wgm_disable_pan_control') == 'Y' ? 'checked="checked"' : ''); ?>> Disable Pan Controls
133
+ <br/>
134
+ <input type="checkbox" name="_wgm_disable_map_type_control" id="_wgm_disable_map_type_control"
135
+ value="Y" <?php echo esc_attr(get_option('_wgm_disable_map_type_control') == 'Y' ? 'checked="checked"' : ''); ?>> Disable Map Type Controls
136
+ <br/>
137
+ <input type="checkbox" name="_wgm_disable_mouse_wheel_zoom" id="_wgm_disable_mouse_wheel_zoom"
138
+ value="Y" <?php echo esc_attr(get_option('_wgm_disable_mouse_wheel_zoom') == 'Y' ? 'checked="checked"' : ''); ?>> Disable Mouse Wheel Zoom
139
+ <br/>
140
+ <input type="checkbox" name="_wgm_disable_mouse_dragging" id="_wgm_disable_mouse_dragging"
141
+ value="Y" <?php echo esc_attr(get_option('_wgm_disable_mouse_dragging') == 'Y' ? 'checked="checked"' : ''); ?>> Disable Mouse Dragging
142
+ <br/>
143
+ <input type="checkbox" name="_wgm_disable_mouse_double_click_zooming"
144
+ id="_wgm_disable_mouse_double_click_zooming"
145
+ value="Y" <?php echo esc_attr(get_option('_wgm_disable_mouse_double_click_zooming') == 'Y' ? 'checked="checked"' : ''); ?>> Disable Mouse Double Click Zooming
146
+ <br/>
147
+ <?php if (_wgm_is_premium()) { ?>
148
+ <input type="checkbox" name="_wgm_enable_direction_form_auto_complete"
149
+ id="_wgm_enable_direction_form_auto_complete"
150
+ value="Y" <?php echo esc_attr(get_option('_wgm_enable_direction_form_auto_complete') == 'Y' ? 'checked="checked"' : ''); ?>> Enable direction From/To Auto Complete
151
+ <br/>
152
+ <?php
153
+ }
154
+ }
155
 
156
+ /**
157
+ * Language selection part markup
158
+ */
159
+ public function gmap_embed_s_map_language_markup()
160
+ {
161
+ ?>
162
+ <select id="srm_gmap_lng" name="srm_gmap_lng" class="regular-text" style="width: 100%;max-width:100%;">
163
+ <?php
164
+ $wpgmap_languages = gmap_embed_get_languages();
165
+ if (count($wpgmap_languages) > 0) {
166
+ foreach ($wpgmap_languages as $lng_key => $language) {
167
+ $selected = '';
168
+ if (get_option('srm_gmap_lng', 'en') == $lng_key) {
169
+ $selected = 'selected';
170
+ }
171
+ echo "<option value='" . esc_attr($lng_key) . "' " . esc_attr($selected) . '>' . esc_html($language) . '</option>';
172
+ }
173
+ }
174
+ ?>
175
+ </select>
176
+ <p class="description" id="tagline-description" style="font-style: italic;">
177
+ <?php esc_html_e('Chose your desired map language', 'gmap-embed'); ?>
178
+ </p>
179
+ <?php
180
+ }
181
 
182
+ /**
183
+ * Region selection part markup
184
+ */
185
+ public function gmap_embed_s_map_region_markup()
186
+ {
187
+ ?>
188
+ <select id="region" name="srm_gmap_region" class="regular-text" style="width: 100%;max-width: 100%;">
189
+ <?php
190
+ $wpgmap_regions = gmap_embed_get_regions();
191
+ if (count($wpgmap_regions) > 0) {
192
+ foreach ($wpgmap_regions as $region_key => $region) {
193
+ $selected = '';
194
+ if (get_option('srm_gmap_region', 'US') == $region_key) {
195
+ $selected = 'selected';
196
+ }
197
+ echo "<option value='" . esc_attr($region_key) . "' " . esc_attr($selected) . '>' . esc_html($region) . '</option>';
198
+ }
199
+ }
200
+ ?>
201
 
202
+ </select>
203
+ <p class="description" id="tagline-description" style="font-style: italic;">
204
+ <?php esc_html_e('Chose your regional area', 'gmap-embed'); ?>
205
+ </p>
206
+ <?php
207
+ }
 
 
 
 
 
208
 
209
+ /**
210
+ * Settings section, fields register
211
+ */
212
+ public function gmapsrm_settings()
213
+ {
214
+ // Language settings section and fields
215
+ add_settings_section(
216
+ 'gmap_embed_language_settings_section',
217
+ __('Map Language and Regional Settings<hr/>', 'gmap-embed'),
218
+ array($this, 'gmap_embed_settings_section_callback'),
219
+ 'gmap-embed-settings-page-ls'
220
+ );
221
 
222
+ add_settings_field(
223
+ 'srm_gmap_lng',
224
+ __('Map Language:', 'gmap-embed'),
225
+ array($this, 'gmap_embed_s_map_language_markup'),
226
+ 'gmap-embed-settings-page-ls',
227
+ 'gmap_embed_language_settings_section'
228
+ );
229
 
230
+ add_settings_field(
231
+ 'srm_gmap_region',
232
+ __('Map Region:', 'gmap-embed'),
233
+ array($this, 'gmap_embed_s_map_region_markup'),
234
+ 'gmap-embed-settings-page-ls',
235
+ 'gmap_embed_language_settings_section'
236
+ );
237
 
238
+ // Custom Scripts section and fields
239
+ add_settings_section(
240
+ 'gmap_embed_custom_scripts_section',
241
+ __('Custom Scripts<hr/>', 'gmap-embed'),
242
+ array($this, 'gmap_embed_settings_section_callback'),
243
+ 'gmap-embed-settings-page-cs'
244
+ );
245
 
246
+ add_settings_field(
247
+ 'wpgmap_s_custom_css',
248
+ __('Custom CSS:', 'gmap-embed'),
249
+ array($this, 'gmap_embed_s_custom_css_markup'),
250
+ 'gmap-embed-settings-page-cs',
251
+ 'gmap_embed_custom_scripts_section'
252
+ );
253
 
254
+ add_settings_field(
255
+ 'wpgmap_s_custom_js',
256
+ __('Custom JS:', 'gmap-embed'),
257
+ array($this, 'wpgmap_s_custom_js_markup'),
258
+ 'gmap-embed-settings-page-cs',
259
+ 'gmap_embed_custom_scripts_section'
260
+ );
 
 
 
 
261
 
262
+ /**
263
+ * General map settings section and fields
264
+ *
265
+ * @since 1.7.5
266
+ */
267
+ add_settings_section(
268
+ 'gmap_embed_general_map_settings_section',
269
+ __('', 'gmap-embed'),
270
+ array($this, 'gmap_embed_settings_section_callback'),
271
+ 'gmap-embed-general-settings'
272
+ );
273
 
274
+ // General map settings related all fields are included
275
+ add_settings_field(
276
+ 'wpgm_disable_full_screen_control',
277
+ __('Map Control Options:', 'gmap-embed'),
278
+ array($this, 'wgm_general_map_settings_markup'),
279
+ 'gmap-embed-general-settings',
280
+ 'gmap_embed_general_map_settings_section'
281
+ );
 
 
 
282
 
283
+ /**
284
+ * Advance settings section and fields
285
+ *
286
+ * @since 1.7.5
287
+ */
288
+ add_settings_section(
289
+ 'wgm_advance_settings_section',
290
+ __('', 'gmap-embed'),
291
+ array($this, 'gmap_embed_settings_section_callback'),
292
+ 'wgm_advance_settings-page'
293
+ );
294
 
295
+ add_settings_field(
296
+ '_wgm_load_map_api_condition',
297
+ __('Load Map API:', 'gmap-embed'),
298
+ array($this, 'wgm_load_api_condition_markup'),
299
+ 'wgm_advance_settings-page',
300
+ 'wgm_advance_settings_section'
301
+ );
302
 
303
+ add_settings_field(
304
+ '_wgm_prevent_other_plugin_theme_api_load',
305
+ __('Prevent Map API loading for other plugin and themes:', 'gmap-embed'),
306
+ array($this, 'wgm_prevent_api_load_markup'),
307
+ 'wgm_advance_settings-page',
308
+ 'wgm_advance_settings_section'
309
+ );
310
+
311
+ add_settings_field(
312
+ '_wgm_distance_unit',
313
+ __('Distance Unit:', 'gmap-embed'),
314
+ array($this, 'wgm_distance_unit'),
315
+ 'wgm_advance_settings-page',
316
+ 'wgm_advance_settings_section'
317
+ );
318
+
319
+ register_setting('wpgmap_general_settings', 'srm_gmap_lng');
320
+ register_setting('wpgmap_general_settings', 'srm_gmap_region');
321
+ register_setting('wpgmap_general_settings', 'wpgmap_s_custom_css');
322
+ register_setting('wpgmap_general_settings', 'wpgmap_s_custom_js');
323
+ /**
324
+ * Map General Settings
325
+ *
326
+ * @since 1.7.5
327
+ */
328
+ register_setting('wpgmap_general_settings', '_wgm_disable_full_screen_control');
329
+ register_setting('wpgmap_general_settings', '_wgm_disable_street_view');
330
+ register_setting('wpgmap_general_settings', '_wgm_disable_zoom_control');
331
+ register_setting('wpgmap_general_settings', '_wgm_disable_pan_control');
332
+ register_setting('wpgmap_general_settings', '_wgm_disable_map_type_control');
333
+ register_setting('wpgmap_general_settings', '_wgm_disable_mouse_wheel_zoom');
334
+ register_setting('wpgmap_general_settings', '_wgm_disable_mouse_dragging');
335
+ register_setting('wpgmap_general_settings', '_wgm_disable_mouse_double_click_zooming');
336
+ register_setting('wpgmap_general_settings', '_wgm_enable_direction_form_auto_complete');
337
+ /**
338
+ * Advance Settings
339
+ *
340
+ * @since 1.7.5
341
+ */
342
+ register_setting('wgm_advance_settings', '_wgm_load_map_api_condition');
343
+ register_setting('wgm_advance_settings', '_wgm_prevent_other_plugin_theme_api_load');
344
+ register_setting('wgm_advance_settings', '_wgm_distance_unit');
345
+ }
346
  }
public/includes/shortcodes.php CHANGED
@@ -1,144 +1,146 @@
1
  <?php
2
- if ( ! defined( 'ABSPATH' ) ) {
3
- exit;
4
  }
5
  // ************* WP Google Map Shortcode ***************
6
- if ( ! function_exists( 'srm_gmap_embed_shortcode' ) ) {
7
-
8
- /**
9
- * Generate map based on shortcode input
10
- *
11
- * @param $atts
12
- * @param $content
13
- *
14
- * @return string
15
- * @since 1.0.0
16
- */
17
- function srm_gmap_embed_shortcode( $atts, $content ) {
18
- static $count;
19
- if ( ! $count ) {
20
- $count = 0;
21
- }
22
- $count ++;
23
- $wgm_map_id = intval( esc_html( $atts['id'] ) );
24
- $wpgmap_title = esc_html( get_post_meta( $wgm_map_id, 'wpgmap_title', true ) );
25
- $wpgmap_show_heading = esc_html( get_post_meta( $wgm_map_id, 'wpgmap_show_heading', true ) );
26
- $wpgmap_heading_class = esc_html( get_post_meta( $wgm_map_id, 'wpgmap_heading_class', true ) );
27
- $wpgmap_map_zoom = esc_html( get_post_meta( $wgm_map_id, 'wpgmap_map_zoom', true ) );
28
- $wpgmap_map_width = esc_html( get_post_meta( $wgm_map_id, 'wpgmap_map_width', true ) );
29
- $wpgmap_map_height = esc_html( get_post_meta( $wgm_map_id, 'wpgmap_map_height', true ) );
30
- $wpgmap_map_type = esc_html( get_post_meta( $wgm_map_id, 'wpgmap_map_type', true ) );
31
- $wpgmap_enable_direction = esc_html( get_post_meta( $wgm_map_id, 'wpgmap_enable_direction', true ) );
32
- $wpgmap_center_lat_lng = esc_html( get_center_lat_lng_by_map_id( $wgm_map_id ) );
33
- $wgm_theme_json = wp_kses_data( get_post_meta( $wgm_map_id, 'wgm_theme_json', true ) );
34
- ob_start();
35
- if ( '' !== $wpgmap_center_lat_lng ) {
36
- if ( '1' === $wpgmap_show_heading ) {
37
- echo "<h1 class='srm_gmap_heading_$count " . esc_attr( $wpgmap_heading_class ) . "'>" . esc_html( wp_strip_all_tags( $wpgmap_title ) ) . '</h1>';
38
- }
39
- ?>
 
40
  <script type="text/javascript">
41
  jQuery(document).ready(function ($) {
42
- var wgm_map = new google.maps.Map(document.getElementById("srm_gmp_embed_<?php echo esc_html( $count ); ?>"), {
43
- center: new google.maps.LatLng(<?php echo esc_html( $wpgmap_center_lat_lng ); ?>),
44
- zoom:<?php echo esc_html( $wpgmap_map_zoom ); ?>,
45
- mapTypeId: google.maps.MapTypeId.<?php echo esc_html( $wpgmap_map_type ); ?>,
46
- scrollwheel: <?php echo esc_html( get_option( '_wgm_disable_mouse_wheel_zoom' ) ) === 'Y' ? 'false' : 'true'; ?>,
47
- zoomControl: <?php echo esc_html( get_option( '_wgm_disable_zoom_control' ) ) === 'Y' ? 'false' : 'true'; ?>,
48
- mapTypeControl: <?php echo esc_html( get_option( '_wgm_disable_map_type_control' ) ) === 'Y' ? 'false' : 'true'; ?>,
49
- streetViewControl: <?php echo esc_html( get_option( '_wgm_disable_street_view' ) ) === 'Y' ? 'false' : 'true'; ?>,
50
- fullscreenControl: <?php echo esc_html( get_option( '_wgm_disable_full_screen_control' ) ) === 'Y' ? 'false' : 'true'; ?>,
51
- draggable: <?php echo esc_html( get_option( '_wgm_disable_mouse_dragging' ) ) === 'Y' ? 'false' : 'true'; ?>,
52
- disableDoubleClickZoom: <?php echo esc_html( get_option( '_wgm_disable_mouse_double_click_zooming' ) ) === 'Y' ? 'true' : 'false'; ?>,
53
- panControl: <?php echo esc_html( get_option( '_wgm_disable_pan_control' ) ) === 'Y' ? 'false' : 'true'; ?>
54
  });
55
  var wgm_theme_json = '<?php echo wp_kses_data($wgm_theme_json); ?>';
56
  if (wgm_theme_json.length > 0) {
57
  wgm_map.setOptions({styles: JSON.parse(wgm_theme_json)});
58
  }
59
  // To view directions form and data
60
- <?php if ( $wpgmap_enable_direction && _wgm_is_premium() ) { ?>
61
- var wgm_directionsDisplay_<?php echo esc_html( $count ); ?> = new google.maps.DirectionsRenderer();
62
-
63
- wgm_directionsDisplay_<?php echo esc_html( $count ); ?>.setMap(wgm_map);
64
- wgm_directionsDisplay_<?php echo esc_html( $count ); ?>.setPanel(document.getElementById("wp_gmap_directions_<?php echo esc_html( $count ); ?>"));
65
-
66
- var wgm_get_direction_btn_<?php echo esc_html( $count ); ?> = document.getElementById('wp_gmap_submit_<?php echo esc_html( $count ); ?>');
67
- wgm_get_direction_btn_<?php echo esc_html( $count ); ?>.addEventListener('click', function () {
68
- var wgm_selectedMode_<?php echo esc_html( $count ); ?> = document.getElementById("srm_gmap_mode_<?php echo esc_html( $count ); ?>").value,
69
- wgm_dirction_start_<?php echo esc_html( $count ); ?> = document.getElementById("srm_gmap_from_<?php echo esc_html( $count ); ?>").value,
70
- wgm_direction_end_<?php echo esc_html( $count ); ?> = document.getElementById("srm_gmap_to_<?php echo esc_html( $count ); ?>").value;
71
- if (wgm_dirction_start_<?php echo esc_html( $count ); ?> === '' || wgm_direction_end_<?php echo esc_html( $count ); ?> === '') {
72
  // cannot calculate route
73
- document.getElementById("wp_gmap_results_<?php echo esc_html( $count ); ?>").style.display = 'none';
74
  return false;
75
  } else {
76
 
77
 
78
- document.getElementById('wp_gmap_loading_<?php echo esc_html( $count ); ?>').style.display = 'block';
79
 
80
- var wgm_direction_request_<?php echo esc_html( $count ); ?> = {
81
- origin: wgm_dirction_start_<?php echo esc_html( $count ); ?>,
82
- destination: wgm_direction_end_<?php echo esc_html( $count ); ?>,
83
- travelMode: google.maps.DirectionsTravelMode[wgm_selectedMode_<?php echo esc_html( $count ); ?>]
 
84
  };
85
- var wgm_directionsService_<?php echo esc_html( $count ); ?> = new google.maps.DirectionsService();
86
- wgm_directionsService_<?php echo esc_html( $count ); ?>.route(wgm_direction_request_<?php echo esc_html( $count ); ?>, function (response, status) {
87
- document.getElementById('wp_gmap_loading_<?php echo esc_html( $count ); ?>').style.display = 'none';
88
  if (status === google.maps.DirectionsStatus.OK) {
89
- wgm_directionsDisplay_<?php echo esc_html( $count ); ?>.setDirections(response);
90
- document.getElementById("wp_gmap_results_<?php echo esc_html( $count ); ?>").style.display = 'block';
91
  } else {
92
- document.getElementById("wp_gmap_results_<?php echo esc_html( $count ); ?>").style.display = 'none';
93
  }
94
  });
95
 
96
  }
97
  });
98
- <?php } ?>
99
- var wgm_data_<?php echo esc_html( $count ); ?> = {
100
  'action': 'wpgmapembed_p_get_markers_by_map_id',
101
  'data': {
102
- map_id: '<?php echo intval( esc_html( $wgm_map_id ) ); ?>',
103
- ajax_nonce: '<?php echo wp_create_nonce( 'ajax_nonce' ); ?>'
104
  }
105
  };
106
- var wgm_ajaxurl_<?php echo esc_html( $count ); ?> = '<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>'
107
- jQuery.post(wgm_ajaxurl_<?php echo esc_html( $count ); ?>, wgm_data_<?php echo esc_html( $count ); ?>, function (response) {
108
  response = JSON.parse(response);
109
  if (response.markers.length === 1) {
110
- var wgm_marker_to_<?php echo esc_html( $count ); ?> = response.markers[0].marker_desc.replace(/&gt;/g, '>').replace(/&lt;/g, '<');
111
- jQuery('#srm_gmap_to_<?php echo esc_html( $count ); ?>').val(wgm_marker_to_<?php echo esc_html( $count ); ?>.replace(/(<([^>]+)>)/gi, ""));
112
  }
113
- var wgm_default_marker_icon_<?php echo esc_html( $count ); ?> = 'https://maps.gstatic.com/mapfiles/api-3/images/spotlight-poi2.png';
114
  if (response.markers.length > 0) {
115
  var custom_markers = [];
116
  var custom_marker_infowindows = [];
117
  response.markers.forEach(function (wgm_marker, i) {
118
- var wgm_marker_lat_lng_<?php echo esc_html( $count ); ?> = wgm_marker.lat_lng.split(',');
119
- wgm_custom_marker_<?php echo esc_html( $count ); ?> = new google.maps.Marker({
120
- position: new google.maps.LatLng(wgm_marker_lat_lng_<?php echo esc_html( $count ); ?>[0], wgm_marker_lat_lng_<?php echo esc_html( $count ); ?>[1]),
121
  title: wgm_marker.marker_name,
122
  animation: google.maps.Animation.DROP,
123
- icon: (wgm_marker.icon === '') ? wgm_default_marker_icon_<?php echo esc_html( $count ); ?> : wgm_marker.icon
124
  });
125
- custom_markers[i] = wgm_custom_marker_<?php echo esc_html( $count ); ?>;
126
- wgm_custom_marker_<?php echo esc_html( $count ); ?>.setMap(wgm_map);
127
- var wgm_marker_name_<?php echo esc_html( $count ); ?> = (wgm_marker.marker_name !== null) ? ('<span class="info_content_title" style="font-size:18px;font-weight: bold;font-family: Arial;">'
128
  + wgm_marker.marker_name +
129
  '</span><br/>') : '';
130
  wgm_marker.marker_desc = wgm_marker.marker_desc.replace(/&gt;/g, '>').replace(/&lt;/g, '<');
131
  custom_marker_infowindow = new google.maps.InfoWindow({
132
- content: wgm_marker_name_<?php echo esc_html( $count ); ?> + wgm_marker.marker_desc
133
  });
134
  custom_marker_infowindows[i] = custom_marker_infowindow;
135
  if (wgm_marker.show_desc_by_default === '1') {
136
  custom_marker_infowindow.open({
137
- anchor: wgm_custom_marker_<?php echo esc_html( $count ); ?>,
138
  shouldFocus: false
139
  });
140
  } else {
141
- google.maps.event.addListener(wgm_custom_marker_<?php echo esc_html( $count ); ?>, 'click', function () {
142
  custom_marker_infowindows[i].open({
143
  anchor: custom_markers[i],
144
  shouldFocus: false
@@ -146,7 +148,7 @@ if ( ! function_exists( 'srm_gmap_embed_shortcode' ) ) {
146
  });
147
  }
148
  if (wgm_marker.have_marker_link === '1') {
149
- google.maps.event.addListener(wgm_custom_marker_<?php echo esc_html( $count ); ?>, 'click', function () {
150
  var wgm_target = '_self';
151
  if (wgm_marker.marker_link_new_tab === '1') {
152
  wgm_target = '_blank';
@@ -161,13 +163,13 @@ if ( ! function_exists( 'srm_gmap_embed_shortcode' ) ) {
161
 
162
  </script>
163
 
164
- <div id="srm_gmp_embed_<?php echo esc_html( $count ); ?>"
165
- style="width:<?php echo esc_attr( $wpgmap_map_width ) . ' !important'; ?>;height:<?php echo esc_attr( $wpgmap_map_height ); ?> !important; ">
166
  </div>
167
- <?php
168
 
169
- if ( $wpgmap_enable_direction === '1' and _wgm_is_premium() ) {
170
- ?>
171
  <style type="text/css">
172
  .wp_gmap_direction_box {
173
  width: 100%;
@@ -197,54 +199,68 @@ if ( ! function_exists( 'srm_gmap_embed_shortcode' ) ) {
197
  <div class="wp_gmap_direction_box">
198
  <div class="ui-bar-c ui-corner-all ui-shadow">
199
  <div data-role="fieldcontain" class="fieldcontain">
200
- <label for="srm_gmap_from_<?php echo esc_html( $count ); ?>"><?php esc_html_e( 'From', 'gmap-embed' ); ?></label>
201
- <input type="text" id="srm_gmap_from_<?php echo esc_html( $count ); ?>" value=""
202
  style="width: 100%;"/>
203
  </div>
204
  <div data-role="fieldcontain" class="fieldcontain">
205
- <label for="srm_gmap_to_<?php echo esc_html( $count ); ?>"><?php esc_html_e( 'To', 'gmap-embed' ); ?></label>
206
- <input type="text" id="srm_gmap_to_<?php echo esc_html( $count ); ?>"
207
  value=""
208
  style="width: 100%"/>
209
  </div>
210
  <div data-role="fieldcontain" class="fieldcontain">
211
- <label for="srm_gmap_mode_<?php echo esc_html( $count ); ?>"
212
- class="select"><?php esc_html_e( 'Transportation method', 'gmap-embed' ); ?>:</label>
213
- <select name="select_choice_<?php echo esc_html( $count ); ?>"
214
- id="srm_gmap_mode_<?php echo esc_html( $count ); ?>"
215
  style="padding: 5px;width: 100%;">
216
- <option value="DRIVING"><?php esc_html_e( 'Driving', 'gmap-embed' ); ?></option>
217
- <option value="WALKING"><?php esc_html_e( 'Walking', 'gmap-embed' ); ?></option>
218
- <option value="BICYCLING"><?php esc_html_e( 'Bicycling', 'gmap-embed' ); ?></option>
219
- <option value="TRANSIT"><?php esc_html_e( 'Transit', 'gmap-embed' ); ?></option>
220
  </select>
221
  </div>
222
  <button type="button" data-icon="search" data-role="button" href="#" style="padding:8px;"
223
- id="wp_gmap_submit_<?php echo esc_html( $count ); ?>"><?php esc_html_e( 'Get Directions', 'gmap-embed' ); ?>
224
  </button>
225
- <span id="wp_gmap_loading_<?php echo esc_html( $count ); ?>"
226
- style="display: none;"><?php esc_html_e( 'Loading', 'gmap-embed' ); ?>...</span>
227
  </div>
228
 
229
  <!-- Directions will be listed here-->
230
- <div id="wp_gmap_results_<?php echo esc_html( $count ); ?>"
231
  style="display:none;max-height: 300px;overflow-y: scroll;">
232
- <div id="wp_gmap_directions_<?php echo esc_html( $count ); ?>"></div>
233
  </div>
234
 
235
  </div>
236
- <?php
237
- }
238
- } else {
239
- if ( is_user_logged_in() && current_user_can( 'administrator' ) ) {
240
- echo "<span style='color:darkred;'>Shortcode not defined, please check WP Google Map plugin in WordPress admin panel(sidebar). This message only visible to Administrator</span>";
241
- }
242
- }
243
- ?>
244
- <?php
245
- return ob_get_clean();
246
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
247
  }
248
 
249
  // ******* Defining Shortcode for WP Google Map
250
- add_shortcode( 'gmap-embed', 'srm_gmap_embed_shortcode' );
1
  <?php
2
+ if (!defined('ABSPATH')) {
3
+ exit;
4
  }
5
  // ************* WP Google Map Shortcode ***************
6
+ if (!function_exists('srm_gmap_embed_shortcode')) {
7
+
8
+ /**
9
+ * Generate map based on shortcode input
10
+ *
11
+ * @param $atts
12
+ * @param $content
13
+ *
14
+ * @return string
15
+ * @since 1.0.0
16
+ */
17
+ function srm_gmap_embed_shortcode($atts, $content)
18
+ {
19
+ static $count;
20
+ if (!$count) {
21
+ $count = 0;
22
+ }
23
+ $count++;
24
+ $wgm_map_id = intval(esc_html($atts['id']));
25
+ $wpgmap_title = esc_html(get_post_meta($wgm_map_id, 'wpgmap_title', true));
26
+ $wpgmap_show_heading = esc_html(get_post_meta($wgm_map_id, 'wpgmap_show_heading', true));
27
+ $wpgmap_heading_class = esc_html(get_post_meta($wgm_map_id, 'wpgmap_heading_class', true));
28
+ $wpgmap_map_zoom = esc_html(get_post_meta($wgm_map_id, 'wpgmap_map_zoom', true));
29
+ $wpgmap_map_width = esc_html(get_post_meta($wgm_map_id, 'wpgmap_map_width', true));
30
+ $wpgmap_map_height = esc_html(get_post_meta($wgm_map_id, 'wpgmap_map_height', true));
31
+ $wpgmap_map_type = esc_html(get_post_meta($wgm_map_id, 'wpgmap_map_type', true));
32
+ $wpgmap_enable_direction = esc_html(get_post_meta($wgm_map_id, 'wpgmap_enable_direction', true));
33
+ $wpgmap_center_lat_lng = esc_html(get_center_lat_lng_by_map_id($wgm_map_id));
34
+ $wgm_theme_json = wp_kses_data(get_post_meta($wgm_map_id, 'wgm_theme_json', true));
35
+ ob_start();
36
+ if ('' !== $wpgmap_center_lat_lng) {
37
+ if ('1' === $wpgmap_show_heading) {
38
+ echo "<h1 class='srm_gmap_heading_$count " . esc_attr($wpgmap_heading_class) . "'>" . esc_html(wp_strip_all_tags($wpgmap_title)) . '</h1>';
39
+ }
40
+ ?>
41
  <script type="text/javascript">
42
  jQuery(document).ready(function ($) {
43
+ var wgm_map = new google.maps.Map(document.getElementById("srm_gmp_embed_<?php echo esc_html($count); ?>"), {
44
+ center: new google.maps.LatLng(<?php echo esc_html($wpgmap_center_lat_lng); ?>),
45
+ zoom:<?php echo esc_html($wpgmap_map_zoom); ?>,
46
+ mapTypeId: google.maps.MapTypeId.<?php echo esc_html($wpgmap_map_type); ?>,
47
+ scrollwheel: <?php echo esc_html(get_option('_wgm_disable_mouse_wheel_zoom')) === 'Y' ? 'false' : 'true'; ?>,
48
+ zoomControl: <?php echo esc_html(get_option('_wgm_disable_zoom_control')) === 'Y' ? 'false' : 'true'; ?>,
49
+ mapTypeControl: <?php echo esc_html(get_option('_wgm_disable_map_type_control')) === 'Y' ? 'false' : 'true'; ?>,
50
+ streetViewControl: <?php echo esc_html(get_option('_wgm_disable_street_view')) === 'Y' ? 'false' : 'true'; ?>,
51
+ fullscreenControl: <?php echo esc_html(get_option('_wgm_disable_full_screen_control')) === 'Y' ? 'false' : 'true'; ?>,
52
+ draggable: <?php echo esc_html(get_option('_wgm_disable_mouse_dragging')) === 'Y' ? 'false' : 'true'; ?>,
53
+ disableDoubleClickZoom: <?php echo esc_html(get_option('_wgm_disable_mouse_double_click_zooming')) === 'Y' ? 'true' : 'false'; ?>,
54
+ panControl: <?php echo esc_html(get_option('_wgm_disable_pan_control')) === 'Y' ? 'false' : 'true'; ?>
55
  });
56
  var wgm_theme_json = '<?php echo wp_kses_data($wgm_theme_json); ?>';
57
  if (wgm_theme_json.length > 0) {
58
  wgm_map.setOptions({styles: JSON.parse(wgm_theme_json)});
59
  }
60
  // To view directions form and data
61
+ <?php if ( $wpgmap_enable_direction && _wgm_is_premium() ) { ?>
62
+ var wgm_directionsDisplay_<?php echo esc_html($count); ?> = new google.maps.DirectionsRenderer();
63
+ wgm_directionsDisplay_<?php echo esc_html($count); ?>.setMap(wgm_map);
64
+ wgm_directionsDisplay_<?php echo esc_html($count); ?>.setPanel(document.getElementById("wp_gmap_directions_<?php echo esc_html($count); ?>"));
65
+
66
+ var wgm_get_direction_btn_<?php echo esc_html($count); ?> = document.getElementById('wp_gmap_submit_<?php echo esc_html($count); ?>');
67
+ wgm_get_direction_btn_<?php echo esc_html($count); ?>.addEventListener('click', function () {
68
+ var wgm_selectedMode_<?php echo esc_html($count); ?> = document.getElementById("srm_gmap_mode_<?php echo esc_html($count); ?>").value,
69
+ wgm_dirction_start_<?php echo esc_html($count); ?> = document.getElementById("srm_gmap_from_<?php echo esc_html($count); ?>").value,
70
+ wgm_direction_end_<?php echo esc_html($count); ?> = document.getElementById("srm_gmap_to_<?php echo esc_html($count); ?>").value;
71
+
72
+ if (wgm_dirction_start_<?php echo esc_html($count); ?> === '' || wgm_direction_end_<?php echo esc_html($count); ?> === '') {
73
  // cannot calculate route
74
+ document.getElementById("wp_gmap_results_<?php echo esc_html($count); ?>").style.display = 'none';
75
  return false;
76
  } else {
77
 
78
 
79
+ document.getElementById('wp_gmap_loading_<?php echo esc_html($count); ?>').style.display = 'block';
80
 
81
+ var wgm_direction_request_<?php echo esc_html($count); ?> = {
82
+ origin: wgm_dirction_start_<?php echo esc_html($count); ?>,
83
+ destination: wgm_direction_end_<?php echo esc_html($count); ?>,
84
+ travelMode: google.maps.DirectionsTravelMode[wgm_selectedMode_<?php echo esc_html($count); ?>],
85
+ unitSystem: <?php echo get_option('_wgm_distance_unit','km')=='km'?'google.maps.UnitSystem.METRIC':'google.maps.UnitSystem.IMPERIAL' ?>
86
  };
87
+ var wgm_directionsService_<?php echo esc_html($count); ?> = new google.maps.DirectionsService();
88
+ wgm_directionsService_<?php echo esc_html($count); ?>.route(wgm_direction_request_<?php echo esc_html($count); ?>, function (response, status) {
89
+ document.getElementById('wp_gmap_loading_<?php echo esc_html($count); ?>').style.display = 'none';
90
  if (status === google.maps.DirectionsStatus.OK) {
91
+ wgm_directionsDisplay_<?php echo esc_html($count); ?>.setDirections(response);
92
+ document.getElementById("wp_gmap_results_<?php echo esc_html($count); ?>").style.display = 'block';
93
  } else {
94
+ document.getElementById("wp_gmap_results_<?php echo esc_html($count); ?>").style.display = 'none';
95
  }
96
  });
97
 
98
  }
99
  });
100
+ <?php } ?>
101
+ var wgm_data_<?php echo esc_html($count); ?> = {
102
  'action': 'wpgmapembed_p_get_markers_by_map_id',
103
  'data': {
104
+ map_id: '<?php echo intval(esc_html($wgm_map_id)); ?>',
105
+ ajax_nonce: '<?php echo wp_create_nonce('ajax_nonce'); ?>'
106
  }
107
  };
108
+ var wgm_ajaxurl_<?php echo esc_html($count); ?> = '<?php echo esc_url(admin_url('admin-ajax.php')); ?>'
109
+ jQuery.post(wgm_ajaxurl_<?php echo esc_html($count); ?>, wgm_data_<?php echo esc_html($count); ?>, function (response) {
110
  response = JSON.parse(response);
111
  if (response.markers.length === 1) {
112
+ var wgm_marker_to_<?php echo esc_html($count); ?> = response.markers[0].marker_desc.replace(/&gt;/g, '>').replace(/&lt;/g, '<');
113
+ jQuery('#srm_gmap_to_<?php echo esc_html($count); ?>').val(wgm_marker_to_<?php echo esc_html($count); ?>.replace(/(<([^>]+)>)/gi, ""));
114
  }
115
+ var wgm_default_marker_icon_<?php echo esc_html($count); ?> = 'https://maps.gstatic.com/mapfiles/api-3/images/spotlight-poi2.png';
116
  if (response.markers.length > 0) {
117
  var custom_markers = [];
118
  var custom_marker_infowindows = [];
119
  response.markers.forEach(function (wgm_marker, i) {
120
+ var wgm_marker_lat_lng_<?php echo esc_html($count); ?> = wgm_marker.lat_lng.split(',');
121
+ wgm_custom_marker_<?php echo esc_html($count); ?> = new google.maps.Marker({
122
+ position: new google.maps.LatLng(wgm_marker_lat_lng_<?php echo esc_html($count); ?>[0], wgm_marker_lat_lng_<?php echo esc_html($count); ?>[1]),
123
  title: wgm_marker.marker_name,
124
  animation: google.maps.Animation.DROP,
125
+ icon: (wgm_marker.icon === '') ? wgm_default_marker_icon_<?php echo esc_html($count); ?> : wgm_marker.icon
126
  });
127
+ custom_markers[i] = wgm_custom_marker_<?php echo esc_html($count); ?>;
128
+ wgm_custom_marker_<?php echo esc_html($count); ?>.setMap(wgm_map);
129
+ var wgm_marker_name_<?php echo esc_html($count); ?> = (wgm_marker.marker_name !== null) ? ('<span class="info_content_title" style="font-size:18px;font-weight: bold;font-family: Arial;">'
130
  + wgm_marker.marker_name +
131
  '</span><br/>') : '';
132
  wgm_marker.marker_desc = wgm_marker.marker_desc.replace(/&gt;/g, '>').replace(/&lt;/g, '<');
133
  custom_marker_infowindow = new google.maps.InfoWindow({
134
+ content: wgm_marker_name_<?php echo esc_html($count); ?> + wgm_marker.marker_desc
135
  });
136
  custom_marker_infowindows[i] = custom_marker_infowindow;
137
  if (wgm_marker.show_desc_by_default === '1') {
138
  custom_marker_infowindow.open({
139
+ anchor: wgm_custom_marker_<?php echo esc_html($count); ?>,
140
  shouldFocus: false
141
  });
142
  } else {
143
+ google.maps.event.addListener(wgm_custom_marker_<?php echo esc_html($count); ?>, 'click', function () {
144
  custom_marker_infowindows[i].open({
145
  anchor: custom_markers[i],
146
  shouldFocus: false
148
  });
149
  }
150
  if (wgm_marker.have_marker_link === '1') {
151
+ google.maps.event.addListener(wgm_custom_marker_<?php echo esc_html($count); ?>, 'click', function () {
152
  var wgm_target = '_self';
153
  if (wgm_marker.marker_link_new_tab === '1') {
154
  wgm_target = '_blank';
163
 
164
  </script>
165
 
166
+ <div id="srm_gmp_embed_<?php echo esc_html($count); ?>"
167
+ style="width:<?php echo esc_attr($wpgmap_map_width) . ' !important'; ?>;height:<?php echo esc_attr($wpgmap_map_height); ?> !important; ">
168
  </div>
169
+ <?php
170
 
171
+ if ($wpgmap_enable_direction === '1' and _wgm_is_premium()) {
172
+ ?>
173
  <style type="text/css">
174
  .wp_gmap_direction_box {
175
  width: 100%;
199
  <div class="wp_gmap_direction_box">
200
  <div class="ui-bar-c ui-corner-all ui-shadow">
201
  <div data-role="fieldcontain" class="fieldcontain">
202
+ <label for="srm_gmap_from_<?php echo esc_html($count); ?>"><?php esc_html_e('From', 'gmap-embed'); ?></label>
203
+ <input type="text" id="srm_gmap_from_<?php echo esc_html($count); ?>" value=""
204
  style="width: 100%;"/>
205
  </div>
206
  <div data-role="fieldcontain" class="fieldcontain">
207
+ <label for="srm_gmap_to_<?php echo esc_html($count); ?>"><?php esc_html_e('To', 'gmap-embed'); ?></label>
208
+ <input type="text" id="srm_gmap_to_<?php echo esc_html($count); ?>"
209
  value=""
210
  style="width: 100%"/>
211
  </div>
212
  <div data-role="fieldcontain" class="fieldcontain">
213
+ <label for="srm_gmap_mode_<?php echo esc_html($count); ?>"
214
+ class="select"><?php esc_html_e('Transportation method', 'gmap-embed'); ?>:</label>
215
+ <select name="select_choice_<?php echo esc_html($count); ?>"
216
+ id="srm_gmap_mode_<?php echo esc_html($count); ?>"
217
  style="padding: 5px;width: 100%;">
218
+ <option value="DRIVING"><?php esc_html_e('Driving', 'gmap-embed'); ?></option>
219
+ <option value="WALKING"><?php esc_html_e('Walking', 'gmap-embed'); ?></option>
220
+ <option value="BICYCLING"><?php esc_html_e('Bicycling', 'gmap-embed'); ?></option>
221
+ <option value="TRANSIT"><?php esc_html_e('Transit', 'gmap-embed'); ?></option>
222
  </select>
223
  </div>
224
  <button type="button" data-icon="search" data-role="button" href="#" style="padding:8px;"
225
+ id="wp_gmap_submit_<?php echo esc_html($count); ?>"><?php esc_html_e('Get Directions', 'gmap-embed'); ?>
226
  </button>
227
+ <span id="wp_gmap_loading_<?php echo esc_html($count); ?>"
228
+ style="display: none;"><?php esc_html_e('Loading', 'gmap-embed'); ?>...</span>
229
  </div>
230
 
231
  <!-- Directions will be listed here-->
232
+ <div id="wp_gmap_results_<?php echo esc_html($count); ?>"
233
  style="display:none;max-height: 300px;overflow-y: scroll;">
234
+ <div id="wp_gmap_directions_<?php echo esc_html($count); ?>"></div>
235
  </div>
236
 
237
  </div>
238
+
239
+ <?php
240
+ if (esc_html(get_option('_wgm_enable_direction_form_auto_complete'))=='Y') { ?>
241
+ <script type="text/javascript">
242
+ jQuery(document).ready(function ($) {
243
+ new google.maps.places.Autocomplete(
244
+ (document.getElementById("srm_gmap_from_<?php echo esc_html($count); ?>"))
245
+ );
246
+ new google.maps.places.Autocomplete(
247
+ (document.getElementById("srm_gmap_to_<?php echo esc_html($count); ?>"))
248
+ );
249
+ });
250
+ </script>
251
+ <?php
252
+ }
253
+ }
254
+ } else {
255
+ if (is_user_logged_in() && current_user_can('administrator')) {
256
+ echo "<span style='color:darkred;'>Shortcode not defined, please check WP Google Map plugin in WordPress admin panel(sidebar). This message only visible to Administrator</span>";
257
+ }
258
+ }
259
+ ?>
260
+ <?php
261
+ return ob_get_clean();
262
+ }
263
  }
264
 
265
  // ******* Defining Shortcode for WP Google Map
266
+ add_shortcode('gmap-embed', 'srm_gmap_embed_shortcode');
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: 6.0
7
- Version: 1.8.8
8
- Stable tag: 1.8.8
9
  Requires PHP: 5.3
10
  Text Domain: gmap-embed
11
  License: GPLv2 or later
@@ -81,7 +81,7 @@ Get a free **License Key** of the WP Google Map Pro version in exchange for tran
81
  * **[Twitter Community](https://wpgooglemap.com/twitter?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=read_support_cont)**
82
  * **[LIVE CHAT](https://wpgooglemap.com/live-chat?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=read_support_cont)**
83
 
84
- To have continued the update, please donate for the WP Google Map plugin. **You will get Lifetime License Key by donating minimum 10 USD**
85
  **[Click here to donate](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZBERRKARGNEYA)**
86
 
87
  ### Features of WP Google Map Plugin-Lite version(FREE):
@@ -193,14 +193,16 @@ Go to **Appearance** =-> **Widget** . Now please [See the documentation](https:/
193
 
194
  == Changelog ==
195
 
196
-
197
- = 1.8.8 =
198
- * New UI screenshots updated in wp.org
199
- * Chinese version of map introduced
200
  * Copy to clipboard for map shortcode
201
  * Default markers bundle added
202
  * CADATA introduced for frontend
203
- * Markers category system introduced
 
 
 
 
 
204
  * Map Theme option introduced including custom theme JSON.
205
 
206
  = 1.8.6 =
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: 6.0
7
+ Version: 1.8.9
8
+ Stable tag: 1.8.9
9
  Requires PHP: 5.3
10
  Text Domain: gmap-embed
11
  License: GPLv2 or later
81
  * **[Twitter Community](https://wpgooglemap.com/twitter?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=read_support_cont)**
82
  * **[LIVE CHAT](https://wpgooglemap.com/live-chat?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=read_support_cont)**
83
 
84
+ To have continued the update, please donate for the WP Google Map plugin. **You will get Lifetime License Key by donating minimum 19 USD**
85
  **[Click here to donate](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZBERRKARGNEYA)**
86
 
87
  ### Features of WP Google Map Plugin-Lite version(FREE):
193
 
194
  == Changelog ==
195
 
196
+ = 1.8.9 =
 
 
 
197
  * Copy to clipboard for map shortcode
198
  * Default markers bundle added
199
  * CADATA introduced for frontend
200
+ * Auto-Complete/Auto suggestion option added for direction From/To input field
201
+ * Added Distance Unit (Miles and KM) configurable
202
+
203
+
204
+ = 1.8.8 =
205
+ * New UI screenshots updated in wp.org
206
  * Map Theme option introduced including custom theme JSON.
207
 
208
  = 1.8.6 =
srm_gmap_embed.php CHANGED
@@ -7,7 +7,7 @@
7
  Text Domain: gmap-embed
8
  Domain Path: /languages
9
  Author URI: https://www.wpgooglemap.com?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash
10
- Version: 1.8.8
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.8' );
20
  define( 'WGM_PLUGIN_PATH', trailingslashit( plugin_dir_path( __FILE__ ) ) );
21
  define( 'WGM_PLUGIN_URL', trailingslashit( plugins_url( '/', __FILE__ ) ) );
22
  define( 'WGM_ICONS_DIR', WGM_PLUGIN_PATH.'admin/assets/images/markers/icons/' );
7
  Text Domain: gmap-embed
8
  Domain Path: /languages
9
  Author URI: https://www.wpgooglemap.com?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash
10
+ Version: 1.8.9
11
  */
12
 
13
  use WGMSRM\Classes\Database;
16
  exit;
17
  }
18
 
19
+ define( 'WGM_PLUGIN_VERSION', '1.8.9' );
20
  define( 'WGM_PLUGIN_PATH', trailingslashit( plugin_dir_path( __FILE__ ) ) );
21
  define( 'WGM_PLUGIN_URL', trailingslashit( plugins_url( '/', __FILE__ ) ) );
22
  define( 'WGM_ICONS_DIR', WGM_PLUGIN_PATH.'admin/assets/images/markers/icons/' );