Make WordPress Core

Changeset 11757


Ignore:
Timestamp:
07/31/2009 09:35:59 AM (16 years ago)
Author:
markjaquith
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/default-widgets.php

    r11718 r11757  
    407407        <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>
    408408
    409         <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>
     409        <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>
    410410<?php
    411411    }
     
    484484        $instance = wp_parse_args( (array) $instance, array( 'title' => '') );
    485485        $title = esc_attr( $instance['title'] );
    486         $count = (bool) $instance['count'];
    487         $hierarchical = (bool) $instance['hierarchical'];
    488         $dropdown = (bool) $instance['dropdown'];
     486        $count = isset($instance['count']) ? (bool) $instance['count'] :false;
     487        $hierarchical = isset( $instance['hierarchical'] ) ? (bool) $instance['hierarchical'] : false;
     488        $dropdown = isset( $instance['dropdown'] ) ? (bool) $instance['dropdown'] : false;
    489489?>
    490490        <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:' ); ?></label>
     
    580580
    581581    function form( $instance ) {
    582         $title = esc_attr($instance['title']);
    583         if ( !$number = (int) $instance['number'] )
     582        $title = isset($instance['title']) ? esc_attr($instance['title']) : '';
     583        if ( !isset($instance['number']) || !$number = (int) $instance['number'] )
    584584            $number = 5;
    585585?>
     
    986986?>
    987987    <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:') ?></label>
    988     <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>
     988    <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>
    989989<?php
    990990    }
Note: See TracChangeset for help on using the changeset viewer.