prefix = framework_get_prefix(); /* Set up the widget options. */ $widget_options = array( 'classname' => 'flickr-gallery', 'description' => esc_html__( 'Display your flickr images.', 'wordsmith' ) ); /* Set up the widget control options. */ $control_options = array( 'width' => 200, 'height' => 350 ); /* Create the widget. */ $this->WP_Widget( "{$this->prefix}-flickr-gallery", __( 'Flickr Gallery', 'wordsmith' ), $widget_options, $control_options ); } /* Outputs the widget based on the arguments input through the widget controls. */ function widget( $args, $instance ) { extract( $args ); /* Output the theme's $before_widget wrapper. */ echo $before_widget; /* If a title was input by the user, display it. */ if ( !empty( $instance['title'] ) ) echo $before_title . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $after_title; $args['id'] = $instance['id']; $args['limit'] = $instance['limit']; $args['type'] = $instance['type']; $args['display'] = $instance['display']; echo ''; /* Close the theme's widget wrapper. */ echo $after_widget; } /* Updates the widget control options for the particular instance of the widget. */ function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance = $new_instance; $instance['title'] = strip_tags( $new_instance['title'] ); $instance['id'] = strip_tags( $new_instance['id'] ); $instance['limit'] = $new_instance['limit']; $instance['type'] = $new_instance['type']; $instance['display'] = $new_instance['display']; return $instance; } /* Displays the widget control options in the Widgets admin screen. */ function form( $instance ) { /* Set up the default form values. */ $defaults = array( 'title' => esc_attr__( 'Flickr Gallery', 'wordsmith' ), 'id' => '1045413@N25', 'limit' => '6', 'type' => 'group', 'display' => 'latest' ); $instance = wp_parse_args( (array) $instance, $defaults ); $limit = array( '3' => esc_attr__( '3', 'wordsmith' ), '6' => esc_attr__( '6', 'wordsmith' ), '9' => esc_attr__( '9', 'wordsmith' ) ); $type = array( 'group' => esc_attr__( 'Group', 'wordsmith' ), 'user' => esc_attr__( 'User', 'wordsmith' ) ); $display = array( 'latest' => esc_attr__( 'Latest', 'wordsmith' ), 'random' => esc_attr__( 'Random', 'wordsmith' ) ); ?>