function form($instance) { $instance = wp_parse_args((array) $instance, array('title' => 'Map', 'address' => 'New York, USA', 'thumb_pin_color' => 'red', 'thumb_pin_size' => 'default', 'thumb_width' => 250, 'thumb_height' => 250, 'thumb_type' => 'roadmap', 'thumb_zoom' => '13', 'lightbox_width' => 550, 'lightbox_height' => 550, 'lightbox_type' => 'roadmap', 'lightbox_zoom' => '14', 'lightbox_bubble' => '1', 'lightbox_skin' => '', 'lightbox_title' => '1', 'lightbox_header' => '', 'lightbox_footer' => '')); $title = $instance['title']; $lightbox_footer = $instance['lightbox_footer']; $lightbox_header = $instance['lightbox_header']; $address = $instance['address']; $thumb_pin_color = $instance['thumb_pin_color']; $thumb_pin_size = $instance['thumb_pin_size']; $thumb_width = $instance['thumb_width']; $thumb_height = $instance['thumb_height']; $thumb_type = $instance['thumb_type']; $thumb_zoom = $instance['thumb_zoom']; $lightbox_width = $instance['lightbox_width']; $lightbox_height = $instance['lightbox_height']; $lightbox_type = $instance['lightbox_type']; $lightbox_zoom = $instance['lightbox_zoom']; $lightbox_bubble = $instance['lightbox_bubble']; $lightbox_title = $instance['lightbox_title']; $lightbox_skin = $instance['lightbox_skin']; $map_types_thumb = array(array('val' => 'roadmap', 'label' => 'Road'), array('val' => 'satellite', 'label' => 'Satellite'), array('val' => 'terrain', 'label' => 'Terrain'), array('val' => 'hybrid', 'label' => 'Hybrid')); $map_types_lightbox = array(array('val' => 'm', 'label' => 'Road'), array('val' => 'k', 'label' => 'Satellite'), array('val' => 'p', 'label' => 'Terrain'), array('val' => 'h', 'label' => 'Hybrid')); $pin_colors = array(array('val' => 'black', 'label' => 'Black'), array('val' => 'brown', 'label' => 'Brown'), array('val' => 'green', 'label' => 'Green'), array('val' => 'purple', 'label' => 'Purple'), array('val' => 'yellow', 'label' => 'Yellow'), array('val' => 'blue', 'label' => 'Blue'), array('val' => 'gray', 'label' => 'Gray'), array('val' => 'orange', 'label' => 'Orange'), array('val' => 'red', 'label' => 'Red'), array('val' => 'white', 'label' => 'White')); $pin_sizes = array(array('val' => 'tiny', 'label' => 'Tiny'), array('val' => 'small', 'label' => 'Small'), array('val' => 'mid', 'label' => 'Medium'), array('val' => 'default', 'label' => 'Large (default)')); $zoom_levels = array(array('val' => '0', 'label' => '0 - entire world')); for ($tmp = 1; $tmp <= 20; $tmp++) { $zoom_levels[] = array('val' => $tmp, 'label' => $tmp); } $zoom_levels[] = array('val' => '21', 'label' => '21 - street view'); $lightbox_skins[] = array('val' => '', 'label' => 'White with rounded corners (default)'); $lightbox_skins[] = array('val' => 'black-rounded', 'label' => 'Black with rounded corners'); $lightbox_skins[] = array('val' => 'white-square', 'label' => 'White with square corners'); $lightbox_skins[] = array('val' => 'black-square', 'label' => 'Black with square corners'); 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>'; 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>'; 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>'; echo '<div id="gmw-thumb">'; echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_width') . '">Map Size: </label>'; 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 '; 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) . '" />'; echo ' px</p>'; echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_type') . '">Map Type: </label>'; echo '<select id="' . $this->get_field_id('thumb_type') . '" name="' . $this->get_field_name('thumb_type') . '">'; GMW::create_select_options($map_types_thumb, $thumb_type); echo '</select></p>'; echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_pin_color') . '">Pin Color: </label>'; echo '<select id="' . $this->get_field_id('thumb_pin_color') . '" name="' . $this->get_field_name('thumb_pin_color') . '">'; GMW::create_select_options($pin_colors, $thumb_pin_color); echo '</select></p>'; echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_pin_size') . '">Pin Size: </label>'; echo '<select id="' . $this->get_field_id('thumb_pin_size') . '" name="' . $this->get_field_name('thumb_pin_size') . '">'; GMW::create_select_options($pin_sizes, $thumb_pin_size); echo '</select></p>'; echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_zoom') . '">Zoom Level: </label>'; echo '<select id="' . $this->get_field_id('thumb_zoom') . '" name="' . $this->get_field_name('thumb_zoom') . '">'; GMW::create_select_options($zoom_levels, $thumb_zoom); echo '</select></p>'; echo '</div>'; // thumbnail tab echo '<div id="gmw-lightbox">'; echo '<p><label class="gmw-label" for="' . $this->get_field_id('lightbox_width') . '">Map Size: </label>'; 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 '; 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) . '" />'; echo ' px</p>'; echo '<p><label class="gmw-label" for="' . $this->get_field_id('lightbox_type') . '">Map Type: </label>'; echo '<select id="' . $this->get_field_id('lightbox_type') . '" name="' . $this->get_field_name('lightbox_type') . '">'; GMW::create_select_options($map_types_lightbox, $lightbox_type); echo '</select></p>'; echo '<p><label class="gmw-label" for="' . $this->get_field_id('lightbox_zoom') . '">Zoom Level: </label>'; echo '<select id="' . $this->get_field_id('lightbox_zoom') . '" name="' . $this->get_field_name('lightbox_zoom') . '">'; GMW::create_select_options($zoom_levels, $lightbox_zoom); echo '</select></p>'; echo '<p><label class="gmw-label" for="' . $this->get_field_id('lightbox_skin') . '">Skin: </label>'; echo '<select id="' . $this->get_field_id('lightbox_skin') . '" name="' . $this->get_field_name('lightbox_skin') . '">'; GMW::create_select_options($lightbox_skins, $lightbox_skin); echo '</select></p>'; echo '<p><label for="' . $this->get_field_id('lightbox_bubble') . '">Show Address Bubble: </label>'; 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') . '">'; echo '</p>'; echo '<p><label for="' . $this->get_field_id('lightbox_title') . '">Show Title Below Lightbox: </label>'; 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') . '">'; echo '</p>'; echo '<p><label for="' . $this->get_field_id('lightbox_header') . '">Header Text:</label>'; 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>'; echo '<p><label for="' . $this->get_field_id('lightbox_footer') . '">Footer Text:</label>'; 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>'; echo '</div>'; // lightbox tab echo '</div>'; // tabs 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>'; }
function form($instance) { $instance = wp_parse_args((array) $instance, array('title' => __('Map', 'google-maps-widget'), 'address' => __('New York, USA', 'google-maps-widget'), 'thumb_pin_color' => 'red', 'thumb_pin_type' => 'predefined', 'thumb_pin_size' => 'default', 'thumb_pin_img' => '', 'thumb_width' => '250', 'thumb_height' => '250', 'thumb_type' => 'roadmap', 'thumb_zoom' => '13', 'thumb_header' => '', 'thumb_footer' => 'Powered by Google Maps Widget', 'thumb_color_scheme' => '', 'thumb_link_type' => 'lightbox', 'thumb_link' => '', 'lightbox_width' => '550', 'lightbox_height' => '550', 'lightbox_type' => 'roadmap', 'lightbox_zoom' => '14', 'lightbox_bubble' => '1', 'lightbox_skin' => 'light', 'lightbox_title' => '1', 'lightbox_header' => '', 'lightbox_footer' => '')); extract($instance, EXTR_SKIP); // legacy fixes for older versions; it's auto-fixed on first widget save but has to be here if (!$thumb_pin_type) { $thumb_pin_type = 'predefined'; } if (!$thumb_link_type) { $thumb_link_type = 'lightbox'; } if (!$lightbox_skin) { $lightbox_skin = 'light'; } $map_types_thumb = array(array('val' => 'roadmap', 'label' => __('Road (default)', 'google-maps-widget')), array('val' => 'satellite', 'label' => __('Satellite', 'google-maps-widget')), array('val' => 'terrain', 'label' => __('Terrain', 'google-maps-widget')), array('val' => 'hybrid', 'label' => __('Hybrid', 'google-maps-widget'))); $map_types_lightbox = array(array('val' => 'm', 'label' => __('Road (default)', 'google-maps-widget')), array('val' => 'k', 'label' => __('Satellite', 'google-maps-widget')), array('val' => 'p', 'label' => __('Terrain', 'google-maps-widget')), array('val' => 'h', 'label' => __('Hybrid', 'google-maps-widget'))); $pin_colors = array(array('val' => 'black', 'label' => __('Black', 'google-maps-widget')), array('val' => 'brown', 'label' => __('Brown', 'google-maps-widget')), array('val' => 'green', 'label' => __('Green', 'google-maps-widget')), array('val' => 'purple', 'label' => __('Purple', 'google-maps-widget')), array('val' => 'yellow', 'label' => __('Yellow', 'google-maps-widget')), array('val' => 'blue', 'label' => __('Blue', 'google-maps-widget')), array('val' => 'gray', 'label' => __('Gray', 'google-maps-widget')), array('val' => 'orange', 'label' => __('Orange', 'google-maps-widget')), array('val' => 'red', 'label' => __('Red (default)', 'google-maps-widget')), array('val' => 'white', 'label' => __('White', 'google-maps-widget'))); $pin_sizes = array(array('val' => 'tiny', 'label' => __('Tiny', 'google-maps-widget')), array('val' => 'small', 'label' => __('Small', 'google-maps-widget')), array('val' => 'mid', 'label' => __('Medium', 'google-maps-widget')), array('val' => 'default', 'label' => __('Large (default)', 'google-maps-widget'))); $zoom_levels = array(array('val' => '0', 'label' => __('0 - entire world', 'google-maps-widget'))); for ($tmp = 1; $tmp <= 21; $tmp++) { $zoom_levels[] = array('val' => $tmp, 'label' => $tmp); } $lightbox_skins = array(array('val' => 'light', 'label' => __('Light (default)', 'google-maps-widget')), array('val' => 'dark', 'label' => __('Dark', 'google-maps-widget'))); $lightbox_bubbles = array(array('val' => '0', 'label' => __('Hide', 'google-maps-widget')), array('val' => '1', 'label' => __('Show (default)', 'google-maps-widget'))); $lightbox_titles = array(array('val' => '0', 'label' => __('Do not show map title on lightbox', 'google-maps-widget')), array('val' => '1', 'label' => __('Show map title on lightbox (default)', 'google-maps-widget'))); $thumb_pin_types = array(array('val' => 'predefined', 'label' => __('Predefined (default)', 'google-maps-widget')), array('val' => 'custom', 'label' => __('Custom', 'google-maps-widget'))); $thumb_link_types = array(array('val' => 'lightbox', 'label' => __('Lightbox (default)', 'google-maps-widget')), array('val' => 'custom', 'label' => __('Custom URL', 'google-maps-widget')), array('val' => 'nolink', 'label' => __('Disable link', 'google-maps-widget'))); $thumb_color_schemes = array(array('val' => 'default', 'label' => __('Default', 'gmw')), array('val' => 'new', 'label' => __('Refreshed by Google', 'gmw'))); if (GMW::is_activated()) { array_push($thumb_color_schemes, array('val' => 'apple', 'label' => __('Apple', 'google-maps-widget')), array('val' => 'gray', 'label' => __('Gray', 'google-maps-widget')), array('val' => 'paper', 'label' => __('Paper', 'google-maps-widget'))); array_push($lightbox_skins, array('val' => 'noimage-blue', 'label' => __('Blue', 'google-maps-widget')), array('val' => 'noimage-rounded', 'label' => __('Rounded', 'google-maps-widget'))); } if (date('Y-m-d') < '2015-12-20') { echo '<a title="Decorate your site for Christmas with Xmas Widget" href="http://xmaswidget.webfactoryltd.com/" target="_blank" style="position: absolute; top: -21px; left: -17px;"><img title="Decorate your site for Christmas with Xmas Widget" alt="Decorate your site for Christmas with Xmas Widget" src="' . plugins_url('/images/santa_cap.png', __FILE__) . '"></a>'; } 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') . '" placeholder="' . __('Map title', 'google-maps-widget') . '" type="text" value="' . esc_attr($title) . '" /></p>'; echo '<p><label for="' . $this->get_field_id('address') . '">' . __('Address', 'google-maps-widget') . ':</label><input class="widefat" id="' . $this->get_field_id('address') . '" placeholder="' . __('Address to show', 'google-maps-widget') . '" name="' . $this->get_field_name('address') . '" type="text" value="' . esc_attr($address) . '" required="required" /></p>'; 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><li><a href="#gmw-shortcode">' . __('Shortcode', 'google-maps-widget') . '</a></li><li><a href="#gmw-info">' . __('Info & Support', 'google-maps-widget') . '</a></li></ul>'; echo '<div id="gmw-thumb">'; echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_width') . '">' . __('Map Size', 'google-maps-widget') . ':</label>'; echo '<input min="50" max="640" step="1" class="small-text" id="' . $this->get_field_id('thumb_width') . '" name="' . $this->get_field_name('thumb_width') . '" type="number" value="' . esc_attr($thumb_width) . '" required="required" /> x '; echo '<input min="50" max="640" step="1" class="small-text" id="' . $this->get_field_id('thumb_height') . '" name="' . $this->get_field_name('thumb_height') . '" type="number" value="' . esc_attr($thumb_height) . '" required="required" />'; echo ' px</p>'; echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_type') . '">' . __('Map Type', 'google-maps-widget') . ':</label>'; echo '<select id="' . $this->get_field_id('thumb_type') . '" name="' . $this->get_field_name('thumb_type') . '">'; GMW::create_select_options($map_types_thumb, $thumb_type); echo '</select></p>'; echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_pin_type') . '">' . __('Pin Type', 'google-maps-widget') . ':</label>'; echo '<select class="gmw_thumb_pin_type" id="' . $this->get_field_id('thumb_pin_type') . '" name="' . $this->get_field_name('thumb_pin_type') . '">'; GMW::create_select_options($thumb_pin_types, $thumb_pin_type); echo '</select></p>'; 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>'; echo '<select id="' . $this->get_field_id('thumb_pin_color') . '" name="' . $this->get_field_name('thumb_pin_color') . '">'; GMW::create_select_options($pin_colors, $thumb_pin_color); echo '</select></p>'; 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>'; echo '<select id="' . $this->get_field_id('thumb_pin_size') . '" name="' . $this->get_field_name('thumb_pin_size') . '">'; GMW::create_select_options($pin_sizes, $thumb_pin_size); echo '</select></p>'; echo '<p class="gmw_thumb_pin_type_custom_section"><label class="gmw-label" for="' . $this->get_field_id('thumb_pin_img') . '">' . __('Pin Image URL', 'google-maps-widget') . ':</label>'; echo '<input type="url" placeholder="http://" 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) . '" required="required" />'; echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_zoom') . '">' . __('Zoom Level', 'google-maps-widget') . ':</label>'; echo '<select id="' . $this->get_field_id('thumb_zoom') . '" name="' . $this->get_field_name('thumb_zoom') . '">'; GMW::create_select_options($zoom_levels, $thumb_zoom); echo '</select></p>'; echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_link_type') . '">' . __('Link To', 'google-maps-widget') . ':</label>'; echo '<select class="gmw_thumb_link_type" id="' . $this->get_field_id('thumb_link_type') . '" name="' . $this->get_field_name('thumb_link_type') . '">'; GMW::create_select_options($thumb_link_types, $thumb_link_type); echo '</select></p>'; echo '<p class="gmw_thumb_link_section"><label class="gmw-label" for="' . $this->get_field_id('thumb_link') . '">' . __('Custom URL', 'google-maps-widget') . ':</label>'; echo '<input class="regular-text" placeholder="http://" id="' . $this->get_field_id('thumb_link') . '" name="' . $this->get_field_name('thumb_link') . '" type="url" value="' . esc_attr($thumb_link) . '" required="required" /></p>'; echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_color_scheme') . '">' . __('Color Scheme', 'google-maps-widget') . ':</label>'; echo '<select class="gmw_thumb_color_scheme" id="' . $this->get_field_id('thumb_color_scheme') . '" name="' . $this->get_field_name('thumb_color_scheme') . '">'; GMW::create_select_options($thumb_color_schemes, $thumb_color_scheme); if (!GMW::is_activated()) { echo '<option class="promo" value="-1">' . __('Add more schemes for FREE', 'google-maps-widget') . '</option>'; } echo '</select></p>'; echo '<p><label for="' . $this->get_field_id('thumb_header') . '">' . __('Text Above Map', 'google-maps-widget') . ':</label>'; echo '<textarea class="widefat" rows="3" cols="20" id="' . $this->get_field_id('thumb_header') . '" name="' . $this->get_field_name('thumb_header') . '">' . esc_textarea($thumb_header) . '</textarea></p>'; echo '<p><label for="' . $this->get_field_id('thumb_footer') . '">' . __('Text Below Map', 'google-maps-widget') . ':</label>'; echo '<textarea class="widefat" rows="3" cols="20" id="' . $this->get_field_id('thumb_footer') . '" name="' . $this->get_field_name('thumb_footer') . '">' . esc_textarea($thumb_footer) . '</textarea></p>'; echo '</div>'; // thumbnail tab echo '<div id="gmw-lightbox">'; echo '<p><label class="gmw-label" for="' . $this->get_field_id('lightbox_width') . '">' . __('Map Size', 'google-maps-widget') . ':</label>'; echo '<input min="50" max="2000" step="1" class="small-text" id="' . $this->get_field_id('lightbox_width') . '" name="' . $this->get_field_name('lightbox_width') . '" type="number" value="' . esc_attr($lightbox_width) . '" required="required" /> x '; echo '<input min="50" max="2000" step="1" class="small-text" id="' . $this->get_field_id('lightbox_height') . '" name="' . $this->get_field_name('lightbox_height') . '" type="number" value="' . esc_attr($lightbox_height) . '" required="required" />'; echo ' px</p>'; echo '<p><label class="gmw-label" for="' . $this->get_field_id('lightbox_type') . '">' . __('Map Type', 'google-maps-widget') . ':</label>'; echo '<select id="' . $this->get_field_id('lightbox_type') . '" name="' . $this->get_field_name('lightbox_type') . '">'; GMW::create_select_options($map_types_lightbox, $lightbox_type); echo '</select></p>'; echo '<p><label class="gmw-label" for="' . $this->get_field_id('lightbox_zoom') . '">' . __('Zoom Level', 'google-maps-widget') . ':</label>'; echo '<select id="' . $this->get_field_id('lightbox_zoom') . '" name="' . $this->get_field_name('lightbox_zoom') . '">'; GMW::create_select_options($zoom_levels, $lightbox_zoom); echo '</select></p>'; echo '<p><label class="gmw-label" for="' . $this->get_field_id('lightbox_skin') . '">' . __('Lightbox Skin', 'google-maps-widget') . ':</label>'; echo '<select class="gmw_lightbox_skin" id="' . $this->get_field_id('lightbox_skin') . '" name="' . $this->get_field_name('lightbox_skin') . '">'; GMW::create_select_options($lightbox_skins, $lightbox_skin); if (!GMW::is_activated()) { echo '<option class="promo" value="-1">' . __('Add more skins for FREE', 'google-maps-widget') . '</option>'; } echo '</select></p>'; echo '<p><label class="gmw-label" for="' . $this->get_field_id('lightbox_bubble') . '">' . __('Address Bubble', 'google-maps-widget') . ':</label>'; echo '<select id="' . $this->get_field_id('lightbox_bubble') . '" name="' . $this->get_field_name('lightbox_bubble') . '">'; GMW::create_select_options($lightbox_bubbles, $lightbox_bubble); echo '</select></p>'; echo '<p><label class="gmw-label" for="' . $this->get_field_id('lightbox_title') . '">' . __('Map Title', 'google-maps-widget') . ': </label>'; echo '<select id="' . $this->get_field_id('lightbox_title') . '" name="' . $this->get_field_name('lightbox_title') . '">'; GMW::create_select_options($lightbox_titles, $lightbox_title); echo '</select></p>'; echo '<p><label for="' . $this->get_field_id('lightbox_header') . '">' . __('Header Text', 'google-maps-widget') . ':</label>'; echo '<textarea class="widefat" rows="3" cols="20" id="' . $this->get_field_id('lightbox_header') . '" name="' . $this->get_field_name('lightbox_header') . '">' . esc_textarea($lightbox_header) . '</textarea></p>'; echo '<p><label for="' . $this->get_field_id('lightbox_footer') . '">' . __('Footer Text', 'google-maps-widget') . ':</label>'; echo '<textarea class="widefat" rows="3" cols="20" id="' . $this->get_field_id('lightbox_footer') . '" name="' . $this->get_field_name('lightbox_footer') . '">' . esc_textarea($lightbox_footer) . '</textarea></p>'; echo '</div>'; // lightbox tab // shortcode tab echo '<div id="gmw-shortcode">'; if (GMW::is_activated()) { $id = str_replace('googlemapswidget-', '', $this->id); if (!$id || !is_numeric($id)) { echo '<p>' . __('Please save the widget so that the shortcode can be generated.', 'google-maps-widget') . '</p>'; } else { echo '<p><code>[gmw id="' . $id . '"]</code><br></p>'; echo '<p>' . __('Use the above shortcode to display this Google Maps Widget instance in any page or post. <br>Please note that your theme might style the widget in the post as if it is placed in a sidebar. In that case use the <code>span.gmw-shortcode-widget</code> class to target the shortcode and make necessary changes via CSS.', 'google-maps-widget') . '</p>'; } } else { echo '<p>Shortcode support is an extra feature. You can activate it <b>for free</b> and get more features & options for free as well.<br><br><a class="button open_promo_dialog" href="#">Activate extra features</a></p>'; } echo '</div>'; // shortcode tab echo '<div id="gmw-info">'; echo '<h4>' . __('Support', 'google-maps-widget') . '</h4>'; echo '<p>If you have any problems, questions or would like a new feature added post it on the <a href="https://wordpress.org/support/plugin/google-maps-widget" target="_blank">official support forum</a>. It\'s the only place to get support. Since it\'s free and community powered please be patient. <a target="_blank" href="https://www.paypal.com/cgi-bin/webscr?business=gordan@webfactoryltd.com&cmd=_xclick¤cy_code=USD&amount=19&item_name=Premium%20support%20for%20Google%20Maps%20Widget">Premium support</a> is available for $19.</p>'; echo '<h4>' . __('Activate extra features & options', 'google-maps-widget') . '</h4>'; echo '<p>' . __('If you subscribe to our mailing list we\'ll instantly activate additional features in the plugin! At the moment those features are: shortcode support, 3 additional thumbnail map skins and 2 additional lightbox skins. More <i>activate by subscribing</i> features will be available soon!', 'google-maps-widget') . '<br>'; if (GMW::is_activated()) { echo __('You\'ve already subscribed and activated extra features. Thank you!', 'google-maps-widget'); } else { echo __('Subscribe and <a class="open_promo_dialog" href="#">activate extra features</a>.', 'google-maps-widget'); } echo '</p>'; echo '<h4>' . __('Rate the plugin & spread the word', 'google-maps-widget') . '</h4>'; echo '<p>It won\'t take you more than a minute but it will help us immensely. So please - <a href="https://wordpress.org/support/view/plugin-reviews/google-maps-widget" target="_blank">rate the plugin</a>. Or spread the word by <a href="https://twitter.com/intent/tweet?via=WebFactoryLtd&text=' . urlencode('I\'m using the #free Google Maps Widget for #wordpress. You can grab it too at http://goo.gl/2qcbbf') . '" target="_blank">tweeting about it</a>. Thank you!</p>'; echo '</div>'; // info tab echo '</div><p></p>'; // tabs if (username_exists('admin') || get_userdata(1)) { echo '<p>' . __('We have detected at least one <b><span style="color: #d54e21;">security issue</span></b> on this site related to user accounts. Don\'t become a statistic! Protect your site with <a href="http://security-ninja-plugins-bundle.webfactoryltd.com/" target="_blank">Security Ninja</a>.', 'google-maps-widget') . '</p>'; } }
function form($instance) { $instance = wp_parse_args((array) $instance, array('title' => __('Map', 'google-maps-widget'), 'address' => __('New York, USA', 'google-maps-widget'), 'thumb_pin_color' => 'red', 'thumb_pin_type' => 'predefined', 'thumb_pin_size' => 'default', 'thumb_pin_img' => '', 'thumb_width' => '250', 'thumb_height' => '250', 'thumb_type' => 'roadmap', 'thumb_zoom' => '13', 'thumb_header' => '', 'thumb_footer' => '', 'thumb_new_colors' => '1', 'thumb_link_type' => 'lightbox', 'thumb_link' => '', 'lightbox_width' => '550', 'lightbox_height' => '550', 'lightbox_type' => 'roadmap', 'lightbox_zoom' => '14', 'lightbox_bubble' => '1', 'lightbox_skin' => 'light', 'lightbox_title' => '1', 'lightbox_header' => '', 'lightbox_footer' => '')); extract($instance, EXTR_SKIP); // legacy fixes for older versions; it's auto-fixed on first widget save but has to be here if (!$thumb_pin_type) { $thumb_pin_type = 'predefined'; } if (!$thumb_link_type) { $thumb_link_type = 'lightbox'; } if (!$lightbox_skin) { $lightbox_skin = 'light'; } $map_types_thumb = array(array('val' => 'roadmap', 'label' => __('Road (default)', 'google-maps-widget')), array('val' => 'satellite', 'label' => __('Satellite', 'google-maps-widget')), array('val' => 'terrain', 'label' => __('Terrain', 'google-maps-widget')), array('val' => 'hybrid', 'label' => __('Hybrid', 'google-maps-widget'))); $map_types_lightbox = array(array('val' => 'm', 'label' => __('Road (default)', 'google-maps-widget')), array('val' => 'k', 'label' => __('Satellite', 'google-maps-widget')), array('val' => 'p', 'label' => __('Terrain', 'google-maps-widget')), array('val' => 'h', 'label' => __('Hybrid', 'google-maps-widget'))); $pin_colors = array(array('val' => 'black', 'label' => __('Black', 'google-maps-widget')), array('val' => 'brown', 'label' => __('Brown', 'google-maps-widget')), array('val' => 'green', 'label' => __('Green', 'google-maps-widget')), array('val' => 'purple', 'label' => __('Purple', 'google-maps-widget')), array('val' => 'yellow', 'label' => __('Yellow', 'google-maps-widget')), array('val' => 'blue', 'label' => __('Blue', 'google-maps-widget')), array('val' => 'gray', 'label' => __('Gray', 'google-maps-widget')), array('val' => 'orange', 'label' => __('Orange', 'google-maps-widget')), array('val' => 'red', 'label' => __('Red (default)', 'google-maps-widget')), array('val' => 'white', 'label' => __('White', 'google-maps-widget'))); $pin_sizes = array(array('val' => 'tiny', 'label' => __('Tiny', 'google-maps-widget')), array('val' => 'small', 'label' => __('Small', 'google-maps-widget')), array('val' => 'mid', 'label' => __('Medium', 'google-maps-widget')), array('val' => 'default', 'label' => __('Large (default)', 'google-maps-widget'))); $zoom_levels = array(array('val' => '0', 'label' => __('0 - entire world', 'google-maps-widget'))); for ($tmp = 1; $tmp <= 21; $tmp++) { $zoom_levels[] = array('val' => $tmp, 'label' => $tmp); } $lightbox_skins[] = array('val' => 'light', 'label' => __('Light (default)', 'google-maps-widget')); $lightbox_skins[] = array('val' => 'dark', 'label' => __('Dark', 'google-maps-widget')); $thumb_pin_types[] = array('val' => 'predefined', 'label' => __('Predefined (default)', 'google-maps-widget')); $thumb_pin_types[] = array('val' => 'custom', 'label' => __('Custom', 'google-maps-widget')); $thumb_link_types[] = array('val' => 'lightbox', 'label' => __('Lightbox (default)', 'google-maps-widget')); $thumb_link_types[] = array('val' => 'custom', 'label' => __('Custom link', 'google-maps-widget')); $thumb_link_types[] = array('val' => 'nolink', 'label' => __('Disable link', 'google-maps-widget')); 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>'; 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>'; 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>'; echo '<div id="gmw-thumb">'; echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_width') . '">' . __('Map Size', 'google-maps-widget') . ':</label>'; 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 '; 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) . '" />'; echo ' px</p>'; echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_type') . '">' . __('Map Type', 'google-maps-widget') . ':</label>'; echo '<select id="' . $this->get_field_id('thumb_type') . '" name="' . $this->get_field_name('thumb_type') . '">'; GMW::create_select_options($map_types_thumb, $thumb_type); echo '</select></p>'; echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_pin_type') . '">' . __('Pin Type', 'google-maps-widget') . ':</label>'; echo '<select class="gmw_thumb_pin_type" id="' . $this->get_field_id('thumb_pin_type') . '" name="' . $this->get_field_name('thumb_pin_type') . '">'; GMW::create_select_options($thumb_pin_types, $thumb_pin_type); echo '</select></p>'; 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>'; echo '<select id="' . $this->get_field_id('thumb_pin_color') . '" name="' . $this->get_field_name('thumb_pin_color') . '">'; GMW::create_select_options($pin_colors, $thumb_pin_color); echo '</select></p>'; 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>'; echo '<select id="' . $this->get_field_id('thumb_pin_size') . '" name="' . $this->get_field_name('thumb_pin_size') . '">'; GMW::create_select_options($pin_sizes, $thumb_pin_size); echo '</select></p>'; 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>'; 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) . '">'; echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_zoom') . '">' . __('Zoom Level', 'google-maps-widget') . ':</label>'; echo '<select id="' . $this->get_field_id('thumb_zoom') . '" name="' . $this->get_field_name('thumb_zoom') . '">'; GMW::create_select_options($zoom_levels, $thumb_zoom); echo '</select></p>'; echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_link_type') . '">' . __('Link To', 'google-maps-widget') . ':</label>'; echo '<select class="gmw_thumb_link_type" id="' . $this->get_field_id('thumb_link_type') . '" name="' . $this->get_field_name('thumb_link_type') . '">'; GMW::create_select_options($thumb_link_types, $thumb_link_type); echo '</select></p>'; echo '<p class="gmw_thumb_link_section"><label class="gmw-label" for="' . $this->get_field_id('thumb_link') . '">' . __('Custom Link', 'google-maps-widget') . ':</label>'; 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>'; echo '<p><label for="' . $this->get_field_id('thumb_new_colors') . '">' . __('Use New Color Scheme', 'google-maps-widget') . ': </label>'; 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') . '">'; echo '</p>'; echo '<p><label for="' . $this->get_field_id('thumb_header') . '">' . __('Text Above Map', 'google-maps-widget') . ':</label>'; 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>'; echo '<p><label for="' . $this->get_field_id('thumb_footer') . '">' . __('Text Below Map', 'google-maps-widget') . ':</label>'; 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>'; echo '</div>'; // thumbnail tab echo '<div id="gmw-lightbox">'; echo '<p><label class="gmw-label" for="' . $this->get_field_id('lightbox_width') . '">' . __('Map Size', 'google-maps-widget') . ':</label>'; 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 '; 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) . '" />'; echo ' px</p>'; echo '<p><label class="gmw-label" for="' . $this->get_field_id('lightbox_type') . '">' . __('Map Type', 'google-maps-widget') . ':</label>'; echo '<select id="' . $this->get_field_id('lightbox_type') . '" name="' . $this->get_field_name('lightbox_type') . '">'; GMW::create_select_options($map_types_lightbox, $lightbox_type); echo '</select></p>'; echo '<p><label class="gmw-label" for="' . $this->get_field_id('lightbox_zoom') . '">' . __('Zoom Level', 'google-maps-widget') . ':</label>'; echo '<select id="' . $this->get_field_id('lightbox_zoom') . '" name="' . $this->get_field_name('lightbox_zoom') . '">'; GMW::create_select_options($zoom_levels, $lightbox_zoom); echo '</select></p>'; echo '<p><label class="gmw-label" for="' . $this->get_field_id('lightbox_skin') . '">' . __('Skin', 'google-maps-widget') . ':</label>'; echo '<select id="' . $this->get_field_id('lightbox_skin') . '" name="' . $this->get_field_name('lightbox_skin') . '">'; GMW::create_select_options($lightbox_skins, $lightbox_skin); echo '</select></p>'; echo '<p><label for="' . $this->get_field_id('lightbox_bubble') . '">' . __('Show Address Bubble', 'google-maps-widget') . ': </label>'; 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') . '">'; echo '</p>'; echo '<p><label for="' . $this->get_field_id('lightbox_title') . '">' . __('Show Map Title Above Lightbox', 'google-maps-widget') . ': </label>'; 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') . '">'; echo '</p>'; echo '<p><label for="' . $this->get_field_id('lightbox_header') . '">' . __('Header Text', 'google-maps-widget') . ':</label>'; 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>'; echo '<p><label for="' . $this->get_field_id('lightbox_footer') . '">' . __('Footer Text', 'google-maps-widget') . ':</label>'; 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>'; echo '</div>'; // lightbox tab echo '</div>'; // tabs 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>'; }