Google Maps Widget – Ultimate Google Maps Plugin - Version 0.11

Version Description

  • 2012/08/03
  • Fixed a few minor bugs.
Download this release

Release Info

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

Code changes from version 0.1 to 0.11

Files changed (3) hide show
  1. gmw-widget.php +29 -23
  2. google-maps-widget.php +5 -5
  3. readme.txt +14 -6
gmw-widget.php CHANGED
@@ -20,28 +20,33 @@ class GoogleMapsWidget extends WP_Widget {
20
  'thumb_width' => 250,
21
  'thumb_height' => 250,
22
  'thumb_type' => 'roadmap',
 
23
  'lightbox_width' => 550,
24
  'lightbox_height' => 550,
25
  'lightbox_type' => 'roadmap',
26
- 'footer' => '',
27
- 'zoom_thumb' => '13',
28
- 'zoom_big' => '14'));
29
  $title = $instance['title'];
30
  $footer = $instance['footer'];
31
  $address = $instance['address'];
32
  $thumb_width = $instance['thumb_width'];
33
  $thumb_height = $instance['thumb_height'];
34
  $thumb_type = $instance['thumb_type'];
 
35
  $lightbox_width = $instance['lightbox_width'];
36
  $lightbox_height = $instance['lightbox_height'];
37
  $lightbox_type = $instance['lightbox_type'];
38
- $zoom_thumb = $instance['zoom_thumb'];
39
- $zoom_big = $instance['zoom_big'];
40
 
41
- $map_types = array(array('val' => 'roadmap', 'label' => 'Road map'),
42
- array('val' => 'satellite', 'label' => 'Satellite'),
43
- array('val' => 'terrain', 'label' => 'Terrain'),
44
- array('val' => 'hybrid', 'label' => 'Hybrid'));
 
 
 
 
 
45
 
46
  $zoom_levels = array(array('val' => '0', 'label' => '0 - entire world'));
