WP Google Maps - Version 6.3.20

Version Description

  • 2016-09-27 =
  • Fixed a big that prevented the map from loading in a widget
  • Refactored code used to load the Google Maps API and Script files
Download this release

Release Info

Developer WPGMaps
Plugin Icon 128x128 WP Google Maps
Version 6.3.20
Comparing to
See all releases

Code changes from version 6.3.19 to 6.3.20

Files changed (2) hide show
  1. readme.txt +6 -1
  2. wpGoogleMaps.php +336 -207
readme.txt CHANGED
@@ -213,7 +213,12 @@ Please upgrade your version of WP Google Maps to version 6.0.27 as it includes m
213
 
214
  == Changelog ==
215
 
216
- = 6.3.19 - 2016-09-22 =
 
 
 
 
 
217
  * Fixed a bug that caused some maps to not load markers on page load
218
 
219
  = 6.3.18 - 2016-09-15 =
213
 
214
  == Changelog ==
215
 
216
+
217
+ = 6.3.20 - 2016-09-27 =
218
+ * Fixed a big that prevented the map from loading in a widget
219
+ * Refactored code used to load the Google Maps API and Script files
220
+
221
+ = 6.3.19 - 2016-09-21 =
222
  * Fixed a bug that caused some maps to not load markers on page load
223
 
224
  = 6.3.18 - 2016-09-15 =
wpGoogleMaps.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP Google Maps
4
  Plugin URI: http://www.wpgmaps.com
5
  Description: The easiest to use Google Maps plugin! Create custom Google Maps with high quality markers containing locations, descriptions, images and links. Add your customized map to your WordPress posts and/or pages quickly and easily with the supplied shortcode. No fuss.
6
- Version: 6.3.19
7
  Author: WP Google Maps
8
  Author URI: http://www.wpgmaps.com
9
  Text Domain: wp-google-maps
@@ -11,7 +11,11 @@ Domain Path: /languages
11
  */
12
 
13
  /*
14
- * 6.3.19 - 2016-09-22
 
 
 
 
15
  * Fixed a bug that caused some maps to not load markers on page load
16
  *
17
  * 6.3.18 - 2016-09-15
@@ -1677,186 +1681,172 @@ function wpgmaps_admin_javascript_basic() {
1677
 
1678
 
1679
  function wpgmaps_user_javascript_basic() {
 
 
 
 
 
1680
  global $short_code_active;
1681
  global $wpgmza_current_map_id;
1682
  global $wpgmza_version;
1683
 
1684
- if ($short_code_active) {
1685
-
1686
- $ajax_nonce = wp_create_nonce("wpgmza");
1687
 
1688
- $res = array();
1689
- $res[0] = wpgmza_get_map_data($wpgmza_current_map_id);
1690
- $wpgmza_settings = get_option("WPGMZA_OTHER_SETTINGS");
1691
-
1692
- if (isset($wpgmza_settings['wpgmza_api_version'])) {
1693
- $api_version = $wpgmza_settings['wpgmza_api_version'];
1694
- if (isset($api_version) && $api_version != "") {
1695
- $api_version_string = "v=$api_version&";
1696
- } else {
1697
- $api_version_string = "v=3.exp&";
1698
- }
1699
  } else {
1700
  $api_version_string = "v=3.exp&";
1701
  }
1702
-
1703
- $map_other_settings = maybe_unserialize($res[0]->other_settings);
1704
- $res[0]->other_settings = $map_other_settings;
1705
- $res[0]->map_width_type = stripslashes($res[0]->map_width_type);
 
 
 
1706
 
1707
 
1708
- if ($res[0]->other_settings['wpgmza_theme_data'] != '') {
1709
- $res[0]->other_settings['wpgmza_theme_data'] = html_entity_decode(stripslashes($res[0]->other_settings['wpgmza_theme_data']));
1710
- }
1711
- /*
1712
- * deprecated in 6.2.0
1713
-
1714
- if (isset($map_other_settings['weather_layer'])) { $weather_layer = $map_other_settings['weather_layer']; } else { $weather_layer = false; }
1715
- if (isset($map_other_settings['weather_layer_temp_type'])) { $weather_layer_temp_type = $map_other_settings['weather_layer_temp_type']; } else { $weather_layer_temp_type = false; }
1716
- if (isset($map_other_settings['cloud_layer'])) { $cloud_layer = $map_other_settings['cloud_layer']; } else { $cloud_layer = false; }
1717
- */
1718
-
1719
 
