Add option to run wpautop for text widget. Props Denis-de-Bernardy. fixes #5113

git-svn-id: https://develop.svn.wordpress.org/trunk@11018 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2009-04-20 19:59:46 +00:00
parent ed24743eb5
commit 3d3d56b538
1 changed files with 3 additions and 1 deletions

View File

@ -355,7 +355,7 @@ class WP_Widget_Text extends WP_Widget {
$text = apply_filters( 'widget_text', $instance['text'] ); $text = apply_filters( 'widget_text', $instance['text'] );
echo $before_widget; echo $before_widget;
if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } ?> if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } ?>
<div class="textwidget"><?php echo $text; ?></div> <div class="textwidget"><?php echo $instance['filter'] ? wpautop($text) : $text; ?></div>
<?php <?php
echo $after_widget; echo $after_widget;
} }
@ -367,6 +367,7 @@ class WP_Widget_Text extends WP_Widget {
$instance['text'] = $new_instance['text']; $instance['text'] = $new_instance['text'];
else else
$instance['text'] = wp_filter_post_kses( $new_instance['text'] ); $instance['text'] = wp_filter_post_kses( $new_instance['text'] );
$instance['filter'] = isset($new_instance['filter']);
return $instance; return $instance;
} }
@ -377,6 +378,7 @@ class WP_Widget_Text extends WP_Widget {
?> ?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p> <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>
<textarea class="widefat" rows="16" cols="20" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>"><?php echo $text; ?></textarea> <textarea class="widefat" rows="16" cols="20" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>"><?php echo $text; ?></textarea>
<p><label for="<?php echo $this->get_field_id('filter'); ?>"><input id="<?php echo $this->get_field_id('filter'); ?>" name="<?php echo $this->get_field_name('filter'); ?>" type="checkbox" <?php checked($instance['filter']); ?> />&nbsp;<?php _e('Automatically add paragraphs.') ?></label></p>
<?php <?php
} }
} }