/** * Show Polylines Options * Polylines options menu for the map. * * @param array $args Array of arguments. * @return array|string Array or HTML select menu. */ function wpgeo_show_polylines_options($args = null) { $args = wp_parse_args($args, array('id' => 'show_polylines', 'name' => 'show_polylines', 'return' => 'array', 'selected' => null)); $menu_options = array('' => __('Default', 'wp-geo'), 'Y' => __('Show Polylines', 'wp-geo'), 'N' => __('Hide Polylines', 'wp-geo')); if ($args['return'] = 'menu') { return wpgeo_select($args['name'], $menu_options, $args['selected']); } return $menu_options; }
/** * Google Map Types * Map type array or menu. * * @param string $return (optional) Array or menu type. * @param string $selected (optional) Selected value. * @param array $args (optional) Args. * @return array|string Array or menu HTML. */ function google_map_types($return = 'array', $selected = '', $args = null) { global $wpgeo; $args = wp_parse_args((array) $args, array('return' => null, 'selected' => null, 'name' => 'google_map_type', 'id' => 'google_map_type')); // Deprecated compatibility if ($args['return'] == null) { $args['return'] = $return; } if ($args['selected'] == null) { $args['selected'] = $selected; } $menu_options = $wpgeo->api->map_types(); if ($args['return'] = 'menu') { return wpgeo_select($args['name'], $menu_options, $args['selected'], false, $args['id']); } return $menu_options; }
/** * Show Post Map Field */ function show_post_map_field() { global $wpgeo; $options = get_option('wp_geo_options'); $menu_options = array('TOP' => __('At top of post', 'wp-geo'), 'BOTTOM' => __('At bottom of post', 'wp-geo'), 'HIDE' => __('Manually', 'wp-geo')); echo wpgeo_select('wp_geo_options[show_post_map]', $menu_options, $options['show_post_map'], false, 'show_post_map') . '<br />'; echo wpgeo_checkbox('wp_geo_options[show_maps_on_excerpts]', 'Y', $options['show_maps_on_excerpts'], false, 'show_maps_on_excerpts') . ' ' . __('Show on excerpts', 'wp-geo'); }
/** * Dropdown Markers * Output marker select menu. * * @param array $args Args. * @return string Dropdown HTML. */ function dropdown_markers($args) { $defaults = array('selected' => '', 'echo' => 1, 'name' => 'marker_id', 'id' => '', 'show_option_none' => '', 'option_none_value' => ''); $r = wp_parse_args($args, $defaults); $output = ''; $name = $r['name']; if (empty($r['id'])) { $r['id'] = $r['name']; } $id = $r['id']; $options = array(); if (!empty($r['show_option_none'])) { $options[$r['option_none_value']] = $r['show_option_none']; } foreach ($this->markers as $marker) { $options[$marker->id] = $marker->name; } $output .= wpgeo_select($name, $options, $r['selected'], false, $id); if ($r['echo']) { echo $output; } return $output; }