'give-donors-gravatars', 'description' => esc_html__( 'Displays gravatars of people who have donated using your your form. Will only show on the single form page.', 'give' ), ); // widget control settings $control_ops = array( 'width' => 250, 'height' => 350, 'id_base' => 'give_gravatars_widget' ); // create the widget parent::__construct( 'give_donors_gravatars_widget', esc_html__( 'Give Donors Gravatars', 'give' ), $widget_ops, $control_ops ); } /** * Donors gravatars widget content * * Outputs the content of the widget * * @since 1.0 * @access public * * @param array $args Display arguments including 'before_title', 'after_title', 'before_widget', and 'after_widget'. * @param array $instance Settings for the current Links widget instance. * * @return void */ public function widget( $args, $instance ) { //@TODO: Don't extract it!!! extract( $args ); if ( ! is_singular( 'give_forms' ) ) { return; } // Variables from widget settings $title = apply_filters( 'widget_title', $instance['title'] ); // Used by themes. Opens the widget echo $before_widget; // Display the widget title if ( $title ) { echo $before_title . $title . $after_title; } echo Give_Donor_Wall::get_instance()->gravatars( get_the_ID(), null ); // remove title // Used by themes. Closes the widget echo $after_widget; } /** * Update donors gravatars * * Processes widget options to be saved. * * @since 1.0 * @access public * * @param array $new_instance New settings for this instance as input by the user via WP_Widget::form(). * @param array $old_instance Old settings for this instance. * * @return array Updated settings to save. */ public function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['title'] = strip_tags( $new_instance['title'] ); return $instance; } /** * Output donors * * Displays the actual form on the widget page. * * @since 1.0 * @access public * * @param array $instance Current settings. * * @return void */ public function form( $instance ) { // Set up some default widget settings. $defaults = array( 'title' => '', ); $instance = wp_parse_args( (array) $instance, $defaults ); ?>
self ); } }