| 1 |
<?php |
| 2 |
/* |
| 3 |
* Google Maps Widget |
| 4 |
* Widget definition, admin GUI and front-end functions |
| 5 |
* (c) Web factory Ltd, 2012 - 2014 |
| 6 |
*/ |
| 7 |
|
| 8 |
|
| 9 |
// include only file |
| 10 |
if (!defined('ABSPATH')) { |
| 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 |
|
| 19 |
|
| 20 |
// constructor method |
| 21 |
function GoogleMapsWidget() { |
| 22 |
$widget_ops = array('classname' => 'google-maps-widget', 'description' => __('Displays a map image thumbnail with a larger map available in a lightbox.', 'google-maps-widget')); |
| 23 |
$control_ops = array('width' => 450, 'height' => 350); |
| 24 |
$this->WP_Widget('GoogleMapsWidget', __('Google Maps Widget', 'google-maps-widget'), $widget_ops, $control_ops); |
| 25 |
} // GoogleMapsWidget |
| 26 |
|
| 27 |
|
| 28 |
// widget edit form HTML |
| 29 |
function form($instance) { |
| 30 |
$instance = wp_parse_args((array) $instance, |
| 31 |
array('title' => __('Map', 'google-maps-widget'), |
| 32 |
'address' => __('New York, USA', 'google-maps-widget'), |
| 33 |
'thumb_pin_color' => 'red', |
| 34 |
'thumb_pin_type' => 'predefined', |
| 35 |
'thumb_pin_size' => 'default', |
| 36 |
'thumb_pin_img' => '', |
| 37 |
'thumb_width' => '250', |
| 38 |
'thumb_height' => '250', |
| 39 |
'thumb_type' => 'roadmap', |
| 40 |
'thumb_zoom' => '13', |
| 41 |
'thumb_header' => '', |
| 42 |
'thumb_footer' => '', |
| 43 |
'thumb_new_colors' => '1', |
| 44 |
'thumb_link_type' => 'lightbox', |
| 45 |
'thumb_link' => '', |
| 46 |
'lightbox_width' => '550', |
| 47 |
'lightbox_height' => '550', |
| 48 |
'lightbox_type' => 'roadmap', |
| 49 |
'lightbox_zoom' => '14', |
| 50 |
'lightbox_bubble' => '1', |
| 51 |
'lightbox_skin' => 'light', |
| 52 |
'lightbox_title' => '1', |
| 53 |
'lightbox_header' => '', |
| 54 |
'lightbox_footer' => '')); |
| 55 |
|
| 56 |
extract($instance, EXTR_SKIP); |
| 57 |
|
| 58 |
// legacy fixes for older versions; it's auto-fixed on first widget save but has to be here |
| 59 |
if(!$thumb_pin_type) { |
| 60 |
$thumb_pin_type = 'predefined'; |
| 61 |
} |
| 62 |
if(!$thumb_link_type) { |
| 63 |
$thumb_link_type = 'lightbox'; |
| 64 |
} |
| 65 |
if(!$lightbox_skin) { |
| 66 |
$lightbox_skin = 'light'; |
| 67 |
} |
| 68 |
|
| 69 |
$map_types_thumb = array(array('val' => 'roadmap', 'label' => __('Road (default)', 'google-maps-widget')), |
| 70 |
array('val' => 'satellite', 'label' => __('Satellite', 'google-maps-widget')), |
| 71 |
array('val' => 'terrain', 'label' => __('Terrain', 'google-maps-widget')), |
| 72 |
array('val' => 'hybrid', 'label' => __('Hybrid', 'google-maps-widget'))); |
| 73 |
|
| 74 |
$map_types_lightbox = array(array('val' => 'm', 'label' => __('Road (default)', 'google-maps-widget')), |
| 75 |
array('val' => 'k', 'label' => __('Satellite', 'google-maps-widget')), |
| 76 |
array('val' => 'p', 'label' => __('Terrain', 'google-maps-widget')), |
| 77 |
array('val' => 'h', 'label' => __('Hybrid', 'google-maps-widget'))); |
| 78 |
|
| 79 |
$pin_colors = array(array('val' => 'black', 'label' => __('Black', 'google-maps-widget')), |
| 80 |
array('val' => 'brown', 'label' => __('Brown', 'google-maps-widget')), |
| 81 |
array('val' => 'green', 'label' => __('Green', 'google-maps-widget')), |
| 82 |
array('val' => 'purple', 'label' => __('Purple', 'google-maps-widget')), |
| 83 |
array('val' => 'yellow', 'label' => __('Yellow', 'google-maps-widget')), |
| 84 |
array('val' => 'blue', 'label' => __('Blue', 'google-maps-widget')), |
| 85 |
array('val' => 'gray', 'label' => __('Gray', 'google-maps-widget')), |
| 86 |
array('val' => 'orange', 'label' => __('Orange', 'google-maps-widget')), |
| 87 |
array('val' => 'red', 'label' => __('Red (default)', 'google-maps-widget')), |
| 88 |
array('val' => 'white', 'label' => __('White', 'google-maps-widget'))); |
| 89 |
|
| 90 |
$pin_sizes = array(array('val' => 'tiny', 'label' => __('Tiny', 'google-maps-widget')), |
| 91 |
array('val' => 'small', 'label' => __('Small', 'google-maps-widget')), |
| 92 |
array('val' => 'mid', 'label' => __('Medium', 'google-maps-widget')), |
| 93 |
array('val' => 'default', 'label' => __('Large (default)', 'google-maps-widget'))); |
| 94 |
|
| 95 |
$zoom_levels = array(array('val' => '0', 'label' => __('0 - entire world', 'google-maps-widget'))); |
| 96 |
for ($tmp = 1; $tmp <= 21; $tmp++) { |
| 97 |
$zoom_levels[] = array('val' => $tmp, 'label' => $tmp); |
| 98 |
} |
| 99 |
|
| 100 |
$lightbox_skins[] = array('val' => 'light', 'label' => __('Light (default)', 'google-maps-widget')); |
| 101 |
$lightbox_skins[] = array('val' => 'dark', 'label' => __('Dark', 'google-maps-widget')); |
| 102 |
|
| 103 |
$thumb_pin_types[] = array('val' => 'predefined', 'label' => __('Predefined (default)', 'google-maps-widget')); |
| 104 |
$thumb_pin_types[] = array('val' => 'custom', 'label' => __('Custom', 'google-maps-widget')); |
| 105 |
|
| 106 |
$thumb_link_types[] = array('val' => 'lightbox', 'label' => __('Lightbox (default)', 'google-maps-widget')); |
| 107 |
$thumb_link_types[] = array('val' => 'custom', 'label' => __('Custom link', 'google-maps-widget')); |
| 108 |
$thumb_link_types[] = array('val' => 'nolink', 'label' => __('Disable link', 'google-maps-widget')); |
| 109 |
|
| 110 |
|
| 111 |
echo '<p><label for="' . $this->get_field_id('title') . '">' . __('Title', 'google-maps-widget') . ':</label><input class="widefat" id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" type="text" value="' . esc_attr($title) . '" /></p>'; |
| 112 |
echo '<p><label for="' . $this->get_field_id('address') . '">' . __('Address', 'google-maps-widget') . ':</label><input class="widefat" id="' . $this->get_field_id('address') . '" name="' . $this->get_field_name('address') . '" type="text" value="' . esc_attr($address) . '" /></p>'; |
| 113 |
|
| 114 |
echo '<div class="gmw-tabs" id="tab-' . $this->id . '"><ul><li><a href="#gmw-thumb">' . __('Thumbnail map', 'google-maps-widget') . '</a></li><li><a href="#gmw-lightbox">' . __('Lightbox map', 'google-maps-widget') . '</a></li></ul>'; |
| 115 |
echo '<div id="gmw-thumb">'; |
| 116 |
|
| 117 |
echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_width') . '">' . __('Map Size', 'google-maps-widget') . ':</label>'; |
| 118 |
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 '; |
| 119 |
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) . '" />'; |
| 120 |
echo ' px</p>'; |
| 121 |
|
| 122 |
echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_type') . '">' . __('Map Type', 'google-maps-widget') . ':</label>'; |
| 123 |
echo '<select id="' . $this->get_field_id('thumb_type') . '" name="' . $this->get_field_name('thumb_type') . '">'; |
| 124 |
GMW::create_select_options($map_types_thumb, $thumb_type); |
| 125 |
echo '</select></p>'; |
| 126 |
|
| 127 |
echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_pin_type') . '">' . __('Pin Type', 'google-maps-widget') . ':</label>'; |
| 128 |
echo '<select class="gmw_thumb_pin_type" id="' . $this->get_field_id('thumb_pin_type') . '" name="' . $this->get_field_name('thumb_pin_type') . '">'; |
| 129 |
GMW::create_select_options($thumb_pin_types, $thumb_pin_type); |
| 130 |
echo '</select></p>'; |
| 131 |
|
| 132 |
echo '<p class="gmw_thumb_pin_type_predefined_section"><label class="gmw-label" for="' . $this->get_field_id('thumb_pin_color') . '">' . __('Pin Color', 'google-maps-widget') . ':</label>'; |
| 133 |
echo '<select id="' . $this->get_field_id('thumb_pin_color') . '" name="' . $this->get_field_name('thumb_pin_color') . '">'; |
| 134 |
GMW::create_select_options($pin_colors, $thumb_pin_color); |
| 135 |
echo '</select></p>'; |
| 136 |
|
| 137 |
echo '<p class="gmw_thumb_pin_type_predefined_section"><label class="gmw-label" for="' . $this->get_field_id('thumb_pin_size') . '">' . __('Pin Size', 'google-maps-widget') . ':</label>'; |
| 138 |
echo '<select id="' . $this->get_field_id('thumb_pin_size') . '" name="' . $this->get_field_name('thumb_pin_size') . '">'; |
| 139 |
GMW::create_select_options($pin_sizes, $thumb_pin_size); |
| 140 |
echo '</select></p>'; |
| 141 |
|
| 142 |
echo '<p class="gmw_thumb_pin_type_custom_section"><label class="gmw-label gmw-label-wide" for="' . $this->get_field_id('thumb_pin_img') . '">' . __('Custom Pin Image URL', 'google-maps-widget') . ':</label>'; |
| 143 |
echo '<input type="text" class="regular-text" id="' . $this->get_field_id('thumb_pin_img') . '" name="' . $this->get_field_name('thumb_pin_img') . '" value="' . esc_attr($thumb_pin_img) . '">'; |
| 144 |
|
| 145 |
echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_zoom') . '">' . __('Zoom Level', 'google-maps-widget') . ':</label>'; |
| 146 |
echo '<select id="' . $this->get_field_id('thumb_zoom') . '" name="' . $this->get_field_name('thumb_zoom') . '">'; |
| 147 |
GMW::create_select_options($zoom_levels, $thumb_zoom); |
| 148 |
echo '</select></p>'; |
| 149 |
|
| 150 |
echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_link_type') . '">' . __('Link To', 'google-maps-widget') . ':</label>'; |
| 151 |
echo '<select class="gmw_thumb_link_type" id="' . $this->get_field_id('thumb_link_type') . '" name="' . $this->get_field_name('thumb_link_type') . '">'; |
| 152 |
GMW::create_select_options($thumb_link_types, $thumb_link_type); |
| 153 |
echo '</select></p>'; |
| 154 |
|
| 155 |
echo '<p class="gmw_thumb_link_section"><label class="gmw-label" for="' . $this->get_field_id('thumb_link') . '">' . __('Custom Link', 'google-maps-widget') . ':</label>'; |
| 156 |
echo '<input class="regular-text" id="' . $this->get_field_id('thumb_link') . '" name="' . $this->get_field_name('thumb_link') . '" type="text" value="' . esc_attr($thumb_link) . '" /></p>'; |
| 157 |
|
| 158 |
echo '<p><label for="' . $this->get_field_id('thumb_new_colors') . '">' . __('Use New Color Scheme', 'google-maps-widget') . ': </label>'; |
| 159 |
echo '<input ' . checked('1', $thumb_new_colors, false) . ' value="1" type="checkbox" id="' . $this->get_field_id('thumb_new_colors') . '" name="' . $this->get_field_name('thumb_new_colors') . '">'; |
| 160 |
echo '</p>'; |
| 161 |
|
| 162 |
echo '<p><label for="' . $this->get_field_id('thumb_header') . '">' . __('Text Above Map', 'google-maps-widget') . ':</label>'; |
| 163 |
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>'; |
| 164 |
|
| 165 |
echo '<p><label for="' . $this->get_field_id('thumb_footer') . '">' . __('Text Below Map', 'google-maps-widget') . ':</label>'; |
| 166 |
echo '<textarea class="widefat" rows="3" cols="20" id="' . $this->get_field_id('thumb_footer') . '" name="' . $this->get_field_name('thumb_footer') . '">'. $thumb_footer . '</textarea></p>'; |
| 167 |
|
| 168 |
echo '</div>'; // thumbnail tab |
| 169 |
echo '<div id="gmw-lightbox">'; |
| 170 |
|
| 171 |
echo '<p><label class="gmw-label" for="' . $this->get_field_id('lightbox_width') . '">' . __('Map Size', 'google-maps-widget') . ':</label>'; |
| 172 |
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 '; |
| 173 |
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) . '" />'; |
| 174 |
echo ' px</p>'; |
| 175 |
|
| 176 |
echo '<p><label class="gmw-label" for="' . $this->get_field_id('lightbox_type') . '">' . __('Map Type', 'google-maps-widget') . ':</label>'; |
| 177 |
echo '<select id="' . $this->get_field_id('lightbox_type') . '" name="' . $this->get_field_name('lightbox_type') . '">'; |
| 178 |
GMW::create_select_options($map_types_lightbox, $lightbox_type); |
| 179 |
echo '</select></p>'; |
| 180 |
|
| 181 |
echo '<p><label class="gmw-label" for="' . $this->get_field_id('lightbox_zoom') . '">' . __('Zoom Level', 'google-maps-widget') . ':</label>'; |
| 182 |
echo '<select id="' . $this->get_field_id('lightbox_zoom') . '" name="' . $this->get_field_name('lightbox_zoom') . '">'; |
| 183 |
GMW::create_select_options($zoom_levels, $lightbox_zoom); |
| 184 |
echo '</select></p>'; |
| 185 |
|
| 186 |
echo '<p><label class="gmw-label" for="' . $this->get_field_id('lightbox_skin') . '">' . __('Skin', 'google-maps-widget') . ':</label>'; |
| 187 |
echo '<select id="' . $this->get_field_id('lightbox_skin') . '" name="' . $this->get_field_name('lightbox_skin') . '">'; |
| 188 |
GMW::create_select_options($lightbox_skins, $lightbox_skin); |
| 189 |
echo '</select></p>'; |
| 190 |
|
| 191 |
echo '<p><label for="' . $this->get_field_id('lightbox_bubble') . '">' . __('Show Address Bubble', 'google-maps-widget') . ': </label>'; |
| 192 |
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') . '">'; |
| 193 |
echo '</p>'; |
| 194 |
|
| 195 |
echo '<p><label for="' . $this->get_field_id('lightbox_title') . '">' . __('Show Map Title Above Lightbox', 'google-maps-widget') . ': </label>'; |
| 196 |
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') . '">'; |
| 197 |
echo '</p>'; |
| 198 |
|
| 199 |
echo '<p><label for="' . $this->get_field_id('lightbox_header') . '">' . __('Header Text', 'google-maps-widget') . ':</label>'; |
| 200 |
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>'; |
| 201 |
|
| 202 |
echo '<p><label for="' . $this->get_field_id('lightbox_footer') . '">' . __('Footer Text', 'google-maps-widget') . ':</label>'; |
| 203 |
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>'; |
| 204 |
|
| 205 |
echo '</div>'; // lightbox tab |
| 206 |
echo '</div>'; // tabs |
| 207 |
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>'; |
| 208 |
} // form |
| 209 |
|
| 210 |
|
| 211 |
// update/save widget options |
| 212 |
function update($new_instance, $old_instance) { |
| 213 |
$instance = $old_instance; |
| 214 |
|
| 215 |
$instance['title'] = $new_instance['title']; |
| 216 |
$instance['address'] = $new_instance['address']; |
| 217 |
$instance['thumb_pin_type'] = $new_instance['thumb_pin_type']; |
| 218 |
$instance['thumb_pin_color'] = $new_instance['thumb_pin_color']; |
| 219 |
$instance['thumb_pin_size'] = $new_instance['thumb_pin_size']; |
| 220 |
$instance['thumb_pin_img'] = trim($new_instance['thumb_pin_img']); |
| 221 |
$instance['thumb_width'] = (int) $new_instance['thumb_width']; |
| 222 |
$instance['thumb_height'] = (int) $new_instance['thumb_height']; |
| 223 |
$instance['thumb_zoom'] = $new_instance['thumb_zoom']; |
| 224 |
$instance['thumb_type'] = $new_instance['thumb_type']; |
| 225 |
$instance['thumb_link_type'] = $new_instance['thumb_link_type']; |
| 226 |
$instance['thumb_link'] = trim($new_instance['thumb_link']); |
| 227 |
$instance['thumb_header'] = trim($new_instance['thumb_header']); |
| 228 |
$instance['thumb_footer'] = trim($new_instance['thumb_footer']); |
| 229 |
$instance['thumb_new_colors'] = isset($new_instance['thumb_new_colors']); |
| 230 |
$instance['lightbox_width'] = (int) $new_instance['lightbox_width']; |
| 231 |
$instance['lightbox_height'] = (int) $new_instance['lightbox_height']; |
| 232 |
$instance['lightbox_type'] = $new_instance['lightbox_type']; |
| 233 |
$instance['lightbox_zoom'] = $new_instance['lightbox_zoom']; |
| 234 |
$instance['lightbox_bubble'] = isset($new_instance['lightbox_bubble']); |
| 235 |
$instance['lightbox_title'] = isset($new_instance['lightbox_title']); |
| 236 |
$instance['lightbox_header'] = trim($new_instance['lightbox_header']); |
| 237 |
$instance['lightbox_footer'] = trim($new_instance['lightbox_footer']); |
| 238 |
$instance['lightbox_skin'] = $new_instance['lightbox_skin']; |
| 239 |
|
| 240 |
return $instance; |
| 241 |
} // update |
| 242 |
|
| 243 |
|
| 244 |
// echo widget |
| 245 |
function widget($args, $instance) { |
| 246 |
$out = $tmp = ''; |
| 247 |
|
| 248 |
extract($args, EXTR_SKIP); |
| 249 |
|
| 250 |
$ll = ''; |
| 251 |
if ($instance['lightbox_zoom'] > 14) { |
| 252 |
$coordinates = GMW::get_coordinates($instance['address']); |
| 253 |
if ($coordinates) { |
| 254 |
$ll = $coordinates['lat'] . ',' . $coordinates['lng']; |
| 255 |
} |
| 256 |
} |
| 257 |
|
| 258 |
$lang = substr(@$_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); |
| 259 |
if (!$lang) { |
| 260 |
$lang = 'en'; |
| 261 |
} |
| 262 |
|
| 263 |
// legacy fix for older versions; it's auto-fixed on first widget save but has to be here |
| 264 |
if(!$instance['lightbox_skin']) { |
| 265 |
$instance['lightbox_skin'] = 'light'; |
| 266 |
} |
| 267 |
|
| 268 |
self::$widgets[] = array('title' => ($instance['lightbox_title']? $instance['title']: ''), |
| 269 |
'width' => $instance['lightbox_width'], |
| 270 |
'height' => $instance['lightbox_height'], |
| 271 |
'footer' => $instance['lightbox_footer'], |
| 272 |
'header' => $instance['lightbox_header'], |
| 273 |
'address' => $instance['address'], |
| 274 |
'zoom' => $instance['lightbox_zoom'], |
| 275 |
'type' => $instance['lightbox_type'], |
| 276 |
'skin' => $instance['lightbox_skin'], |
| 277 |
'bubble' => $instance['lightbox_bubble'], |
| 278 |
'll' => $ll, |
| 279 |
'id' => $widget_id); |
| 280 |
|
| 281 |
$out .= $before_widget; |
| 282 |
|
| 283 |
if (!isset($instance['thumb_pin_type']) || empty($instance['thumb_pin_type'])) { |
| 284 |
$instance['thumb_pin_type'] = 'predefined'; |
| 285 |
} |
| 286 |
|
| 287 |
if (!isset($instance['thumb_link_type']) || empty($instance['thumb_link_type'])) { |
| 288 |
$instance['thumb_link_type'] = 'lightbox'; |
| 289 |
} |
| 290 |
|
| 291 |
if (isset($instance['thumb_new_colors']) && $instance['thumb_new_colors']) { |
| 292 |
$instance['thumb_new_colors'] = 'true'; |
| 293 |
} else { |
| 294 |
$instance['thumb_new_colors'] = 'false'; |
| 295 |
} |
| 296 |
|
| 297 |
$title = empty($instance['title'])? ' ' : apply_filters('widget_title', $instance['title']); |
| 298 |
if (!empty($title)) { |
| 299 |
$out .= $before_title . $title . $after_title; |
| 300 |
} |
| 301 |
|
| 302 |
if (isset($instance['thumb_header']) && $instance['thumb_header']) { |
| 303 |
$tmp .= wpautop(do_shortcode($instance['thumb_header'])); |
| 304 |
} |
| 305 |
$tmp .= '<p>'; |
| 306 |
|
| 307 |
if ($instance['thumb_link_type'] == 'lightbox') { |
| 308 |
$alt = __('Click to open larger map', 'google-maps-widget'); |
| 309 |
} else { |
| 310 |
$alt = esc_attr($instance['address']); |
| 311 |
} |
| 312 |
|
| 313 |
if ($instance['thumb_link_type'] == 'lightbox') { |
| 314 |
$tmp .= '<a class="gmw-thumbnail-map gmw-lightbox-enabled" href="#gmw-dialog-' . $widget_id . '" title="' . __('Click to open larger map', 'google-maps-widget') . '">'; |
| 315 |
} elseif ($instance['thumb_link_type'] == 'custom') { |
| 316 |
$tmp .= '<a class="gmw-thumbnail-map" title="' . esc_attr($instance['address']) . '" href="' . $instance['thumb_link'] . '">'; |
| 317 |
} |
| 318 |
$tmp .= '<img alt="' . $alt . '" title="' . $alt . '" src="//maps.googleapis.com/maps/api/staticmap?center=' . |
| 319 |
urlencode($instance['address']) . '&zoom=' . $instance['thumb_zoom'] . |
| 320 |
'&size=' . $instance['thumb_width'] . 'x' . $instance['thumb_height'] . '&maptype=' . $instance['thumb_type'] . |
| 321 |
'&scale=1&'; |
| 322 |
if ($instance['thumb_pin_type'] != 'custom') { |
| 323 |
$tmp .= 'markers=size:' . $instance['thumb_pin_size'] . '%7Ccolor:' . $instance['thumb_pin_color']; |
| 324 |
} else { |
| 325 |
$tmp .= 'markers=icon:' . urlencode($instance['thumb_pin_img']); |
| 326 |
} |
| 327 |
$tmp .= '%7Clabel:A%7C' . urlencode($instance['address']) . '&language=' . $lang . '&visual_refresh=' . $instance['thumb_new_colors'] .'">'; |
| 328 |
if ($instance['thumb_link_type'] == 'lightbox' || $instance['thumb_link_type'] == 'custom') { |
| 329 |
$tmp .= '</a>'; |
| 330 |
} |
| 331 |
$tmp .= '</p>'; |
| 332 |
if (isset($instance['thumb_footer']) && $instance['thumb_footer']) { |
| 333 |
$tmp .= wpautop(do_shortcode($instance['thumb_footer'])); |
| 334 |
} |
| 335 |
$out .= apply_filters('google_maps_widget_content', $tmp); |
| 336 |
|
| 337 |
$out .= $after_widget; |
| 338 |
|
| 339 |
echo $out; |
| 340 |
} // widget |
| 341 |
} // class GoogleMapsWidget |