Google Maps Widget – Ultimate Google Maps Plugin - Version 1.85

Version Description

  • 2014/09/22
  • added custom pin image option for thumbnail map - thanks Rudloff!
Download this release

Release Info

Developer WebFactory
Plugin Icon 128x128 Google Maps Widget – Ultimate Google Maps Plugin
Version 1.85
Comparing to
See all releases

Code changes from version 1.80 to 1.85

Files changed (5) hide show
  1. css/gmw-admin.css +4 -0
  2. gmw-widget.php +31 -4
  3. google-maps-widget.php +2 -2
  4. js/gmw-admin.js +15 -1
  5. readme.txt +5 -1
css/gmw-admin.css CHANGED
@@ -8,6 +8,10 @@
8
  display: inline-block;
9
  }
10
 
 
 
 
 
11
  .gmw-tabs {
12
  border-bottom: 1px solid #CCCCCC !important;
13
  }
8
  display: inline-block;
9
  }
10
 
11
+ .gmw-label-wide {
12
+ width: 90%;
13
+ }
14
+
15
  .gmw-tabs {
16
  border-bottom: 1px solid #CCCCCC !important;
17
  }
gmw-widget.php CHANGED
@@ -31,7 +31,9 @@ class GoogleMapsWidget extends WP_Widget {
31
  array('title' => __('Map', 'google-maps-widget'),
32
  'address' => __('New York, USA', 'google-maps-widget'),
33
  'thumb_pin_color' => 'red',
 
34
  'thumb_pin_size' => 'default',
 
35
  'thumb_width' => '250',
36
  'thumb_height' => '250',
37
  'thumb_type' => 'roadmap',
@@ -54,6 +56,9 @@ class GoogleMapsWidget extends WP_Widget {
54
  extract($instance, EXTR_SKIP);
55
 
56
  // legacy fixes for older versions; it's auto-fixed on first widget save but has to be here
 
 
 
57
  if(!$thumb_link_type) {
58
  $thumb_link_type = 'lightbox';
59
  }
@@ -94,6 +99,9 @@ class GoogleMapsWidget extends WP_Widget {
94
 
95
  $lightbox_skins[] = array('val' => 'light', 'label' => __('Light (default)', 'google-maps-widget'));
96
  $lightbox_skins[] = array('val' => 'dark', 'label' => __('Dark', 'google-maps-widget'));
 
 
 
97
 
98
  $thumb_link_types[] = array('val' => 'lightbox', 'label' => __('Lightbox (default)', 'google-maps-widget'));
99
  $thumb_link_types[] = array('val' => 'custom', 'label' => __('Custom link', 'google-maps-widget'));
@@ -115,16 +123,24 @@ class GoogleMapsWidget extends WP_Widget {
115
  echo '<select id="' . $this->get_field_id('thumb_type') . '" name="' . $this->get_field_name('thumb_type') . '">';
116
  GMW::create_select_options($map_types_thumb, $thumb_type);
117
  echo '</select></p>';
 
 
 
 
 
118
 
119
- echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_pin_color') . '">' . __('Pin Color', 'google-maps-widget') . ':</label>';
120
  echo '<select id="' . $this->get_field_id('thumb_pin_color') . '" name="' . $this->get_field_name('thumb_pin_color') . '">';
121
  GMW::create_select_options($pin_colors, $thumb_pin_color);
122
  echo '</select></p>';
123
 
124
- echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_pin_size') . '">' . __('Pin Size', 'google-maps-widget') . ':</label>';
125
  echo '<select id="' . $this->get_field_id('thumb_pin_size') . '" name="' . $this->get_field_name('thumb_pin_size') . '">';
126
  GMW::create_select_options($pin_sizes, $thumb_pin_size);
127
  echo '</select></p>';
 
 
 
128
 
129
  echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_zoom') . '">' . __('Zoom Level', 'google-maps-widget') . ':</label>';
130
  echo '<select id="' . $this->get_field_id('thumb_zoom') . '" name="' . $this->get_field_name('thumb_zoom') . '">';
@@ -198,8 +214,10 @@ class GoogleMapsWidget extends WP_Widget {
198
 
199
  $instance['title'] = $new_instance['title'];
200
  $instance['address'] = $new_instance['address'];
 
201
  $instance['thumb_pin_color'] = $new_instance['thumb_pin_color'];
202
  $instance['thumb_pin_size'] = $new_instance['thumb_pin_size'];
 
203
  $instance['thumb_width'] = (int) $new_instance['thumb_width'];
204
  $instance['thumb_height'] = (int) $new_instance['thumb_height'];
205
  $instance['thumb_zoom'] = $new_instance['thumb_zoom'];
@@ -262,6 +280,10 @@ class GoogleMapsWidget extends WP_Widget {
262
 
263
  $out .= $before_widget;
264
 
 
 
 
 
265
  if (!isset($instance['thumb_link_type']) || empty($instance['thumb_link_type'])) {
266
  $instance['thumb_link_type'] = 'lightbox';
267
  }
@@ -296,8 +318,13 @@ class GoogleMapsWidget extends WP_Widget {
296
  $tmp .= '<img alt="' . $alt . '" title="' . $alt . '" src="//maps.googleapis.com/maps/api/staticmap?center=' .
297
  urlencode($instance['address']) . '&amp;zoom=' . $instance['thumb_zoom'] .
298
  '&amp;size=' . $instance['thumb_width'] . 'x' . $instance['thumb_height'] . '&amp;maptype=' . $instance['thumb_type'] .
299
- '&amp;sensor=false&amp;scale=1&amp;markers=size:' . $instance['thumb_pin_size'] . '%7Ccolor:' . $instance['thumb_pin_color'] . '%7Clabel:A%7C' .
300
- urlencode($instance['address']) . '&amp;language=' . $lang . '&amp;visual_refresh=' . $instance['thumb_new_colors'] .'">';
 
 
 
 
 
301
  if ($instance['thumb_link_type'] == 'lightbox' || $instance['thumb_link_type'] == 'custom') {
302
  $tmp .= '</a>';
303
  }
31
  array('title' => __('Map', 'google-maps-widget'),
32
  'address' => __('New York, USA', 'google-maps-widget'),
33
  'thumb_pin_color' => 'red',
34
+ 'thumb_pin_type' => 'predefined',
35
  'thumb_pin_size' => 'default',
36
+ 'thumb_pin_img' => '',
37
  'thumb_width' => '250',
38
  'thumb_height' => '250',
39
  'thumb_type' => 'roadmap',
56
  extract($instance, EXTR_SKIP);
57
 
58
  // legacy fixes for older versions; it's auto-fixed on first widget save but has to be here
59
+ if(!$thumb_pin_type) {
60
+ $thumb_pin_type = 'predefined';
61
+ }
62
  if(!$thumb_link_type) {
63
  $thumb_link_type = 'lightbox';
64
  }
99
 
100
  $lightbox_skins[] = array('val' => 'light', 'label' => __('Light (default)', 'google-maps-widget'));
101
  $lightbox_skins[] = array('val' => 'dark', 'label' => __('Dark', 'google-maps-widget'));
102
+
103
+ $thumb_pin_types[] = array('val' => 'predefined', 'label' => __('Predefined (default)', 'google-maps-widget'));
104
+ $thumb_pin_types[] = array('val' => 'custom', 'label' => __('Custom', 'google-maps-widget'));
105
 
106
  $thumb_link_types[] = array('val' => 'lightbox', 'label' => __('Lightbox (default)', 'google-maps-widget'));
107
  $thumb_link_types[] = array('val' => 'custom', 'label' => __('Custom link', 'google-maps-widget'));
123
  echo '<select id="' . $this->get_field_id('thumb_type') . '" name="' . $this->get_field_name('thumb_type') . '">';
124
  GMW::create_select_options($map_types_thumb, $thumb_type);
125
  echo '</select></p>';
126
+
127
+ echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_pin_type') . '">' . __('Pin Type', 'google-maps-widget') . ':</label>';
128
+ echo '<select class="gmw_thumb_pin_type" id="' . $this->get_field_id('thumb_pin_type') . '" name="' . $this->get_field_name('thumb_pin_type') . '">';
129
+ GMW::create_select_options($thumb_pin_types, $thumb_pin_type);
130
+ echo '</select></p>';
131
 
132
+ echo '<p class="gmw_thumb_pin_type_predefined_section"><label class="gmw-label" for="' . $this->get_field_id('thumb_pin_color') . '">' . __('Pin Color', 'google-maps-widget') . ':</label>';
133
  echo '<select id="' . $this->get_field_id('thumb_pin_color') . '" name="' . $this->get_field_name('thumb_pin_color') . '">';
134
  GMW::create_select_options($pin_colors, $thumb_pin_color);
135
  echo '</select></p>';
136
 
137
+ echo '<p class="gmw_thumb_pin_type_predefined_section"><label class="gmw-label" for="' . $this->get_field_id('thumb_pin_size') . '">' . __('Pin Size', 'google-maps-widget') . ':</label>';
138
  echo '<select id="' . $this->get_field_id('thumb_pin_size') . '" name="' . $this->get_field_name('thumb_pin_size') . '">';
139
  GMW::create_select_options($pin_sizes, $thumb_pin_size);
140
  echo '</select></p>';
141
+
142
+ echo '<p class="gmw_thumb_pin_type_custom_section"><label class="gmw-label gmw-label-wide" for="' . $this->get_field_id('thumb_pin_img') . '">' . __('Custom Pin Image URL', 'google-maps-widget') . ':</label>';
143
+ echo '<input type="text" class="regular-text" id="' . $this->get_field_id('thumb_pin_img') . '" name="' . $this->get_field_name('thumb_pin_img') . '" value="' . esc_attr($thumb_pin_img) . '">';
144
 
145
  echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_zoom') . '">' . __('Zoom Level', 'google-maps-widget') . ':</label>';
146
  echo '<select id="' . $this->get_field_id('thumb_zoom') . '" name="' . $this->get_field_name('thumb_zoom') . '">';
214
 
215
  $instance['title'] = $new_instance['title'];
216
  $instance['address'] = $new_instance['address'];
217
+ $instance['thumb_pin_type'] = $new_instance['thumb_pin_type'];
218
  $instance['thumb_pin_color'] = $new_instance['thumb_pin_color'];
219
  $instance['thumb_pin_size'] = $new_instance['thumb_pin_size'];
220
+ $instance['thumb_pin_img'] = trim($new_instance['thumb_pin_img']);
221
  $instance['thumb_width'] = (int) $new_instance['thumb_width'];
222
  $instance['thumb_height'] = (int) $new_instance['thumb_height'];
223
  $instance['thumb_zoom'] = $new_instance['thumb_zoom'];
280
 
281
  $out .= $before_widget;
282
 
283
+ if (!isset($instance['thumb_pin_type']) || empty($instance['thumb_pin_type'])) {
284
+ $instance['thumb_pin_type'] = 'predefined';
285
+ }
286
+
287
  if (!isset($instance['thumb_link_type']) || empty($instance['thumb_link_type'])) {
288
  $instance['thumb_link_type'] = 'lightbox';
289
  }
318
  $tmp .= '<img alt="' . $alt . '" title="' . $alt . '" src="//maps.googleapis.com/maps/api/staticmap?center=' .
319
  urlencode($instance['address']) . '&amp;zoom=' . $instance['thumb_zoom'] .
320
  '&amp;size=' . $instance['thumb_width'] . 'x' . $instance['thumb_height'] . '&amp;maptype=' . $instance['thumb_type'] .
321
+ '&amp;sensor=false&amp;scale=1&amp;';
322
+ if ($instance['thumb_pin_type'] != 'custom') {
323
+ $tmp .= 'markers=size:' . $instance['thumb_pin_size'] . '%7Ccolor:' . $instance['thumb_pin_color'];
324
+ } else {
325
+ $tmp .= 'markers=icon:' . urlencode($instance['thumb_pin_img']);
326
+ }
327
+ $tmp .= '%7Clabel:A%7C' . urlencode($instance['address']) . '&amp;language=' . $lang . '&amp;visual_refresh=' . $instance['thumb_new_colors'] .'">';
328
  if ($instance['thumb_link_type'] == 'lightbox' || $instance['thumb_link_type'] == 'custom') {
329
  $tmp .= '</a>';
330
  }
google-maps-widget.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Google Maps Widget
4
  Plugin URI: http://www.googlemapswidget.com/
5
  Description: Display a single-image super-fast loading Google map in a widget. A larger, full featured map is available on click in a lightbox.
6
  Author: Web factory Ltd
7
- Version: 1.80
8
  Author URI: http://www.webfactoryltd.com/
9
  Text Domain: google-maps-widget
10
  Domain Path: lang
@@ -31,7 +31,7 @@ if (!defined('ABSPATH')) {
31
  }
32
 
33
 
34
- define('GMW_VER', '1.80');
35
  define('GMW_OPTIONS', 'gmw_options');
36
  define('GMW_CRON', 'gmw_cron');
37
 
4
  Plugin URI: http://www.googlemapswidget.com/
5
  Description: Display a single-image super-fast loading Google map in a widget. A larger, full featured map is available on click in a lightbox.
6
  Author: Web factory Ltd
7
+ Version: 1.85
8
  Author URI: http://www.webfactoryltd.com/
9
  Text Domain: google-maps-widget
10
  Domain Path: lang
31
  }
32
 
33
 
34
+ define('GMW_VER', '1.85');
35
  define('GMW_OPTIONS', 'gmw_options');
36
  define('GMW_CRON', 'gmw_cron');
37
 
js/gmw-admin.js CHANGED
@@ -5,13 +5,14 @@
5
 
6
  jQuery(function($) {
7
  $('.gmw-tabs').each(function(i, el) {
 
8
  change_link_type(el);
 
9
  $('.gmw_thumb_link_type', el).on('change', function() { change_link_type(el) });
10
  el_id = $(el).attr('id');
11
  $(el).tabs({ active: get_active_tab(el_id),
12
  activate: function(event, ui) { save_active_tab(this); }
13
  });
14
-
15
  });
16
 
17
  // get active tab index from cookie
@@ -34,11 +35,24 @@ jQuery(function($) {
34
  $('.gmw_thumb_link_section', widget).hide();
35
  }
36
  } // link_type
 
 
 
 
 
 
 
 
 
 
 
37
 
38
  // re-tab on GUI rebuild
39
  $('div[id*="googlemapswidget"]').ajaxSuccess(function(event, request, option) {
40
  $('.gmw-tabs').each(function(i, el) {
 
41
  change_link_type(el);
 
42
  $('.gmw_thumb_link_type', el).on('change', function() { change_link_type(el) });
43
  el_id = $(el).attr('id');
44
  $(el).tabs({ active: get_active_tab(el_id),
5
 
6
  jQuery(function($) {
7
  $('.gmw-tabs').each(function(i, el) {
8
+ change_pin_type(el);
9
  change_link_type(el);
10
+ $('.gmw_thumb_pin_type', el).on('change', function() { change_pin_type(el) });
11
  $('.gmw_thumb_link_type', el).on('change', function() { change_link_type(el) });
12
  el_id = $(el).attr('id');
13
  $(el).tabs({ active: get_active_tab(el_id),
14
  activate: function(event, ui) { save_active_tab(this); }
15
  });
 
16
  });
17
 
18
  // get active tab index from cookie
35
  $('.gmw_thumb_link_section', widget).hide();
36
  }
37
  } // link_type
38
+
39
+ // show/hide custom pin URL field based on user's pin type choice
40
+ function change_pin_type(widget) {
41
+ if ($('.gmw_thumb_pin_type', widget).val() == 'custom') {
42
+ $('.gmw_thumb_pin_type_custom_section', widget).show();
43
+ $('.gmw_thumb_pin_type_predefined_section', widget).hide();
44
+ } else {
45
+ $('.gmw_thumb_pin_type_custom_section', widget).hide();
46
+ $('.gmw_thumb_pin_type_predefined_section', widget).show();
47
+ }
48
+ } // pin_type
49
 
50
  // re-tab on GUI rebuild
51
  $('div[id*="googlemapswidget"]').ajaxSuccess(function(event, request, option) {
52
  $('.gmw-tabs').each(function(i, el) {
53
+ change_pin_type(el);
54
  change_link_type(el);
55
+ $('.gmw_thumb_pin_type', el).on('change', function() { change_pin_type(el) });
56
  $('.gmw_thumb_link_type', el).on('change', function() { change_link_type(el) });
57
  el_id = $(el).attr('id');
58
  $(el).tabs({ active: get_active_tab(el_id),
readme.txt CHANGED
@@ -6,7 +6,7 @@ License: GPLv2 or later
6
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
  Requires at least: 3.3
8
  Tested up to: 4.0
9
- Stable tag: 1.80
10
 
11
  Displays a single-image super-fast loading Google map in a widget. A larger map with all the usual features is available on click in a lightbox.
12
 
@@ -100,6 +100,10 @@ If you can figure it out open a thread in the support forums.
100
  4. Widget options - lightbox map
101
 
102
  == Changelog ==
 
 
 
 
103
  = 1.80 =
104
  * 2014/09/08
105
  * minor updates for WordPress v4.0
6
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
  Requires at least: 3.3
8
  Tested up to: 4.0
9
+ Stable tag: 1.85
10
 
11
  Displays a single-image super-fast loading Google map in a widget. A larger map with all the usual features is available on click in a lightbox.
12
 
100
  4. Widget options - lightbox map
101
 
102
  == Changelog ==
103
+ = 1.85 =
104
+ * 2014/09/22
105
+ * added custom pin image option for thumbnail map - thanks Rudloff!
106
+
107
  = 1.80 =
108
  * 2014/09/08
109
  * minor updates for WordPress v4.0