'aimatch_ad_call', 'description' => __('An aiMatch custom ad call widget that displays an ad.') ); // Widget control settings. $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'aimatch-apc-custom-widget' ); // Create the widget. $this->WP_Widget( 'aimatch-apc-custom-widget', __('aiMatch Custom Ad Call', 'AdCall'), $widget_ops, $control_ops ); } // How to display widget on screen function widget( $args, $instance ) { extract( $args ); // Our variables from the widget settings. $title = apply_filters('widget_title', $instance['title'] ); $adServer = $instance['adServer']; $shortName = $instance['shortName']; $adCallType = $instance['adCallType']; $adSize = $instance['adSize']; $targeting = $instance['targeting']; // Before widget (defined by themes). echo $before_widget; // Display the widget title if one was input (before and after defined by themes). if ( $title ) echo $before_title . $title . $after_title; // aiMatch function call aimatch_apc($adServer, $shortName, $adCallType, $targeting, $adSize); // After widget (defined by themes). echo $after_widget; } // Update 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['title'] = trim( trim( strip_tags( $new_instance['title'] ), "/") ); $instance['adServer'] = trim( trim( strip_tags( $new_instance['adServer'] ), "/") ); $instance['shortName'] = trim( trim( strip_tags( $new_instance['shortName'] ), "/") ); $instance['adCallType'] = $new_instance['adCallType']; $instance['adSize'] = $new_instance['adSize']; $instance['targeting'] = trim( trim( strip_tags( $new_instance['targeting'] ), "/") ); 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 your form elements. This handles the confusing stuff. */ function form( $instance ) { // Set up some default widget settings. $defaults = array( 'title' => __('', ''), 'adCallType' => 'jserver', 'adSize' => '' ); $instance = wp_parse_args( (array) $instance, $defaults ); ?>