1720
- /*
1721
- if (isset($map_other_settings['transport_layer'])) { $transport_layer = $map_other_settings['transport_layer']; } else { $transport_layer = false; }
1722
- if (isset($map_other_settings['store_locator_bounce'])) { $store_locator_bounce = $map_other_settings['store_locator_bounce']; } else { $store_locator_bounce = 1; }
1723
-
1724
- $wpgmza_lat = $res->map_start_lat;
1725
- $wpgmza_lng = $res->map_start_lng;
1726
- $wpgmza_width = $res->map_width;
1727
- $wpgmza_height = $res->map_height;
1728
- $wpgmza_width_type = $res->map_width_type;
1729
- $wpgmza_height_type = $res->map_height_type;
1730
- $wpgmza_map_type = $res->type;
1731
- $wpgmza_traffic = $res->traffic;
1732
- $wpgmza_bicycle = $res->bicycle;
1733
 
1734
- if (isset($map_other_settings['map_max_zoom'])) { $wpgmza_max_zoom = intval($map_other_settings['map_max_zoom']); } else { $wpgmza_max_zoom = 2; }
1735
- if (isset($map_other_settings['wpgmza_theme_data'])) { $wpgmza_theme_data = $map_other_settings['wpgmza_theme_data']; } else { $wpgmza_theme_data = false; }
1736
 
1737
-
1738
- if (isset($wpgmza_settings['wpgmza_settings_map_open_marker_by'])) { $wpgmza_open_infowindow_by = $wpgmza_settings['wpgmza_settings_map_open_marker_by']; } else { $wpgmza_open_infowindow_by = '1'; }
1739
- if ($wpgmza_open_infowindow_by == null || !isset($wpgmza_open_infowindow_by)) { $wpgmza_open_infowindow_by = '1'; }
1740
 
1741
- if (!$wpgmza_map_type || $wpgmza_map_type == "" || $wpgmza_map_type == "1") { $wpgmza_map_type = "ROADMAP"; }
1742
- else if ($wpgmza_map_type == "2") { $wpgmza_map_type = "SATELLITE"; }
1743
- else if ($wpgmza_map_type == "3") { $wpgmza_map_type = "HYBRID"; }
1744
- else if ($wpgmza_map_type == "4") { $wpgmza_map_type = "TERRAIN"; }
1745
- else { $wpgmza_map_type = "ROADMAP"; }
1746
-
1747
 
1748
- $start_zoom = $res->map_start_zoom;
1749
- if ($start_zoom < 1 || !$start_zoom) { $start_zoom = 5; }
1750
- if (!$wpgmza_lat || !$wpgmza_lng) { $wpgmza_lat = "51.5081290"; $wpgmza_lng = "-0.1280050"; }
1751
-
1752
-
1753
- if (isset($wpgmza_settings['wpgmza_settings_marker_pull'])) { $marker_pull = $wpgmza_settings['wpgmza_settings_marker_pull']; } else { $marker_pull = "1"; }
1754
- $restrict_search = false;
1755
- if (isset($map_other_settings['wpgmza_store_locator_restrict'])) { $restrict_search = $map_other_settings['wpgmza_store_locator_restrict']; } else { $restrict_search = false; }
1756
- */
1757
 
1758
- $polygonoptions = array();
1759
- $total_poly_array = wpgmza_b_return_polygon_id_array($wpgmza_current_map_id);
1760
-
1761
- if ($total_poly_array > 0) {
1762
- foreach ($total_poly_array as $poly_id) {
1763
- $polygonoptions[$poly_id] = wpgmza_b_return_poly_options($poly_id);
1764
-
1765
- $tmp_poly_array = wpgmza_b_return_polygon_array($poly_id);
1766
- $poly_data_raw_array = array();
1767
- foreach ($tmp_poly_array as $single_poly) {
1768
- $poly_data_raw = str_replace(" ","",$single_poly);
1769
- $poly_data_raw = explode(",",$poly_data_raw);
1770
- $lat = $poly_data_raw[0];
1771
- $lng = $poly_data_raw[1];
1772
- $poly_data_raw_array[] = $poly_data_raw;
1773
- }
1774
- $polygonoptions[$poly_id]->polydata = $poly_data_raw_array;
1775
-
1776
- $linecolor = $polygonoptions[$poly_id]->linecolor;
1777
- $fillcolor = $polygonoptions[$poly_id]->fillcolor;
1778
- $fillopacity = $polygonoptions[$poly_id]->opacity;
1779
- if (!$linecolor) { $polygonoptions[$poly_id]->linecolor = "000000"; }
1780
- if (!$fillcolor) { $polygonoptions[$poly_id]->fillcolor = "66FF00"; }
1781
- if (!$fillopacity) { $polygonoptions[$poly_id]->opacity = "0.5"; }
1782
  }
1783
- } else { $polygonoptions = array(); }
1784
-
1785
-
1786
- $polylineoptions = array();
1787
-
1788
- $total_poly_array = wpgmza_b_return_polyline_id_array($wpgmza_current_map_id);
1789
- if ($total_poly_array > 0) {
1790
- foreach ($total_poly_array as $poly_id) {
1791
- $polylineoptions[$poly_id] = wpgmza_b_return_polyline_options($poly_id);
1792
-
1793
- $tmp_poly_array = wpgmza_b_return_polyline_array($poly_id);
1794
- $poly_data_raw_array = array();
1795
- foreach ($tmp_poly_array as $single_poly) {
1796
- $poly_data_raw = str_replace(" ","",$single_poly);
1797
- $poly_data_raw = str_replace(")","",$poly_data_raw );
1798
- $poly_data_raw = str_replace("(","",$poly_data_raw );
1799
- $poly_data_raw = explode(",",$poly_data_raw);
1800
- $lat = $poly_data_raw[0];
1801
- $lng = $poly_data_raw[1];
1802
- $poly_data_raw_array[] = $poly_data_raw;
1803
- }
1804
- $polylineoptions[$poly_id]->polydata = $poly_data_raw_array;
1805
-
1806
-
1807
- if (isset($polylineoptions[$poly_id]->linecolor)) { $linecolor = $polylineoptions[$poly_id]->linecolor; } else { $linecolor = false; }
1808
- if (isset($polylineoptions[$poly_id]->fillcolor)) { $fillcolor = $polylineoptions[$poly_id]->fillcolor; } else { $fillcolor = false; }
1809
- if (isset($polylineoptions[$poly_id]->opacity)) { $fillopacity = $polylineoptions[$poly_id]->opacity; } else { $fillopacity = false; }
1810
- if (!$linecolor) { $polylineoptions[$poly_id]->linecolor = "000000"; }
1811
- if (!$fillcolor) { $polylineoptions[$poly_id]->fillcolor = "66FF00"; }
1812
- if (!$fillopacity) { $polylineoptions[$poly_id]->opacity = "0.5"; }
1813
- }
1814
- } else { $polylineoptions = array(); }
1815
-
1816
- if (isset($wpgmza_settings['wpgmza_settings_marker_pull']) && $wpgmza_settings['wpgmza_settings_marker_pull'] == "0") {
1817
- $markers = wpgmaps_return_markers($wpgmza_current_map_id);
1818
  }
