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

git-svn-id: http://svn.automattic.com/wordpress/trunk@11018 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-04-20 19:59:46 +00:00
parent 63fad3d055
commit 3d15f1aad4
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'] );
echo $before_widget;
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
echo $after_widget;
}
@ -367,6 +367,7 @@ class WP_Widget_Text extends WP_Widget {
$instance['text'] = $new_instance['text'];
else
$instance['text'] = wp_filter_post_kses( $new_instance['text'] );
$instance['filter'] = isset($new_instance['filter']);
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>
<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
}
}