WP Google Maps - Version 6.0.16

Version Description

  • You can now choose which folder your markers are saved in
  • Better error reporting for file permission issues
Download this release

Release Info

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

Code changes from version 6.0.15 to 6.0.16

Files changed (2) hide show
  1. readme.txt +6 -0
  2. wpGoogleMaps.php +124 -27
readme.txt CHANGED
@@ -83,6 +83,8 @@ Simply visit http://www.wpgmaps.com and purchase the WP Google Maps Professional
83
 
84
  Once installed and activated, a link should appear in your left navigation panel within your WP-ADMIN section. Click on the "WP Google Maps" link and follow the on screen instructions.
85
 
 
 
86
 
87
  == Screenshots ==
88
 
@@ -102,6 +104,10 @@ This is a must for users on IIS. Older WP Google Maps versions will not be compa
102
 
103
  == Changelog ==
104
 
 
 
 
 
105
  = 6.0.15 =
106
  * Small bug fixes
107
  * Map marker location bug fix
83
 
84
  Once installed and activated, a link should appear in your left navigation panel within your WP-ADMIN section. Click on the "WP Google Maps" link and follow the on screen instructions.
85
 
86
+ = How do I put a Google map on my page/post? =
87
+ In order to show your custom Google map on your page or post, simply copy the shortcode supplied and paste it into your page or post. WP Google Maps will automatically configure the map to the settings you selected in the map edit page.
88
 
89
  == Screenshots ==
90
 
104
 
105
  == Changelog ==
106
 
107
+ = 6.0.16 =
108
+ * You can now choose which folder your markers are saved in
109
+ * Better error reporting for file permission issues
110
+
111
  = 6.0.15 =
112
  * Small bug fixes
113
  * Map marker location bug fix
wpGoogleMaps.php CHANGED
@@ -3,12 +3,16 @@
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.0.15
7
  Author: WP Google Maps
8
  Author URI: http://www.wpgmaps.com
9
  */
10
 
11
  /*
 
 
 
 
12
  * 6.0.15
13
  * Fixed a bug that used the incorrect upload folder if the upload folder was changed in wp-config
14
  * Small bug fixes
@@ -112,8 +116,8 @@ $wpgmza_tblname_poly = $wpdb->prefix . "wpgmza_polygon";
112
  $wpgmza_tblname_polylines = $wpdb->prefix . "wpgmza_polylines";
113
  $wpgmza_tblname_categories = $wpdb->prefix. "wpgmza_categories";
114
  $wpgmza_tblname_category_maps = $wpdb->prefix. "wpgmza_category_maps";
115
- $wpgmza_version = "6.0.15";
116
- $wpgmza_p_version = "6.0.15";
117
  $wpgmza_t = "basic";
118
  define("WPGMAPS", $wpgmza_version);
119
  define("WPGMAPS_DIR",plugin_dir_url(__FILE__));
@@ -154,6 +158,16 @@ function wpgmaps_activate() {
154
  $table_name_maps = $wpdb->prefix . "wpgmza_maps";
155
  delete_option("WPGMZA");
156
 
 
 
 
 
 
 
 
 
 
 
157
  wpgmaps_handle_db();
158
  wpgmaps_handle_directory();
159
 
@@ -242,8 +256,9 @@ function wpgmaps_activate() {
242
 
243
  // load first marker as an example marker
244
  $results = $wpdb->get_results("SELECT * FROM $table_name WHERE `map_id` = '1'");
245
- if (!$results) { $rows_affected = $wpdb->insert( $table_name, array( 'map_id' => '1', 'address' => 'London', 'lat' => '51.5081290', 'lng' => '-0.1280050', 'pic' => '', 'link' => '', 'icon' => '', 'anim' => '', 'title' => '', 'infoopen' => '', 'description' => '', 'category' => 0) ); }
246
 
 
247
  wpgmaps_update_all_xml_file();
248
  add_option("wpgmaps_current_version",$wpgmza_version);
249
 
@@ -256,8 +271,17 @@ function wpgmaps_init() {
256
  wp_enqueue_script("jquery");
257
  $plugin_dir = basename(dirname(__FILE__))."/languages/";
258
  load_plugin_textdomain( 'wp-google-maps', false, $plugin_dir );
259
-
260
 
 
 
 
 
 
 
 
 
 
 
261
  /* handle first time users and updates */
