'sm_search_widget', 'description' => __( "Adds a customizable search widget to your site" ) ); $this->WP_Widget('sm_search_widget', __('SimpleMap Search'), $widget_ops); } function widget( $args, $instance ) { global $simple_map, $wp_rewrite; extract( $args ); $options = $simple_map->get_options(); $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'] ); // Search Form Options $show_address = $instance['show_address'] ? 1 : 0; $show_city = $instance['show_city'] ? 1 : 0; $show_state = $instance['show_state'] ? 1 : 0; $show_zip = $instance['show_zip'] ? 1 : 0; $show_distance = $instance['show_distance'] ? 1 : 0; $default_lat = $instance['default_lat'] ? $instance['default_lat'] : 0; $default_lng = $instance['default_lng'] ? $instance['default_lng'] : 0; $simplemap_page = $instance['simplemap_page'] ? $instance['simplemap_page'] : 2; // Set taxonomies to available equivalents $show = array(); $terms = array(); foreach ( $options['taxonomies'] as $taxonomy => $tax_info ) { $key = strtolower( $tax_info['plural'] ); $show[$taxonomy] = $instance['show_' . $key] ? 1 : 0; $terms[$taxonomy] = $instance[$key] ? $instance[$key] : ''; } $available = $terms; echo $before_widget; if ( $title ) echo '
'; // Form Field Values $address_value = isset( $_REQUEST['location_search_address'] ) ? $_REQUEST['location_search_address'] : ''; $city_value = isset( $_REQUEST['location_search_city'] ) ? $_REQUEST['location_search_city'] : ''; $state_value = isset( $_REQUEST['location_search_state'] ) ? $_REQUEST['location_search_state'] : ''; $zip_value = isset( $_REQUEST['location_search_zip'] ) ? $_REQUEST['location_search_zip'] : ''; $radius_value = isset( $_REQUEST['location_search_distance'] ) ? $_REQUEST['location_search_distance'] : $options['default_radius']; $limit_value = isset( $_REQUEST['location_search_limit'] ) ? $_REQUEST['location_search_limit'] : $options['results_limit']; // Set action based on permalink structure if ( ! $wp_rewrite->permalink_structure ) { $method = 'get'; $action = site_url(); } else { $method = 'post'; $action = get_permalink( absint( $simplemap_page ) ); } $location_search = '
/>
/>
/>
/>
/>
get_options();
foreach ( $options['taxonomies'] as $taxonomy => $tax_info ) {
$key = strtolower( $tax_info['plural'] );
$show_field = 'show_' . $key;
$show = isset( $instance[$show_field] ) ? (bool) $instance[$show_field] : false;
?>
/>
*/ ?>