Version Description
- 2012/09/28
- added 4 skins for lightbox
Download this release
Release Info
| Developer | WebFactory |
| Plugin | |
| Version | 0.35 |
| Comparing to | |
| See all releases | |
Code changes from version 0.3 to 0.35
- css/gmw.css +33 -1
- gmw-widget.php +39 -33
- google-maps-widget.php +16 -16
- js/gmw.js +4 -3
- readme.txt +14 -3
css/gmw.css
CHANGED
|
@@ -6,7 +6,7 @@
|
|
| 6 |
.gmw-header, .gmw-footer {
|
| 7 |
padding: 5px;
|
| 8 |
}
|
| 9 |
-
|
| 10 |
|
| 11 |
/*! fancyBox v2.1.0 fancyapps.com | fancyapps.com/fancybox/#license */
|
| 12 |
.fancybox-wrap,
|
|
@@ -271,4 +271,36 @@
|
|
| 271 |
padding: 10px;
|
| 272 |
background: #000;
|
| 273 |
background: rgba(0, 0, 0, .8);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 274 |
}
|
| 6 |
.gmw-header, .gmw-footer {
|
| 7 |
padding: 5px;
|
| 8 |
}
|
| 9 |
+
|
| 10 |
|
| 11 |
/*! fancyBox v2.1.0 fancyapps.com | fancyapps.com/fancybox/#license */
|
| 12 |
.fancybox-wrap,
|
| 271 |
padding: 10px;
|
| 272 |
background: #000;
|
| 273 |
background: rgba(0, 0, 0, .8);
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
/* lightbox skins */
|
| 277 |
+
.black-rounded .fancybox-skin {
|
| 278 |
+
background: black;
|
| 279 |
+
}
|
| 280 |
+
.black-rounded .fancybox-title-float-wrap .child {
|
| 281 |
+
background: black;
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
.white-square .fancybox-skin {
|
| 285 |
+
-webkit-border-radius: 0;
|
| 286 |
+
-moz-border-radius: 0;
|
| 287 |
+
border-radius: 0;
|
| 288 |
+
}
|
| 289 |
+
.white-square .fancybox-title-float-wrap .child {
|
| 290 |
+
-webkit-border-radius: 0;
|
| 291 |
+
-moz-border-radius: 0;
|
| 292 |
+
border-radius: 0;
|
| 293 |
+
}
|
| 294 |
+
|
| 295 |
+
.black-square .fancybox-skin {
|
| 296 |
+
background: black;
|
| 297 |
+
-webkit-border-radius: 0;
|
| 298 |
+
-moz-border-radius: 0;
|
| 299 |
+
border-radius: 0;
|
| 300 |
+
}
|
| 301 |
+
.black-square .fancybox-title-float-wrap .child {
|
| 302 |
+
background: black;
|
| 303 |
+
-webkit-border-radius: 0;
|
| 304 |
+
-moz-border-radius: 0;
|
| 305 |
+
border-radius: 0;
|
| 306 |
}
|
gmw-widget.php
CHANGED
|
@@ -3,16 +3,16 @@
|
|
| 3 |
* Google Maps Widget
|
| 4 |
* (c) Web factory Ltd, 2012
|
| 5 |
*/
|
| 6 |
-
|
| 7 |
class GoogleMapsWidget extends WP_Widget {
|
| 8 |
static $widgets = array();
|
| 9 |
-
|
| 10 |
function GoogleMapsWidget() {
|
| 11 |
$widget_ops = array('classname' => 'google-maps-widget', 'description' => 'Displays a map image thumbnail with a larger map available in a lightbox.');
|
| 12 |
$control_ops = array('width' => 400, 'height' => 350);
|
| 13 |
$this->WP_Widget('GoogleMapsWidget', 'Google Maps Widget', $widget_ops, $control_ops);
|
| 14 |
}
|
| 15 |
-
|
| 16 |
function form($instance) {
|
| 17 |
$instance = wp_parse_args((array) $instance,
|
| 18 |
array('title' => 'Map',
|
|
@@ -32,7 +32,7 @@ class GoogleMapsWidget extends WP_Widget {
|
|
| 32 |
'lightbox_title' => '1',
|
| 33 |
'lightbox_header' => '',
|
| 34 |
'lightbox_footer' => ''));
|
| 35 |
-
|
| 36 |
$title = $instance['title'];
|
| 37 |
$lightbox_footer = $instance['lightbox_footer'];
|
| 38 |
$lightbox_header = $instance['lightbox_header'];
|
|
@@ -82,40 +82,44 @@ class GoogleMapsWidget extends WP_Widget {
|
|
| 82 |
$zoom_levels[] = array('val' => $tmp, 'label' => $tmp);
|
| 83 |
}
|
| 84 |
$zoom_levels[] = array('val' => '21', 'label' => '21 - street view');
|
| 85 |
-
|
| 86 |
-
$lightbox_skins[] = array('val' => '', 'label' => '
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
|
| 88 |
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>';
|
| 89 |
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>';
|
| 90 |
-
|
| 91 |
echo '<div class="gmw-tabs" id="tab-' . $this->id . '"><ul><li><a href="#gmw-thumb">Thumbnail map</a></li><li><a href="#gmw-lightbox">Lightbox map</a></li></ul>';
|
| 92 |
echo '<div id="gmw-thumb">';
|
| 93 |
-
|
| 94 |
echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_width') . '">Map Size: </label>';
|
| 95 |
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 ';
|
| 96 |
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) . '" />';
|
| 97 |
echo ' px</p>';
|
| 98 |
-
|
| 99 |
echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_type') . '">Map Type: </label>';
|
| 100 |
echo '<select id="' . $this->get_field_id('thumb_type') . '" name="' . $this->get_field_name('thumb_type') . '">';
|
| 101 |
GMW::create_select_options($map_types_thumb, $thumb_type);
|
| 102 |
echo '</select></p>';
|
| 103 |
-
|
| 104 |
echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_pin_color') . '">Pin Color: </label>';
|
| 105 |
echo '<select id="' . $this->get_field_id('thumb_pin_color') . '" name="' . $this->get_field_name('thumb_pin_color') . '">';
|
| 106 |
GMW::create_select_options($pin_colors, $thumb_pin_color);
|
| 107 |
echo '</select></p>';
|
| 108 |
-
|
| 109 |
echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_pin_size') . '">Pin Size: </label>';
|
| 110 |
echo '<select id="' . $this->get_field_id('thumb_pin_size') . '" name="' . $this->get_field_name('thumb_pin_size') . '">';
|
| 111 |
GMW::create_select_options($pin_sizes, $thumb_pin_size);
|
| 112 |
echo '</select></p>';
|
| 113 |
-
|
| 114 |
echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_zoom') . '">Zoom Level: </label>';
|
| 115 |
echo '<select id="' . $this->get_field_id('thumb_zoom') . '" name="' . $this->get_field_name('thumb_zoom') . '">';
|
| 116 |
GMW::create_select_options($zoom_levels, $thumb_zoom);
|
| 117 |
echo '</select></p>';
|
| 118 |
-
|
| 119 |
echo '</div>'; // thumbnail tab
|
| 120 |
echo '<div id="gmw-lightbox">';
|
| 121 |
|
|
@@ -123,44 +127,44 @@ class GoogleMapsWidget extends WP_Widget {
|
|
| 123 |
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 ';
|
| 124 |
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) . '" />';
|
| 125 |
echo ' px</p>';
|
| 126 |
-
|
| 127 |
echo '<p><label class="gmw-label" for="' . $this->get_field_id('lightbox_type') . '">Map Type: </label>';
|
| 128 |
echo '<select id="' . $this->get_field_id('lightbox_type') . '" name="' . $this->get_field_name('lightbox_type') . '">';
|
| 129 |
GMW::create_select_options($map_types_lightbox, $lightbox_type);
|
| 130 |
echo '</select></p>';
|
| 131 |
-
|
| 132 |
echo '<p><label class="gmw-label" for="' . $this->get_field_id('lightbox_zoom') . '">Zoom Level: </label>';
|
| 133 |
echo '<select id="' . $this->get_field_id('lightbox_zoom') . '" name="' . $this->get_field_name('lightbox_zoom') . '">';
|
| 134 |
GMW::create_select_options($zoom_levels, $lightbox_zoom);
|
| 135 |
echo '</select></p>';
|
| 136 |
-
|
| 137 |
echo '<p><label class="gmw-label" for="' . $this->get_field_id('lightbox_skin') . '">Skin: </label>';
|
| 138 |
echo '<select id="' . $this->get_field_id('lightbox_skin') . '" name="' . $this->get_field_name('lightbox_skin') . '">';
|
| 139 |
GMW::create_select_options($lightbox_skins, $lightbox_skin);
|
| 140 |
echo '</select></p>';
|
| 141 |
-
|
| 142 |
echo '<p><label for="' . $this->get_field_id('lightbox_bubble') . '">Show Address Bubble: </label>';
|
| 143 |
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') . '">';
|
| 144 |
echo '</p>';
|
| 145 |
-
|
| 146 |
echo '<p><label for="' . $this->get_field_id('lightbox_title') . '">Show Title Below Lightbox: </label>';
|
| 147 |
echo '<input ' . checked('1', $lightbox_title, false) . ' value="1" type="checkbox" id="' . $this->get_field_id('lightbox_title') . '" name="' . $this->get_field_name('lightbox_title') . '">';
|
| 148 |
echo '</p>';
|
| 149 |
-
|
| 150 |
echo '<p><label for="' . $this->get_field_id('lightbox_header') . '">Header Text:</label>';
|
| 151 |
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>';
|
| 152 |
-
|
| 153 |
echo '<p><label for="' . $this->get_field_id('lightbox_footer') . '">Footer Text:</label>';
|
| 154 |
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>';
|
| 155 |
-
|
| 156 |
echo '</div>'; // lightbox tab
|
| 157 |
echo '</div>'; // tabs
|
| 158 |
echo '<p><i>If you like the plugin give us a shout <a title="WebFactory on Twitter" target="_blank" href="http://twitter.com/WebFactoryLtd">@WebFactoryLtd</a>. Thanks!</i></p>';
|
| 159 |
}
|
| 160 |
-
|
| 161 |
function update($new_instance, $old_instance) {
|
| 162 |
$instance = $old_instance;
|
| 163 |
-
|
| 164 |
$instance['title'] = $new_instance['title'];
|
| 165 |
$instance['address'] = $new_instance['address'];
|
| 166 |
$instance['thumb_pin_color'] = $new_instance['thumb_pin_color'];
|
|
@@ -177,13 +181,14 @@ class GoogleMapsWidget extends WP_Widget {
|
|
| 177 |
$instance['lightbox_title'] = isset($new_instance['lightbox_title']);
|
| 178 |
$instance['lightbox_footer'] = $new_instance['lightbox_footer'];
|
| 179 |
$instance['lightbox_header'] = $new_instance['lightbox_header'];
|
| 180 |
-
|
|
|
|
| 181 |
return $instance;
|
| 182 |
}
|
| 183 |
-
|
| 184 |
function widget($args, $instance) {
|
| 185 |
$out = $tmp = '';
|
| 186 |
-
|
| 187 |
extract($args, EXTR_SKIP);
|
| 188 |
self::$widgets[] = array('title' => ($instance['lightbox_title']? $instance['title']: ''),
|
| 189 |
'width' => $instance['lightbox_width'],
|
|
@@ -193,27 +198,28 @@ class GoogleMapsWidget extends WP_Widget {
|
|
| 193 |
'address' => $instance['address'],
|
| 194 |
'zoom' => $instance['lightbox_zoom'],
|
| 195 |
'type' => $instance['lightbox_type'],
|
|
|
|
| 196 |
'bubble' => $instance['lightbox_bubble'],
|
| 197 |
'id' => $widget_id);
|
| 198 |
-
|
| 199 |
$out .= $before_widget;
|
| 200 |
-
|
| 201 |
$title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
|
| 202 |
if (!empty($title)) {
|
| 203 |
$out .= $before_title . $title . $after_title;
|
| 204 |
}
|
| 205 |
-
|
| 206 |
-
$tmp .= '<p><a class="
|
| 207 |
-
$tmp .= '<img title="Click to open larger map" alt="Click to open larger map" src="https://maps.googleapis.com/maps/api/staticmap?center=' .
|
| 208 |
urlencode($instance['address']) . '&zoom=' . $instance['thumb_zoom'] .
|
| 209 |
'&size=' . $instance['thumb_width'] . 'x' . $instance['thumb_height'] . '&maptype=' . $instance['thumb_type'] .
|
| 210 |
'&sensor=false&scale=1&markers=size:' . $instance['thumb_pin_size'] . '%7Ccolor:' . $instance['thumb_pin_color'] . '%7Clabel:A%7C' .
|
| 211 |
urlencode($instance['address']) . '"></a>';
|
| 212 |
$tmp .= '</p>';
|
| 213 |
$out .= apply_filters('google_maps_widget_content', $tmp);
|
| 214 |
-
|
| 215 |
$out .= $after_widget;
|
| 216 |
-
|
| 217 |
echo $out;
|
| 218 |
}
|
| 219 |
} // class GoogleMapsWidget
|
| 3 |
* Google Maps Widget
|
| 4 |
* (c) Web factory Ltd, 2012
|
| 5 |
*/
|
| 6 |
+
|
| 7 |
class GoogleMapsWidget extends WP_Widget {
|
| 8 |
static $widgets = array();
|
| 9 |
+
|
| 10 |
function GoogleMapsWidget() {
|
| 11 |
$widget_ops = array('classname' => 'google-maps-widget', 'description' => 'Displays a map image thumbnail with a larger map available in a lightbox.');
|
| 12 |
$control_ops = array('width' => 400, 'height' => 350);
|
| 13 |
$this->WP_Widget('GoogleMapsWidget', 'Google Maps Widget', $widget_ops, $control_ops);
|
| 14 |
}
|
| 15 |
+
|
| 16 |
function form($instance) {
|
| 17 |
$instance = wp_parse_args((array) $instance,
|
| 18 |
array('title' => 'Map',
|
| 32 |
'lightbox_title' => '1',
|
| 33 |
'lightbox_header' => '',
|
| 34 |
'lightbox_footer' => ''));
|
| 35 |
+
|
| 36 |
$title = $instance['title'];
|
| 37 |
$lightbox_footer = $instance['lightbox_footer'];
|
| 38 |
$lightbox_header = $instance['lightbox_header'];
|
| 82 |
$zoom_levels[] = array('val' => $tmp, 'label' => $tmp);
|
| 83 |
}
|
| 84 |
$zoom_levels[] = array('val' => '21', 'label' => '21 - street view');
|
| 85 |
+
|
| 86 |
+
$lightbox_skins[] = array('val' => '', 'label' => 'White with rounded corners (default)');
|
| 87 |
+
$lightbox_skins[] = array('val' => 'black-rounded', 'label' => 'Black with rounded corners');
|
| 88 |
+
$lightbox_skins[] = array('val' => 'white-square', 'label' => 'White with square corners');
|
| 89 |
+
$lightbox_skins[] = array('val' => 'black-square', 'label' => 'Black with square corners');
|
| 90 |
+
|
| 91 |
|
| 92 |
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>';
|
| 93 |
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>';
|
| 94 |
+
|
| 95 |
echo '<div class="gmw-tabs" id="tab-' . $this->id . '"><ul><li><a href="#gmw-thumb">Thumbnail map</a></li><li><a href="#gmw-lightbox">Lightbox map</a></li></ul>';
|
| 96 |
echo '<div id="gmw-thumb">';
|
| 97 |
+
|
| 98 |
echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_width') . '">Map Size: </label>';
|
| 99 |
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 ';
|
| 100 |
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) . '" />';
|
| 101 |
echo ' px</p>';
|
| 102 |
+
|
| 103 |
echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_type') . '">Map Type: </label>';
|
| 104 |
echo '<select id="' . $this->get_field_id('thumb_type') . '" name="' . $this->get_field_name('thumb_type') . '">';
|
| 105 |
GMW::create_select_options($map_types_thumb, $thumb_type);
|
| 106 |
echo '</select></p>';
|
| 107 |
+
|
| 108 |
echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_pin_color') . '">Pin Color: </label>';
|
| 109 |
echo '<select id="' . $this->get_field_id('thumb_pin_color') . '" name="' . $this->get_field_name('thumb_pin_color') . '">';
|
| 110 |
GMW::create_select_options($pin_colors, $thumb_pin_color);
|
| 111 |
echo '</select></p>';
|
| 112 |
+
|
| 113 |
echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_pin_size') . '">Pin Size: </label>';
|
| 114 |
echo '<select id="' . $this->get_field_id('thumb_pin_size') . '" name="' . $this->get_field_name('thumb_pin_size') . '">';
|
| 115 |
GMW::create_select_options($pin_sizes, $thumb_pin_size);
|
| 116 |
echo '</select></p>';
|
| 117 |
+
|
| 118 |
echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_zoom') . '">Zoom Level: </label>';
|
| 119 |
echo '<select id="' . $this->get_field_id('thumb_zoom') . '" name="' . $this->get_field_name('thumb_zoom') . '">';
|
| 120 |
GMW::create_select_options($zoom_levels, $thumb_zoom);
|
| 121 |
echo '</select></p>';
|
| 122 |
+
|
| 123 |
echo '</div>'; // thumbnail tab
|
| 124 |
echo '<div id="gmw-lightbox">';
|
| 125 |
|
| 127 |
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 ';
|
| 128 |
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) . '" />';
|
| 129 |
echo ' px</p>';
|
| 130 |
+
|
| 131 |
echo '<p><label class="gmw-label" for="' . $this->get_field_id('lightbox_type') . '">Map Type: </label>';
|
| 132 |
echo '<select id="' . $this->get_field_id('lightbox_type') . '" name="' . $this->get_field_name('lightbox_type') . '">';
|
| 133 |
GMW::create_select_options($map_types_lightbox, $lightbox_type);
|
| 134 |
echo '</select></p>';
|
| 135 |
+
|
| 136 |
echo '<p><label class="gmw-label" for="' . $this->get_field_id('lightbox_zoom') . '">Zoom Level: </label>';
|
| 137 |
echo '<select id="' . $this->get_field_id('lightbox_zoom') . '" name="' . $this->get_field_name('lightbox_zoom') . '">';
|
| 138 |
GMW::create_select_options($zoom_levels, $lightbox_zoom);
|
| 139 |
echo '</select></p>';
|
| 140 |
+
|
| 141 |
echo '<p><label class="gmw-label" for="' . $this->get_field_id('lightbox_skin') . '">Skin: </label>';
|
| 142 |
echo '<select id="' . $this->get_field_id('lightbox_skin') . '" name="' . $this->get_field_name('lightbox_skin') . '">';
|
| 143 |
GMW::create_select_options($lightbox_skins, $lightbox_skin);
|
| 144 |
echo '</select></p>';
|
| 145 |
+
|
| 146 |
echo '<p><label for="' . $this->get_field_id('lightbox_bubble') . '">Show Address Bubble: </label>';
|
| 147 |
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') . '">';
|
| 148 |
echo '</p>';
|
| 149 |
+
|
| 150 |
echo '<p><label for="' . $this->get_field_id('lightbox_title') . '">Show Title Below Lightbox: </label>';
|
| 151 |
echo '<input ' . checked('1', $lightbox_title, false) . ' value="1" type="checkbox" id="' . $this->get_field_id('lightbox_title') . '" name="' . $this->get_field_name('lightbox_title') . '">';
|
| 152 |
echo '</p>';
|
| 153 |
+
|
| 154 |
echo '<p><label for="' . $this->get_field_id('lightbox_header') . '">Header Text:</label>';
|
| 155 |
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>';
|
| 156 |
+
|
| 157 |
echo '<p><label for="' . $this->get_field_id('lightbox_footer') . '">Footer Text:</label>';
|
| 158 |
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>';
|
| 159 |
+
|
| 160 |
echo '</div>'; // lightbox tab
|
| 161 |
echo '</div>'; // tabs
|
| 162 |
echo '<p><i>If you like the plugin give us a shout <a title="WebFactory on Twitter" target="_blank" href="http://twitter.com/WebFactoryLtd">@WebFactoryLtd</a>. Thanks!</i></p>';
|
| 163 |
}
|
| 164 |
+
|
| 165 |
function update($new_instance, $old_instance) {
|
| 166 |
$instance = $old_instance;
|
| 167 |
+
|
| 168 |
$instance['title'] = $new_instance['title'];
|
| 169 |
$instance['address'] = $new_instance['address'];
|
| 170 |
$instance['thumb_pin_color'] = $new_instance['thumb_pin_color'];
|
| 181 |
$instance['lightbox_title'] = isset($new_instance['lightbox_title']);
|
| 182 |
$instance['lightbox_footer'] = $new_instance['lightbox_footer'];
|
| 183 |
$instance['lightbox_header'] = $new_instance['lightbox_header'];
|
| 184 |
+
$instance['lightbox_skin'] = $new_instance['lightbox_skin'];
|
| 185 |
+
|
| 186 |
return $instance;
|
| 187 |
}
|
| 188 |
+
|
| 189 |
function widget($args, $instance) {
|
| 190 |
$out = $tmp = '';
|
| 191 |
+
|
| 192 |
extract($args, EXTR_SKIP);
|
| 193 |
self::$widgets[] = array('title' => ($instance['lightbox_title']? $instance['title']: ''),
|
| 194 |
'width' => $instance['lightbox_width'],
|
| 198 |
'address' => $instance['address'],
|
| 199 |
'zoom' => $instance['lightbox_zoom'],
|
| 200 |
'type' => $instance['lightbox_type'],
|
| 201 |
+
'skin' => $instance['lightbox_skin'],
|
| 202 |
'bubble' => $instance['lightbox_bubble'],
|
| 203 |
'id' => $widget_id);
|
| 204 |
+
|
| 205 |
$out .= $before_widget;
|
| 206 |
+
|
| 207 |
$title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
|
| 208 |
if (!empty($title)) {
|
| 209 |
$out .= $before_title . $title . $after_title;
|
| 210 |
}
|
| 211 |
+
|
| 212 |
+
$tmp .= '<p><a class="gmw-thumbnail-map" href="#dialog-' . $widget_id . '" title="Click to open larger map">';
|
| 213 |
+
$tmp .= '<img title="Click to open larger map" alt="Click to open larger map" src="https://maps.googleapis.com/maps/api/staticmap?center=' .
|
| 214 |
urlencode($instance['address']) . '&zoom=' . $instance['thumb_zoom'] .
|
| 215 |
'&size=' . $instance['thumb_width'] . 'x' . $instance['thumb_height'] . '&maptype=' . $instance['thumb_type'] .
|
| 216 |
'&sensor=false&scale=1&markers=size:' . $instance['thumb_pin_size'] . '%7Ccolor:' . $instance['thumb_pin_color'] . '%7Clabel:A%7C' .
|
| 217 |
urlencode($instance['address']) . '"></a>';
|
| 218 |
$tmp .= '</p>';
|
| 219 |
$out .= apply_filters('google_maps_widget_content', $tmp);
|
| 220 |
+
|
| 221 |
$out .= $after_widget;
|
| 222 |
+
|
| 223 |
echo $out;
|
| 224 |
}
|
| 225 |
} // class GoogleMapsWidget
|
google-maps-widget.php
CHANGED
|
@@ -2,9 +2,9 @@
|
|
| 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.
|
| 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 |
|
|
@@ -28,7 +28,7 @@ class GMW {
|
|
| 28 |
add_filter('plugin_action_links_' . basename(dirname(__FILE__)) . '/' . basename(__FILE__),
|
| 29 |
array(__CLASS__, 'plugin_action_links'));
|
| 30 |
add_filter('plugin_row_meta', array(__CLASS__, 'plugin_meta_links'), 10, 2);
|
| 31 |
-
|
| 32 |
// enqueue admin scripts
|
| 33 |
add_action('admin_enqueue_scripts', array(__CLASS__, 'admin_enqueue_scripts'));
|
| 34 |
} else {
|
|
@@ -86,13 +86,13 @@ class GMW {
|
|
| 86 |
function dialogs_markup() {
|
| 87 |
$out = '';
|
| 88 |
$widgets = GoogleMapsWidget::$widgets;
|
| 89 |
-
|
| 90 |
if (!$widgets) {
|
| 91 |
wp_dequeue_script('gmw');
|
| 92 |
wp_dequeue_script('gmw-fancybox');
|
| 93 |
return;
|
| 94 |
}
|
| 95 |
-
|
| 96 |
foreach ($widgets as $widget) {
|
| 97 |
if ($widget['bubble']) {
|
| 98 |
$iwloc = 'addr';
|
|
@@ -100,8 +100,8 @@ class GMW {
|
|
| 100 |
$iwloc = 'near';
|
| 101 |
}
|
| 102 |
$map_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']) . '';
|
| 103 |
-
|
| 104 |
-
$out .= '<div class="gmw-dialog" style="display: none;" data-map-height="' . $widget['height'] . '" data-map-width="' . $widget['width'] . '" data-iframe-url="' . $map_url . '" id="dialog-' . $widget['id'] . '" title="' . $widget['title'] . '">';
|
| 105 |
if ($widget['header']) {
|
| 106 |
$out .= '<div class="gmw-header"><i>' . do_shortcode($widget['header']) . '</i></div>';
|
| 107 |
}
|
|
@@ -109,9 +109,9 @@ class GMW {
|
|
| 109 |
if ($widget['footer']) {
|
| 110 |
$out .= '<div class="gmw-footer"><i>' . do_shortcode($widget['footer']) . '</i></div>';
|
| 111 |
}
|
| 112 |
-
$out .= "</div>\n";
|
| 113 |
} // foreach $widgets
|
| 114 |
-
|
| 115 |
echo $out;
|
| 116 |
} // run_scroller
|
| 117 |
|
|
@@ -125,20 +125,20 @@ class GMW {
|
|
| 125 |
}
|
| 126 |
} // enqueue_scripts
|
| 127 |
|
| 128 |
-
|
| 129 |
// enqueue CSS and JS scripts on widgets page
|
| 130 |
function admin_enqueue_scripts() {
|
| 131 |
if (self::is_plugin_admin_page()) {
|
| 132 |
$plugin_url = plugin_dir_url(__FILE__);
|
| 133 |
-
|
| 134 |
wp_enqueue_script('jquery-ui-tabs');
|
| 135 |
wp_enqueue_script('sn-cookie', $plugin_url . 'js/jquery.cookie.js', array('jquery'), GMW_VER, true);
|
| 136 |
wp_enqueue_script('gmw-admin', $plugin_url . 'js/gmw-admin.js', array(), GMW_VER, true);
|
| 137 |
wp_enqueue_style('gmw-admin', $plugin_url . 'css/gmw-admin.css', array(), GMW_VER);
|
| 138 |
} // if
|
| 139 |
} // admin_enqueue_scripts
|
| 140 |
-
|
| 141 |
-
|
| 142 |
// check if plugin's admin page is shown
|
| 143 |
function is_plugin_admin_page() {
|
| 144 |
$current_screen = get_current_screen();
|
|
@@ -149,8 +149,8 @@ class GMW {
|
|
| 149 |
return false;
|
| 150 |
}
|
| 151 |
} // is_plugin_admin_page
|
| 152 |
-
|
| 153 |
-
|
| 154 |
// helper function for creating dropdowns
|
| 155 |
function create_select_options($options, $selected = null, $output = true) {
|
| 156 |
$out = "\n";
|
| 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.35
|
| 8 |
Author URI: http://www.webfactoryltd.com/
|
| 9 |
*/
|
| 10 |
|
| 14 |
}
|
| 15 |
|
| 16 |
|
| 17 |
+
define('GMW_VER', '0.35');
|
| 18 |
require 'gmw-widget.php';
|
| 19 |
|
| 20 |
|
| 28 |
add_filter('plugin_action_links_' . basename(dirname(__FILE__)) . '/' . basename(__FILE__),
|
| 29 |
array(__CLASS__, 'plugin_action_links'));
|
| 30 |
add_filter('plugin_row_meta', array(__CLASS__, 'plugin_meta_links'), 10, 2);
|
| 31 |
+
|
| 32 |
// enqueue admin scripts
|
| 33 |
add_action('admin_enqueue_scripts', array(__CLASS__, 'admin_enqueue_scripts'));
|
| 34 |
} else {
|
| 86 |
function dialogs_markup() {
|
| 87 |
$out = '';
|
| 88 |
$widgets = GoogleMapsWidget::$widgets;
|
| 89 |
+
|
| 90 |
if (!$widgets) {
|
| 91 |
wp_dequeue_script('gmw');
|
| 92 |
wp_dequeue_script('gmw-fancybox');
|
| 93 |
return;
|
| 94 |
}
|
| 95 |
+
|
| 96 |
foreach ($widgets as $widget) {
|
| 97 |
if ($widget['bubble']) {
|
| 98 |
$iwloc = 'addr';
|
| 100 |
$iwloc = 'near';
|
| 101 |
}
|
| 102 |
$map_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']) . '';
|
| 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']) {
|
| 106 |
$out .= '<div class="gmw-header"><i>' . do_shortcode($widget['header']) . '</i></div>';
|
| 107 |
}
|
| 109 |
if ($widget['footer']) {
|
| 110 |
$out .= '<div class="gmw-footer"><i>' . do_shortcode($widget['footer']) . '</i></div>';
|
| 111 |
}
|
| 112 |
+
$out .= "</div>\n";
|
| 113 |
} // foreach $widgets
|
| 114 |
+
|
| 115 |
echo $out;
|
| 116 |
} // run_scroller
|
| 117 |
|
| 125 |
}
|
| 126 |
} // enqueue_scripts
|
| 127 |
|
| 128 |
+
|
| 129 |
// enqueue CSS and JS scripts on widgets page
|
| 130 |
function admin_enqueue_scripts() {
|
| 131 |
if (self::is_plugin_admin_page()) {
|
| 132 |
$plugin_url = plugin_dir_url(__FILE__);
|
| 133 |
+
|
| 134 |
wp_enqueue_script('jquery-ui-tabs');
|
| 135 |
wp_enqueue_script('sn-cookie', $plugin_url . 'js/jquery.cookie.js', array('jquery'), GMW_VER, true);
|
| 136 |
wp_enqueue_script('gmw-admin', $plugin_url . 'js/gmw-admin.js', array(), GMW_VER, true);
|
| 137 |
wp_enqueue_style('gmw-admin', $plugin_url . 'css/gmw-admin.css', array(), GMW_VER);
|
| 138 |
} // if
|
| 139 |
} // admin_enqueue_scripts
|
| 140 |
+
|
| 141 |
+
|
| 142 |
// check if plugin's admin page is shown
|
| 143 |
function is_plugin_admin_page() {
|
| 144 |
$current_screen = get_current_screen();
|
| 149 |
return false;
|
| 150 |
}
|
| 151 |
} // is_plugin_admin_page
|
| 152 |
+
|
| 153 |
+
|
| 154 |
// helper function for creating dropdowns
|
| 155 |
function create_select_options($options, $selected = null, $output = true) {
|
| 156 |
$out = "\n";
|
js/gmw.js
CHANGED
|
@@ -4,17 +4,18 @@
|
|
| 4 |
*/
|
| 5 |
|
| 6 |
jQuery(function($) {
|
| 7 |
-
$('.
|
| 8 |
dialog = $($(this).attr('href'));
|
| 9 |
map_width = dialog.attr('data-map-width');
|
| 10 |
map_height = dialog.attr('data-map-height');
|
| 11 |
-
map_url = dialog.attr('data-iframe-url');
|
| 12 |
map_title = dialog.attr('title');
|
|
|
|
| 13 |
|
| 14 |
var content = $(dialog.html());
|
| 15 |
content.filter('.gmw-map').html('<iframe width="' + map_width + 'px" height="' + map_height + 'px" src="' + map_url + '"></iframe>');
|
| 16 |
|
| 17 |
-
$.fancybox( {'type': 'html', 'content': content, 'title': map_title, 'autoSize': true, 'minWidth': map_width, 'minHeight': map_height } );
|
| 18 |
|
| 19 |
return false;
|
| 20 |
});
|
| 4 |
*/
|
| 5 |
|
| 6 |
jQuery(function($) {
|
| 7 |
+
$('a.gmw-thumbnail-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 |
+
map_url = dialog.attr('data-map-iframe-url');
|
| 12 |
map_title = dialog.attr('title');
|
| 13 |
+
map_skin = dialog.attr('data-map-skin');
|
| 14 |
|
| 15 |
var content = $(dialog.html());
|
| 16 |
content.filter('.gmw-map').html('<iframe width="' + map_width + 'px" height="' + map_height + 'px" src="' + map_url + '"></iframe>');
|
| 17 |
|
| 18 |
+
$.fancybox( { 'wrapCSS': map_skin, 'type': 'html', 'content': content, 'title': map_title, 'autoSize': true, 'minWidth': map_width, 'minHeight': map_height } );
|
| 19 |
|
| 20 |
return false;
|
| 21 |
});
|
readme.txt
CHANGED
|
@@ -4,14 +4,16 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=paypa
|
|
| 4 |
Tags: google maps, maps, gmaps, widget, lightbox, map, google map, fancybox, fancybox2
|
| 5 |
License: GPLv2 or later
|
| 6 |
Requires at least: 3.2
|
| 7 |
-
Tested up to: 3.4.
|
| 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 |
|
| 12 |
== Description ==
|
| 13 |
|
| 14 |
-
|
|
|
|
|
|
|
| 15 |
|
| 16 |
**General widget options**
|
| 17 |
|
|
@@ -31,6 +33,7 @@ More features, videos and demos are coming up on a daily basis! Till then here a
|
|
| 31 |
* map size - width & height
|
| 32 |
* map type - road, satellite, map or hybrid
|
| 33 |
* zoom level
|
|
|
|
| 34 |
* show/hide address bubble
|
| 35 |
* show/hide map title
|
| 36 |
* header text
|
|
@@ -76,6 +79,14 @@ If you can figure it out open a thread in the support forums.
|
|
| 76 |
|
| 77 |
== Changelog ==
|
| 78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
= 0.3 =
|
| 80 |
* 2012/09/04
|
| 81 |
* lightbox script changed from jQuery UI Dialog to <a href="http://fancyapps.com/fancybox/">fancyBox2</a>
|
| 4 |
Tags: google maps, maps, gmaps, widget, lightbox, map, google map, fancybox, fancybox2
|
| 5 |
License: GPLv2 or later
|
| 6 |
Requires at least: 3.2
|
| 7 |
+
Tested up to: 3.4.2
|
| 8 |
+
Stable tag: 0.35
|
| 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 |
|
| 12 |
== Description ==
|
| 13 |
|
| 14 |
+
Check out the [Google Maps Widget video](http://www.youtube.com/watch?v=y1siX9ha7Pw) or give us a shout <a href="http://twitter.com/WebFactoryLtd">@WebFactoryLtd</a>.
|
| 15 |
+
|
| 16 |
+
http://www.youtube.com/watch?v=y1siX9ha7Pw&hd=1
|
| 17 |
|
| 18 |
**General widget options**
|
| 19 |
|
| 33 |
* map size - width & height
|
| 34 |
* map type - road, satellite, map or hybrid
|
| 35 |
* zoom level
|
| 36 |
+
* skin
|
| 37 |
* show/hide address bubble
|
| 38 |
* show/hide map title
|
| 39 |
* header text
|
| 79 |
|
| 80 |
== Changelog ==
|
| 81 |
|
| 82 |
+
= 0.35 =
|
| 83 |
+
* 2012/09/28
|
| 84 |
+
* added 4 skins for lightbox
|
| 85 |
+
|
| 86 |
+
= 0.31 =
|
| 87 |
+
* 2012/09/14
|
| 88 |
+
* fix for bad themes which don't respect proper sidebar markup
|
| 89 |
+
|
| 90 |
= 0.3 =
|
| 91 |
* 2012/09/04
|
| 92 |
* lightbox script changed from jQuery UI Dialog to <a href="http://fancyapps.com/fancybox/">fancyBox2</a>
|
