Version Description
- 2012/08/28
- Complete GUI rewrite
- Added header text option
- Added address bubble visibility option
- Fixed thumbnail map scaling bug
- Fixed lightbox map size bug
Download this release
Release Info
Developer | WebFactory |
Plugin | Google Maps Widget – Ultimate Google Maps Plugin |
Version | 0.2 |
Comparing to | |
See all releases |
Code changes from version 0.13 to 0.2
- css/gmw-admin.css +69 -0
- gmw-widget.php +64 -38
- google-maps-widget.php +43 -8
- js/gmw-admin.js +12 -0
- js/gmw.js +14 -7
- readme.txt +34 -12
- screenshot-3.png +0 -0
- screenshot-4.png +0 -0
css/gmw-admin.css
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Google Maps Widget
|
3 |
+
* (c) Web factory Ltd, 2012
|
4 |
+
*/
|
5 |
+
|
6 |
+
.gmw-label {
|
7 |
+
width: 80px;
|
8 |
+
display: inline-block;
|
9 |
+
}
|
10 |
+
|
11 |
+
.gmw-tabs {
|
12 |
+
border-bottom: 1px solid #CCCCCC !important;
|
13 |
+
}
|
14 |
+
|
15 |
+
/*
|
16 |
+
* jQuery UI Tabs 1.8.14
|
17 |
+
*
|
18 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
19 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
20 |
+
* http://jquery.org/license
|
21 |
+
*
|
22 |
+
* http://docs.jquery.com/UI/Tabs#theming
|
23 |
+
*/
|
24 |
+
.ui-tabs { position: relative; padding: .2em; zoom: 1;margin-top:25px } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
|
25 |
+
.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
|
26 |
+
.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }
|
27 |
+
.ui-tabs .ui-tabs-nav li a { text-decoration: none; }
|
28 |
+
.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; border-bottom: 1px solid #F8F8F8 !important; }
|
29 |
+
.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
|
30 |
+
.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
|
31 |
+
.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 0.3em 1.4em; background: none; }
|
32 |
+
.ui-tabs .ui-tabs-hide { display: none !important; }
|
33 |
+
|
34 |
+
.ui-tabs .ui-tabs-nav li a {
|
35 |
+
font-weight: 200;
|
36 |
+
line-height: 32px;
|
37 |
+
color: #AAAAAA;
|
38 |
+
padding: 0 15px;
|
39 |
+
}
|
40 |
+
|
41 |
+
.ui-tabs ul.ui-tabs-nav li {
|
42 |
+
border-color: #DFDFDF #DFDFDF #FFFFFF;
|
43 |
+
border-radius: 3px 3px 0 0;
|
44 |
+
border-style: solid;
|
45 |
+
border-width: 1px 1px 0;
|
46 |
+
color: #AAAAAA;
|
47 |
+
display: inline-block;
|
48 |
+
font-size: 12px;
|
49 |
+
line-height: 16px;
|
50 |
+
margin: 0 0 -1px 10px;
|
51 |
+
text-decoration: none;
|
52 |
+
text-shadow: 0 1px 0 #FFFFFF;
|
53 |
+
}
|
54 |
+
|
55 |
+
ul.ui-tabs-nav{
|
56 |
+
float: left;
|
57 |
+
border-bottom: 1px solid #CCCCCC;
|
58 |
+
padding-bottom: 0;
|
59 |
+
width: 100%;
|
60 |
+
margin-bottom: 20px !important
|
61 |
+
}
|
62 |
+
|
63 |
+
.ui-state-hover a, .ui-state-active a {
|
64 |
+
color: #464646 !important;
|
65 |
+
}
|
66 |
+
|
67 |
+
.ui-state-hover a {
|
68 |
+
color: #D54E21 !important;
|
69 |
+
}
|
gmw-widget.php
CHANGED
@@ -27,9 +27,13 @@ class GoogleMapsWidget extends WP_Widget {
|
|
27 |
'lightbox_height' => 550,
|
28 |
'lightbox_type' => 'roadmap',
|
29 |
'lightbox_zoom' => '14',
|
30 |
-
'
|
|
|
|
|
|
|
31 |
$title = $instance['title'];
|
32 |
-
$
|
|
|
33 |
$address = $instance['address'];
|
34 |
$thumb_pin_color = $instance['thumb_pin_color'];
|
35 |
$thumb_pin_size = $instance['thumb_pin_size'];
|
@@ -41,13 +45,14 @@ class GoogleMapsWidget extends WP_Widget {
|
|
41 |
$lightbox_height = $instance['lightbox_height'];
|
42 |
$lightbox_type = $instance['lightbox_type'];
|
43 |
$lightbox_zoom = $instance['lightbox_zoom'];
|
|
|
44 |
|
45 |
-
$map_types_thumb = array(array('val' => 'roadmap', 'label' => 'Road
|
46 |
array('val' => 'satellite', 'label' => 'Satellite'),
|
47 |
array('val' => 'terrain', 'label' => 'Terrain'),
|
48 |
array('val' => 'hybrid', 'label' => 'Hybrid'));
|
49 |
|
50 |
-
$map_types_lightbox = array(array('val' => 'm', 'label' => 'Road
|
51 |
array('val' => 'k', 'label' => 'Satellite'),
|
52 |
array('val' => 'p', 'label' => 'Terrain'),
|
53 |
array('val' => 'h', 'label' => 'Hybrid'));
|
@@ -75,51 +80,66 @@ class GoogleMapsWidget extends WP_Widget {
|
|
75 |
$zoom_levels[] = array('val' => '21', 'label' => '21 - street view');
|
76 |
|
77 |
echo '<p><label for="' . $this->get_field_id('title') . '">Title:</label><input class="widefat" id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" type="text" value="' . esc_attr($title) . '" /></p>';
|
78 |
-
|
79 |
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>';
|
80 |
-
|
81 |
-
echo '<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
echo '<select id="' . $this->get_field_id('thumb_pin_color') . '" name="' . $this->get_field_name('thumb_pin_color') . '">';
|
83 |
GMW::create_select_options($pin_colors, $thumb_pin_color);
|
84 |
echo '</select></p>';
|
85 |
-
|
86 |
-
echo '<p><label for="' . $this->get_field_id('thumb_pin_size') . '">
|
87 |
echo '<select id="' . $this->get_field_id('thumb_pin_size') . '" name="' . $this->get_field_name('thumb_pin_size') . '">';
|
88 |
GMW::create_select_options($pin_sizes, $thumb_pin_size);
|
89 |
echo '</select></p>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
|
91 |
-
echo '<p><label for="' . $this->get_field_id('
|
92 |
-
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 ';
|
93 |
-
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) . '" />';
|
94 |
-
echo '</p>';
|
95 |
-
|
96 |
-
echo '<p><label for="' . $this->get_field_id('lightbox_width') . '">Lightbox Map Size: </label>';
|
97 |
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 ';
|
98 |
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) . '" />';
|
99 |
-
echo '</p>';
|
100 |
|
101 |
-
echo '<p><label for="' . $this->get_field_id('
|
102 |
-
echo '<select id="' . $this->get_field_id('
|
103 |
-
GMW::create_select_options($
|
104 |
echo '</select></p>';
|
105 |
|
106 |
-
echo '<p><label for="' . $this->get_field_id('lightbox_zoom') . '">Zoom Level
|
107 |
echo '<select id="' . $this->get_field_id('lightbox_zoom') . '" name="' . $this->get_field_name('lightbox_zoom') . '">';
|
108 |
GMW::create_select_options($zoom_levels, $lightbox_zoom);
|
109 |
echo '</select></p>';
|
110 |
-
|
111 |
-
echo '<p><label for="' . $this->get_field_id('thumb_type') . '">Thumbnail Map Type: </label>';
|
112 |
-
echo '<select id="' . $this->get_field_id('thumb_type') . '" name="' . $this->get_field_name('thumb_type') . '">';
|
113 |
-
GMW::create_select_options($map_types_thumb, $thumb_type);
|
114 |
-
echo '</select></p>';
|
115 |
-
|
116 |
-
echo '<p><label for="' . $this->get_field_id('lightbox_type') . '">Lightbox Map Type: </label>';
|
117 |
-
echo '<select id="' . $this->get_field_id('lightbox_type') . '" name="' . $this->get_field_name('lightbox_type') . '">';
|
118 |
-
GMW::create_select_options($map_types_lightbox, $lightbox_type);
|
119 |
-
echo '</select></p>';
|
120 |
|
121 |
-
echo '<p><label for="' . $this->get_field_id('
|
122 |
-
echo '<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
}
|
124 |
|
125 |
function update($new_instance, $old_instance) {
|
@@ -137,7 +157,9 @@ class GoogleMapsWidget extends WP_Widget {
|
|
137 |
$instance['lightbox_type'] = $new_instance['lightbox_type'];
|
138 |
$instance['thumb_zoom'] = $new_instance['thumb_zoom'];
|
139 |
$instance['lightbox_zoom'] = $new_instance['lightbox_zoom'];
|
140 |
-
$instance['
|
|
|
|
|
141 |
|
142 |
return $instance;
|
143 |
}
|
@@ -147,10 +169,14 @@ class GoogleMapsWidget extends WP_Widget {
|
|
147 |
|
148 |
extract($args, EXTR_SKIP);
|
149 |
self::$widgets[] = array('title' => $instance['title'],
|
150 |
-
'
|
|
|
|
|
|
|
151 |
'address' => $instance['address'],
|
152 |
-
'
|
153 |
-
'
|
|
|
154 |
'id' => $widget_id);
|
155 |
|
156 |
$out .= $before_widget;
|
@@ -163,8 +189,8 @@ class GoogleMapsWidget extends WP_Widget {
|
|
163 |
$tmp .= '<p><a class="widget-map" href="#dialog-' . $widget_id . '" title="Click to open larger map">';
|
164 |
$tmp .= '<img title="Click to open larger map" alt="Click to open larger map" src="https://maps.googleapis.com/maps/api/staticmap?center=' .
|
165 |
urlencode($instance['address']) . '&zoom=' . $instance['thumb_zoom'] .
|
166 |
-
'&size='
|
167 |
-
'&sensor=false&scale=
|
168 |
urlencode($instance['address']) . '"></a>';
|
169 |
$tmp .= '</p>';
|
170 |
$out .= apply_filters('google_maps_widget_content', $tmp);
|
27 |
'lightbox_height' => 550,
|
28 |
'lightbox_type' => 'roadmap',
|
29 |
'lightbox_zoom' => '14',
|
30 |
+
'lightbox_bubble' => '1',
|
31 |
+
'lightbox_header' => '',
|
32 |
+
'lightbox_footer' => ''));
|
33 |
+
|
34 |
$title = $instance['title'];
|
35 |
+
$lightbox_footer = $instance['lightbox_footer'];
|
36 |
+
$lightbox_header = $instance['lightbox_header'];
|
37 |
$address = $instance['address'];
|
38 |
$thumb_pin_color = $instance['thumb_pin_color'];
|
39 |
$thumb_pin_size = $instance['thumb_pin_size'];
|
45 |
$lightbox_height = $instance['lightbox_height'];
|
46 |
$lightbox_type = $instance['lightbox_type'];
|
47 |
$lightbox_zoom = $instance['lightbox_zoom'];
|
48 |
+
$lightbox_bubble = $instance['lightbox_bubble'];
|
49 |
|
50 |
+
$map_types_thumb = array(array('val' => 'roadmap', 'label' => 'Road'),
|
51 |
array('val' => 'satellite', 'label' => 'Satellite'),
|
52 |
array('val' => 'terrain', 'label' => 'Terrain'),
|
53 |
array('val' => 'hybrid', 'label' => 'Hybrid'));
|
54 |
|
55 |
+
$map_types_lightbox = array(array('val' => 'm', 'label' => 'Road'),
|
56 |
array('val' => 'k', 'label' => 'Satellite'),
|
57 |
array('val' => 'p', 'label' => 'Terrain'),
|
58 |
array('val' => 'h', 'label' => 'Hybrid'));
|
80 |
$zoom_levels[] = array('val' => '21', 'label' => '21 - street view');
|
81 |
|
82 |
echo '<p><label for="' . $this->get_field_id('title') . '">Title:</label><input class="widefat" id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" type="text" value="' . esc_attr($title) . '" /></p>';
|
|
|
83 |
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>';
|
84 |
+
|
85 |
+
echo '<div class="gmw-tabs"><ul><li><a href="#gmw-thumb">Thumbnail map</a></li><li><a href="#gmw-lightbox">Lightbox map</a></li></ul>';
|
86 |
+
echo '<div id="gmw-thumb">';
|
87 |
+
|
88 |
+
echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_width') . '">Map Size: </label>';
|
89 |
+
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 ';
|
90 |
+
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) . '" />';
|
91 |
+
echo ' px</p>';
|
92 |
+
|
93 |
+
echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_type') . '">Map Type: </label>';
|
94 |
+
echo '<select id="' . $this->get_field_id('thumb_type') . '" name="' . $this->get_field_name('thumb_type') . '">';
|
95 |
+
GMW::create_select_options($map_types_thumb, $thumb_type);
|
96 |
+
echo '</select></p>';
|
97 |
+
|
98 |
+
echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_pin_color') . '">Pin Color: </label>';
|
99 |
echo '<select id="' . $this->get_field_id('thumb_pin_color') . '" name="' . $this->get_field_name('thumb_pin_color') . '">';
|
100 |
GMW::create_select_options($pin_colors, $thumb_pin_color);
|
101 |
echo '</select></p>';
|
102 |
+
|
103 |
+
echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_pin_size') . '">Pin Size: </label>';
|
104 |
echo '<select id="' . $this->get_field_id('thumb_pin_size') . '" name="' . $this->get_field_name('thumb_pin_size') . '">';
|
105 |
GMW::create_select_options($pin_sizes, $thumb_pin_size);
|
106 |
echo '</select></p>';
|
107 |
+
|
108 |
+
echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_zoom') . '">Zoom Level: </label>';
|
109 |
+
echo '<select id="' . $this->get_field_id('thumb_zoom') . '" name="' . $this->get_field_name('thumb_zoom') . '">';
|
110 |
+
GMW::create_select_options($zoom_levels, $thumb_zoom);
|
111 |
+
echo '</select></p>';
|
112 |
+
|
113 |
+
echo '</div>'; // thumbnail tab
|
114 |
+
echo '<div id="gmw-lightbox">';
|
115 |
|
116 |
+
echo '<p><label class="gmw-label" for="' . $this->get_field_id('lightbox_width') . '">Map Size: </label>';
|
|
|
|
|
|
|
|
|
|
|
117 |
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 ';
|
118 |
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) . '" />';
|
119 |
+
echo ' px</p>';
|
120 |
|
121 |
+
echo '<p><label class="gmw-label" for="' . $this->get_field_id('lightbox_type') . '">Map Type: </label>';
|
122 |
+
echo '<select id="' . $this->get_field_id('lightbox_type') . '" name="' . $this->get_field_name('lightbox_type') . '">';
|
123 |
+
GMW::create_select_options($map_types_lightbox, $lightbox_type);
|
124 |
echo '</select></p>';
|
125 |
|
126 |
+
echo '<p><label class="gmw-label" for="' . $this->get_field_id('lightbox_zoom') . '">Zoom Level: </label>';
|
127 |
echo '<select id="' . $this->get_field_id('lightbox_zoom') . '" name="' . $this->get_field_name('lightbox_zoom') . '">';
|
128 |
GMW::create_select_options($zoom_levels, $lightbox_zoom);
|
129 |
echo '</select></p>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
|
131 |
+
echo '<p><label for="' . $this->get_field_id('lightbox_bubble') . '">Show Address Bubble: </label>';
|
132 |
+
echo '<input ' . checked('1', $lightbox_bubble, false) . ' value="1" type="checkbox" id="' . $this->get_field_id('lightbox_bubble') . '" name="' . $this->get_field_name('lightbox_bubble') . '">';
|
133 |
+
echo '</p>';
|
134 |
+
|
135 |
+
echo '<p><label for="' . $this->get_field_id('lightbox_header') . '">Header Text:</label>';
|
136 |
+
echo '<textarea class="widefat" rows="3" cols="20" id="' . $this->get_field_id('lightbox_header') . '" name="' . $this->get_field_name('lightbox_header') . '">'. $lightbox_header . '</textarea></p>';
|
137 |
+
|
138 |
+
echo '<p><label for="' . $this->get_field_id('lightbox_footer') . '">Footer Text:</label>';
|
139 |
+
echo '<textarea class="widefat" rows="3" cols="20" id="' . $this->get_field_id('lightbox_footer') . '" name="' . $this->get_field_name('lightbox_footer') . '">'. $lightbox_footer . '</textarea></p>';
|
140 |
+
|
141 |
+
echo '</div>'; // lightbox tab
|
142 |
+
echo '</div>'; // tabs
|
143 |
}
|
144 |
|
145 |
function update($new_instance, $old_instance) {
|
157 |
$instance['lightbox_type'] = $new_instance['lightbox_type'];
|
158 |
$instance['thumb_zoom'] = $new_instance['thumb_zoom'];
|
159 |
$instance['lightbox_zoom'] = $new_instance['lightbox_zoom'];
|
160 |
+
$instance['lightbox_bubble'] = (int) @$new_instance['lightbox_bubble'];
|
161 |
+
$instance['lightbox_footer'] = $new_instance['lightbox_footer'];
|
162 |
+
$instance['lightbox_header'] = $new_instance['lightbox_header'];
|
163 |
|
164 |
return $instance;
|
165 |
}
|
169 |
|
170 |
extract($args, EXTR_SKIP);
|
171 |
self::$widgets[] = array('title' => $instance['title'],
|
172 |
+
'width' => $instance['lightbox_width'],
|
173 |
+
'height' => $instance['lightbox_height'],
|
174 |
+
'footer' => $instance['lightbox_footer'],
|
175 |
+
'header' => $instance['lightbox_header'],
|
176 |
'address' => $instance['address'],
|
177 |
+
'zoom' => $instance['lightbox_zoom'],
|
178 |
+
'type' => $instance['lightbox_type'],
|
179 |
+
'bubble' => $instance['lightbox_bubble'],
|
180 |
'id' => $widget_id);
|
181 |
|
182 |
$out .= $before_widget;
|
189 |
$tmp .= '<p><a class="widget-map" href="#dialog-' . $widget_id . '" title="Click to open larger map">';
|
190 |
$tmp .= '<img title="Click to open larger map" alt="Click to open larger map" src="https://maps.googleapis.com/maps/api/staticmap?center=' .
|
191 |
urlencode($instance['address']) . '&zoom=' . $instance['thumb_zoom'] .
|
192 |
+
'&size=' . $instance['thumb_width'] . 'x' . $instance['thumb_height'] . '&maptype=' . $instance['thumb_type'] .
|
193 |
+
'&sensor=false&scale=1&markers=size:' . $instance['thumb_pin_size'] . '%7Ccolor:' . $instance['thumb_pin_color'] . '%7Clabel:A%7C' .
|
194 |
urlencode($instance['address']) . '"></a>';
|
195 |
$tmp .= '</p>';
|
196 |
$out .= apply_filters('google_maps_widget_content', $tmp);
|
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 |
|
@@ -13,7 +13,7 @@ if (!function_exists('add_action')) {
|
|
13 |
die('Please don\'t open this file directly!');
|
14 |
}
|
15 |
|
16 |
-
define('GOOGLE_MAPS_WIDGET_CORE_VER', '0.
|
17 |
require_once 'gmw-widget.php';
|
18 |
|
19 |
class GMW {
|
@@ -26,10 +26,13 @@ class GMW {
|
|
26 |
add_filter('plugin_action_links_' . basename(dirname(__FILE__)) . '/' . basename(__FILE__),
|
27 |
array(__CLASS__, 'plugin_action_links'));
|
28 |
add_filter('plugin_row_meta', array(__CLASS__, 'plugin_meta_links'), 10, 2);
|
|
|
|
|
|
|
29 |
} else {
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
}
|
34 |
} // init
|
35 |
|
@@ -87,7 +90,15 @@ class GMW {
|
|
87 |
}
|
88 |
|
89 |
foreach ($widgets as $widget) {
|
90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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>';
|
@@ -99,7 +110,7 @@ class GMW {
|
|
99 |
} // run_scroller
|
100 |
|
101 |
|
102 |
-
|
103 |
function enqueue_scripts() {
|
104 |
if (is_active_widget(false, false, 'googlemapswidget', true)) {
|
105 |
wp_enqueue_style('wp-jquery-ui-dialog');
|
@@ -108,7 +119,31 @@ class GMW {
|
|
108 |
}
|
109 |
} // enqueue_scripts
|
110 |
|
111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
// helper function for creating dropdowns
|
113 |
function create_select_options($options, $selected = null, $output = true) {
|
114 |
$out = "\n";
|
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.2
|
8 |
Author URI: http://www.webfactoryltd.com/
|
9 |
*/
|
10 |
|
13 |
die('Please don\'t open this file directly!');
|
14 |
}
|
15 |
|
16 |
+
define('GOOGLE_MAPS_WIDGET_CORE_VER', '0.2');
|
17 |
require_once 'gmw-widget.php';
|
18 |
|
19 |
class GMW {
|
26 |
add_filter('plugin_action_links_' . basename(dirname(__FILE__)) . '/' . basename(__FILE__),
|
27 |
array(__CLASS__, 'plugin_action_links'));
|
28 |
add_filter('plugin_row_meta', array(__CLASS__, 'plugin_meta_links'), 10, 2);
|
29 |
+
|
30 |
+
// enqueue admin scripts
|
31 |
+
add_action('admin_enqueue_scripts', array(__CLASS__, 'admin_enqueue_scripts'));
|
32 |
} else {
|
33 |
+
// enqueue frontend scripts
|
34 |
+
add_action('wp_enqueue_scripts', array(__CLASS__, 'enqueue_scripts'));
|
35 |
+
add_action('wp_footer', array(__CLASS__, 'dialogs_markup'));
|
36 |
}
|
37 |
} // init
|
38 |
|
90 |
}
|
91 |
|
92 |
foreach ($widgets as $widget) {
|
93 |
+
if ($widget['bubble']) {
|
94 |
+
$iwloc = 'addr';
|
95 |
+
} else {
|
96 |
+
$iwloc = 'near';
|
97 |
+
}
|
98 |
+
$out .= '<div class="gmw-dialog" style="display: none;" data-map-height="' . $widget['height'] . '" data-map-width="' . $widget['width'] . '" data-iframe-url="http://maps.google.co.uk/maps?hl=en&ie=utf8&output=embed&iwloc=' . $iwloc . '&iwd=1&mrt=loc&t=' . $widget['type'] . '&q=' . urlencode($widget['address']) . '&z=' . urlencode($widget['zoom']) . '" id="dialog-' . $widget['id'] . '" title="' . $widget['title'] . '">';
|
99 |
+
if ($widget['header']) {
|
100 |
+
$out .= '<div class="gmw-header" style="padding: 5px;"><i>' . do_shortcode($widget['header']) . '</i></div>';
|
101 |
+
}
|
102 |
$out .= '<div class="gmw-map"></div>';
|
103 |
if ($widget['footer']) {
|
104 |
$out .= '<div class="gmw-footer" style="padding: 5px;"><i>' . do_shortcode($widget['footer']) . '</i></div>';
|
110 |
} // run_scroller
|
111 |
|
112 |
|
113 |
+
// enqueue frontend scripts if necessary
|
114 |
function enqueue_scripts() {
|
115 |
if (is_active_widget(false, false, 'googlemapswidget', true)) {
|
116 |
wp_enqueue_style('wp-jquery-ui-dialog');
|
119 |
}
|
120 |
} // enqueue_scripts
|
121 |
|
122 |
+
|
123 |
+
// enqueue CSS and JS scripts on widgets page
|
124 |
+
function admin_enqueue_scripts() {
|
125 |
+
if (self::is_plugin_admin_page()) {
|
126 |
+
$plugin_url = plugin_dir_url(__FILE__);
|
127 |
+
|
128 |
+
wp_enqueue_script('jquery-ui-tabs');
|
129 |
+
wp_enqueue_script('gmw-admin', $plugin_url . 'js/gmw-admin.js', array(), '1.0', true);
|
130 |
+
wp_enqueue_style('gmw-admin', $plugin_url . 'css/gmw-admin.css', array(), '1.0');
|
131 |
+
} // if
|
132 |
+
} // admin_enqueue_scripts
|
133 |
+
|
134 |
+
|
135 |
+
// check if plugin's admin page is shown
|
136 |
+
function is_plugin_admin_page() {
|
137 |
+
$current_screen = get_current_screen();
|
138 |
+
|
139 |
+
if ($current_screen->id == 'widgets') {
|
140 |
+
return true;
|
141 |
+
} else {
|
142 |
+
return false;
|
143 |
+
}
|
144 |
+
} // is_plugin_admin_page
|
145 |
+
|
146 |
+
|
147 |
// helper function for creating dropdowns
|
148 |
function create_select_options($options, $selected = null, $output = true) {
|
149 |
$out = "\n";
|
js/gmw-admin.js
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Google Maps Widget
|
3 |
+
* (c) Web factory Ltd, 2012
|
4 |
+
*/
|
5 |
+
|
6 |
+
jQuery(function($) {
|
7 |
+
$('.gmw-tabs').tabs();
|
8 |
+
|
9 |
+
$('div[id*="googlemapswidget"]').ajaxSuccess(function(event, request, option) {
|
10 |
+
$('.gmw-tabs').tabs();
|
11 |
+
});
|
12 |
+
}); // onload
|
js/gmw.js
CHANGED
@@ -5,7 +5,12 @@
|
|
5 |
|
6 |
jQuery(function($) {
|
7 |
$('.google-maps-widget a.widget-map').click(function() {
|
8 |
-
$($(this).attr('href'))
|
|
|
|
|
|
|
|
|
|
|
9 |
return false;
|
10 |
});
|
11 |
|
@@ -13,11 +18,10 @@ jQuery(function($) {
|
|
13 |
'modal': true,
|
14 |
'resizable': false,
|
15 |
'zIndex': 9999,
|
16 |
-
'minWidth':
|
17 |
-
'minHeight':
|
18 |
-
'hide':
|
19 |
'open': function(event, ui) { renderMap(event, ui); fixDialogClose(event, ui); },
|
20 |
-
'close': function(event, ui) { $('#wrap').show(); },
|
21 |
'show': 'fade',
|
22 |
'autoOpen': false,
|
23 |
'closeOnEscape': true
|
@@ -27,9 +31,12 @@ jQuery(function($) {
|
|
27 |
function renderMap(event, ui) {
|
28 |
dialog_id = '#' + event.target.id;
|
29 |
map_url = jQuery(dialog_id).attr('data-iframe-url');
|
30 |
-
jQuery(
|
|
|
|
|
|
|
31 |
} // renderMap
|
32 |
|
33 |
function fixDialogClose(event, ui) {
|
34 |
-
jQuery('.ui-widget-overlay').
|
35 |
} // fixDialogClose
|
5 |
|
6 |
jQuery(function($) {
|
7 |
$('.google-maps-widget a.widget-map').click(function() {
|
8 |
+
dialog = $($(this).attr('href'));
|
9 |
+
map_width = dialog.attr('data-map-width');
|
10 |
+
map_height = dialog.attr('data-map-height');
|
11 |
+
|
12 |
+
dialog.dialog('option', {'minWidth': map_width, 'minHeight': map_height,} ).dialog('open');
|
13 |
+
|
14 |
return false;
|
15 |
});
|
16 |
|
18 |
'modal': true,
|
19 |
'resizable': false,
|
20 |
'zIndex': 9999,
|
21 |
+
'minWidth': 550,
|
22 |
+
'minHeight': 550,
|
23 |
+
'hide': 'fade',
|
24 |
'open': function(event, ui) { renderMap(event, ui); fixDialogClose(event, ui); },
|
|
|
25 |
'show': 'fade',
|
26 |
'autoOpen': false,
|
27 |
'closeOnEscape': true
|
31 |
function renderMap(event, ui) {
|
32 |
dialog_id = '#' + event.target.id;
|
33 |
map_url = jQuery(dialog_id).attr('data-iframe-url');
|
34 |
+
map_width = jQuery(dialog_id).attr('data-map-width');
|
35 |
+
map_height = jQuery(dialog_id).attr('data-map-height');
|
36 |
+
|
37 |
+
jQuery('.gmw-map', dialog_id).html('<iframe width="' + map_width + '" height="' + map_height + '" src="' + map_url + '"></iframe>');
|
38 |
} // renderMap
|
39 |
|
40 |
function fixDialogClose(event, ui) {
|
41 |
+
jQuery('.ui-widget-overlay').on('click', function(){ jQuery('.gmw-dialog').dialog('close'); });
|
42 |
} // fixDialogClose
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: google maps, maps, gmaps, widget, lightbox, map, google map
|
|
5 |
License: GPLv2 or later
|
6 |
Requires at least: 3.2
|
7 |
Tested up to: 3.4.1
|
8 |
-
Stable tag: 0.
|
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 |
|
@@ -13,20 +13,29 @@ Display a single-image super-fast loading Google map in a widget. A larger map w
|
|
13 |
|
14 |
More features, videos and demos are coming in a few days! Till then here's the widget's features list:
|
15 |
|
|
|
|
|
16 |
* title
|
17 |
* address
|
18 |
-
* thumbnail map pin color
|
19 |
-
* thumbnail map pin size
|
20 |
-
* thumbnail map width/height
|
21 |
-
* thumbnail map zoom level
|
22 |
-
* thumbnail map type
|
23 |
-
* lightbox map width/height
|
24 |
-
* lightbox map zoom level
|
25 |
-
* lightbox map type
|
26 |
-
* lightbox footer text
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
== Installation ==
|
32 |
|
@@ -51,11 +60,21 @@ If you can figure it out open a thread in the support forums.
|
|
51 |
|
52 |
== Screenshots ==
|
53 |
|
54 |
-
1. Small map is shown as a widget and since it's just one image loads super-fast
|
55 |
2. Larger map with all features is available in the lightbox
|
|
|
|
|
56 |
|
57 |
== Changelog ==
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
= 0.13 =
|
60 |
* 2012/08/09
|
61 |
* Added pin size for thumbnail map
|
@@ -76,6 +95,9 @@ If you can figure it out open a thread in the support forums.
|
|
76 |
|
77 |
== Upgrade Notice ==
|
78 |
|
|
|
|
|
|
|
79 |
= 0.1x =
|
80 |
Upgrade without any fear :)
|
81 |
|
5 |
License: GPLv2 or later
|
6 |
Requires at least: 3.2
|
7 |
Tested up to: 3.4.1
|
8 |
+
Stable tag: 0.2
|
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 |
|
13 |
|
14 |
More features, videos and demos are coming in a few days! Till then here's the widget's features list:
|
15 |
|
16 |
+
**General widget options**
|
17 |
+
|
18 |
* title
|
19 |
* address
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
+
**Thumbnail map options**
|
22 |
+
|
23 |
+
* map size - width & height
|
24 |
+
* map type - road, satellite, map or hybrid
|
25 |
+
* pin color
|
26 |
+
* pin size
|
27 |
+
* zoom level
|
28 |
+
|
29 |
+
**Lightbox map options**
|
30 |
|
31 |
+
* map size - width & height
|
32 |
+
* map type - road, satellite, map or hybrid
|
33 |
+
* zoom level
|
34 |
+
* show/hide address bubble
|
35 |
+
* header text
|
36 |
+
* footer text
|
37 |
+
|
38 |
+
There are no additional JS libraries included; GMW uses jQuery and jQuery UI Dialog bundled with WP. There are also no extra CSS files included. We do plan to add them in the future to provide map and dialog themes.
|
39 |
|
40 |
== Installation ==
|
41 |
|
60 |
|
61 |
== Screenshots ==
|
62 |
|
63 |
+
1. Small map is shown as a widget and since it's just one image it loads super-fast
|
64 |
2. Larger map with all features is available in the lightbox
|
65 |
+
3. Widget options - thumbnail map
|
66 |
+
4. Widget options - lightbox map
|
67 |
|
68 |
== Changelog ==
|
69 |
|
70 |
+
= 0.2 =
|
71 |
+
* 2012/08/28
|
72 |
+
* Complete GUI rewrite
|
73 |
+
* Added header text option
|
74 |
+
* Added address bubble visibility option
|
75 |
+
* Fixed thumbnail map scaling bug
|
76 |
+
* Fixed lightbox map size bug
|
77 |
+
|
78 |
= 0.13 =
|
79 |
* 2012/08/09
|
80 |
* Added pin size for thumbnail map
|
95 |
|
96 |
== Upgrade Notice ==
|
97 |
|
98 |
+
= 0.2 =
|
99 |
+
Due to variable name change footer text will be reset
|
100 |
+
|
101 |
= 0.1x =
|
102 |
Upgrade without any fear :)
|
103 |
|
screenshot-3.png
ADDED
Binary file
|
screenshot-4.png
ADDED
Binary file
|