From 04743911174a44c4510ecfe985ef9e1190041dfa Mon Sep 17 00:00:00 2001 From: EkoJr Date: Thu, 30 Mar 2017 16:52:34 -0700 Subject: [PATCH] Condenced Widget Class #223 --- classes/widgets.php | 107 +++++++++++++++----------------------------- 1 file changed, 35 insertions(+), 72 deletions(-) diff --git a/classes/widgets.php b/classes/widgets.php index ae53deb..385fc40 100644 --- a/classes/widgets.php +++ b/classes/widgets.php @@ -42,39 +42,11 @@ public function widget( $args, $instance ) { $options = $simple_map->get_options(); - $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'] ); - // Ensures Variables are always Defined $instance = $this->set_instance( $instance ); - /* - * Most of these variables could be reduced, and use the instance - * array instead. - * - * Same with $this->form method. - */ - // Search Form Options. - $show_address = $instance['show_address']; - $show_city = $instance['show_city']; - $show_state = $instance['show_state']; - $show_zip = $instance['show_zip']; - $show_distance = $instance['show_distance']; - - $default_lat = $instance['default_lat']; - $default_lng = $instance['default_lng']; - $simplemap_page = $instance['simplemap_page']; - - // Set taxonomies to available equivalents. - $show = array(); - $terms = array(); - foreach ( $options['taxonomies'] as $taxonomy => $tax_info ) { - $key = strtolower( $tax_info['plural'] ); - $show[ $taxonomy ] = ! empty( $instance[ 'show_' . $key ] ) ? 1 : 0; - $terms[ $taxonomy ] = ! empty( $instance[ $key ] ) ? $instance[ $key ] : ''; - } - - $available = $terms; - + //TODO update this to modern Widget API code. + $title = apply_filters( 'widget_title', $instance['title'] ); echo $before_widget; if ( $title ) { echo '' . $before_title . $title . $after_title . ''; // XSS ok. @@ -94,7 +66,7 @@ public function widget( $args, $instance ) { $action = site_url(); } else { $method = 'post'; - $action = get_permalink( absint( $simplemap_page ) ); + $action = get_permalink( absint( $instance['simplemap_page'] ) ); } $location_search = '