Ticket #16761: 16761.2.patch
File 16761.2.patch, 4.9 KB (added by , 13 years ago) |
---|
-
wp-includes/default-widgets.php
177 177 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; 183 183 if ( $title ) … … 220 220 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 227 227 echo $before_widget; … … 375 375 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; 385 385 } … … 426 426 extract( $args ); 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; 434 434 if ( $title ) … … 525 525 if ( !is_array($cache) ) 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 } 532 532 … … 534 534 extract($args); 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 540 540 $r = new WP_Query(array('posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true)); … … 628 628 if ( ! is_array( $cache ) ) 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 } 635 635 … … 637 637 $output = ''; 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 643 643 $comments = get_comments( array( 'number' => $number, 'status' => 'approve', 'post_status' => 'publish' ) ); … … 705 705 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); 711 711 … … 751 751 } 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 } 757 757 … … 1059 1059 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']; 1070 1070