__( 'Show post formats in the sidebar.', 'friends' ), ) ); } /** * Render the widget. * * @param array $args Sidebar arguments. * @param array $instance Widget instance settings. */ public function widget( $args, $instance ) { $instance = wp_parse_args( $instance, $this->defaults() ); $friends = Friends::get_instance(); echo wp_kses( $args['before_widget'], 'post' ); ?>
defaults(), $instance ); ?>

$title ) { $instance[ 'post_format_title_' . $slug ] = ( ! empty( $new_instance[ 'post_format_title_' . $slug ] ) ) ? strip_tags( $new_instance[ 'post_format_title_' . $slug ] ) : $title; if ( $new_instance[ 'show_post_format_' . $slug ] ) { $instance[ 'show_post_format_' . $slug ] = true; } else { $instance[ 'show_post_format_' . $slug ] = false; } } return $instance; } /** * Return an associative array of default values * * These values are used in new widgets. * * @return array Array of default values for the Widget's options */ public function defaults() { $instance = array( 'title' => __( 'Filter', 'friends' ), ); foreach ( get_post_format_strings() as $slug => $title ) { $t = 'post_format_title_' . $slug; $instance[ $t ] = ( ! empty( $new_instance[ $t ] ) ) ? strip_tags( $new_instance[ $t ] ) : $title; $instance[ 'show_post_format_' . $slug ] = in_array( $slug, array( 'standard', 'status', 'image', 'video' ) ); } return $instance; } /** * Register this widget. */ public static function register() { register_widget( __CLASS__ ); } }