Version Description
- 2013/04/06
- fixed zoom bug in lightbox
Download this release
Release Info
Developer | WebFactory |
Plugin | Google Maps Widget – Ultimate Google Maps Plugin |
Version | 0.60 |
Comparing to | |
See all releases |
Code changes from version 0.55 to 0.60
- gmw-widget.php +12 -3
- google-maps-widget.php +49 -3
- readme.txt +5 -1
gmw-widget.php
CHANGED
@@ -82,10 +82,9 @@ class GoogleMapsWidget extends WP_Widget {
|
|
82 |
array('val' => 'default', 'label' => 'Large (default)'));
|
83 |
|
84 |
$zoom_levels = array(array('val' => '0', 'label' => '0 - entire world'));
|
85 |
-
for ($tmp = 1; $tmp <=
|
86 |
$zoom_levels[] = array('val' => $tmp, 'label' => $tmp);
|
87 |
}
|
88 |
-
$zoom_levels[] = array('val' => '21', 'label' => '21 - street view');
|
89 |
|
90 |
$lightbox_skins[] = array('val' => '', 'label' => 'White with rounded corners (default)');
|
91 |
$lightbox_skins[] = array('val' => 'black-rounded', 'label' => 'Black with rounded corners');
|
@@ -123,7 +122,7 @@ class GoogleMapsWidget extends WP_Widget {
|
|
123 |
echo '<select id="' . $this->get_field_id('thumb_zoom') . '" name="' . $this->get_field_name('thumb_zoom') . '">';
|
124 |
GMW::create_select_options($zoom_levels, $thumb_zoom);
|
125 |
echo '</select></p>';
|
126 |
-
|
127 |
echo '<p><label for="' . $this->get_field_id('thumb_header') . '">Text Above Map:</label>';
|
128 |
echo '<textarea class="widefat" rows="3" cols="20" id="' . $this->get_field_id('thumb_header') . '" name="' . $this->get_field_name('thumb_header') . '">'. $thumb_header . '</textarea></p>';
|
129 |
|
@@ -202,6 +201,15 @@ class GoogleMapsWidget extends WP_Widget {
|
|
202 |
$out = $tmp = '';
|
203 |
|
204 |
extract($args, EXTR_SKIP);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
205 |
self::$widgets[] = array('title' => ($instance['lightbox_title']? $instance['title']: ''),
|
206 |
'width' => $instance['lightbox_width'],
|
207 |
'height' => $instance['lightbox_height'],
|
@@ -212,6 +220,7 @@ class GoogleMapsWidget extends WP_Widget {
|
|
212 |
'type' => $instance['lightbox_type'],
|
213 |
'skin' => $instance['lightbox_skin'],
|
214 |
'bubble' => $instance['lightbox_bubble'],
|
|
|
215 |
'id' => $widget_id);
|
216 |
|
217 |
$out .= $before_widget;
|
82 |
array('val' => 'default', 'label' => 'Large (default)'));
|
83 |
|
84 |
$zoom_levels = array(array('val' => '0', 'label' => '0 - entire world'));
|
85 |
+
for ($tmp = 1; $tmp <= 21; $tmp++) {
|
86 |
$zoom_levels[] = array('val' => $tmp, 'label' => $tmp);
|
87 |
}
|
|
|
88 |
|
89 |
$lightbox_skins[] = array('val' => '', 'label' => 'White with rounded corners (default)');
|
90 |
$lightbox_skins[] = array('val' => 'black-rounded', 'label' => 'Black with rounded corners');
|
122 |
echo '<select id="' . $this->get_field_id('thumb_zoom') . '" name="' . $this->get_field_name('thumb_zoom') . '">';
|
123 |
GMW::create_select_options($zoom_levels, $thumb_zoom);
|
124 |
echo '</select></p>';
|
125 |
+
|
126 |
echo '<p><label for="' . $this->get_field_id('thumb_header') . '">Text Above Map:</label>';
|
127 |
echo '<textarea class="widefat" rows="3" cols="20" id="' . $this->get_field_id('thumb_header') . '" name="' . $this->get_field_name('thumb_header') . '">'. $thumb_header . '</textarea></p>';
|
128 |
|
201 |
$out = $tmp = '';
|
202 |
|
203 |
extract($args, EXTR_SKIP);
|
204 |
+
|
205 |
+
$ll = '';
|
206 |
+
if ($instance['lightbox_zoom'] > 14) {
|
207 |
+
$coordinates = GMW::get_coordinates($instance['address']);
|
208 |
+
if ($coordinates) {
|
209 |
+
$ll = $coordinates['lat'] . ',' . $coordinates['lng'];
|
210 |
+
}
|
211 |
+
}
|
212 |
+
|
213 |
self::$widgets[] = array('title' => ($instance['lightbox_title']? $instance['title']: ''),
|
214 |
'width' => $instance['lightbox_width'],
|
215 |
'height' => $instance['lightbox_height'],
|
220 |
'type' => $instance['lightbox_type'],
|
221 |
'skin' => $instance['lightbox_skin'],
|
222 |
'bubble' => $instance['lightbox_bubble'],
|
223 |
+
'll' => $ll,
|
224 |
'id' => $widget_id);
|
225 |
|
226 |
$out .= $before_widget;
|
google-maps-widget.php
CHANGED
@@ -4,7 +4,7 @@ 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.
|
8 |
Author URI: http://www.webfactoryltd.com/
|
9 |
*/
|
10 |
|
@@ -14,7 +14,7 @@ if (!function_exists('add_action')) {
|
|
14 |
}
|
15 |
|
16 |
|
17 |
-
define('GMW_VER', '0.
|
18 |
require 'gmw-widget.php';
|
19 |
|
20 |
|
@@ -99,7 +99,13 @@ class GMW {
|
|
99 |
} else {
|
100 |
$iwloc = 'near';
|
101 |
}
|
102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
|
104 |
$out .= '<div class="gmw-dialog" style="display: none;" data-map-height="' . $widget['height'] . '" data-map-width="' . $widget['width'] . '" data-map-skin="' . $widget['skin'] . '" data-map-iframe-url="' . $map_url . '" id="dialog-' . $widget['id'] . '" title="' . esc_attr($widget['title']) . '">';
|
105 |
if ($widget['header']) {
|
@@ -167,6 +173,46 @@ class GMW {
|
|
167 |
return $out;
|
168 |
}
|
169 |
} // create_select_options
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
} // class GMW
|
171 |
|
172 |
|
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.60
|
8 |
Author URI: http://www.webfactoryltd.com/
|
9 |
*/
|
10 |
|
14 |
}
|
15 |
|
16 |
|
17 |
+
define('GMW_VER', '0.60');
|
18 |
require 'gmw-widget.php';
|
19 |
|
20 |
|
99 |
} else {
|
100 |
$iwloc = 'near';
|
101 |
}
|
102 |
+
if ($widget['ll']) {
|
103 |
+
$ll = '&ll=' . $widget['ll'];
|
104 |
+
} else {
|
105 |
+
$ll = '';
|
106 |
+
}
|
107 |
+
|
108 |
+
$map_url = 'http://maps.google.com/maps?hl=en&ie=utf8&output=embed&iwloc=' . $iwloc . '&iwd=1&mrt=loc&t=' . $widget['type'] . '&q=' . urlencode(remove_accents($widget['address'])) . '&z=' . urlencode($widget['zoom']) . $ll;
|
109 |
|
110 |
$out .= '<div class="gmw-dialog" style="display: none;" data-map-height="' . $widget['height'] . '" data-map-width="' . $widget['width'] . '" data-map-skin="' . $widget['skin'] . '" data-map-iframe-url="' . $map_url . '" id="dialog-' . $widget['id'] . '" title="' . esc_attr($widget['title']) . '">';
|
111 |
if ($widget['header']) {
|
173 |
return $out;
|
174 |
}
|
175 |
} // create_select_options
|
176 |
+
|
177 |
+
|
178 |
+
function get_coordinates($address, $force_refresh = false) {
|
179 |
+
$address_hash = md5('gmw' . $address);
|
180 |
+
|
181 |
+
if ($force_refresh || ($coordinates = get_transient($address_hash)) === false) {
|
182 |
+
$url = 'http://maps.googleapis.com/maps/api/geocode/xml?address=' . urlencode($address) . '&sensor=false';
|
183 |
+
|
184 |
+
$ch = curl_init();
|
185 |
+
curl_setopt($ch, CURLOPT_URL, $url);
|
186 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
187 |
+
$xml = curl_exec($ch);
|
188 |
+
$ch_info = curl_getinfo($ch);
|
189 |
+
curl_close($ch);
|
190 |
+
|
191 |
+
if ($ch_info['http_code'] == 200) {
|
192 |
+
$data = new SimpleXMLElement($xml);
|
193 |
+
if ($data->status == 'OK') {
|
194 |
+
$cache_value['lat'] = (string) $data->result->geometry->location->lat;
|
195 |
+
$cache_value['lng'] = (string) $data->result->geometry->location->lng;
|
196 |
+
$cache_value['address'] = (string) $data->result->formatted_address;
|
197 |
+
|
198 |
+
// cache coordinates for 3 months
|
199 |
+
set_transient($address_hash, $cache_value, 3600*24*30*3);
|
200 |
+
$data = $cache_value;
|
201 |
+
} elseif (!$data->status) {
|
202 |
+
return false;
|
203 |
+
} else {
|
204 |
+
return false;
|
205 |
+
}
|
206 |
+
} else {
|
207 |
+
return false;
|
208 |
+
}
|
209 |
+
} else {
|
210 |
+
// data is cached, get it
|
211 |
+
$data = get_transient($address_hash);
|
212 |
+
}
|
213 |
+
|
214 |
+
return $data;
|
215 |
+
} // get_coordinates
|
216 |
} // class GMW
|
217 |
|
218 |
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: google maps, maps, gmaps, widget, lightbox, map, google map, fancybox, fan
|
|
5 |
License: GPLv2 or later
|
6 |
Requires at least: 3.2
|
7 |
Tested up to: 3.5
|
8 |
-
Stable tag: 0.
|
9 |
|
10 |
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.
|
11 |
|
@@ -79,6 +79,10 @@ If you can figure it out open a thread in the support forums.
|
|
79 |
|
80 |
== Changelog ==
|
81 |
|
|
|
|
|
|
|
|
|
82 |
= 0.55 =
|
83 |
* 2013/04/05
|
84 |
* added 2 new options - text above and below thumbnail map
|
5 |
License: GPLv2 or later
|
6 |
Requires at least: 3.2
|
7 |
Tested up to: 3.5
|
8 |
+
Stable tag: 0.60
|
9 |
|
10 |
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.
|
11 |
|
79 |
|
80 |
== Changelog ==
|
81 |
|
82 |
+
= 0.60 =
|
83 |
+
* 2013/04/06
|
84 |
+
* fixed zoom bug in lightbox
|
85 |
+
|
86 |
= 0.55 =
|
87 |
* 2013/04/05
|
88 |
* added 2 new options - text above and below thumbnail map
|