1819
-
1820
- $wpgmza_locale = get_locale();
1821
- $wpgmza_suffix = ".com";
1822
- /* Hebrew correction */
1823
- if ($wpgmza_locale == "he_IL") { $wpgmza_locale = "iw"; }
1824
-
1825
- /* Chinese integration */
1826
- if ($wpgmza_locale == "zh_CN") { $wpgmza_suffix = ".cn"; } else { $wpgmza_suffix = ".com"; }
1827
-
1828
- wp_enqueue_script('wpgmaps_core', plugins_url('/js/wpgmaps.min.js',__FILE__), array( 'wpgmza_api_call' ), $wpgmza_version.'b' , false);
 
 
 
 
 
 
 
 
 
 
 
 
1829
 
1830
- do_action("wpgooglemaps_basic_hook_user_js_after_core");
1831
 
 
 
 
 
 
 
 
 
1832
 
 
 
 
 
 
 
1833
 
 
1834
 
1835
- wp_localize_script( 'wpgmaps_core', 'wpgmaps_localize', $res);
1836
- wp_localize_script( 'wpgmaps_core', 'wpgmaps_localize_polygon_settings', $polygonoptions);
1837
- wp_localize_script( 'wpgmaps_core', 'wpgmaps_localize_polyline_settings', $polylineoptions);
1838
 
1839
- wp_localize_script( 'wpgmaps_core', 'wpgmaps_markerurl', wpgmaps_get_marker_url($wpgmza_current_map_id));
1840
 
1841
 
1842
- if ($wpgmza_settings['wpgmza_settings_marker_pull'] == "0") {
1843
- wp_localize_script( 'wpgmaps_core', 'wpgmaps_localize_marker_data', $markers);
1844
- }
1845
-
1846
- $wpgmza_settings = apply_filters("wpgmza_basic_filter_localize_settings",$wpgmza_settings);
1847
-
1848
- wp_localize_script( 'wpgmaps_core', 'wpgmaps_localize_global_settings', $wpgmza_settings);
1849
-
1850
- wp_localize_script( 'wpgmaps_core', 'wpgmaps_lang_km_away', __("km away","wp-google-maps"));
1851
- wp_localize_script( 'wpgmaps_core', 'wpgmaps_lang_m_away', __("miles away","wp-google-maps"));
1852
 
1853
-
1854
-
1855
- ?>
1856
 
 
 
1857
 
1858
- <?php
1859
- }
1860
  }
1861
 
1862
 
@@ -2370,8 +2360,6 @@ function wpgmaps_tag_basic( $atts ) {
2370
  return;
2371
  }
2372
 
2373
- $short_code_active = true;
2374
-
2375
  if (!function_exists('wpgmaps_admin_styles_pro')) {
2376
 
2377
  wp_register_style( 'wpgmaps-style', plugins_url('css/wpgmza_style.css', __FILE__),array(),$wpgmza_version);
@@ -2382,11 +2370,8 @@ function wpgmaps_tag_basic( $atts ) {
2382
  $wpgmza_override['zoom'] = $zoom_override;
2383
  }
2384
 
2385
-
2386
-
2387
  $map_align = $res->alignment;
2388
-
2389
-
2390
  $wpgmza_settings = get_option("WPGMZA_OTHER_SETTINGS");
2391
  if (isset($wpgmza_settings['wpgmza_settings_marker_pull']) && $wpgmza_settings['wpgmza_settings_marker_pull'] == '0') {
2392
  } else {
@@ -2394,9 +2379,6 @@ function wpgmaps_tag_basic( $atts ) {
2394
  wpgmza_check_if_marker_file_exists($wpgmza_current_map_id);
2395
  }
2396
 
2397
-
2398
-
2399
-
2400
  $map_width_type = stripslashes($res->map_width_type);
2401
  $map_height_type = stripslashes($res->map_height_type);
2402
  if (!isset($map_width_type)) { $map_width_type == "px"; }
@@ -2439,6 +2421,197 @@ function wpgmaps_tag_basic( $atts ) {
2439
  ."</style>
2440
  ".$ret_msg;
2441
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2442
 
2443
  return $ret_msg;
2444
  }
@@ -5445,7 +5618,7 @@ if (function_exists('wpgmza_register_pro_version')) {
5445
  add_action('wp_ajax_delete_polyline', 'wpgmaps_action_callback_basic');
5446
 
5447
  add_action('template_redirect','wpgmaps_check_shortcode');
5448
- add_action('wp_footer', 'wpgmaps_user_javascript_basic');
5449
  add_shortcode( 'wpgmza', 'wpgmaps_tag_basic' );
5450
  }
5451
 
@@ -6164,48 +6337,4 @@ function wpgmza_deregister_styles() {
6164
  }
6165
  }
6166
  }
