Google Maps Widget – Ultimate Google Maps Plugin - Version 1.70

Version Description

  • 2014/07/10
  • fixed a small bug on thumbnail
  • finished up a todo
Download this release

Release Info

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

Code changes from version 1.66 to 1.70

Files changed (3) hide show
  1. gmw-widget.php +21 -34
  2. google-maps-widget.php +2 -2
  3. readme.txt +6 -1
gmw-widget.php CHANGED
@@ -11,6 +11,8 @@ if (!defined('ABSPATH')) {
11
  die();
12
  }
13
 
 
 
14
  class GoogleMapsWidget extends WP_Widget {
15
  static $widgets = array();
16
 
@@ -18,7 +20,7 @@ class GoogleMapsWidget extends WP_Widget {
18
  $widget_ops = array('classname' => 'google-maps-widget', 'description' => __('Displays a map image thumbnail with a larger map available in a lightbox.', 'google-maps-widget'));
19
  $control_ops = array('width' => 450, 'height' => 350);
20
  $this->WP_Widget('GoogleMapsWidget', __('Google Maps Widget', 'google-maps-widget'), $widget_ops, $control_ops);
21
- }
22
 
23
  function form($instance) {
24
  $instance = wp_parse_args((array) $instance,
@@ -45,30 +47,7 @@ class GoogleMapsWidget extends WP_Widget {
45
  'lightbox_header' => '',
46
  'lightbox_footer' => ''));
47
 
48
- // todo - use extract() to make code nicer
49
- // extract($instance, EXTR_SKIP); - not very smart, other plugins can add keys to $instance
50
- $title = $instance['title'];
51
- $address = $instance['address'];
52
- $thumb_pin_color = $instance['thumb_pin_color'];
53
- $thumb_pin_size = $instance['thumb_pin_size'];
54
- $thumb_width = $instance['thumb_width'];
55
- $thumb_height = $instance['thumb_height'];
56
- $thumb_type = $instance['thumb_type'];
57
- $thumb_zoom = $instance['thumb_zoom'];
58
- $thumb_header = $instance['thumb_header'];
59
- $thumb_footer = $instance['thumb_footer'];
60
- $thumb_new_colors = $instance['thumb_new_colors'];
61
- $thumb_link_type = $instance['thumb_link_type'];
62
- $thumb_link = $instance['thumb_link'];
63
- $lightbox_width = $instance['lightbox_width'];
64
- $lightbox_height = $instance['lightbox_height'];
65
- $lightbox_type = $instance['lightbox_type'];
66
- $lightbox_zoom = $instance['lightbox_zoom'];
67
- $lightbox_bubble = $instance['lightbox_bubble'];
68
- $lightbox_title = $instance['lightbox_title'];
69
- $lightbox_skin = $instance['lightbox_skin'];
70
- $lightbox_footer = $instance['lightbox_footer'];
71
- $lightbox_header = $instance['lightbox_header'];
72
 
73
  if(!$thumb_link_type) {
74
  $thumb_link_type = 'lightbox';
@@ -106,9 +85,10 @@ class GoogleMapsWidget extends WP_Widget {
106
  }
107
 
108
  $lightbox_skins[] = array('val' => '', 'label' => __('Light (default)', 'google-maps-widget'));
109
- //$lightbox_skins[] = array('val' => 'dark', 'label' => __('Dark', 'google-maps-widget'));
110
- //$lightbox_skins[] = array('val' => 'white-square', 'label' => __('White with square corners', 'google-maps-widget'));
111
- //$lightbox_skins[] = array('val' => 'black-square', 'label' => __('Black with square corners', 'google-maps-widget'));
 
112
 
113
  $thumb_link_types[] = array('val' => 'lightbox', 'label' => __('Lightbox', 'google-maps-widget'));
114
  $thumb_link_types[] = array('val' => 'custom', 'label' => __('Custom link', 'google-maps-widget'));
@@ -204,7 +184,7 @@ class GoogleMapsWidget extends WP_Widget {
204
  echo '</div>'; // lightbox tab
205
  echo '</div>'; // tabs
206
  echo '<p><i>' . __('If you like the plugin give us a shout. Thanks!', 'google-maps-widget') . ' <a title="WebFactory on Twitter" target="_blank" href="http://twitter.com/WebFactoryLtd">@WebFactoryLtd</a></i></p>';
207
- }
208
 
209
  function update($new_instance, $old_instance) {
210
  $instance = $old_instance;
@@ -233,7 +213,7 @@ class GoogleMapsWidget extends WP_Widget {
233
  $instance['lightbox_skin'] = $new_instance['lightbox_skin'];
234
 
235
  return $instance;
236
- }
237
 
238
  function widget($args, $instance) {
239
  $out = $tmp = '';
@@ -268,7 +248,7 @@ class GoogleMapsWidget extends WP_Widget {
268
 
269
  $out .= $before_widget;
270
 
271
- if (!isset($instance['thumb_link_type']) || !$instance['thumb_link_type']) {
272
  $instance['thumb_link_type'] = 'lightbox';
273
  }
274
 
@@ -287,12 +267,19 @@ class GoogleMapsWidget extends WP_Widget {
287
  $tmp .= wpautop(do_shortcode($instance['thumb_header']));
288
  }
289
  $tmp .= '<p>';
 
 
 
 
 
 
 
290
  if ($instance['thumb_link_type'] == 'lightbox') {
291
  $tmp .= '<a class="gmw-thumbnail-map gmw-lightbox-enabled" href="#gmw-dialog-' . $widget_id . '" title="' . __('Click to open larger map', 'google-maps-widget') . '">';
292
  } elseif ($instance['thumb_link_type'] == 'custom') {
293
- $tmp .= '<a class="gmw-thumbnail-map" href="' . $instance['thumb_link'] . '">';
294
  }
295
- $tmp .= '<img title="' . __('Click to open larger map', 'google-maps-widget') . '" alt="' . __('Click to open larger map', 'google-maps-widget') . '" src="//maps.googleapis.com/maps/api/staticmap?center=' .
296
  urlencode($instance['address']) . '&amp;zoom=' . $instance['thumb_zoom'] .
297
  '&amp;size=' . $instance['thumb_width'] . 'x' . $instance['thumb_height'] . '&amp;maptype=' . $instance['thumb_type'] .
298
  '&amp;sensor=false&amp;scale=1&amp;markers=size:' . $instance['thumb_pin_size'] . '%7Ccolor:' . $instance['thumb_pin_color'] . '%7Clabel:A%7C' .
@@ -309,5 +296,5 @@ class GoogleMapsWidget extends WP_Widget {
309
  $out .= $after_widget;
310
 
311
  echo $out;
312
- }
313
  } // class GoogleMapsWidget
11
  die();
12
  }
13
 
14
+
15
+ // main widget class, extends WP widget interface/class
16
  class GoogleMapsWidget extends WP_Widget {
17
  static $widgets = array();
18
 
20
  $widget_ops = array('classname' => 'google-maps-widget', 'description' => __('Displays a map image thumbnail with a larger map available in a lightbox.', 'google-maps-widget'));
21
  $control_ops = array('width' => 450, 'height' => 350);
22
  $this->WP_Widget('GoogleMapsWidget', __('Google Maps Widget', 'google-maps-widget'), $widget_ops, $control_ops);
23
+ } // GoogleMapsWidget
24
 
25
  function form($instance) {
26
  $instance = wp_parse_args((array) $instance,
47
  'lightbox_header' => '',
48
  'lightbox_footer' => ''));
49
 
50
+ extract($instance, EXTR_SKIP);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
  if(!$thumb_link_type) {
53
  $thumb_link_type = 'lightbox';
85
  }
86
 
87
  $lightbox_skins[] = array('val' => '', 'label' => __('Light (default)', 'google-maps-widget'));
88
+ // todo add skins
89
+ // $lightbox_skins[] = array('val' => 'dark', 'label' => __('Dark', 'google-maps-widget'));
90
+ // $lightbox_skins[] = array('val' => 'white-square', 'label' => __('White with square corners', 'google-maps-widget'));
91
+ // $lightbox_skins[] = array('val' => 'black-square', 'label' => __('Black with square corners', 'google-maps-widget'));
92
 
93
  $thumb_link_types[] = array('val' => 'lightbox', 'label' => __('Lightbox', 'google-maps-widget'));
94
  $thumb_link_types[] = array('val' => 'custom', 'label' => __('Custom link', 'google-maps-widget'));
184
  echo '</div>'; // lightbox tab
185
  echo '</div>'; // tabs
186
  echo '<p><i>' . __('If you like the plugin give us a shout. Thanks!', 'google-maps-widget') . ' <a title="WebFactory on Twitter" target="_blank" href="http://twitter.com/WebFactoryLtd">@WebFactoryLtd</a></i></p>';
187
+ } // form
188
 
189
  function update($new_instance, $old_instance) {
190
  $instance = $old_instance;
213
  $instance['lightbox_skin'] = $new_instance['lightbox_skin'];
214
 
215
  return $instance;
216
+ } // update
217
 
218
  function widget($args, $instance) {
219
  $out = $tmp = '';
248
 
249
  $out .= $before_widget;
250
 
251
+ if (!isset($instance['thumb_link_type']) || empty($instance['thumb_link_type'])) {
252
  $instance['thumb_link_type'] = 'lightbox';
253
  }
254
 
267
  $tmp .= wpautop(do_shortcode($instance['thumb_header']));
268
  }
269
  $tmp .= '<p>';
270
+
271
+ if ($instance['thumb_link_type'] == 'lightbox') {
272
+ $alt = __('Click to open larger map', 'google-maps-widget');
273
+ } else {
274
+ $alt = esc_attr($instance['address']);
275
+ }
276
+
277
  if ($instance['thumb_link_type'] == 'lightbox') {
278
  $tmp .= '<a class="gmw-thumbnail-map gmw-lightbox-enabled" href="#gmw-dialog-' . $widget_id . '" title="' . __('Click to open larger map', 'google-maps-widget') . '">';
279
  } elseif ($instance['thumb_link_type'] == 'custom') {
280
+ $tmp .= '<a class="gmw-thumbnail-map" title="' . esc_attr($instance['address']) . '" href="' . $instance['thumb_link'] . '">';
281
  }
282
+ $tmp .= '<img alt="' . $alt . '" title="' . $alt . '" src="//maps.googleapis.com/maps/api/staticmap?center=' .
283
  urlencode($instance['address']) . '&amp;zoom=' . $instance['thumb_zoom'] .
284
  '&amp;size=' . $instance['thumb_width'] . 'x' . $instance['thumb_height'] . '&amp;maptype=' . $instance['thumb_type'] .
285
  '&amp;sensor=false&amp;scale=1&amp;markers=size:' . $instance['thumb_pin_size'] . '%7Ccolor:' . $instance['thumb_pin_color'] . '%7Clabel:A%7C' .
296
  $out .= $after_widget;
297
 
298
  echo $out;
299
+ } // widget
300
  } // class GoogleMapsWidget
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.66
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.66');
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.70
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.70');
35
  define('GMW_OPTIONS', 'gmw_options');
36
  define('GMW_CRON', 'gmw_cron');
37
 
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: 3.9
9
- Stable tag: 1.66
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,11 @@ If you can figure it out open a thread in the support forums.
100
  4. Widget options - lightbox map
101
 
102
  == Changelog ==
 
 
 
 
 
103
  = 1.65 =
104
  * 2014/05/06
105
  * finished up a few todos
6
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
  Requires at least: 3.3
8
  Tested up to: 3.9
9
+ Stable tag: 1.70
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.70 =
104
+ * 2014/07/10
105
+ * fixed a small bug on thumbnail
106
+ * finished up a todo
107
+
108
  = 1.65 =
109
  * 2014/05/06
110
  * finished up a few todos