Ticket #4259: widgets.diff
File widgets.diff, 3.5 KB (added by , 17 years ago) |
---|
-
widgets.php
324 324 extract($args); 325 325 $options = get_option('widget_pages'); 326 326 $title = empty($options['title']) ? __('Pages') : $options['title']; 327 $exclude = ""; 328 foreach ( (array) $options['exclude'] as $val ) 329 { 330 $exclude .= ( $exclude ? ',' : '' ) . $val; 331 } 327 332 echo $before_widget . $before_title . $title . $after_title . "<ul>\n"; 328 wp_list_pages( "title_li=");333 wp_list_pages('sort_column=menu_order,post_title&title_li=' . ( $exclude ? ('&exclude=' . $exclude ) : '')); 329 334 echo "</ul>\n" . $after_widget; 330 335 } 331 336 … … 333 338 $options = $newoptions = get_option('widget_pages'); 334 339 if ( $_POST["pages-submit"] ) { 335 340 $newoptions['title'] = strip_tags(stripslashes($_POST["pages-title"])); 341 preg_match_all("/\d+/", $_POST["pages-exclude"], $exclude); 342 $newoptions['exclude'] = end($exclude); 336 343 } 337 344 if ( $options != $newoptions ) { 338 345 $options = $newoptions; 339 346 update_option('widget_pages', $options); 340 347 } 341 348 $title = attribute_escape($options['title']); 349 $exclude = ""; 350 foreach ( (array) $options['exclude'] as $val ) 351 { 352 $exclude .= ( $exclude ? ', ' : '' ) . $val; 353 } 342 354 ?> 343 355 <p><label for="pages-title"><?php _e('Title:'); ?> <input style="width: 250px;" id="pages-title" name="pages-title" type="text" value="<?php echo $title; ?>" /></label></p> 356 <p><label for="pages-exclude"><?php _e('Exclude (Page ID list):'); ?> <input style="width: 250px;" id="pages-exclude" name="pages-exclude" type="text" value="<?php echo $exclude; ?>" /></label></p> 344 357 <input type="hidden" id="pages-submit" name="pages-submit" value="1" /> 345 358 <?php 346 359 } … … 487 500 extract($args); 488 501 $options = get_option('widget_text'); 489 502 $title = $options[$number]['title']; 490 if ( empty($title) ) 491 $title = ' '; 503 $filter = (bool) $options[$number]['filter']; 492 504 $text = $options[$number]['text']; 493 505 ?> 494 506 <?php echo $before_widget; ?> 495 507 <?php $title ? print($before_title . $title . $after_title) : null; ?> 496 <div class="textwidget"><?php echo $ text; ?></div>508 <div class="textwidget"><?php echo $filter ? wpautop($text) : $text; ?></div> 497 509 <?php echo $after_widget; ?> 498 510 <?php 499 511 } … … 507 519 $newoptions[$number]['text'] = stripslashes($_POST["text-text-$number"]); 508 520 if ( !current_user_can('unfiltered_html') ) 509 521 $newoptions[$number]['text'] = stripslashes(wp_filter_post_kses($newoptions[$number]['text'])); 522 $newoptions[$number]['filter'] = isset($_POST["text-filter-$number"]); 510 523 } 511 524 if ( $options != $newoptions ) { 512 525 $options = $newoptions; … … 514 527 } 515 528 $title = attribute_escape($options[$number]['title']); 516 529 $text = attribute_escape($options[$number]['text']); 530 $filter = (bool) $options[$number]['filter']; 517 531 ?> 518 532 <input style="width: 450px;" id="text-title-<?php echo "$number"; ?>" name="text-title-<?php echo "$number"; ?>" type="text" value="<?php echo $title; ?>" /> 519 533 <textarea style="width: 450px; height: 280px;" id="text-text-<?php echo "$number"; ?>" name="text-text-<?php echo "$number"; ?>"><?php echo $text; ?></textarea> 534 <label for="text-filter-<?php echo "$number"; ?>"><input type="checkbox" id="text-filter-<?php echo "$number"; ?>" name="text-filter-<?php echo "$number"; ?>" id="text-filter-<?php echo "$number"; ?>" <?php echo $filter ? "checked" : ""; ?> /> <?php _e('Automatically insert paragraphs'); ?> 520 535 <input type="hidden" id="text-submit-<?php echo "$number"; ?>" name="text-submit-<?php echo "$number"; ?>" value="1" /> 521 536 <?php 522 537 }