Fix some default widget PHP notices. props mrmist. fixes #10225

git-svn-id: http://svn.automattic.com/wordpress/trunk@11757 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2009-07-31 09:35:59 +00:00
parent 81e0fe00ee
commit 5141747487
1 changed files with 7 additions and 7 deletions

View File

@ -406,7 +406,7 @@ class WP_Widget_Text extends WP_Widget {
<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><input id="<?php echo $this->get_field_id('filter'); ?>" name="<?php echo $this->get_field_name('filter'); ?>" type="checkbox" <?php checked($instance['filter']); ?> />&nbsp;<label for="<?php echo $this->get_field_id('filter'); ?>"><?php _e('Automatically add paragraphs.'); ?></label></p> <p><input id="<?php echo $this->get_field_id('filter'); ?>" name="<?php echo $this->get_field_name('filter'); ?>" type="checkbox" <?php checked(isset($instance['filter']) ? $instance['filter'] : 0); ?> />&nbsp;<label for="<?php echo $this->get_field_id('filter'); ?>"><?php _e('Automatically add paragraphs.'); ?></label></p>
<?php <?php
} }
} }
@ -483,9 +483,9 @@ class WP_Widget_Categories extends WP_Widget {
//Defaults //Defaults
$instance = wp_parse_args( (array) $instance, array( 'title' => '') ); $instance = wp_parse_args( (array) $instance, array( 'title' => '') );
$title = esc_attr( $instance['title'] ); $title = esc_attr( $instance['title'] );
$count = (bool) $instance['count']; $count = isset($instance['count']) ? (bool) $instance['count'] :false;
$hierarchical = (bool) $instance['hierarchical']; $hierarchical = isset( $instance['hierarchical'] ) ? (bool) $instance['hierarchical'] : false;
$dropdown = (bool) $instance['dropdown']; $dropdown = isset( $instance['dropdown'] ) ? (bool) $instance['dropdown'] : false;
?> ?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:' ); ?></label> <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
@ -579,8 +579,8 @@ class WP_Widget_Recent_Posts extends WP_Widget {
} }
function form( $instance ) { function form( $instance ) {
$title = esc_attr($instance['title']); $title = isset($instance['title']) ? esc_attr($instance['title']) : '';
if ( !$number = (int) $instance['number'] ) if ( !isset($instance['number']) || !$number = (int) $instance['number'] )
$number = 5; $number = 5;
?> ?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label> <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
@ -985,7 +985,7 @@ class WP_Widget_Tag_Cloud extends WP_Widget {
function form( $instance ) { function form( $instance ) {
?> ?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:') ?></label> <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:') ?></label>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" /></p> <input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php if (isset ( $instance['title'])) {echo esc_attr( $instance['title'] );} ?>" /></p>
<?php <?php
} }
} }