Changeset 18676
- Timestamp:
- 09/15/2011 09:41:17 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/default-widgets.php
r17825 r18676 178 178 function widget( $args, $instance ) { 179 179 extract($args); 180 $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base);180 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); 181 181 182 182 echo $before_widget; … … 221 221 function widget( $args, $instance ) { 222 222 extract($args); 223 $c = $instance['count']? '1' : '0';224 $d = $instance['dropdown']? '1' : '0';223 $c = ! empty( $instance['count'] ) ? '1' : '0'; 224 $d = ! empty( $instance['dropdown'] ) ? '1' : '0'; 225 225 $title = apply_filters('widget_title', empty($instance['title']) ? __('Archives') : $instance['title'], $instance, $this->id_base); 226 226 … … 376 376 function widget( $args, $instance ) { 377 377 extract($args); 378 $title = apply_filters( 'widget_title', empty( $instance['title']) ? '' : $instance['title'], $instance, $this->id_base);379 $text = apply_filters( 'widget_text', $instance['text'], $instance );378 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); 379 $text = apply_filters( 'widget_text', empty( $instance['text'] ) ? '' : $instance['text'], $instance ); 380 380 echo $before_widget; 381 381 if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } ?> 382 <div class="textwidget"><?php echo $instance['filter'] ? wpautop($text) : $text; ?></div>382 <div class="textwidget"><?php echo !empty( $instance['filter'] ) ? wpautop( $text ) : $text; ?></div> 383 383 <?php 384 384 echo $after_widget; … … 427 427 428 428 $title = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title'], $instance, $this->id_base); 429 $c = $instance['count']? '1' : '0';430 $h = $instance['hierarchical']? '1' : '0';431 $d = $instance['dropdown']? '1' : '0';429 $c = ! empty( $instance['count'] ) ? '1' : '0'; 430 $h = ! empty( $instance['hierarchical'] ) ? '1' : '0'; 431 $d = ! empty( $instance['dropdown'] ) ? '1' : '0'; 432 432 433 433 echo $before_widget; … … 526 526 $cache = array(); 527 527 528 if ( isset( $cache[$args['widget_id']]) ) {529 echo $cache[ $args['widget_id']];528 if ( isset( $args['widget_id'] ) && isset( $cache[ $args['widget_id'] ] ) ) { 529 echo $cache[ $args['widget_id'] ]; 530 530 return; 531 531 } … … 535 535 536 536 $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Posts') : $instance['title'], $instance, $this->id_base); 537 if ( ! $number = absint( $instance['number'] ) )537 if ( empty( $instance['number'] ) || ! $number = absint( $instance['number'] ) ) 538 538 $number = 10; 539 539 … … 629 629 $cache = array(); 630 630 631 if ( isset( $ cache[$args['widget_id']] ) ) {632 echo $cache[ $args['widget_id']];631 if ( isset( $args['widget_id'] ) && isset( $cache[ $args['widget_id'] ] ) ) { 632 echo $cache[ $args['widget_id'] ]; 633 633 return; 634 634 } … … 638 638 $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Comments') : $instance['title']); 639 639 640 if ( ! $number = absint( $instance['number'] ) )640 if ( empty( $instance['number'] ) || ! $number = absint( $instance['number'] ) ) 641 641 $number = 5; 642 642 … … 706 706 extract($args, EXTR_SKIP); 707 707 708 $url = $instance['url'];708 $url = ! empty( $instance['url'] ) ? $instance['url'] : ''; 709 709 while ( stristr($url, 'http') != $url ) 710 710 $url = substr($url, 1); … … 752 752 753 753 function update($new_instance, $old_instance) { 754 $testurl = ( isset( $new_instance['url']) && ($new_instance['url'] != $old_instance['url']) );754 $testurl = ( isset( $new_instance['url'] ) && ( !isset( $old_instance['url'] ) || ( $new_instance['url'] != $old_instance['url'] ) ) ); 755 755 return wp_widget_rss_process( $new_instance, $testurl ); 756 756 } … … 1060 1060 function widget($args, $instance) { 1061 1061 // Get menu 1062 $nav_menu = wp_get_nav_menu_object( $instance['nav_menu'] );1062 $nav_menu = ! empty( $instance['nav_menu'] ) ? wp_get_nav_menu_object( $instance['nav_menu'] ) : false; 1063 1063 1064 1064 if ( !$nav_menu ) 1065 1065 return; 1066 1066 1067 $instance['title'] = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base);1067 $instance['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); 1068 1068 1069 1069 echo $args['before_widget'];
Note: See TracChangeset
for help on using the changeset viewer.