262
  if (isset($_GET['page']) && $_GET['page'] == 'wp-google-maps-menu') {
263
 
@@ -307,15 +331,13 @@ function wpgmaps_init() {
307
  }
308
 
309
  function wpgmaps_handle_directory() {
310
- $upload_dir = wp_upload_dir();
311
-
312
- if (!file_exists($upload_dir['basedir'].'/wp-google-maps/cache')) {
313
- wp_mkdir_p($upload_dir['basedir'].'/wp-google-maps/cache');
314
  }
315
- if (is_multisite()) {
316
- if (!file_exists($upload_dir['basedir'].'/wp-google-maps/cache')) {
317
- wp_mkdir_p($upload_dir['basedir'].'/wp-google-maps/cache');
318
- }
319
  }
320
  }
321
  function wpgmaps_cache_permission_warning() {
@@ -409,15 +431,19 @@ function wpgmaps_get_marker_url($mapid = false) {
409
  }
410
  } else {
411
  /* later versions store marker files in wp-content/uploads/wp-google-maps director */
412
- if (is_multisite()) {
 
413
  $upload_dir = wp_upload_dir();
 
 
 
 
 
414
  global $blog_id;
415
- $wurl = $upload_dir['baseurl'].'/wp-google-maps/'.$blog_id."-".$mapid."markers.xml";;
416
  }
417
  else {
418
- $upload_dir = wp_upload_dir();
419
- $wurl = $upload_dir['baseurl'].'/wp-google-maps/'.$mapid."markers.xml";
420
-
421
  }
422
  }
423
 
@@ -1735,10 +1761,13 @@ function wpgmaps_update_xml_file($mapid = false) {
1735
 
1736
  wpgmaps_handle_directory();
1737
 
 
 
 
1738
  if (is_multisite()) {
1739
  global $blog_id;
1740
- if ($dom->save($upload_dir['basedir'].'/wp-google-maps/'.$blog_id.'-'.$mapid.'markers.xml') == FALSE) {
1741
- return new WP_Error( 'db_query_error', __( 'Could not save XML file' ), "Could not save marker XML file (".$upload_dir['basedir']."/wp-google-maps/".$blog_id."-".$mapid."markers.xml) for Map ID $mapid" );
1742
  }
1743
  } else {
1744
 
@@ -1747,13 +1776,13 @@ function wpgmaps_update_xml_file($mapid = false) {
1747
  if (function_exists('wpgmza_register_pro_version')) {
1748
  $prov = get_option("WPGMZA_PRO");
1749
  $wpgmza_pro_version = $prov['version'];
1750
- if ($dom->save($upload_dir['basedir'].'/wp-google-maps/'.$mapid.'markers.xml') == FALSE) {
1751
- return new WP_Error( 'db_query_error', __( 'Could not save XML file' ), "Could not save marker XML file (".$upload_dir['basedir']."/wp-google-maps/".$mapid."markers.xml) for Map ID $mapid" );
1752
  }
1753
  }
1754
  else {
1755
- if ($dom->save($upload_dir['basedir'].'/wp-google-maps/'.$mapid.'markers.xml') == FALSE) {
1756
- return new WP_Error( 'db_query_error', __( 'Could not save XML file' ), "Could not save marker XML file (".$upload_dir['basedir']."/wp-google-maps/".$mapid."markers.xml) for Map ID $mapid" );
1757
  }
1758
  }
1759
  }
@@ -2011,7 +2040,12 @@ function wpgmaps_get_plugin_url() {
2011
  function wpgmaps_head() {
2012
  global $wpgmza_tblname_maps;
2013
  global $wpgmza_version;
2014
-
 
 
 
 
 
2015
 
2016
  if (isset($_POST['wpgmza_savemap'])){
2017
  global $wpdb;
@@ -2270,6 +2304,8 @@ function wpgmaps_head() {
2270
  if (isset($_POST['wpgmza_settings_map_clickzoom'])) { $wpgmza_data['wpgmza_settings_map_clickzoom'] = esc_attr($_POST['wpgmza_settings_map_clickzoom']); }
2271
  if (isset($_POST['wpgmza_settings_map_open_marker_by'])) { $wpgmza_data['wpgmza_settings_map_open_marker_by'] = esc_attr($_POST['wpgmza_settings_map_open_marker_by']); }
2272
  if (isset($_POST['wpgmza_api_version'])) { $wpgmza_data['wpgmza_api_version'] = esc_attr($_POST['wpgmza_api_version']); }
 
 
2273
 
2274
 
2275
  update_option('WPGMZA_OTHER_SETTINGS', $wpgmza_data);
@@ -2843,7 +2879,30 @@ function wpgmaps_settings_page_basic() {
2843
  $pro_settings1 = "";
2844
  $prov_msg = "";
2845
  }
2846
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2847
  echo "
2848
 
2849
  <form action='' method='post' id='wpgmaps_options'>
@@ -2887,9 +2946,25 @@ function wpgmaps_settings_page_basic() {
2887
  </select>
2888
  </td>
2889
  </tr>
 
2890
 
2891
  </table>
2892
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2893
 
2894
  <p class='submit'><input type='submit' name='wpgmza_save_settings' class='button-primary' value='".__("Save Settings","wp-google-maps")." &raquo;' /></p>
2895
 
@@ -3069,6 +3144,7 @@ function wpgmza_basic_menu() {
3069
  if ($_GET['action'] == "edit" && isset($_GET['map_id'])) {
3070
  $res = wpgmza_get_map_data($_GET['map_id']);
3071
 
 
3072
 
3073
 
3074
  $other_settings_data = maybe_unserialize($res->other_settings);
@@ -4547,4 +4623,25 @@ function wpgmza_return_error_log() {
4547
  }
4548
  return $ret;
4549
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4550
  }
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.0.16
7
  Author: WP Google Maps
8
  Author URI: http://www.wpgmaps.com
9
  */
10
 
11
  /*
12
+ * 6.0.16
13
+ * You can now choose which folder your markers are saved in
14
+ * Better error reporting for file permission issues
15
+ *
16
  * 6.0.15
17
  * Fixed a bug that used the incorrect upload folder if the upload folder was changed in wp-config
18
  * Small bug fixes
116
  $wpgmza_tblname_polylines = $wpdb->prefix . "wpgmza_polylines";
117
  $wpgmza_tblname_categories = $wpdb->prefix. "wpgmza_categories";
118
  $wpgmza_tblname_category_maps = $wpdb->prefix. "wpgmza_category_maps";
119
+ $wpgmza_version = "6.0.16";
120
+ $wpgmza_p_version = "6.0.16";
121
  $wpgmza_t = "basic";
122
  define("WPGMAPS", $wpgmza_version);
123
  define("WPGMAPS_DIR",plugin_dir_url(__FILE__));
158
  $table_name_maps = $wpdb->prefix . "wpgmza_maps";
159
  delete_option("WPGMZA");
160
 
161
+ if (get_option("wpgmza_xml_location") == "") {
162
+ $upload_dir = wp_upload_dir();
163
+ add_option("wpgmza_xml_location",$upload_dir['basedir'].'/wp-google-maps/');
164
+ }
165
+ if (get_option("wpgmza_xml_url") == "") {
166
+ $upload_dir = wp_upload_dir();
167
+ add_option("wpgmza_xml_url",$upload_dir['baseurl'].'/wp-google-maps/');
168
+ }
169
+
170
+
171
  wpgmaps_handle_db();
172
  wpgmaps_handle_directory();
173
 
256
 
257
  // load first marker as an example marker
258
  $results = $wpdb->get_results("SELECT * FROM $table_name WHERE `map_id` = '1'");
259
+ if (!$results) { $rows_affected = $wpdb->insert( $table_name, array( 'map_id' => '1', 'address' => 'California', 'lat' => '36.778261', 'lng' => '-119.4179323999', 'pic' => '', 'link' => '', 'icon' => '', 'anim' => '', 'title' => '', 'infoopen' => '', 'description' => '', 'category' => 0) ); }
260
 
261
+
262
  wpgmaps_update_all_xml_file();
263
  add_option("wpgmaps_current_version",$wpgmza_version);
264
 
271
  wp_enqueue_script("jquery");
272
  $plugin_dir = basename(dirname(__FILE__))."/languages/";
273
  load_plugin_textdomain( 'wp-google-maps', false, $plugin_dir );
 
274
 
275
+ if (get_option("wpgmza_xml_location") == "") {
276
+ $upload_dir = wp_upload_dir();
277
+ add_option("wpgmza_xml_location",$upload_dir['basedir'].'/wp-google-maps/');
278
+ }
279
+ if (get_option("wpgmza_xml_url") == "") {
280
+ $upload_dir = wp_upload_dir();
281
+ add_option("wpgmza_xml_url",$upload_dir['baseurl'].'/wp-google-maps/');
282
+ }
283
+
284
+ wpgmaps_handle_directory();
285
  /* handle first time users and updates */
286
  if (isset($_GET['page']) && $_GET['page'] == 'wp-google-maps-menu') {
287
 
331
  }
332
 
333
  function wpgmaps_handle_directory() {
334
+ if (get_option("wpgmza_xml_location") == "") {
335
+ $upload_dir = wp_upload_dir();
336
+ add_option("wpgmza_xml_location",$upload_dir['basedir'].'/wp-google-maps/');
 
337
  }
338
+ $xml_marker_location = get_option("wpgmza_xml_location");
339
+ if (!file_exists($xml_marker_location)) {
340
+ wp_mkdir_p($xml_marker_location);
 
341
  }
342
  }
343
  function wpgmaps_cache_permission_warning() {
431
  }
432
  } else {
433
  /* later versions store marker files in wp-content/uploads/wp-google-maps director */
434
+
435
+ if (get_option("wpgmza_xml_url") == "") {
436
  $upload_dir = wp_upload_dir();
437
+ add_option("wpgmza_xml_url",$upload_dir['baseurl'].'/wp-google-maps/');
438
+ }
439
+ $xml_marker_url = get_option("wpgmza_xml_url");
440
+
441
+ if (is_multisite()) {
442
  global $blog_id;
443
+ $wurl = $xml_marker_url.$blog_id."-".$mapid."markers.xml";;
444
  }
445
  else {
446
+ $wurl = $xml_marker_url.$mapid."markers.xml";
 
 
447
  }
448
  }
449
 
1761
 
1762
  wpgmaps_handle_directory();
1763
 
1764
+
1765
+ $xml_marker_location = get_option("wpgmza_xml_location");
1766
+
1767
  if (is_multisite()) {
1768
  global $blog_id;
1769
+ if ($dom->save($xml_marker_location.$blog_id.'-'.$mapid.'markers.xml') == FALSE) {
1770
+ return new WP_Error( 'db_query_error', __( 'Could not save XML file' ), "Could not save marker XML file (".$xml_marker_location.$blog_id."-".$mapid."markers.xml) for Map ID $mapid" );
1771
  }
1772
  } else {
1773
 
1776
  if (function_exists('wpgmza_register_pro_version')) {
1777
  $prov = get_option("WPGMZA_PRO");
1778
  $wpgmza_pro_version = $prov['version'];
1779
+ if ($dom->save($xml_marker_location.$mapid.'markers.xml') == FALSE) {
1780
+ return new WP_Error( 'db_query_error', __( 'Could not save XML file' ), "Could not save marker XML file (".$xml_marker_location.$mapid."markers.xml) for Map ID $mapid" );
1781
  }
1782
  }
1783
  else {
1784
+ if ($dom->save($xml_marker_location.$mapid.'markers.xml') == FALSE) {
1785
+ return new WP_Error( 'db_query_error', __( 'Could not save XML file' ), "Could not save marker XML file (".$xml_marker_location.$mapid."markers.xml) for Map ID $mapid" );
1786
  }
1787
  }
1788
  }
2040
  function wpgmaps_head() {
2041
  global $wpgmza_tblname_maps;
2042
  global $wpgmza_version;
2043
+
2044
+ $checker = get_dropins();
2045
+ if (isset($checker['object-cache.php'])) {
2046
+ echo "<div id=\"message\" class=\"error\"><p>".__("Please note: <strong>WP Google Maps will not function correctly while using APC Object Cache.</strong> We have found that GoDaddy hosting packages automatically include this with their WordPress hosting packages. Please email GoDaddy and ask them to remove the object-cache.php from your wp-content/ directory.","wp-google-maps")."</p></div>";
2047
+ }
2048
+
2049
 
2050
  if (isset($_POST['wpgmza_savemap'])){
2051
  global $wpdb;
2304
  if (isset($_POST['wpgmza_settings_map_clickzoom'])) { $wpgmza_data['wpgmza_settings_map_clickzoom'] = esc_attr($_POST['wpgmza_settings_map_clickzoom']); }
2305
  if (isset($_POST['wpgmza_settings_map_open_marker_by'])) { $wpgmza_data['wpgmza_settings_map_open_marker_by'] = esc_attr($_POST['wpgmza_settings_map_open_marker_by']); }
2306
  if (isset($_POST['wpgmza_api_version'])) { $wpgmza_data['wpgmza_api_version'] = esc_attr($_POST['wpgmza_api_version']); }
2307
+ if (isset($_POST['wpgmza_marker_xml_location'])) { update_option("wpgmza_xml_location",$_POST['wpgmza_marker_xml_location']); }
2308
+ if (isset($_POST['wpgmza_marker_xml_url'])) { update_option("wpgmza_xml_url",$_POST['wpgmza_marker_xml_url']); }
2309
 
2310
 
2311
  update_option('WPGMZA_OTHER_SETTINGS', $wpgmza_data);
2879
  $pro_settings1 = "";
2880
  $prov_msg = "";
2881
  }
2882
+ $marker_location = get_option("wpgmza_xml_location");
2883
+ $marker_url = get_option("wpgmza_xml_url");
2884
+ $wpgmza_file_perms = substr(sprintf('%o', fileperms($marker_location)), -4);
2885
+ $fpe = false;
2886
+ $fpe_error = "";
2887
+ if ($wpgmza_file_perms == "0777" || $wpgmza_file_perms == "0755" || $wpgmza_file_perms == "0775" || $wpgmza_file_perms == "0705") {
2888
+ $fpe = true;
2889
+ $fpe_error = "";
2890
+ }
2891
+ else if ($wpgmza_file_perms == "0") {
2892
+ $fpe = false;
2893
+ $fpe_error = __("This folder does not exist. Please create it.","wp-google-maps");
2894
+ } else {
2895
+ $fpe = false;
2896
+ $fpe_error = __("File Permissions:","wp-google-maps").$wpgmza_file_perms." ".__(" - The plugin does not have write access to this folder. Please CHMOD this folder to 755 or 777, or change the location","wp-google-maps");
2897
+ }
2898
+
2899
+ if (!$fpe) {
2900
+ $wpgmza_file_perms_check = "<span style='color:red;'>$fpe_error</span>";
2901
+ } else {
2902
+ $wpgmza_file_perms_check = "<span style='color:green;'>$fpe_error</span>";
2903
+
2904
+ }
2905
+
2906
  echo "
2907
 
2908
  <form action='' method='post' id='wpgmaps_options'>
2946
  </select>
2947
  </td>
2948
  </tr>
2949
+
2950
 
2951
  </table>
2952
+ <h3>".__("Advanced Settings")."</h3>
2953
+ <p>".__("We suggest that you change the two fields below ONLY if you are experiencing issues when trying to save the marker XML files. Please note that both the URL and the directory should point to the same place, but in different methods. <br /><br />For example: <br /> <strong>directory</strong>: <span style='font-weight:bold; color:green;'>/usr/path/public_html</span>/wp-content/uploads/wp-google-maps/<br /> <strong>URL</strong>: <span style='font-weight:bold; color:green;'>http://www.your-site.com</span>/wp-content/uploads/wp-google-maps/","wp-google-maps")."</p>
2954
+ <table class='form-table'>
2955
+ <tr>
2956
+ <td width='200' valign='top'>".__("Marker data XML directory","wp-google-maps").":</td>
2957
+ <td>
2958
+ <input id='wpgmza_marker_xml_location' name='wpgmza_marker_xml_location' value='$marker_location' class='regular-text code' /> $wpgmza_file_perms_check
2959
+ </td>
2960
+ </tr>
2961
+ <tr>
2962
+ <td width='200' valign='top'>".__("Marker data XML URL","wp-google-maps").":</td>
2963
+ <td>
2964
+ <input id='wpgmza_marker_xml_url' name='wpgmza_marker_xml_url' value='$marker_url' class='regular-text code' />
2965
+ </td>
2966
+ </tr>
2967
+ </table>
2968
 
2969
  <p class='submit'><input type='submit' name='wpgmza_save_settings' class='button-primary' value='".__("Save Settings","wp-google-maps")." &raquo;' /></p>
2970
 
3144
  if ($_GET['action'] == "edit" && isset($_GET['map_id'])) {
3145
  $res = wpgmza_get_map_data($_GET['map_id']);
3146
 
3147
+ if (function_exists("wpgmaps_marker_permission_check")) { wpgmaps_marker_permission_check(); }
3148
 
3149
 
3150
  $other_settings_data = maybe_unserialize($res->other_settings);
4623
  }
4624
  return $ret;
4625
 
4626
+ }
4627
+ function wpgmaps_marker_permission_check() {
4628
+ $marker_location = get_option("wpgmza_xml_location");
4629
+ $wpgmza_file_perms = substr(sprintf('%o', fileperms($marker_location)), -4);
4630
+ $fpe = false;
4631
+ $fpe_error = "";
4632
+ if ($wpgmza_file_perms == "0777" || $wpgmza_file_perms == "0755" || $wpgmza_file_perms == "0775" || $wpgmza_file_perms == "0705") {
4633
+ $fpe = true;
4634
+ $fpe_error = "";
4635
+ }
4636
+ else if ($wpgmza_file_perms == "0") {
4637
+ $fpe = false;
4638
+ $fpe_error = __("This folder does not exist. Please create it.","wp-google-maps");
4639
+ } else {
4640
+ $fpe = false;
4641
+ $fpe_error = __("WP Google Maps does not have write permission to the marker location directory. This is required to store marker data. Please CHMOD the folder ","wp-google-maps").$marker_location.__(" to 755 or 777, or change the directory in the Maps->Settings page. (Current file permissions are ","wp-google-maps").$wpgmza_file_perms.")";
4642
+ }
4643
+
4644
+ if (!$fpe) {
4645
+ echo "<div id=\"message\" class=\"error\"><p>".$fpe_error."</p></div>";
4646
+ }
4647
  }