'WL_AGM_LITE_MAP_Widget', 'description' => 'Google Map Widget to dispay Advance Maps', ); parent::__construct( 'WL_AGM_LITE_MAP_Widget', __( 'Advance Google Map Lite Widget', WL_AGM_LITE_DOMAIN ), $widget_options ); } public function widget( $args, $instance ) { $title = apply_filters( 'widget_title', $instance['title'] ); $map_id = apply_filters( 'widget_map_id', $instance['map_id'] ); $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); $map_id = apply_filters( 'map_id', $map_id, $instance, $this->id_base ); echo wp_kses_post($args['before_widget']); if ( ! empty( $title ) ) echo wp_kses_post($args['before_title']) . wp_kses_post($title) . wp_kses_post($args['after_title']); $p_type = get_post_type( $map_id ); if ( ! empty ( $p_type ) && $p_type == 'wl_agm_locations' ) { echo do_shortcode( '[WL_AGM_LOCATION id=' . $map_id . ']' ); } elseif ( ! empty ( $p_type ) && $p_type == 'wl_agm_maps' ) { echo do_shortcode( '[WL_AGM_Map id=' . $map_id . ']' ); } elseif ( ! empty ( $p_type ) && $p_type == 'wl_agm_routes' ) { echo do_shortcode( '[WL_AGM_Route id=' . $map_id . ']' ); } elseif ( ! empty ( $p_type ) && $p_type == 'wl_agm_inter_maps' ) { echo do_shortcode( '[WL_AGM_I_Map id=' . $map_id . ']' ); } echo wp_kses_post($args['after_widget']); } public function form( $instance ) { if ( isset( $instance[ 'title' ] ) && isset( $instance[ 'map_id' ] ) ) { $title = $instance[ 'title' ]; $map_id = $instance[ 'map_id' ]; } ?>

'', 'map_id' => '', 'text' => '', 'filter' => false, // For back-compat. 'visual' => null, // Must be explicitly defined. ) ); $instance = $old_instance; $instance['title'] = sanitize_text_field( $new_instance['title'] ); $instance['map_id'] = sanitize_text_field( $new_instance['map_id'] ); if ( current_user_can( 'unfiltered_html' ) ) { $instance['text'] = $new_instance['text']; } else { $instance['text'] = wp_kses_post( $new_instance['text'] ); } $instance['filter'] = ! empty( $new_instance['filter'] ); // Upgrade 4.8.0 format. if ( isset( $old_instance['filter'] ) && 'content' === $old_instance['filter'] ) { $instance['visual'] = true; } if ( 'content' === $new_instance['filter'] ) { $instance['visual'] = true; } if ( isset( $new_instance['visual'] ) ) { $instance['visual'] = ! empty( $new_instance['visual'] ); } // Filter is always true in visual mode. if ( ! empty( $instance['visual'] ) ) { $instance['filter'] = true; } return $instance; } } ?>