6167
- }
6168
-
6169
- if( !function_exists( 'wpgmaps_pro_activate' ) ){
6170
- add_action( 'wp_enqueue_scripts', 'wpgmza_load_google_maps_api' );
6171
- }
6172
-
6173
- function wpgmza_load_google_maps_api(){
6174
-
6175
- global $short_code_active;
6176
-
6177
- if( $short_code_active ){
6178
-
6179
- $wpgmza_settings = get_option("WPGMZA_OTHER_SETTINGS");
6180
-
6181
- if(isset($wpgmza_settings['wpgmza_settings_remove_api']) && $wpgmza_settings['wpgmza_settings_remove_api'] == "yes"){ } else {
6182
-
6183
- $wpgmza_locale = get_locale();
6184
-
6185
- $wpgmza_suffix = ".com";
6186
- /* Hebrew correction */
6187
- if ($wpgmza_locale == "he_IL") { $wpgmza_locale = "iw"; }
6188
-
6189
- /* Chinese integration */
6190
- if ($wpgmza_locale == "zh_CN") { $wpgmza_suffix = ".cn"; } else { $wpgmza_suffix = ".com"; }
6191
-
6192
- $wpgmza_settings = get_option("WPGMZA_OTHER_SETTINGS");
6193
- if (isset($wpgmza_settings['wpgmza_api_version']) && $wpgmza_settings['wpgmza_api_version'] != "") {
6194
- $api_version_string = "v=".$wpgmza_settings['wpgmza_api_version']."&";
6195
- } else {
6196
- $api_version_string = "v=3.exp&";
6197
- }
6198
-
6199
- $wpgmza_api_key = get_option( 'wpgmza_google_maps_api_key' );
6200
-
6201
- if( $wpgmza_api_key ){
6202
- wp_enqueue_script('wpgmza_api_call', 'http://maps.google'.$wpgmza_suffix.'/maps/api/js?'.$api_version_string.'key='.$wpgmza_api_key.'&language='.$wpgmza_locale, array(), null );
6203
- } else {
6204
- wp_enqueue_script('wpgmza_api_call', '//maps.google'.$wpgmza_suffix.'/maps/api/js?'.$api_version_string.'language='.$wpgmza_locale, array(), null );
6205
- }
6206
-
6207
- }
6208
-
6209
- }
6210
-
6211
  }
3
  Plugin Name: WP Google Maps
4
  Plugin URI: http://www.wpgmaps.com
5
  Description: The easiest to use Google Maps plugin! Create custom Google Maps with high quality markers containing locations, descriptions, images and links. Add your customized map to your WordPress posts and/or pages quickly and easily with the supplied shortcode. No fuss.
6
+ Version: 6.3.20
7
  Author: WP Google Maps
8
  Author URI: http://www.wpgmaps.com
9
  Text Domain: wp-google-maps
11
  */
12
 
13
  /*
14
+ * 6.3.20 - 2016-09-27
15
+ * Fixed a big that prevented the map from loading in a widget
16
+ * Refactored code used to load the Google Maps API and Script files
17
+ *
18
+ * 6.3.19 - 2016-09-21
19
  * Fixed a bug that caused some maps to not load markers on page load
20
  *
21
  * 6.3.18 - 2016-09-15
1681
 
1682
 
1683
  function wpgmaps_user_javascript_basic() {
1684
+
1685
+ /**
1686
+ * @deprecated [6.3.10] [Moved into the wpgmza_tag_basic function]
1687
+ *
1688
+ */
1689
  global $short_code_active;
1690
  global $wpgmza_current_map_id;
1691
  global $wpgmza_version;
1692
 
1693
+ $ajax_nonce = wp_create_nonce("wpgmza");
 
 
1694
 
1695
+ $res = array();
1696
+ $res[0] = wpgmza_get_map_data($wpgmza_current_map_id);
1697
+ $wpgmza_settings = get_option("WPGMZA_OTHER_SETTINGS");
1698
+
1699
+ if (isset($wpgmza_settings['wpgmza_api_version'])) {
1700
+ $api_version = $wpgmza_settings['wpgmza_api_version'];
1701
+ if (isset($api_version) && $api_version != "") {
1702
+ $api_version_string = "v=$api_version&";
 
 
 
1703
  } else {
1704
  $api_version_string = "v=3.exp&";
1705
  }
1706
+ } else {
1707
+ $api_version_string = "v=3.exp&";
1708
+ }
1709
+
1710
+ $map_other_settings = maybe_unserialize($res[0]->other_settings);
1711
+ $res[0]->other_settings = $map_other_settings;
1712
+ $res[0]->map_width_type = stripslashes($res[0]->map_width_type);
1713
 
1714
 
1715
+ if ($res[0]->other_settings['wpgmza_theme_data'] != '') {
1716
+ $res[0]->other_settings['wpgmza_theme_data'] = html_entity_decode(stripslashes($res[0]->other_settings['wpgmza_theme_data']));
1717
+ }
1718
+ /*
1719
+ * deprecated in 6.2.0
1720
+
1721
+ if (isset($map_other_settings['weather_layer'])) { $weather_layer = $map_other_settings['weather_layer']; } else { $weather_layer = false; }
1722
+ if (isset($map_other_settings['weather_layer_temp_type'])) { $weather_layer_temp_type = $map_other_settings['weather_layer_temp_type']; } else { $weather_layer_temp_type = false; }
1723
+ if (isset($map_other_settings['cloud_layer'])) { $cloud_layer = $map_other_settings['cloud_layer']; } else { $cloud_layer = false; }
1724
+ */
1725
+
1726
 