47
  for ($tmp = 1; $tmp <= 20; $tmp++) {
@@ -53,34 +58,34 @@ class GoogleMapsWidget extends WP_Widget {
53
 
54
  echo '<p><label for="' . $this->get_field_id('address') . '">Address:</label><input class="widefat" id="' . $this->get_field_id('address') . '" name="' . $this->get_field_name('address') . '" type="text" value="' . esc_attr($address) . '" /></p>';
55
 
56
- echo '<p><label for="' . $this->get_field_id('thumb_width') . '">Thumbnail Size: </label>';
57
  echo '<input class="small-text" id="' . $this->get_field_id('thumb_width') . '" name="' . $this->get_field_name('thumb_width') . '" type="text" value="' . esc_attr($thumb_width) . '" /> x ';
58
  echo '<input class="small-text" id="' . $this->get_field_id('thumb_height') . '" name="' . $this->get_field_name('thumb_height') . '" type="text" value="' . esc_attr($thumb_height) . '" />';
59
  echo '</p>';
60
 
61
- echo '<p><label for="' . $this->get_field_id('lightbox_width') . '">Lightbox Size: </label>';
62
  echo '<input class="small-text" id="' . $this->get_field_id('lightbox_width') . '" name="' . $this->get_field_name('lightbox_width') . '" type="text" value="' . esc_attr($lightbox_width) . '" /> x ';
63
  echo '<input class="small-text" id="' . $this->get_field_id('lightbox_height') . '" name="' . $this->get_field_name('lightbox_height') . '" type="text" value="' . esc_attr($lightbox_height) . '" />';
64
  echo '</p>';
65
 
66
- echo '<p><label for="' . $this->get_field_id('zoom_thumb') . '">Zoom Level for Thumbnail Map: </label>';
67
- echo '<select id="' . $this->get_field_id('zoom_thumb') . '" name="' . $this->get_field_name('zoom_thumb') . '">';
68
- GMW::create_select_options($zoom_levels, $zoom_thumb);
69
  echo '</select></p>';
70
 
71
- echo '<p><label for="' . $this->get_field_id('zoom_big') . '">Zoom Level for Lightbox Map: </label>';
72
- echo '<select id="' . $this->get_field_id('zoom_big') . '" name="' . $this->get_field_name('zoom_big') . '">';
73
- GMW::create_select_options($zoom_levels, $zoom_big);
74
  echo '</select></p>';
75
 
76
  echo '<p><label for="' . $this->get_field_id('thumb_type') . '">Thumbnail Map Type: </label>';
77
  echo '<select id="' . $this->get_field_id('thumb_type') . '" name="' . $this->get_field_name('thumb_type') . '">';
78
- GMW::create_select_options($map_types, $thumb_type);
79
  echo '</select></p>';
80
 
81
  echo '<p><label for="' . $this->get_field_id('lightbox_type') . '">Lightbox Map Type: </label>';
82
  echo '<select id="' . $this->get_field_id('lightbox_type') . '" name="' . $this->get_field_name('lightbox_type') . '">';
83
- GMW::create_select_options($map_types, $lightbox_type);
84
  echo '</select></p>';
85
 
86
  echo '<p><label for="' . $this->get_field_id('footer') . '">Lightbox Footer Text:</label>';
@@ -98,8 +103,8 @@ class GoogleMapsWidget extends WP_Widget {
98
  $instance['lightbox_height'] = (int) $new_instance['lightbox_height'];
99
  $instance['thumb_type'] = $new_instance['thumb_type'];
100
  $instance['lightbox_type'] = $new_instance['lightbox_type'];
101
- $instance['zoom_thumb'] = $new_instance['zoom_thumb'];
102
- $instance['zoom_big'] = $new_instance['zoom_big'];
103
  $instance['footer'] = $new_instance['footer'];
104
 
105
  return $instance;
@@ -112,7 +117,8 @@ class GoogleMapsWidget extends WP_Widget {
112
  self::$widgets[] = array('title' => $instance['title'],
113
  'footer' => $instance['footer'],
114
  'address' => $instance['address'],
115
- 'zoom_big' => $instance['zoom_big'],
 
116
  'id' => $widget_id);
117
 
118
  $out .= $before_widget;
@@ -124,7 +130,7 @@ class GoogleMapsWidget extends WP_Widget {
124
 
125
  $tmp .= '<p><a class="widget-map" href="#dialog-' . $widget_id . '" title="Click to open larger map">';
126
  $tmp .= '<img title="Click to open larger map" alt="Click to open larger map" src="https://maps.googleapis.com/maps/api/staticmap?center=' .
127
- urlencode($instance['address']) . '&amp;zoom=' . $instance['zoom_thumb'] .
128
  '&amp;size=' .$instance['thumb_width'] . 'x' . $instance['thumb_height'] . '&amp;maptype=' . $instance['thumb_type'] . '&amp;sensor=false&amp;scale=2&amp;markers=color:red%7Clabel:A%7C' .
129
  urlencode($instance['address']) . '"></a>';
130
  $tmp .= '</p>';
20
  'thumb_width' => 250,
21
  'thumb_height' => 250,
22
  'thumb_type' => 'roadmap',
23
+ 'thumb_zoom' => '13',
24
  'lightbox_width' => 550,
25
  'lightbox_height' => 550,
26
  'lightbox_type' => 'roadmap',
27
+ 'lightbox_zoom' => '14',
28
+ 'footer' => ''));
 
29
  $title = $instance['title'];
30
  $footer = $instance['footer'];
31
  $address = $instance['address'];
32
  $thumb_width = $instance['thumb_width'];
33
  $thumb_height = $instance['thumb_height'];
34
  $thumb_type = $instance['thumb_type'];
35
+ $thumb_zoom = $instance['thumb_zoom'];
36
  $lightbox_width = $instance['lightbox_width'];
37
  $lightbox_height = $instance['lightbox_height'];
38
  $lightbox_type = $instance['lightbox_type'];
39
+ $lightbox_zoom = $instance['lightbox_zoom'];
 
40
 
41
+ $map_types_thumb = array(array('val' => 'roadmap', 'label' => 'Road map'),
42
+ array('val' => 'satellite', 'label' => 'Satellite'),
43
+ array('val' => 'terrain', 'label' => 'Terrain'),
44
+ array('val' => 'hybrid', 'label' => 'Hybrid'));
45
+
46
+ $map_types_lightbox = array(array('val' => 'm', 'label' => 'Road map'),
47
+ array('val' => 'k', 'label' => 'Satellite'),
48
+ array('val' => 'p', 'label' => 'Terrain'),
49
+ array('val' => 'h', 'label' => 'Hybrid'));
50
 
51
  $zoom_levels = array(array('val' => '0', 'label' => '0 - entire world'));
52
  for ($tmp = 1; $tmp <= 20; $tmp++) {
58
 
59
  echo '<p><label for="' . $this->get_field_id('address') . '">Address:</label><input class="widefat" id="' . $this->get_field_id('address') . '" name="' . $this->get_field_name('address') . '" type="text" value="' . esc_attr($address) . '" /></p>';
60
 
61
+ echo '<p><label for="' . $this->get_field_id('thumb_width') . '">Thumbnail Map Size: </label>';
62
  echo '<input class="small-text" id="' . $this->get_field_id('thumb_width') . '" name="' . $this->get_field_name('thumb_width') . '" type="text" value="' . esc_attr($thumb_width) . '" /> x ';
63
  echo '<input class="small-text" id="' . $this->get_field_id('thumb_height') . '" name="' . $this->get_field_name('thumb_height') . '" type="text" value="' . esc_attr($thumb_height) . '" />';
64
  echo '</p>';
65
 
66
+ echo '<p><label for="' . $this->get_field_id('lightbox_width') . '">Lightbox Map Size: </label>';
67
  echo '<input class="small-text" id="' . $this->get_field_id('lightbox_width') . '" name="' . $this->get_field_name('lightbox_width') . '" type="text" value="' . esc_attr($lightbox_width) . '" /> x ';
68
  echo '<input class="small-text" id="' . $this->get_field_id('lightbox_height') . '" name="' . $this->get_field_name('lightbox_height') . '" type="text" value="' . esc_attr($lightbox_height) . '" />';
69
  echo '</p>';
70
 
71
+ echo '<p><label for="' . $this->get_field_id('thumb_zoom') . '">Zoom Level for Thumbnail Map: </label>';
72
+ echo '<select id="' . $this->get_field_id('thumb_zoom') . '" name="' . $this->get_field_name('thumb_zoom') . '">';
73
+ GMW::create_select_options($zoom_levels, $thumb_zoom);
74
  echo '</select></p>';
75
 
76
+ echo '<p><label for="' . $this->get_field_id('lightbox_zoom') . '">Zoom Level for Lightbox Map: </label>';
77
+ echo '<select id="' . $this->get_field_id('lightbox_zoom') . '" name="' . $this->get_field_name('lightbox_zoom') . '">';
78
+ GMW::create_select_options($zoom_levels, $lightbox_zoom);
79
  echo '</select></p>';
80
 
81
  echo '<p><label for="' . $this->get_field_id('thumb_type') . '">Thumbnail Map Type: </label>';
82
  echo '<select id="' . $this->get_field_id('thumb_type') . '" name="' . $this->get_field_name('thumb_type') . '">';
83
+ GMW::create_select_options($map_types_thumb, $thumb_type);
84
  echo '</select></p>';
85
 
86
  echo '<p><label for="' . $this->get_field_id('lightbox_type') . '">Lightbox Map Type: </label>';
87
  echo '<select id="' . $this->get_field_id('lightbox_type') . '" name="' . $this->get_field_name('lightbox_type') . '">';
88
+ GMW::create_select_options($map_types_lightbox, $lightbox_type);
89
  echo '</select></p>';
90
 
91
  echo '<p><label for="' . $this->get_field_id('footer') . '">Lightbox Footer Text:</label>';
103
  $instance['lightbox_height'] = (int) $new_instance['lightbox_height'];
104
  $instance['thumb_type'] = $new_instance['thumb_type'];
105
  $instance['lightbox_type'] = $new_instance['lightbox_type'];
106
+ $instance['thumb_zoom'] = $new_instance['thumb_zoom'];
107
+ $instance['lightbox_zoom'] = $new_instance['lightbox_zoom'];
108
  $instance['footer'] = $new_instance['footer'];
109
 
110
  return $instance;
117
  self::$widgets[] = array('title' => $instance['title'],
118
  'footer' => $instance['footer'],
119
  'address' => $instance['address'],
120
+ 'lightbox_zoom' => $instance['lightbox_zoom'],
121
+ 'lightbox_type' => $instance['lightbox_type'],
122
  'id' => $widget_id);
123
 
124
  $out .= $before_widget;
130
 
131
  $tmp .= '<p><a class="widget-map" href="#dialog-' . $widget_id . '" title="Click to open larger map">';
132
  $tmp .= '<img title="Click to open larger map" alt="Click to open larger map" src="https://maps.googleapis.com/maps/api/staticmap?center=' .
133
+ urlencode($instance['address']) . '&amp;zoom=' . $instance['thumb_zoom'] .
134
  '&amp;size=' .$instance['thumb_width'] . 'x' . $instance['thumb_height'] . '&amp;maptype=' . $instance['thumb_type'] . '&amp;sensor=false&amp;scale=2&amp;markers=color:red%7Clabel:A%7C' .
135
  urlencode($instance['address']) . '"></a>';
136
  $tmp .= '</p>';
google-maps-widget.php CHANGED
@@ -1,10 +1,10 @@
1
  <?php
2
  /*
3
  Plugin Name: Google Maps Widget
4
- Plugin URI: http://google-maps-widget.webfactoryltd.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: 0.1
8
  Author URI: http://www.webfactoryltd.com/
9
  */
10
 
@@ -42,7 +42,7 @@ class GMW {
42
 
43
  // add settings link to plugins page
44
  function plugin_action_links($links) {
45
- $settings_link = '<a href="widgets.php" title="Configure Google Maps Widget">Widgets</a>';
46
  array_unshift($links, $settings_link);
47
 
48
  return $links;
@@ -87,10 +87,10 @@ class GMW {
87
  }
88
 
89
  foreach ($widgets as $widget) {
90
- $out .= '<div class="gmw-dialog" style="display: none;" data-iframe-url="http://maps.google.co.uk/maps?hl=en&amp;ie=utf8&amp;output=embed&amp;iwloc=A&amp;iwd=1&amp;mrt=loc&amp;t=m&amp;q=' . urlencode($widget['address']) . '&amp;z=' . urlencode($widget['zoom_big']) . '" id="dialog-' . $widget['id'] . '" title="' . $widget['title'] . '">';
91
  $out .= '<div class="gmw-map"></div>';
92
  if ($widget['footer']) {
93
- $out .= '<div class="gmw-footer"><i>' . do_shortcode($widget['footer']) . '</i></div>';
94
  }
95
  $out .= "</div>\n";
96
  } // foreach $widgets
1
  <?php
2
  /*
3
  Plugin Name: Google Maps Widget
4
+ Plugin URI: http://wordpress.org/extend/plugins/google-maps-widget/
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: 0.11
8
  Author URI: http://www.webfactoryltd.com/
9
  */
10
 
42
 
43
  // add settings link to plugins page
44
  function plugin_action_links($links) {
45
+ $settings_link = '<a href="' . admin_url('widgets.php') . '" title="Configure Google Maps Widget">Widgets</a>';
46
  array_unshift($links, $settings_link);
47
 
48
  return $links;
87
  }
88
 
89
  foreach ($widgets as $widget) {
90
+ $out .= '<div class="gmw-dialog" style="display: none;" data-iframe-url="http://maps.google.co.uk/maps?hl=en&amp;ie=utf8&amp;output=embed&amp;iwloc=A&amp;iwd=1&amp;mrt=loc&amp;t=' . $widget['lightbox_type'] . '&amp;q=' . urlencode($widget['address']) . '&amp;z=' . urlencode($widget['lightbox_zoom']) . '" id="dialog-' . $widget['id'] . '" title="' . $widget['title'] . '">';
91
  $out .= '<div class="gmw-map"></div>';
92
  if ($widget['footer']) {
93
+ $out .= '<div class="gmw-footer" style="padding: 5px;"><i>' . do_shortcode($widget['footer']) . '</i></div>';
94
  }
95
  $out .= "</div>\n";
96
  } // foreach $widgets
readme.txt CHANGED
@@ -1,24 +1,24 @@
1
  === Google Maps Widget ===
2
  Contributors: WebFactory
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=paypal%40webfactoryltd%2ecom&lc=US&item_name=Google%20Maps%20Widget&no_note=0&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest
4
- Tags: google maps, maps, gmaps, widget, lightbox
5
  License: GPLv2 or later
6
  Requires at least: 3.2
7
  Tested up to: 3.4.1
8
- Stable tag: 0.1
9
 
10
  Display 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.
11
 
12
  == Description ==
13
 
14
- More features coming soon! So far widget has these options:
15
 
16
  * title
17
  * address
18
  * thumbnail map width/height
19
  * thumbnail map zoom level
20
  * thumbnail map type
21
- * lightbox zoom level
22
  * lightbox map zoom level
23
  * lightbox map type
24
  * lightbox footer text
@@ -26,7 +26,7 @@ More features coming soon! So far widget has these options:
26
 
27
  == Installation ==
28
 
29
- Follow the usuall routine;
30
 
31
  1. Download the plugin.
32
  2. Unzip it and upload to wp-content/plugin/
@@ -36,10 +36,14 @@ Follow the usuall routine;
36
 
37
  == Frequently Asked Questions ==
38
 
39
- = Who is this plugin for =
40
 
41
  For just about anyone who needs a map on their site.
42
 
 
 
 
 
43
 
44
  == Screenshots ==
45
 
@@ -48,6 +52,10 @@ For just about anyone who needs a map on their site.
48
 
49
  == Changelog ==
50
 
 
 
 
 
51
  = 0.1 =
52
  * 2012/08/03
53
  * Initial release.
1
  === Google Maps Widget ===
2
  Contributors: WebFactory
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=paypal%40webfactoryltd%2ecom&lc=US&item_name=Google%20Maps%20Widget&no_note=0&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest
4
+ Tags: google maps, maps, gmaps, widget, lightbox, map
5
  License: GPLv2 or later
6
  Requires at least: 3.2
7
  Tested up to: 3.4.1
8
+ Stable tag: 0.11
9
 
10
  Display 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.
11
 
12
  == Description ==
13
 
14
+ More features and demo coming in a few days! Till then the widget has these options:
15
 
16
  * title
17
  * address
18
  * thumbnail map width/height
19
  * thumbnail map zoom level
20
  * thumbnail map type
21
+ * lightbox map width/height
22
  * lightbox map zoom level
23
  * lightbox map type
24
  * lightbox footer text
26
 
27
  == Installation ==
28
 
29
+ Follow the usual routine;
30
 
31
  1. Download the plugin.
32
  2. Unzip it and upload to wp-content/plugin/
36
 
37
  == Frequently Asked Questions ==
38
 
39
+ = Who is this plugin for? =
40
 
41
  For just about anyone who needs a map on their site.
42
 
43
+ = It's not working!!! Arrrrrrrrr =
44
+
45
+ A more detailed help is coming soon. Till then check 2 things: does your theme have wp_footer() function call in the footer and if there are any jQuery errors on the site.
46
+ If you can figure it out open a thread in the support forums.
47
 
48
  == Screenshots ==
49
 
52
 
53
  == Changelog ==
54
 
55
+ = 0.11 =
56
+ * 2012/08/03
57
+ * Fixed a few minor bugs.
58
+
59
  = 0.1 =
60
  * 2012/08/03
61
  * Initial release.