Ticket #22400: widgets.2.diff
File widgets.2.diff, 9.4 KB (added by , 9 years ago) |
---|
-
src/wp-includes/default-widgets.php
19 19 } 20 20 21 21 function widget( $args, $instance ) { 22 extract( $args );23 22 24 23 /** 25 24 * Filter the widget title. … … 54 53 'exclude' => $exclude 55 54 ) ) ); 56 55 57 if ( !empty( $out ) ) { 58 echo $before_widget; 59 if ( $title) 60 echo $before_title . $title . $after_title; 56 if ( ! empty( $out ) ) { 57 echo $args['before_widget']; 58 if ( $title ) { 59 echo $args['before_title'] . $title . $args['after_title']; 60 } 61 61 ?> 62 62 <ul> 63 63 <?php echo $out; ?> 64 64 </ul> 65 65 <?php 66 echo $a fter_widget;66 echo $args['after_widget']; 67 67 } 68 68 } 69 69 … … 119 119 } 120 120 121 121 function widget( $args, $instance ) { 122 extract($args, EXTR_SKIP);123 122 124 123 $show_description = isset($instance['description']) ? $instance['description'] : false; 125 124 $show_name = isset($instance['name']) ? $instance['name'] : false; … … 130 129 $order = $orderby == 'rating' ? 'DESC' : 'ASC'; 131 130 $limit = isset( $instance['limit'] ) ? $instance['limit'] : -1; 132 131 133 $before_widget = preg_replace( '/id="[^"]*"/','id="%id"', $before_widget);132 $before_widget = preg_replace( '/id="[^"]*"/', 'id="%id"', $args['before_widget'] ); 134 133 135 134 /** 136 135 * Filter the arguments for the Links widget. … … 142 141 * @param array $args An array of arguments to retrieve the links list. 143 142 */ 144 143 wp_list_bookmarks( apply_filters( 'widget_links_args', array( 145 'title_before' => $ before_title, 'title_after' => $after_title,146 'category_before' => $before_widget, 'category_after' => $a fter_widget,144 'title_before' => $args['before_title'], 'title_after' => $args['after_title'], 145 'category_before' => $before_widget, 'category_after' => $args['after_widget'], 147 146 'show_images' => $show_images, 'show_description' => $show_description, 148 147 'show_name' => $show_name, 'show_rating' => $show_rating, 149 148 'category' => $category, 'class' => 'linkcat widget', … … 229 228 } 230 229 231 230 function widget( $args, $instance ) { 232 extract($args);233 231 234 232 /** This filter is documented in wp-includes/default-widgets.php */ 235 233 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); 236 234 237 echo $before_widget; 238 if ( $title ) 239 echo $before_title . $title . $after_title; 235 echo $args['before_widget']; 236 if ( $title ) { 237 echo $args['before_title'] . $title . $args['after_title']; 238 } 240 239 241 240 // Use current theme search form if it exists 242 241 get_search_form(); 243 242 244 echo $a fter_widget;243 echo $args['after_widget']; 245 244 } 246 245 247 246 function form( $instance ) { … … 274 273 } 275 274 276 275 function widget( $args, $instance ) { 277 extract($args);278 276 $c = ! empty( $instance['count'] ) ? '1' : '0'; 279 277 $d = ! empty( $instance['dropdown'] ) ? '1' : '0'; 280 278 281 279 /** This filter is documented in wp-includes/default-widgets.php */ 282 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Archives' ) : $instance['title'], $instance, $this->id_base );280 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Archives' ) : $instance['title'], $instance, $this->id_base ); 283 281 284 echo $before_widget; 285 if ( $title ) 286 echo $before_title . $title . $after_title; 282 echo $args['before_widget']; 283 if ( $title ) { 284 echo $args['before_title'] . $title . $args['after_title']; 285 } 287 286 288 287 if ( $d ) { 289 288 ?> … … 330 329 <?php 331 330 } 332 331 333 echo $a fter_widget;332 echo $args['after_widget']; 334 333 } 335 334 336 335 function update( $new_instance, $old_instance ) { … … 374 373 } 375 374 376 375 function widget( $args, $instance ) { 377 extract($args);378 376 379 377 /** This filter is documented in wp-includes/default-widgets.php */ 380 378 $title = apply_filters( 'widget_title', empty($instance['title']) ? __( 'Meta' ) : $instance['title'], $instance, $this->id_base ); 381 379 382 echo $before_widget; 383 if ( $title ) 384 echo $before_title . $title . $after_title; 380 echo $args['before_widget']; 381 if ( $title ) { 382 echo $args['before_title'] . $title . $args['after_title']; 383 } 385 384 ?> 386 385 <ul> 387 386 <?php wp_register(); ?> … … 406 405 ?> 407 406 </ul> 408 407 <?php 409 echo $a fter_widget;408 echo $args['after_widget']; 410 409 } 411 410 412 411 function update( $new_instance, $old_instance ) { … … 438 437 } 439 438 440 439 function widget( $args, $instance ) { 441 extract($args);442 440 443 441 /** This filter is documented in wp-includes/default-widgets.php */ 444 442 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); 445 443 446 echo $before_widget; 447 if ( $title ) 448 echo $before_title . $title . $after_title; 444 echo $args['before_widget']; 445 if ( $title ) { 446 echo $args['before_title'] . $title . $args['after_title']; 447 } 449 448 echo '<div id="calendar_wrap">'; 450 449 get_calendar(); 451 450 echo '</div>'; 452 echo $a fter_widget;451 echo $args['after_widget']; 453 452 } 454 453 455 454 function update( $new_instance, $old_instance ) { … … 483 482 } 484 483 485 484 function widget( $args, $instance ) { 486 extract($args);487 485 488 486 /** This filter is documented in wp-includes/default-widgets.php */ 489 487 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); … … 497 495 * @param WP_Widget $instance WP_Widget instance. 498 496 */ 499 497 $text = apply_filters( 'widget_text', empty( $instance['text'] ) ? '' : $instance['text'], $instance ); 500 echo $before_widget; 501 if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } ?> 498 echo $args['before_widget']; 499 if ( ! empty( $title ) ) { 500 echo $args['before_title'] . $title . $args['after_title']; 501 } ?> 502 502 <div class="textwidget"><?php echo !empty( $instance['filter'] ) ? wpautop( $text ) : $text; ?></div> 503 503 <?php 504 echo $a fter_widget;504 echo $args['after_widget']; 505 505 } 506 506 507 507 function update( $new_instance, $old_instance ) { … … 543 543 } 544 544 545 545 function widget( $args, $instance ) { 546 extract( $args );547 546 548 547 /** This filter is documented in wp-includes/default-widgets.php */ 549 548 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title'], $instance, $this->id_base ); … … 552 551 $h = ! empty( $instance['hierarchical'] ) ? '1' : '0'; 553 552 $d = ! empty( $instance['dropdown'] ) ? '1' : '0'; 554 553 555 echo $before_widget; 556 if ( $title ) 557 echo $before_title . $title . $after_title; 554 echo $args['before_widget']; 555 if ( $title ) { 556 echo $args['before_title'] . $title . $args['after_title']; 557 } 558 558 559 559 $cat_args = array('orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h); 560 560 … … 605 605 <?php 606 606 } 607 607 608 echo $a fter_widget;608 echo $args['after_widget']; 609 609 } 610 610 611 611 function update( $new_instance, $old_instance ) { … … 679 679 } 680 680 681 681 ob_start(); 682 extract($args);683 682 684 683 $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Recent Posts' ); 685 684 … … 709 708 710 709 if ($r->have_posts()) : 711 710 ?> 712 <?php echo $before_widget; ?> 713 <?php if ( $title ) echo $before_title . $title . $after_title; ?> 711 <?php echo $args['before_widget']; ?> 712 <?php if ( $title ) { 713 echo $args['before_title'] . $title . $args['after_title']; 714 } ?> 714 715 <ul> 715 716 <?php while ( $r->have_posts() ) : $r->the_post(); ?> 716 717 <li> … … 721 722 </li> 722 723 <?php endwhile; ?> 723 724 </ul> 724 <?php echo $a fter_widget; ?>725 <?php echo $args['after_widget']; ?> 725 726 <?php 726 727 // Reset the global $the_post as this query will have stomped on it 727 728 wp_reset_postdata(); … … 832 833 return; 833 834 } 834 835 835 extract($args, EXTR_SKIP);836 836 $output = ''; 837 837 838 838 $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Recent Comments' ); … … 859 859 'post_status' => 'publish' 860 860 ) ) ); 861 861 862 $output .= $before_widget; 863 if ( $title ) 864 $output .= $before_title . $title . $after_title; 862 $output .= $args['before_widget']; 863 if ( $title ) { 864 $output .= $args['before_title'] . $title . $args['after_title']; 865 } 865 866 866 867 $output .= '<ul id="recentcomments">'; 867 868 if ( $comments ) { … … 874 875 } 875 876 } 876 877 $output .= '</ul>'; 877 $output .= $a fter_widget;878 $output .= $args['after_widget']; 878 879 879 880 echo $output; 880 881 … … 1220 1221 } 1221 1222 1222 1223 function widget( $args, $instance ) { 1223 extract($args);1224 1224 $current_taxonomy = $this->_get_current_taxonomy($instance); 1225 1225 if ( !empty($instance['title']) ) { 1226 1226 $title = $instance['title']; … … 1236 1236 /** This filter is documented in wp-includes/default-widgets.php */ 1237 1237 $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); 1238 1238 1239 echo $before_widget; 1240 if ( $title ) 1241 echo $before_title . $title . $after_title; 1239 echo $args['before_widget']; 1240 if ( $title ) { 1241 echo $args['before_title'] . $title . $args['after_title']; 1242 } 1242 1243 echo '<div class="tagcloud">'; 1243 1244 1244 1245 /** … … 1256 1257 ) ) ); 1257 1258 1258 1259 echo "</div>\n"; 1259 echo $a fter_widget;1260 echo $args['after_widget']; 1260 1261 } 1261 1262 1262 1263 function update( $new_instance, $old_instance ) { … … 1323 1324 } 1324 1325 1325 1326 function update( $new_instance, $old_instance ) { 1326 $instance['title'] = strip_tags( stripslashes($new_instance['title']) ); 1327 $instance['nav_menu'] = (int) $new_instance['nav_menu']; 1327 $instance = array(); 1328 if ( ! empty( $new_instance['title'] ) ) { 1329 $instance['title'] = strip_tags( stripslashes($new_instance['title']) ); 1330 } 1331 if ( ! empty( $new_instance['nav_menu'] ) ) { 1332 $instance['nav_menu'] = (int) $new_instance['nav_menu']; 1333 } 1328 1334 return $instance; 1329 1335 } 1330 1336