1727
+ /*
1728
+ if (isset($map_other_settings['transport_layer'])) { $transport_layer = $map_other_settings['transport_layer']; } else { $transport_layer = false; }
1729
+ if (isset($map_other_settings['store_locator_bounce'])) { $store_locator_bounce = $map_other_settings['store_locator_bounce']; } else { $store_locator_bounce = 1; }
1730
+
1731
+ $wpgmza_lat = $res->map_start_lat;
1732
+ $wpgmza_lng = $res->map_start_lng;
1733
+ $wpgmza_width = $res->map_width;
1734
+ $wpgmza_height = $res->map_height;
1735
+ $wpgmza_width_type = $res->map_width_type;
1736
+ $wpgmza_height_type = $res->map_height_type;
1737
+ $wpgmza_map_type = $res->type;
1738
+ $wpgmza_traffic = $res->traffic;
1739
+ $wpgmza_bicycle = $res->bicycle;
1740
 
1741
+ if (isset($map_other_settings['map_max_zoom'])) { $wpgmza_max_zoom = intval($map_other_settings['map_max_zoom']); } else { $wpgmza_max_zoom = 2; }
1742
+ if (isset($map_other_settings['wpgmza_theme_data'])) { $wpgmza_theme_data = $map_other_settings['wpgmza_theme_data']; } else { $wpgmza_theme_data = false; }
1743
 
1744
+
1745
+ if (isset($wpgmza_settings['wpgmza_settings_map_open_marker_by'])) { $wpgmza_open_infowindow_by = $wpgmza_settings['wpgmza_settings_map_open_marker_by']; } else { $wpgmza_open_infowindow_by = '1'; }
1746
+ if ($wpgmza_open_infowindow_by == null || !isset($wpgmza_open_infowindow_by)) { $wpgmza_open_infowindow_by = '1'; }
1747
 
1748
+ if (!$wpgmza_map_type || $wpgmza_map_type == "" || $wpgmza_map_type == "1") { $wpgmza_map_type = "ROADMAP"; }
1749
+ else if ($wpgmza_map_type == "2") { $wpgmza_map_type = "SATELLITE"; }
1750
+ else if ($wpgmza_map_type == "3") { $wpgmza_map_type = "HYBRID"; }
1751
+ else if ($wpgmza_map_type == "4") { $wpgmza_map_type = "TERRAIN"; }
1752
+ else { $wpgmza_map_type = "ROADMAP"; }
1753
+
1754
 
1755
+ $start_zoom = $res->map_start_zoom;
1756
+ if ($start_zoom < 1 || !$start_zoom) { $start_zoom = 5; }
1757
+ if (!$wpgmza_lat || !$wpgmza_lng) { $wpgmza_lat = "51.5081290"; $wpgmza_lng = "-0.1280050"; }
1758
+
1759
+
1760
+ if (isset($wpgmza_settings['wpgmza_settings_marker_pull'])) { $marker_pull = $wpgmza_settings['wpgmza_settings_marker_pull']; } else { $marker_pull = "1"; }
1761
+ $restrict_search = false;
1762
+ if (isset($map_other_settings['wpgmza_store_locator_restrict'])) { $restrict_search = $map_other_settings['wpgmza_store_locator_restrict']; } else { $restrict_search = false; }
1763
+ */
1764
 
1765
+ $polygonoptions = array();
1766
+ $total_poly_array = wpgmza_b_return_polygon_id_array($wpgmza_current_map_id);
1767
+
1768
+ if ($total_poly_array > 0) {
1769
+ foreach ($total_poly_array as $poly_id) {
1770
+ $polygonoptions[$poly_id] = wpgmza_b_return_poly_options($poly_id);
1771
+
1772
+ $tmp_poly_array = wpgmza_b_return_polygon_array($poly_id);
1773
+ $poly_data_raw_array = array();
1774
+ foreach ($tmp_poly_array as $single_poly) {
1775
+ $poly_data_raw = str_replace(" ","",$single_poly);
1776
+ $poly_data_raw = explode(",",$poly_data_raw);
1777
+ $lat = $poly_data_raw[0];
1778
+ $lng = $poly_data_raw[1];
1779
+ $poly_data_raw_array[] = $poly_data_raw;
 
 
 
 
 
 
 
 
 
1780
  }
1781
+ $polygonoptions[$poly_id]->polydata = $poly_data_raw_array;
1782
+
1783
+ $linecolor = $polygonoptions[$poly_id]->linecolor;
1784
+ $fillcolor = $polygonoptions[$poly_id]->fillcolor;
1785
+ $fillopacity = $polygonoptions[$poly_id]->opacity;
1786
+ if (!$linecolor) { $polygonoptions[$poly_id]->linecolor = "000000"; }
1787
+ if (!$fillcolor) { $polygonoptions[$poly_id]->fillcolor = "66FF00"; }
1788
+ if (!$fillopacity) { $polygonoptions[$poly_id]->opacity = "0.5"; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1789
  }
1790
+ } else { $polygonoptions = array(); }
1791
+
1792
+
1793
+ $polylineoptions = array();
1794
+
1795
+ $total_poly_array = wpgmza_b_return_polyline_id_array($wpgmza_current_map_id);
1796
+ if ($total_poly_array > 0) {
1797
+ foreach ($total_poly_array as $poly_id) {
1798
+ $polylineoptions[$poly_id] = wpgmza_b_return_polyline_options($poly_id);
1799
+
1800
+ $tmp_poly_array = wpgmza_b_return_polyline_array($poly_id);
1801
+ $poly_data_raw_array = array();
1802
+ foreach ($tmp_poly_array as $single_poly) {
1803
+ $poly_data_raw = str_replace(" ","",$single_poly);
1804
+ $poly_data_raw = str_replace(")","",$poly_data_raw );
1805
+ $poly_data_raw = str_replace("(","",$poly_data_raw );
1806
+ $poly_data_raw = explode(",",$poly_data_raw);
1807
+ $lat = $poly_data_raw[0];
1808
+ $lng = $poly_data_raw[1];
1809
+ $poly_data_raw_array[] = $poly_data_raw;
1810
+ }
1811
+ $polylineoptions[$poly_id]->polydata = $poly_data_raw_array;
1812
 
 
1813
 
1814
+ if (isset($polylineoptions[$poly_id]->linecolor)) { $linecolor = $polylineoptions[$poly_id]->linecolor; } else { $linecolor = false; }
1815
+ if (isset($polylineoptions[$poly_id]->fillcolor)) { $fillcolor = $polylineoptions[$poly_id]->fillcolor; } else { $fillcolor = false; }
1816
+ if (isset($polylineoptions[$poly_id]->opacity)) { $fillopacity = $polylineoptions[$poly_id]->opacity; } else { $fillopacity = false; }
1817
+ if (!$linecolor) { $polylineoptions[$poly_id]->linecolor = "000000"; }
1818
+ if (!$fillcolor) { $polylineoptions[$poly_id]->fillcolor = "66FF00"; }
1819
+ if (!$fillopacity) { $polylineoptions[$poly_id]->opacity = "0.5"; }
1820
+ }
1821
+ } else { $polylineoptions = array(); }
1822
 
1823
+ if (isset($wpgmza_settings['wpgmza_settings_marker_pull']) && $wpgmza_settings['wpgmza_settings_marker_pull'] == "0") {
1824
+ $markers = wpgmaps_return_markers($wpgmza_current_map_id);
1825
+ }
1826
+
1827
+ wp_enqueue_script( 'wpgmza_api_call' );
1828
+ wp_enqueue_script( 'wpgmaps_core' );
1829
 
1830
+ do_action("wpgooglemaps_basic_hook_user_js_after_core");
1831
 
1832
+ wp_localize_script( 'wpgmaps_core', 'wpgmaps_localize', $res);
1833
+ wp_localize_script( 'wpgmaps_core', 'wpgmaps_localize_polygon_settings', $polygonoptions);
1834
+ wp_localize_script( 'wpgmaps_core', 'wpgmaps_localize_polyline_settings', $polylineoptions);
1835
 
1836
+ wp_localize_script( 'wpgmaps_core', 'wpgmaps_markerurl', wpgmaps_get_marker_url($wpgmza_current_map_id));
1837
 
1838
 
1839
+ if ($wpgmza_settings['wpgmza_settings_marker_pull'] == "0") {
1840
+ wp_localize_script( 'wpgmaps_core', 'wpgmaps_localize_marker_data', $markers);
1841
+ }
1842
+
1843
+ $wpgmza_settings = apply_filters("wpgmza_basic_filter_localize_settings",$wpgmza_settings);
 
 
 
 
 
1844
 
1845
+ wp_localize_script( 'wpgmaps_core', 'wpgmaps_localize_global_settings', $wpgmza_settings);
 
 
1846
 
1847
+ wp_localize_script( 'wpgmaps_core', 'wpgmaps_lang_km_away', __("km away","wp-google-maps"));
1848
+ wp_localize_script( 'wpgmaps_core', 'wpgmaps_lang_m_away', __("miles away","wp-google-maps"));
1849
 
 
 
1850
  }
