WordPress.org

Make WordPress Core

Ticket #10131: default-widgets.patch

File default-widgets.patch, 2.8 KB (added by mrmist, 9 years ago)

patch for notices in ticket #10225

  • wp-includes/default-widgets.php

     
    406406
    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        }
    412412}
     
    483483                //Defaults
    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>
    491491                <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>
     
    577577        }
    578578
    579579        function form( $instance ) {
    580                 $title = esc_attr($instance['title']);
    581                 if ( !$number = (int) $instance['number'] )
     580                $title = isset($instance['title']) ? esc_attr($instance['title']) : '';
     581                if ( !isset($instance['number']) || !$number = (int) $instance['number'] )
    582582                        $number = 5;
    583583?>
    584584                <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
     
    983983        function form( $instance ) {
    984984?>
    985985        <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:') ?></label>
    986         <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>
     986        <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>
    987987<?php
    988988        }
    989989}