'aprsfisearch', 'description' => __('A simple widget that displays a Ham Call Sign search form against the APRS.fi website.', 'aprsfisearch') ); /* Widget control settings. */ $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'aprsfisearch-widget' ); /* Create the widget. */ $this->WP_Widget( 'aprsfisearch-widget', __('APRS.fi Search Widget', 'aprsfisearch'), $widget_ops, $control_ops ); } /** * How to display the widget on the screen. */ function widget( $args, $instance ) { extract( $args ); /* Our variables from the widget settings. */ $aprsfisearchtitle = apply_filters('widget_title', $instance['aprsfisearchtitle'] ); $aprsfisearchbuttontext = $instance['aprsfisearchbuttontext']; $aprsfisearchinitialsearchvalue = $instance['aprsfisearchinitialsearchvalue']; /* Before widget (defined by themes). */ echo $before_widget; /* Display the widget title if one was input (before and after defined by themes). */ if ( $aprsfisearchtitle ) echo $before_title . $aprsfisearchtitle . $after_title; /* Display search control from widget settings if button text is defined. */ echo (''); printf( '
', $aprsfisearchbuttontext ); /* After widget (defined by themes). */ echo $after_widget; } /** * Update the widget settings. */ function update( $new_instance, $old_instance ) { $instance = $old_instance; /* Strip tags for title and name to remove HTML (important for text inputs). */ $instance['aprsfisearchtitle'] = strip_tags( $new_instance['aprsfisearchtitle'] ); $instance['aprsfisearchbuttontext'] = strip_tags( $new_instance['aprsfisearchbuttontext'] ); $instance['aprsfisearchinitialsearchvalue'] = strip_tags( $new_instance['aprsfisearchinitialsearchvalue'] ); return $instance; } /** * Displays the widget settings controls on the widget panel. * Make use of the get_field_id() and get_field_name() function * when creating form elements. This handles the confusing stuff. */ function form( $instance ) { /* Set up some default widget settings. */ $defaults = array( 'aprsfisearchtitle' => __('APRS.fi Call Sign Lookup', 'aprsfisearch'), 'aprsfisearchbuttontext' => __('Search', 'aprsfisearch'), 'aprsfisearchinitialsearchvalue' => __('W0DTF-10', 'aprsfisearch') ); $instance = wp_parse_args( (array) $instance, $defaults ); ?>