1851
 
1852
 
2360
  return;
2361
  }
2362
 
 
 
2363
  if (!function_exists('wpgmaps_admin_styles_pro')) {
2364
 
2365
  wp_register_style( 'wpgmaps-style', plugins_url('css/wpgmza_style.css', __FILE__),array(),$wpgmza_version);
2370
  $wpgmza_override['zoom'] = $zoom_override;
2371
  }
2372
 
 
 
2373
  $map_align = $res->alignment;
2374
+
 
2375
  $wpgmza_settings = get_option("WPGMZA_OTHER_SETTINGS");
2376
  if (isset($wpgmza_settings['wpgmza_settings_marker_pull']) && $wpgmza_settings['wpgmza_settings_marker_pull'] == '0') {
2377
  } else {
2379
  wpgmza_check_if_marker_file_exists($wpgmza_current_map_id);
2380
  }
2381
 
 
 
 
2382
  $map_width_type = stripslashes($res->map_width_type);
2383
  $map_height_type = stripslashes($res->map_height_type);
2384
  if (!isset($map_width_type)) { $map_width_type == "px"; }
2421
  ."</style>
2422
  ".$ret_msg;
2423
  }
2424
+
2425
+ $wpgmza_locale = get_locale();
2426
+
2427
+ $wpgmza_suffix = ".com";
2428
+ /* Hebrew correction */
2429
+ if ($wpgmza_locale == "he_IL") { $wpgmza_locale = "iw"; }
2430
+
2431
+ /* Chinese integration */
2432
+ if ($wpgmza_locale == "zh_CN") { $wpgmza_suffix = ".cn"; } else { $wpgmza_suffix = ".com"; }
2433
+
2434
+ $wpgmza_settings = get_option("WPGMZA_OTHER_SETTINGS");
2435
+
2436
+ /**
2437
+ * Only register the below scrips so that they are available on demand.
2438
+ */
2439
+ if(isset($wpgmza_settings['wpgmza_settings_remove_api']) && $wpgmza_settings['wpgmza_settings_remove_api'] == "yes"){
2440
+
2441
+ $wpgaps_core_dependancy = array();
2442
+
2443
+ } else {
2444
+
2445
+ if (isset($wpgmza_settings['wpgmza_api_version']) && $wpgmza_settings['wpgmza_api_version'] != "") {
2446
+ $api_version_string = "v=".$wpgmza_settings['wpgmza_api_version']."&";
2447
+ } else {
2448
+ $api_version_string = "v=3.exp&";
2449
+ }
2450
+
2451
+ $wpgmza_api_key = get_option( 'wpgmza_google_maps_api_key' );
2452
+
2453
+ if( $wpgmza_api_key ){
2454
+ wp_enqueue_script('wpgmza_api_call', '//maps.google'.$wpgmza_suffix.'/maps/api/js?'.$api_version_string.'key='.$wpgmza_api_key.'&language='.$wpgmza_locale, array(), null );
2455
+ } else {
2456
+ wp_enqueue_script('wpgmza_api_call', '//maps.google'.$wpgmza_suffix.'/maps/api/js?'.$api_version_string.'language='.$wpgmza_locale, array(), null );
2457
+ }
2458
+
2459
+ $wpgaps_core_dependancy = array( 'wpgmza_api_call' );
2460
+
2461
+ }
2462
+
2463
+ wp_enqueue_script('wpgmaps_core', plugins_url('/js/wpgmaps.min.js',__FILE__), $wpgaps_core_dependancy, $wpgmza_version.'b' , false);
2464
+
2465
+ $res = array();
2466
+ $res[0] = wpgmza_get_map_data($wpgmza_current_map_id);
2467
+ $wpgmza_settings = get_option("WPGMZA_OTHER_SETTINGS");
2468
+
2469
+ if (isset($wpgmza_settings['wpgmza_api_version'])) {
2470
+ $api_version = $wpgmza_settings['wpgmza_api_version'];
2471
+ if (isset($api_version) && $api_version != "") {
2472
+ $api_version_string = "v=$api_version&";
2473
+ } else {
2474
+ $api_version_string = "v=3.exp&";
2475
+ }
2476
+ } else {
2477
+ $api_version_string = "v=3.exp&";
2478
+ }
2479
+
2480
+ $map_other_settings = maybe_unserialize($res[0]->other_settings);
2481
+ $res[0]->other_settings = $map_other_settings;
2482
+ $res[0]->map_width_type = stripslashes($res[0]->map_width_type);
2483
+
2484
+
2485
+ if ( isset( $res[0]->other_settings['wpgmza_theme_data'] ) && $res[0]->other_settings['wpgmza_theme_data'] != '') {
2486
+ $res[0]->other_settings['wpgmza_theme_data'] = html_entity_decode(stripslashes($res[0]->other_settings['wpgmza_theme_data']));
2487
+ }
2488
+ /*
2489
+ * deprecated in 6.2.0
2490
+
2491
+ if (isset($map_other_settings['weather_layer'])) { $weather_layer = $map_other_settings['weather_layer']; } else { $weather_layer = false; }
2492
+ if (isset($map_other_settings['weather_layer_temp_type'])) { $weather_layer_temp_type = $map_other_settings['weather_layer_temp_type']; } else { $weather_layer_temp_type = false; }
2493
+ if (isset($map_other_settings['cloud_layer'])) { $cloud_layer = $map_other_settings['cloud_layer']; } else { $cloud_layer = false; }
2494
+ */
2495
+
2496
+
2497
+ /*
2498
+ if (isset($map_other_settings['transport_layer'])) { $transport_layer = $map_other_settings['transport_layer']; } else { $transport_layer = false; }
2499
+ if (isset($map_other_settings['store_locator_bounce'])) { $store_locator_bounce = $map_other_settings['store_locator_bounce']; } else { $store_locator_bounce = 1; }
2500
+
2501
+ $wpgmza_lat = $res->map_start_lat;
2502
+ $wpgmza_lng = $res->map_start_lng;
2503
+ $wpgmza_width = $res->map_width;
2504
+ $wpgmza_height = $res->map_height;
2505
+ $wpgmza_width_type = $res->map_width_type;
2506
+ $wpgmza_height_type = $res->map_height_type;
2507
+ $wpgmza_map_type = $res->type;
2508
+ $wpgmza_traffic = $res->traffic;
2509
+ $wpgmza_bicycle = $res->bicycle;
2510
+
2511
+ if (isset($map_other_settings['map_max_zoom'])) { $wpgmza_max_zoom = intval($map_other_settings['map_max_zoom']); } else { $wpgmza_max_zoom = 2; }
2512
+ if (isset($map_other_settings['wpgmza_theme_data'])) { $wpgmza_theme_data = $map_other_settings['wpgmza_theme_data']; } else { $wpgmza_theme_data = false; }
2513
+
2514
+
2515
+ if (isset($wpgmza_settings['wpgmza_settings_map_open_marker_by'])) { $wpgmza_open_infowindow_by = $wpgmza_settings['wpgmza_settings_map_open_marker_by']; } else { $wpgmza_open_infowindow_by = '1'; }
2516
+ if ($wpgmza_open_infowindow_by == null || !isset($wpgmza_open_infowindow_by)) { $wpgmza_open_infowindow_by = '1'; }
2517
+
2518
+ if (!$wpgmza_map_type || $wpgmza_map_type == "" || $wpgmza_map_type == "1") { $wpgmza_map_type = "ROADMAP"; }
2519
+ else if ($wpgmza_map_type == "2") { $wpgmza_map_type = "SATELLITE"; }
2520
+ else if ($wpgmza_map_type == "3") { $wpgmza_map_type = "HYBRID"; }
2521
+ else if ($wpgmza_map_type == "4") { $wpgmza_map_type = "TERRAIN"; }
2522
+ else { $wpgmza_map_type = "ROADMAP"; }
2523
+
2524
+
2525
+ $start_zoom = $res->map_start_zoom;
2526
+ if ($start_zoom < 1 || !$start_zoom) { $start_zoom = 5; }
2527
+ if (!$wpgmza_lat || !$wpgmza_lng) { $wpgmza_lat = "51.5081290"; $wpgmza_lng = "-0.1280050"; }
2528
+
2529
+
2530
+ if (isset($wpgmza_settings['wpgmza_settings_marker_pull'])) { $marker_pull = $wpgmza_settings['wpgmza_settings_marker_pull']; } else { $marker_pull = "1"; }
2531
+ $restrict_search = false;
2532
+ if (isset($map_other_settings['wpgmza_store_locator_restrict'])) { $restrict_search = $map_other_settings['wpgmza_store_locator_restrict']; } else { $restrict_search = false; }
2533
+ */
2534
+
2535
+ $polygonoptions = array();
2536
+ $total_poly_array = wpgmza_b_return_polygon_id_array($wpgmza_current_map_id);
2537
+ if ($total_poly_array > 0) {
2538
+ foreach ($total_poly_array as $poly_id) {
2539
+ $polygonoptions[$poly_id] = wpgmza_b_return_poly_options($poly_id);
2540
+
2541
+ $tmp_poly_array = wpgmza_b_return_polygon_array($poly_id);
2542
+ $poly_data_raw_array = array();
2543
+ foreach ($tmp_poly_array as $single_poly) {
2544
+ $poly_data_raw = str_replace(" ","",$single_poly);
2545
+ $poly_data_raw = explode(",",$poly_data_raw);
2546
+ $lat = $poly_data_raw[0];
2547
+ $lng = $poly_data_raw[1];
2548
+ $poly_data_raw_array[] = $poly_data_raw;
2549
+ }
2550
+ $polygonoptions[$poly_id]->polydata = $poly_data_raw_array;
2551
+
2552
+ $linecolor = $polygonoptions[$poly_id]->linecolor;
2553
+ $fillcolor = $polygonoptions[$poly_id]->fillcolor;
2554
+ $fillopacity = $polygonoptions[$poly_id]->opacity;
2555
+ if (!$linecolor) { $polygonoptions[$poly_id]->linecolor = "000000"; }
2556
+ if (!$fillcolor) { $polygonoptions[$poly_id]->fillcolor = "66FF00"; }
2557
+ if (!$fillopacity) { $polygonoptions[$poly_id]->opacity = "0.5"; }
2558
+ }
2559
+ } else { $polygonoptions = array(); }
2560
+
2561
+
2562
+ $polylineoptions = array();
2563
+
2564
+ $total_poly_array = wpgmza_b_return_polyline_id_array($wpgmza_current_map_id);
2565
+ if ($total_poly_array > 0) {
2566
+ foreach ($total_poly_array as $poly_id) {
2567
+ $polylineoptions[$poly_id] = wpgmza_b_return_polyline_options($poly_id);
2568
+
2569
+ $tmp_poly_array = wpgmza_b_return_polyline_array($poly_id);
2570
+ $poly_data_raw_array = array();
2571
+ foreach ($tmp_poly_array as $single_poly) {
2572
+ $poly_data_raw = str_replace(" ","",$single_poly);
2573
+ $poly_data_raw = str_replace(")","",$poly_data_raw );
2574
+ $poly_data_raw = str_replace("(","",$poly_data_raw );
2575
+ $poly_data_raw = explode(",",$poly_data_raw);
2576
+ $lat = $poly_data_raw[0];
2577
+ $lng = $poly_data_raw[1];
2578
+ $poly_data_raw_array[] = $poly_data_raw;
2579
+ }
2580
+ $polylineoptions[$poly_id]->polydata = $poly_data_raw_array;
2581
+
2582
+
2583
+ if (isset($polylineoptions[$poly_id]->linecolor)) { $linecolor = $polylineoptions[$poly_id]->linecolor; } else { $linecolor = false; }
2584
+ if (isset($polylineoptions[$poly_id]->fillcolor)) { $fillcolor = $polylineoptions[$poly_id]->fillcolor; } else { $fillcolor = false; }
2585
+ if (isset($polylineoptions[$poly_id]->opacity)) { $fillopacity = $polylineoptions[$poly_id]->opacity; } else { $fillopacity = false; }
2586
+ if (!$linecolor) { $polylineoptions[$poly_id]->linecolor = "000000"; }
2587
+ if (!$fillcolor) { $polylineoptions[$poly_id]->fillcolor = "66FF00"; }
2588
+ if (!$fillopacity) { $polylineoptions[$poly_id]->opacity = "0.5"; }
2589
+ }
2590
+ } else { $polylineoptions = array(); }
2591
+
2592
+ if (isset($wpgmza_settings['wpgmza_settings_marker_pull']) && $wpgmza_settings['wpgmza_settings_marker_pull'] == "0") {
2593
+ $markers = wpgmaps_return_markers($wpgmza_current_map_id);
2594
+ }
2595
+
2596
+ do_action("wpgooglemaps_basic_hook_user_js_after_core");
2597
+
2598
+ wp_localize_script( 'wpgmaps_core', 'wpgmaps_localize', $res);
2599
+ wp_localize_script( 'wpgmaps_core', 'wpgmaps_localize_polygon_settings', $polygonoptions);
2600
+ wp_localize_script( 'wpgmaps_core', 'wpgmaps_localize_polyline_settings', $polylineoptions);
2601
+
2602
+ wp_localize_script( 'wpgmaps_core', 'wpgmaps_markerurl', wpgmaps_get_marker_url($wpgmza_current_map_id));
2603
+
2604
+
2605
+ if ($wpgmza_settings['wpgmza_settings_marker_pull'] == "0") {
2606
+ wp_localize_script( 'wpgmaps_core', 'wpgmaps_localize_marker_data', $markers);
2607
+ }
2608
+
2609
+ $wpgmza_settings = apply_filters("wpgmza_basic_filter_localize_settings",$wpgmza_settings);
2610
+
2611
+ wp_localize_script( 'wpgmaps_core', 'wpgmaps_localize_global_settings', $wpgmza_settings);
2612
+
2613
+ wp_localize_script( 'wpgmaps_core', 'wpgmaps_lang_km_away', __("km away","wp-google-maps"));
2614
+ wp_localize_script( 'wpgmaps_core', 'wpgmaps_lang_m_away', __("miles away","wp-google-maps"));
2615
 
2616
  return $ret_msg;
2617
  }
5618
  add_action('wp_ajax_delete_polyline', 'wpgmaps_action_callback_basic');
5619
 
5620
  add_action('template_redirect','wpgmaps_check_shortcode');
5621
+ // add_action('wp_footer', 'wpgmaps_user_javascript_basic');
5622
  add_shortcode( 'wpgmza', 'wpgmaps_tag_basic' );
5623
  }
5624
 
6337
  }
6338
  }
6339
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6340
  }